maintenance: title: Multi Dose Now and Then Orders;; mlmname: FORM_Set_PostOp_Lumbar_Lam;; arden: version 2.5;; version: 5.50;; institution: St Clair Hospital;; author: Teresa Spicuzza, Allscripts ;; specialist: Michele Payne, Allscripts;; date: 2011-11-01;; validation: testing;; library: purpose: Used for grids to limit duplicate selections for analgesics and antibiotics ;; explanation: This MLM is called from the Post Op Lumbar Laminectomy Order Set Change history 2011.01.11 TMS Created for CSR #26791 2012.03.16 JML Added logic to restrict IV management of discontinue of PCA/IV Opioid and auto fill the post op day to either T+1 or T+2, depending on user selected option. 2012.03.28 JML Modified logic to include two additional post discharge Vicodin orders 2014.10.29 JML CSR 32824: Modified logic to display alert on form close if Opioid analgesic med was selected without selecting a post op discontinue pca order 2014.11.05 JML CSR 32824: Moved to production 2016.04.26 TMS CSR 33465: Add call on Form Close to Medication Order Management MLM 2017.03.03 SSJ CSR # 35111 - Post Op Anterior Cervical Discectomy Order added code for Checkbox 3 and 4. 2017.03.31 SSJ CSR # 35110 - Commented the logic of [MultiOrderGrid, – MultiFieldOccNum’s 11, 39, 40, and 41] As per teresa/Robert{{{SINGLE-QUOTE}}}s mail [SJ20170331] 2018.08.22 JML CSR # 37177, 37176 - Update logic as a result of Order Set Review process. ;; keywords: Called MLMs, Post Op Lumbar Laminectomy ;; 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; standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; /*******************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; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; Mlt_Order_Grid5:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 5); Mlt_Order_Grid28:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 28); Mlt_Order_Grid33:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 33); Mlt_Order_Grid34:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 34); Mlt_Order_Grid35:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 35); // [SJ20170331]- Commented as per header comment /* Mlt_Order_Grid11:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 11); Mlt_Order_Grid39:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 39); Mlt_Order_Grid40:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 40); Mlt_Order_Grid41:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 41); */ Mtl_Order_Grid42:= first of (field_list where field_list.DataItemName = "MultiOrderGrid" and field_List.Control_MultiFieldOccNum = 42); Chk_DiscPCADay1 := first of (field_list where field_list.DataItemName = "PRX_Checkbox1"); Chk_DiscPCADay2 := first of (field_list where field_list.DataItemName = "PRX_Checkbox2"); /*** Start : CSR # 35111 - Added By shivprasad ****/ Chk_DiscPCADay3 := first of (field_list where field_list.DataItemName = "PRX_Checkbox3" AND field_list.Control_MultiFieldOccNum = 1); Chk_DiscPCADay4 := first of (field_list where field_list.DataItemName = "PRX_Checkbox4" AND field_list.Control_MultiFieldOccNum = 1); /*** End : CSR # 35111 - Added By shivprasad ****/ DiscPCARequestedDate := first of (field_list where field_list.DataItemName = "RequestedDate"); Mlt_Grid5 := Mlt_Order_Grid5.Value; Mlt_Grid28 := Mlt_Order_Grid28.Value; Mlt_Grid33 := Mlt_Order_Grid33.Value; Mlt_Grid34 := Mlt_Order_Grid34.Value; Mlt_Grid35 := Mlt_Order_Grid35.Value; // [SJ20170331]- Commented as per header comment /* Mlt_Grid11 := Mlt_Order_Grid11.Value; Mlt_Grid39 := Mlt_Order_Grid39.Value; Mlt_Grid40 := Mlt_Order_Grid40.Value; Mlt_Grid41 := Mlt_Order_Grid41.Value; */ Mlt_Grid42 := Mtl_Order_Grid42.Value; falselist28 := (); truelist28 := (); falselist33 := (); truelist33 := (); falselist34 := (); truelist34 := (); falselist35 := (); truelist35 := (); buttonresult:=""; // Get patient weight comb_ht_wt_field := first of (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; weightvalue := (wt as number); endif; Gridlist28 := count Mlt_Grid28 ; Gridlist33 := count Mlt_Grid33; Gridlist34 := count Mlt_Grid34; Gridlist35 := count Mlt_Grid35; for p in (1 seqto GridList28) do falselist28 := falselist28, false; truelist28 := truelist28, true; enddo; for r in (1 seqto GridList33) do falselist33 := falselist33, false; truelist33 := truelist33, true; enddo; for k in (1 seqto GridList34) do falselist34 := falselist34, false; truelist34 := truelist34, true; enddo; for s in (1 seqto GridList35) do falselist35 := falselist35, false; truelist35 := truelist35, true; enddo; If CallingEvent = "FormOpen" Then Mlt_Grid42.IsReadOnly := true; Endif; If CallingEvent = "FieldChange" Then If CallingField = "MultiOrderGrid|28" Then If true in Mlt_Grid28.IsSelected Then Mlt_Grid33.IsSelected := falselist33; Mlt_Grid33.IsReadOnly := truelist33; Mlt_Grid34.IsSelected := falselist34; Mlt_Grid34.IsReadOnly := truelist34; Mlt_Grid35.IsSelected := falselist35; Mlt_Grid35.IsReadOnly := truelist35; /*** Start : CSR # 35110 - Added By shivprasad ****/ Chk_DiscPCADay3.Control_Read_Only := true; Chk_DiscPCADay3.Value := False; Chk_DiscPCADay4.Control_Read_Only := true; Chk_DiscPCADay4.Value := False; Else Mlt_Grid33.IsReadOnly := falselist33; Mlt_Grid34.IsReadOnly := falselist34; Mlt_Grid35.IsReadOnly := falselist35; /*** Start : CSR # 35110 - Added By shivprasad ****/ Chk_DiscPCADay3.Control_Read_Only := False; Chk_DiscPCADay4.Control_Read_Only := False; Endif; Endif; If CallingField = "MultiOrderGrid|33" Then If true in Mlt_Grid33.IsSelected Then Mlt_Grid28.IsSelected := falselist28; Mlt_Grid28.IsReadOnly := truelist28; Mlt_Grid34.IsSelected := falselist34; Mlt_Grid34.IsReadOnly := truelist34; Mlt_Grid35.IsSelected := falselist35; Mlt_Grid35.IsReadOnly := truelist35; /*** Start : CSR # 35110 - Added By shivprasad ****/ Chk_DiscPCADay3.Control_Read_Only := true; Chk_DiscPCADay3.Value := False; Chk_DiscPCADay4.Control_Read_Only := true; Chk_DiscPCADay4.Value := False; Else Mlt_Grid28.IsReadOnly := falselist28; Mlt_Grid34.IsReadOnly := falselist34; Mlt_Grid35.IsReadOnly := falselist35; /*** Start : CSR # 35110 - Added By shivprasad ****/ Chk_DiscPCADay3.Control_Read_Only := False; Chk_DiscPCADay4.Control_Read_Only := False; Endif; Endif; If CallingField = "MultiOrderGrid|34" Then If true in Mlt_Grid34.IsSelected Then Mlt_Grid28.IsSelected := falselist28; Mlt_Grid28.IsReadOnly := truelist28; Mlt_Grid33.IsSelected := falselist33; Mlt_Grid33.IsReadOnly := truelist33; Mlt_Grid35.IsSelected := falselist35; Mlt_Grid35.IsReadOnly := truelist35; Else Mlt_Grid28.IsReadOnly := falselist28; Mlt_Grid33.IsReadOnly := falselist33; Mlt_Grid35.IsReadOnly := falselist35; Endif; Endif; If CallingField = "MultiOrderGrid|35" Then If true in Mlt_Grid35.IsSelected Then Mlt_Grid28.IsSelected := falselist28; Mlt_Grid28.IsReadOnly := truelist28; Mlt_Grid33.IsSelected := falselist33; Mlt_Grid33.IsReadOnly := truelist33; Mlt_Grid34.IsSelected := falselist34; Mlt_Grid34.IsReadOnly := truelist34; Else Mlt_Grid28.IsReadOnly := falselist28; Mlt_Grid33.IsReadOnly := falselist33; Mlt_Grid34.IsReadOnly := falselist34; Endif; Endif; If CallingField = "MultiOrderGrid|5" Then If true in Mlt_Grid5.IsSelected Then If Mlt_Grid5.IsSelected [1] = true Then Mlt_Grid5.IsReadOnly := (False,True,True,True); Endif; If Mlt_Grid5.IsSelected [2] = true Then Mlt_Grid5.IsReadOnly := (True,False,True,True); Endif; If Mlt_Grid5.IsSelected [3] = true Then Mlt_Grid5.IsReadOnly := (True,True,False,True); Endif; If Mlt_Grid5.IsSelected [4] = true Then Mlt_Grid5.IsReadOnly := (True,True,True,False); Endif; Else Mlt_Grid5.IsReadOnly := (False,False,False,False); Endif; Endif; // [SJ20170331]- Commented as per header comment /* If CallingField = "MultiOrderGrid|11" then If true in Mlt_Grid11.IsSelected Then Mlt_Grid39.IsSelected := (False,False); Mlt_Grid39.IsReadOnly := (True,True); Mlt_Grid40.IsSelected := (False,False); Mlt_Grid40.IsReadOnly := (True,True); If Mlt_Grid11.IsSelected [1] = True then Mlt_Grid11.IsSelected := (True,False); If weightvalue >= 80 then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid11.IsSelected := (False,True); endif; endif; endif; If Mlt_Grid11.IsSelected [2] = True then Mlt_Grid11.IsSelected := (False, True); If (weightvalue < 80 and weightvalue > 0) then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid11.IsSelected := (True,False); endif; endif; endif; Else Mlt_Grid11.IsReadOnly := (False,False); Mlt_Grid39.IsReadOnly := (False,False); Mlt_Grid40.IsReadOnly := (False,False); Endif; Endif; //If CallingField = "MultiOrderGrid|11" If CallingField = "MultiOrderGrid|39" Then If true in Mlt_Grid39.IsSelected Then Mlt_Grid11.IsSelected := (False,False); Mlt_Grid11.IsReadOnly := (True,True); Mlt_Grid40.IsSelected := (False,False); Mlt_Grid40.IsReadOnly := (True,True); If Mlt_Grid39.IsSelected [1] = True then Mlt_Grid39.IsSelected := (True,False); If weightvalue >= 80 then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid39.IsSelected := (False,True); endif; endif; endif; If Mlt_Grid39.IsSelected [2] = True then Mlt_Grid39.IsSelected := (False, True); If (weightvalue < 80 and weightvalue > 0) then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid39.IsSelected := (True, False); endif; endif; endif; Else Mlt_Grid11.IsReadOnly := (False,False); Mlt_Grid40.IsReadOnly := (False,False); Endif; Endif; //If CallingField = "MultiOrderGrid|39" If CallingField = "MultiOrderGrid|40" Then If true in Mlt_Grid40.IsSelected Then Mlt_Grid11.IsSelected := (False,False); Mlt_Grid11.IsReadOnly := (True,True); Mlt_Grid39.IsSelected := (False,False); Mlt_Grid39.IsReadOnly := (True,True); If Mlt_Grid40.IsSelected [1] = True then Mlt_Grid40.IsSelected := (True,False); If weightvalue >= 80 then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is greater than 80kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (False, True); endif; endif; If weightvalue < 50 and weightvalue > 0 then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is less than 50kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (False, True); endif; endif; endif; If Mlt_Grid40.IsSelected [2] = True then Mlt_Grid40.IsSelected := (False, True); If (weightvalue >= 50 and weightvalue < 80) then dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "Patient weight is between 50kg to 79kg." ||"\n\n Do you wish to change order." ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; buttonresult := dialogResult as string; If buttonresult = "Yes" then Mlt_Grid40.IsSelected := (True, False); endif; endif; endif; Else Mlt_Grid40.IsSelected := (False,False); Mlt_Grid11.IsReadOnly := (False,False); Mlt_Grid39.IsReadOnly := (False,False); Endif; Endif; //If CallingField = "MultiOrderGrid|40" If CallingField = "MultiOrderGrid|41" Then If true in Mlt_Grid41.IsSelected Then Mlt_Grid11.IsSelected := (False,False); Mlt_Grid11.IsReadOnly := (True,True); Mlt_Grid39.IsSelected := (False,False); Mlt_Grid39.IsReadOnly := (True,True); Mlt_Grid40.IsSelected := (False,False); Mlt_Grid40.IsReadOnly := (True, True); Else Mlt_Grid11.IsReadOnly := (False,False); Mlt_Grid39.IsReadOnly := (False,False); Mlt_Grid40.IsReadOnly := (False,False); Endif; Endif; //If CallingField = "MultiOrderGrid|41" */ if (CallingField = "PRX_Checkbox1|1") then if (Chk_DiscPCADay1.Value = true) then Chk_DiscPCADay2.Control_Read_Only := true; Mlt_Grid42.IsSelected := true; PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t"; If (Chk_DiscPCADay3.Value = true) then DiscPCARequestedDate.Value := (NOW) FORMATTED WITH "%.2t"; Else DiscPCARequestedDate.Value := PostOpDay1Date; Endif; else Chk_DiscPCADay2.Control_Read_Only := false; Mlt_Grid42.IsSelected := false; DiscPCARequestedDate.Value := ""; endif; endif; //If CallingField = "PRX_Checkbox1|1" if (CallingField = "PRX_Checkbox2|1") then if (Chk_DiscPCADay2.Value = true) then Chk_DiscPCADay1.Control_Read_Only := true; Mlt_Grid42.IsSelected := true; PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t"; If (Chk_DiscPCADay3.Value = true) then DiscPCARequestedDate.Value := (NOW) FORMATTED WITH "%.2t"; Else DiscPCARequestedDate.Value := PostOpDay2Date; Endif; else Chk_DiscPCADay1.Control_Read_Only := false; Mlt_Grid42.IsSelected := false; DiscPCARequestedDate.Value := ""; endif; endif; //If CallingField = "PrX_Checkbox2|1" /*** Start : Added By shivprasad ****/ if (CallingField = "PRX_Checkbox3|1") then if (Chk_DiscPCADay3.Value = true) then Chk_DiscPCADay4.Control_Read_Only := true; PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay1Date3; else Chk_DiscPCADay4.Control_Read_Only := false; DiscPCARequestedDate.Value := ""; If (Chk_DiscPCADay1.Value = true) then PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay1Date; ElseIf (Chk_DiscPCADay2.Value = true) then PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay2Date; Else PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay1Date3; Endif; endif; endif; //If CallingField = "PRX_Checkbox3|1" if (CallingField = "PRX_Checkbox4|1") then if (Chk_DiscPCADay4.Value = true) then Chk_DiscPCADay3.Control_Read_Only := true; If (Chk_DiscPCADay1.Value = true) then PostOpDay1Date := (NOW + 1 day) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay1Date; ElseIf (Chk_DiscPCADay2.Value = true) then PostOpDay2Date := (NOW + 2 day) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay2Date; Else PostOpDay1Date3 := (NOW ) FORMATTED WITH "%.2t"; DiscPCARequestedDate.Value := PostOpDay1Date3; Endif; else Chk_DiscPCADay3.Control_Read_Only := false; DiscPCARequestedDate.Value := ""; endif; endif; //If CallingField = "PrX_Checkbox4|1" /*** End : Added By Shivprasad ***/ //CSR 32824 Change elseif ( callingEvent = "FormClose" ) then //Check to see if Opioid Analgesic PCA order was selected If ( ( true in Mlt_Grid28.IsSelected ) OR ( true in Mlt_Grid33.IsSelected ) OR ( true in Mlt_Grid34.IsSelected ) OR ( true in Mlt_Grid35.IsSelected ) ) Then if ( ( Chk_DiscPCADay1.Value = false ) AND ( Chk_DiscPCADay2.Value = false ) ) then alert_message := "Please select a Discontinue PCA/IV Opioid Post op Day 1 or Day 2 checkbox."; this_communication.DisplayForm := true; this_communication.Message := alert_message; this_communication.MessageType := "Error"; endif; endif; Med_Order_Mgt := mlm {{{SINGLE-QUOTE}}}FORM_SET_Rx_Medication_Order_Mgt{{{SINGLE-QUOTE}}}; (this_communication, this_form) := call Med_Order_Mgt with this_communication, this_form, client_info_obj; Endif; // If callingEvent = "FieldChange" ;; 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; ;; end: