maintenance: title: Set ifosfamide order set with automatic mesna ordering;; mlmname: FORM_Set_Ifex_Mesna ;; arden: version 2.5;; version: 1.00;; institution: St. Clair Hospital ;; author: Sandy Zhang ;; specialist: Shawn Roberts ;; date: 2018-10-29;; validation: testing;; library: purpose: ;; explanation: This MLM is called from the {{{SINGLE-QUOTE}}}Ifosfamide and Mesna orders{{{SINGLE-QUOTE}}} order set, form: PRX_OsIfex_Mesna Change history 10.29.2018 SZ CSR #35198 - ifex-mesna order set - derived from FORM_Set_Lovenox_Orders_Inj as a model ;; keywords: Ifex, ifosfamide, mesna, mesnex ;; citations: ;; knowledge: type: data-driven;; data: // This MLM is passed three arguments, of types // communication_type, form_type and client info object respectively. (this_communication, // Communication object this_form, // Form object client_info_obj //Arden ClientInfo object ) := argument; // Use String parse str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; client_guid := this_communication.ClientGUID; visit_guid := this_communication.ClientVisitGUID; chart_guid := this_communication.ChartGuid; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; current_time := NOW as time; current_hour := extract hour NOW; current_minute := extract minute NOW; now_plus_half_hour := Now + 30 minutes; now_plus_one_hour := Now + 1 hour; now_plus_three_half_hour := Now + 3 hours + 30 minutes; Ifex_Order_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1); Mesna_Order_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2); Mesna_Order_Grid_List := Mesna_Order_Grid.Value; // Find all reuqested date and requested time fields request_date_1:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1); request_date_2:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2); request_date_3:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3); request_date_4:= last of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4); requested_time_1:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1); requested_time_2:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2); requested_time_3:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3); requested_time_4:= last of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4); requested_time_1_VALUE := requested_time_1.Value; requested_time_2_VALUE := requested_time_2.Value; requested_time_3_VALUE := requested_time_3.Value; stop_after_1:= last of (field_list where field_list.DataItemName = "StopAfter" and field_List.Control_MultiFieldOccNum = 1); stop_after_Value := stop_after_1.Value; comb_ht_wt_field := (field_list where field_list.DataItemName = "CombinedMeasurements"); if exists comb_ht_wt_field then comb_ht_wt_val := comb_ht_wt_field.value; wt := comb_ht_wt_val.weight; ht := comb_ht_wt_val.height; wt_type := comb_ht_wt_val.weighttype; bsa := first of comb_ht_wt_val.bsa; bmi := comb_ht_wt_val.bmi; endif; //Find if any of the med boxes are checked...if so, set Med_Was_Selected to "yes" Med_Grid := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 1); // Med_GridC := last of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 2); Med_List := Med_Grid.Value; //Med_ListC :=Med_GridC.Value; Med_SelList := Med_List.IsSelected; //Med_SelListC := Med_ListC.IsSelected; Med_Selected := true in Med_SelList; //Med_SelectedC := true in Med_SelListC; If (Med_Selected = True) then Med_Was_Selected := "yes"; else Med_Was_Selected := "no" ; endif; /**************************** rules start below *************************************************/ // if a ifosfamide order is selected, then auto-select all mesna orders If (CallingEvent = "FieldChange") and (Med_Was_Selected = "yes") then Mesna_Order_Grid_List.IsSelected := (True,True,True); // ifosfamide order is unchecked in order grid 1F else Mesna_Order_Grid_List.IsSelected := (False,False,False); endif; // If (CallingEvent = "FieldChange") and (Med_Was_Selected = "yes") then If (CallingEvent = "FieldChange") and (CallingField = "RequestedTime|1") then ifex_target_time_formatted := requested_time_1_VALUE.ReqTimeValue as time; date_manipulation := (extract month request_date_1.value) formatted with "%02d" || "-" || (extract day request_date_1.value) formatted with "%02d" || "-" || (extract year request_date_1.value) formatted with "%04d" || " " || (requested_time_1_VALUE.ReqTimeValue) || ":" || 00 formatted with "%02d"; date_manipulation_time := date_manipulation as time; // time manipulation happens here, correct the date prior to this step //ifex_target_time_back_half_hour := ifex_target_time_formatted - 30 minutes; //ifex_target_time_plus_two_half_hour := ifex_target_time_formatted + 2 hours + 30 minutes; ifex_target_time_back_half_hour := date_manipulation_time - 30 minutes; ifex_target_time_plus_two_half_hour := date_manipulation_time + 2 hours + 30 minutes; request_date_2.value := ifex_target_time_back_half_hour; request_date_3.value := ifex_target_time_plus_two_half_hour; requested_time_2_VALUE.ReqTimeCode := "Scheduled/Start Time"; requested_time_2_VALUE.ReqTimeValue := (extract hour ifex_target_time_back_half_hour) formatted with "%02d" || ":" || (extract minute ifex_target_time_back_half_hour) formatted with "%02d" ; requested_time_3_VALUE.ReqTimeCode := "Scheduled/Start Time"; requested_time_3_VALUE.ReqTimeValue := (extract hour ifex_target_time_plus_two_half_hour) formatted with "%02d" || ":" || (extract minute ifex_target_time_plus_two_half_hour) formatted with "%02d" ; endif; //If (CallingEvent = "FieldChange") and (CallingField = "RequestedTime|1") then // upon FormOpen, make all daily lab orders and baseline labs read only // also sets hidden fields so that when a med is selected, the dates populate up to the orders "Scheduled Date" If (CallingEvent = "FormOpen") then Mesna_Order_Grid_List.IsSelected := (True,True,True); requested_time_1_VALUE.ReqTimeCode := "Scheduled/Start Time"; requested_time_1_VALUE.ReqTimeValue := (extract hour now_plus_one_hour) formatted with "%02d" || ":" || (extract minute now_plus_one_hour) formatted with "%02d" ; requested_time_2_VALUE.ReqTimeCode := "Scheduled/Start Time"; requested_time_2_VALUE.ReqTimeValue := (extract hour now_plus_half_hour) formatted with "%02d" || ":" || (extract minute now_plus_half_hour) formatted with "%02d" ; requested_time_3_VALUE.ReqTimeCode := "Scheduled/Start Time"; requested_time_3_VALUE.ReqTimeValue := (extract hour now_plus_three_half_hour) formatted with "%02d" || ":" || (extract minute now_plus_three_half_hour) formatted with "%02d" ; startdate:= request_date_1.value; // used to calculate dates for hidden fields below stop_after_Value.Option := "Times"; endif; // If CallingEvent = "FormOpen" then If (CallingEvent = "FieldChange") and (CallingField = "RequestedDate|1") then day_difference := request_date_1.value - request_date_4.value; request_date_2.value := request_date_2.value + day_difference; request_date_3.value := request_date_3.value + day_difference; request_date_4.value := request_date_1.value; // saves the new date for ifex endif; // If (CallingEvent = "FieldChange") and (CallingField = "RequestedDate|1") then ;; priority: 50 ;; evoke: // No evoke statement ;; logic: conclude true; ;; action: // This MLM returns two parameters, of types communication_type and form_type respectively. return this_communication, this_form; ;; Urgency: 50;; end: