maintenance: title: FORM_SET_DELIRIUM_ORDERS;; mlmname: FORM_SET_DELIRIUM_ORDERS;; arden: version 2.5;; version: 6.10;; institution: St Clair Hospital;; author: Juliet M. Law, Allscripts ;; specialist: Robert Stewart, Allscripts;; date: 2015-02-04;; validation: testing;; library: purpose: Require EKG ordered when Haliperidol IV is ordered based on date of last test. ;; explanation: This MLM is called from Delirium order set. If patient has not had an EKG in the last 10 days, require it be ordered with Haliperidol IV order. Change history 2015.02.04 JML CSR 32828: Created 2014.04.28 JML Copied to Production 2018.05.15 DW CSR# 36322 Delerium OS changes ;; keywords: Called MLMs, Haliperidol, EKG ;; knowledge: type: data-driven;; data: //Includes and Called MLMs standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; generic_mlm := MLM {{{SINGLE-QUOTE}}}FORM_SET_GENERIC_ITEM_CONTROL{{{SINGLE-QUOTE}}}; // ordrmgt_mlm := MLM {{{SINGLE-QUOTE}}}FORM_SET_RX_MEDICATION_ORDER_MGT{{{SINGLE-QUOTE}}}; (this_communication,this_form,client_info_obj) := argument; log_execution_info := FALSE; 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; ClientGuid := this_communication.ClientGUID; ClientVisitGuid := this_communication.ClientVisitGUID; ChartGuid := this_communication.ChartGUID; FormName := this_form.Name; PrimaryObjDetail := this_communication.PrimaryObj; OrderSetName := PrimaryObjDetail.OrderSetName; // Form Fields ScheduledMeds := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 17); // Pharmacy Scheduled Medications ScheduledMeds_List := ScheduledMeds.Value; HaldolIVMed := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 11); // Pharmacy PRN IV Medication - Haloperidol HaldolIVMed_List := HaldolIVMed.Value; HaldolPRNMed := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 8); // Pharmacy PRN Medication - Haloperidol HaldolPRNMed_List := HaldolPRNMed.Value; NonHaldolPRNMed := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 14); // Pharmacy PRN Medication - Non-Haloperidol NonHaldolPRNMed_List:= NonHaldolPRNMed.Value; EKGLab := last of (field_list WHERE field_list.DataItemName = "MultiOrderGrid" AND field_list.Control_MultiFieldOccNum = 4); // Cardiology EKGLab_List := EKGLab.Value; Nur_Instr2 := last of ( field_list WHERE field_list.DataItemName = "MultiOrderInline" AND field_list.Control_MultiFieldOccNum = 1); // Nurse Instructions Nur_Instr2_List := Nur_Instr2.Value; isHaldolIVSelected := last of (HaldolIVMed_List.IsSelected); isHaldolPRNSelected := last of (HaldolPRNMed_List.IsSelected); isNoNHaldolPRNSelected:= last of (NonHaldolPRNMed_List.IsSelected); isEKGSelected := last of (EKGLab_List.IsSelected); // Field Change Event if CallingEvent = "FieldChange" then // Cardiology if CallingField = "MultiOrderGrid|4" then // If EKG Daily order has been selected, select the Daily Nursing Order for i IN 1 seqto count EKGLab.Value do GridItem := EKGLab.Value[i]; if i = 2 then If GridItem.IsSelected = true then EKGLab.Value[3].IsSelected := true; // Daily Orders else EKGLab.Value[3].IsSelected := false; // Daily Orders endif; endif; enddo; // Determine if Haldol IV Push Scheduled has been selected isHaldolSchMedSelected := false; for i IN 1 seqto count ScheduledMeds.Value do SchedMedOrder := ScheduledMeds.Value[i]; if SchedMedOrder.Name = "Haloperidol Inj" and SchedMedOrder.IsSelected = true then isHaldolSchMedSelected := true; endif; enddo; if isHaldolIVSelected = true or isHaldolSchMedSelected = true then EKGLab_List.IsSelected := true; endif; // Pharmacy Secheduled Medication elseif CallingField = "MultiOrderGrid|17" then //Call Generic MLM (this_communication, this_form) := CALL generic_mlm WITH this_communication, this_form, client_info_obj; // Determine if the Haldol IV Scheduled Med is selected isHaldolSchMedSelected := false; for i IN 1 seqto count ScheduledMeds.Value do SchedMedOrder := ScheduledMeds.Value[i]; if SchedMedOrder.Name = "Haloperidol Inj" and SchedMedOrder.IsSelected = true then isHaldolSchMedSelected := true; endif; enddo; // If no Haldol IV (prn or sched) is selected de-select the Nurse Instructions order, EKG Daily Order ann Nursing Daily Orders if isHaldolIVSelected = false and isHaldolSchMedSelected = false then Nur_Instr2_List.IsSelected := false; // Nursing Instructions EKGLab.Value[2].IsSelected := false; // EKG Daily EKGLab.Value[3].IsSelected := false; // Daily Orders else Nur_Instr2_List.IsSelected := true; // Nursing Instructions EKGLab.Value[2].IsSelected := true; // EKG Daily EKGLab.Value[3].IsSelected := true; // Daily Orders endif; // Pharmacy PRN Medication - Non-Haloperidol elseif CallingField = "MultiOrderGrid|14" then SomethingIsSelected := false; // Determine if Something has been selected for i IN 1 seqto count NonHaldolPRNMed.Value do GridItem := NonHaldolPRNMed.Value[i]; if GridItem.IsSelected = true then SomethingIsSelected:= true; SelectedGridNumber := i; endif; enddo; // Make the other orders in this grid read-only for i IN 1 seqto count NonHaldolPRNMed.Value do if i <> SelectedGridNumber then NonHaldolPRNMed.Value[i].IsReadonly := true; endif; enddo; if SomethingIsSelected = true then HaldolPRNMed_List.IsSelected := false; HaldolPRNMed_List.IsReadonly := true; HaldolIVMed_List.IsSelected := false; HaldolIVMed_List.IsReadonly := true; else HaldolPRNMed_List.IsReadonly := false; HaldolIVMed_List.IsReadonly := false; NonHaldolPRNMed_List.IsReadonly := false; endif; // Pharmacy PRN Medication elseif CallingField = "MultiOrderGrid|8" then SomethingIsSelected := false; for i IN 1 seqto count HaldolPRNMed.Value do GridItem := HaldolPRNMed.Value[i]; if GridItem.IsSelected = true then SomethingIsSelected:= true; endif; enddo; if SomethingIsSelected = false and isHaldolIVSelected = false then NonHaldolPRNMed_List.IsReadonly := false; else NonHaldolPRNMed_List.IsReadonly := true; endif; // Pharmacy PRN IV Medication elseif CallingField = "MultiOrderGrid|11" then SomethingIsSelected := false; for i IN 1 seqto count HaldolIVMed.Value do GridItem := HaldolIVMed.Value[i]; if GridItem.IsSelected = true then SomethingIsSelected:= true; endif; enddo; if SomethingIsSelected = false and isHaldolPRNSelected = false then NonHaldolPRNMed_List.IsReadonly := false; else NonHaldolPRNMed_List.IsReadonly := true; endif; // Determine if the Haldol IV Scheduled Med is selected isHaldolSchMedSelected := false; for i IN 1 seqto count ScheduledMeds.Value do SchedMedOrder := ScheduledMeds.Value[i]; if SchedMedOrder.Name = "Haloperidol Inj" and SchedMedOrder.IsSelected = true then isHaldolSchMedSelected := true; endif; enddo; // If no Haldol IV (prn or sched) is selected de-select the Nurse Instructions order, EKG Daily Order ann Nursing Daily Orders if isHaldolIVSelected = false and isHaldolSchMedSelected = false then Nur_Instr2_List.IsSelected := false; // Nursing Instructions EKGLab.Value[2].IsSelected := false; // EKG Daily EKGLab.Value[3].IsSelected := false; // Daily Orders else Nur_Instr2_List.IsSelected := true; // Nursing Instructions EKGLab.Value[2].IsSelected := true; // EKG Daily EKGLab.Value[3].IsSelected := true; // Daily Orders endif; endif; endif; ;; evoke: ;; logic: conclude true; ;; action: return this_communication, this_form; ;; end: