maintenance: title: FORM_SET_ERAS_PREOP_ORDERS;; mlmname: FORM_SET_ERAS_PREOP_ORDERS;; arden: version 2.5;; version: 18.4;; institution: St Clair Hospital;; author: Teresa Spicuzza, Allscripts ;; specialist: Maria Pest, Allscripts ;; date: 2019-11-14;; validation: testing;; library: purpose: Support pre op order set for Enhanced Recovery After Surgery (ERAS) ;; explanation: Change history 12.04.2019 TMS CSR 38333 Created to only select diet order when patient is an inpatient or observation to eliminate sending NPO for suergery orders on SDC and outpatients. ;; keywords: Insulin, weight based, diabetic ;; knowledge: type: data-driven;; data: standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; // 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; comm_obj := this_communication.primaryobj; /*******************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:=""; CR := 13 formatted with "%c"; LF := 10 formatted with "%c"; CRLF:= CR||LF; // TAB := 9 FORMATTED WITH "%C" ; // TAB2 := TAB || TAB ; // TAB3 := TAB || TAB || TAB; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; ClientGuid := this_communication.ClientGUID; ClientVisitGuid := this_communication.ClientVisitGUID; ChartGuid := this_communication.ChartGUID; //Form fields NPO_Orders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 1 ); NPOAfterMidnight:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 2 ); NPOAfterMidnight_List := NPOAfterMidnight.value; NPO4or2Hours:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 4 ); NPO4or2Hours_List := NPO4or2Hours.value; NPOOther:= last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 5 ); NPOOther_List := NPOOther.value; PharmacyConsultOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 3 ); PharmacyConsultOrders_List := PharmacyConsultOrders.value; DietOrders := last of ( field_list WHERE field_list.DataItemName = "MultiOrderCheckbox" AND field_list.Control_MultiFieldOccNum = 1 ); DietOrders_List := DietOrders.value; CurrMeasurements := last of ( field_list WHERE field_list.DataItemName = "CombinedMeasurements" AND field_list.Control_MultiFieldOccNum = 1 ); Inpatient := last of ( field_list WHERE field_list.DataItemName = "Generic Check Box" AND field_list.Control_MultiFieldOccNum = 1 ); If CallingEvent = "FormOpen" then PharmacyConsultOrders_List.IsReadOnly := (true, true); DietOrders_List.IsReadOnly := (true, true,true); PatientType, VisitStatus, CurrLocn := read last {" select typecode, visitStatus, currentlocation from cv3clientvisit with (nolock) where guid = " || SQL (clientvisitguid) }; If PatientType in ("Inpatient", "Observation") and VisitStatus = "ADM" then Inpatient.value := "True"; else Inpatient.value := "False"; endif; If Inpatient.value = "True" then ColoRectalSurgery := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n\n Is this a Colo/Rectal Surgery?" || CRLF || CRLF ,"Alert","YesNo" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; If (ColoRectalSurgery as string) = "Yes" then PharmacyConsultOrders_List.IsSelected := (true, true); endif; endif; endif; If CallingEvent = "FieldChange" then If CallingField = "MultiOrderInline|2" then If True in NPOAfterMidnight_List.IsSelected then NPO4or2Hours_List.IsReadOnly:= (true, true); NPOOther_List.IsReadOnly := (true, true); BoxControl := (); For r in 1 seqto (count NPOAfterMidnight_List) do If NPOAfterMidnight_List.IsSelected [r] = true then BoxControl := BoxControl, "false"; else BoxControl := BoxControl, "true"; endif; enddo; NPOAfterMidnight_List.IsReadOnly:= BoxControl; If Inpatient.value = True then DietOrders_List.IsSelected := (true, false, false); else DietOrders_List.IsSelected := (false, false, false); endif; else NPO4or2Hours_List.IsReadOnly := (false,false); NPOOther_List.IsReadOnly := (false, false); NPOAfterMidnight_List.IsReadOnly := (false, false, false, false); DietOrders_List.IsSelected := (false, false, false); endif; //If True in NPOAfterMidnight endif; //If CallingField = "MultiOrderInline|2" If CallingField = "MultiOrderInline|4" then If True in NPO4or2Hours_List.IsSelected then NPOAfterMidnight_List.IsReadOnly:= (true, true, true, true); NPOOther_List.IsReadOnly := (true, true); BoxControl := (); For r in 1 seqto (count NPO4or2Hours_List) do If NPO4or2Hours_List.IsSelected [r] = true then BoxControl := BoxControl, "false"; If r= 1 and Inpatient.value = True then DietOrders_List.IsSelected := (false, true, false); elseif r= 2 and Inpatient.value = true then DietOrders_List.IsSelected := (false, false, true); endif; else BoxControl := BoxControl, "true"; endif; enddo; NPO4or2Hours_List.IsReadOnly:= BoxControl; else NPOAfterMidnight_List.IsReadOnly := (false,false, false, false); NPOOther_List.IsReadOnly := (false, false); NPO4or2Hours_List.IsReadOnly := (false, false); DietOrders_List.IsSelected := (false, false, false); endif; //If True in NPO4or2Hours_List endif; //If CallingField = "MultiOrderInline|4" If CallingField = "MultiOrderInline|5" then If True in NPOOther_List.IsSelected then NPOAfterMidnight_List.IsReadOnly:= (true, true, true, true); NPO4or2Hours_List.IsReadOnly := (true, true); BoxControl := (); For r in 1 seqto (count NPOOther_List) do If NPOOther_List.IsSelected [r] = true then BoxControl := BoxControl, "false"; If r= 1 and Inpatient.value = True then DietOrders_List.IsSelected := (false, false, false); elseif r= 2 and Inpatient.value = true then DietOrders_List.IsSelected := (true, false, false); endif; else BoxControl := BoxControl, "true"; endif; enddo; NPOOther_List.IsReadOnly:= BoxControl; else NPOAfterMidnight_List.IsReadOnly := (false,false, false, false); NPOOther_List.IsReadOnly := (false, false); NPO4or2Hours_List.IsReadOnly := (false, false); DietOrders_List.IsSelected := (false, false, false); endif; //If True in NPOOther_List endif; //If CallingField = "MultiOrderInline|5" endif; // 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: