maintenance: title: ;; mlmname: FORM_CHEMO_DESENSITIZATION_PROTOCOL;; arden: version 2.5;; version: 1.00;; institution: St.Clair Hospital ;; author: Sandy Zhang ;; specialist: Debbie Bellissimo ;; date: 2017-08-17;; validation: testing;; library: purpose: ;; explanation: ;; keywords: ;; 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; /*******************Make Changes To Spelling And Flags In This Section*******************/ /* Set to true if a decision.log is needed.*/ log_execution_info := FALSE; /***************************************************************************************/ // Initialize error message error_message:=""; // Assigns fields passed in the Form object to the Field object field_list := this_form.Fields; primary_order_set_type := this_communication.PrimaryObj[1]; order_set_name := primary_order_set_type.OrderSetName; // carboplatin orderset guid = 9000068526703910 // oxaliplatin orderset guid = 9000068526803910 if (order_set_name = "Oxaliplatin Desensitization Protocol") then // sets {{{SINGLE-QUOTE}}}Target Dose (mg){{{SINGLE-QUOTE}}} if (this_communication.CallingFieldName = "DosageLow|3") then target_dose := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 3); dose_bag_1 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1); dose_bag_2 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2); dose_bag_3 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 4); dose_bag_4 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 5); dose_bag_5 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 6); calc_bag_1 := target_dose.Value * 0.0001; calc_bag_2 := target_dose.Value * 0.001; calc_bag_3 := target_dose.Value * 0.01; calc_bag_4 := target_dose.Value * 0.1; // calc_bag_5 := target_dose.Value * 0.9; calc_bag_5 := round (target_dose.Value - calc_bag_4 - calc_bag_3 - calc_bag_2 - calc_bag_1); dose_bag_1.Value := calc_bag_1; dose_bag_2.Value := calc_bag_2; dose_bag_3.Value := calc_bag_3; dose_bag_4.Value := calc_bag_4; dose_bag_5.Value := calc_bag_5; endif; // if (this_communication.CallingFieldName = "DosageLow|3") // sets {{{SINGLE-QUOTE}}}Requested Time{{{SINGLE-QUOTE}}} if (this_communication.CallingFieldName = "RequestedTime|1") then // grab hidden time fields time_field_bag_1 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1); time_field_bag_2 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2); time_field_bag_3 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3); time_field_bag_4 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4); time_field_bag_5 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 5); time_field_supportive_med := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 6); // grab hidden date fields date_bag_1 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1); date_bag_2 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2); date_bag_3 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3); date_bag_4 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4); date_bag_5 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 5); // time_value_bag_1 := time_field_bag_1.Value[1]; time_value_bag_2 := time_field_bag_2.Value[1]; time_value_bag_3 := time_field_bag_3.Value[1]; time_value_bag_4 := time_field_bag_4.Value[1]; time_value_bag_5 := time_field_bag_5.Value[1]; time_value_supportive_med := time_field_supportive_med.Value[1]; raw_time_bag_1 := time_value_bag_1.ReqTimeValue as time; get_hour_bag_2 := (extract hour (raw_time_bag_1) + 1) as number; get_hour_bag_3 := (extract hour (raw_time_bag_1) + 2) as number; get_hour_bag_4 := (extract hour (raw_time_bag_1) + 3) as number; get_hour_bag_5 := (extract hour (raw_time_bag_1) + 4) as number; bag_1_date := raw_time_bag_1; // bag_1_date := date_bag_1.Value[1]; bag_2_date := date_bag_2.Value[1]; bag_3_date := date_bag_3.Value[1]; bag_4_date := date_bag_4.Value[1]; bag_5_date := date_bag_5.Value[1]; /************************************************bag 2*****************************************************/ if (get_hour_bag_2 >= 24) then time_value_bag_2.ReqTimeValue := (((extract hour raw_time_bag_1) - 23) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_2.ReqTimeValue := (((extract hour raw_time_bag_1) + 1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************bag 3*****************************************************/ if (get_hour_bag_3 >= 24) then time_value_bag_3.ReqTimeValue := (((extract hour raw_time_bag_1) - 22) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_3.ReqTimeValue := (((extract hour raw_time_bag_1) + 2) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************bag 4*****************************************************/ if (get_hour_bag_4 >= 24) then time_value_bag_4.ReqTimeValue := (((extract hour raw_time_bag_1) - 21) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_4.ReqTimeValue := (((extract hour raw_time_bag_1) + 3) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************bag 5*****************************************************/ if (get_hour_bag_5 >= 24) then //corrected_hour_bag_5 := raw_time_bag_1 - 24; time_value_bag_5.ReqTimeValue := (((extract hour raw_time_bag_1) - 20) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_5.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_5.ReqTimeValue := (((extract hour raw_time_bag_1) + 4) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); date_bag_5.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************supportive meds*****************************************************/ if ((extract hour raw_time_bag_1 - 1) < 0) then time_value_supportive_med.ReqTimeValue := "00:00"; else time_value_supportive_med.ReqTimeValue := (((extract hour raw_time_bag_1) - 1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); endif; endif; // if (this_communication.CallingFieldName = "RequestedTime|1") // sets requested time endif; // if (this_communication.CallingFieldName = "RequestedTime|1") if (order_set_name = "Carboplatin Desensitization Protocol") then // sets {{{SINGLE-QUOTE}}}Target Dose (mg){{{SINGLE-QUOTE}}} if (this_communication.CallingFieldName = "DosageLow|3") then target_dose := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 3); dose_bag_1 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 1); dose_bag_2 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 2); dose_bag_3 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 4); dose_bag_4 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 5); dose_bag_5 := first of (field_list where field_list.DataItemName = "DosageLow" and field_List.Control_MultiFieldOccNum = 6); calc_bag_1 := target_dose.Value * 0.001; calc_bag_2 := target_dose.Value * 0.01; calc_bag_3 := target_dose.Value * 0.1; calc_bag_4 := round (target_dose.Value - calc_bag_1 - calc_bag_2 - calc_bag_3); dose_bag_1.Value := calc_bag_1; dose_bag_2.Value := calc_bag_2; dose_bag_3.Value := calc_bag_3; dose_bag_4.Value := calc_bag_4; endif; // if (this_communication.CallingFieldName = "DosageLow|3") // sets {{{SINGLE-QUOTE}}}Requested Time{{{SINGLE-QUOTE}}} for carboplatin order set if (this_communication.CallingFieldName = "RequestedTime|1") then // grab hidden time fields time_field_bag_1 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 1); time_field_bag_2 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 2); time_field_bag_3 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 3); time_field_bag_4 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 4); time_field_bag_5 := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 5); time_field_supportive_med := first of (field_list where field_list.DataItemName = "RequestedTime" and field_List.Control_MultiFieldOccNum = 6); // grab hidden date fields date_bag_1 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 1); date_bag_2 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 2); date_bag_3 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 3); date_bag_4 := first of (field_list where field_list.DataItemName = "RequestedDate" and field_List.Control_MultiFieldOccNum = 4); // time_value_bag_1 := time_field_bag_1.Value[1]; time_value_bag_2 := time_field_bag_2.Value[1]; time_value_bag_3 := time_field_bag_3.Value[1]; time_value_bag_4 := time_field_bag_4.Value[1]; time_value_bag_5 := time_field_bag_5.Value[1]; time_value_supportive_med := time_field_supportive_med.Value[1]; raw_time_bag_1 := time_value_bag_1.ReqTimeValue as time; get_hour_bag_2 := (extract hour (raw_time_bag_1) + 1) as number; get_hour_bag_3 := (extract hour (raw_time_bag_1) + 3) as number; get_hour_bag_4 := (extract hour (raw_time_bag_1) + 4) as number; get_minutes_bag_2 := (extract minute (raw_time_bag_1) + 30) as number; get_minutes_bag_3 := (extract minute (raw_time_bag_1)) as number; get_minutes_bag_4 := (extract minute (raw_time_bag_1) + 30) as number; bag_1_date := raw_time_bag_1; // bag_1_date := date_bag_1.Value[1]; bag_2_date := date_bag_2.Value[1]; bag_3_date := date_bag_3.Value[1]; bag_4_date := date_bag_4.Value[1]; /************************************************bag 2*****************************************************/ // this calculates the remainder of the minutes if it exceeds 60 minutes if (get_minutes_bag_2 > 60) then minute_remain_bag_2 := get_minutes_bag_2 - 60; hour_remain_bag_2 := get_hour_bag_2 + 1; else minute_remain_bag_2 := get_minutes_bag_2; hour_remain_bag_2 := get_hour_bag_2; endif; if (hour_remain_bag_2 >= 24) then time_value_bag_2.ReqTimeValue := ((hour_remain_bag_2 - 24) FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_2 FORMATTED WITH "%2.2d"); date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_2.ReqTimeValue := (hour_remain_bag_2 FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_2 FORMATTED WITH "%2.2d"); date_bag_2.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************bag 3*****************************************************/ // this calculates the remainder of the minutes if it exceeds 60 minutes if (get_minutes_bag_3 > 60) then minute_remain_bag_3 := get_minutes_bag_3 - 60; hour_remain_bag_3 := get_hour_bag_3 + 1; else minute_remain_bag_3 := get_minutes_bag_3; hour_remain_bag_3 := get_hour_bag_3; endif; if (hour_remain_bag_3 >= 24) then time_value_bag_3.ReqTimeValue := ((hour_remain_bag_3 - 24) FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_3 FORMATTED WITH "%2.2d"); date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_3.ReqTimeValue := (hour_remain_bag_3 FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_3 FORMATTED WITH "%2.2d"); date_bag_3.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************bag 4*****************************************************/ // this calculates the remainder of the minutes if it exceeds 60 minutes if (get_minutes_bag_4 >= 60) then minute_remain_bag_4 := get_minutes_bag_4 - 60; hour_remain_bag_4 := get_hour_bag_4 + 1; else minute_remain_bag_4 := get_minutes_bag_4; hour_remain_bag_4 := get_hour_bag_4; endif; if (hour_remain_bag_4 >= 24) then time_value_bag_4.ReqTimeValue := ((hour_remain_bag_4 - 24) FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_4 FORMATTED WITH "%2.2d"); date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date + 1) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); else time_value_bag_4.ReqTimeValue := (hour_remain_bag_4 FORMATTED WITH "%2.2d") || ":" || (minute_remain_bag_4 FORMATTED WITH "%2.2d"); date_bag_4.Value := ((extract month bag_1_date) || "-" || (extract day bag_1_date) FORMATTED WITH "%2.2d" || "-" || (extract year bag_1_date)); endif; /************************************************bag 5*****************************************************/ // inactive because bag 5 does not exist for carboplatin time_value_bag_5.ReqTimeValue := ((extract hour raw_time_bag_1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); /************************************************supportive meds*****************************************************/ if ((extract hour raw_time_bag_1 - 1) < 0) then time_value_supportive_med.ReqTimeValue := "00:00"; else time_value_supportive_med.ReqTimeValue := (((extract hour raw_time_bag_1) - 1) FORMATTED WITH "%2.2d") || ":" || (extract minute raw_time_bag_1 FORMATTED WITH "%2.2d"); endif; endif; // if (this_communication.CallingFieldName = "RequestedTime|1") // sets requested time endif; // if (order_set_name = {{{SINGLE-QUOTE}}}Carboplatin Desensitization Protocol{{{SINGLE-QUOTE}}}) ;; priority: 50 ;; evoke: // No evoke statement ;; logic: conclude true; ;; action: return this_communication, this_form; ;; Urgency: 50;; end: