maintenance: title: Form_HoldOrder_RequestedTime;; mlmname: Form_HoldOrder_RequestedTime;; arden: version 2;; version: 4.50;; institution: St. Clair Hospital;; author: Teresa Spicuzza ;; specialist: Eclipsys Corporation;; date: 2010-10-27;; validation: testing;; library: purpose: Change med orders to scheduled start time. ;; explanation: ( ) Change history 01.30.2012 TMS Added routines for Now and Then Dosing to only make Start Now Checkbox visible to IT and CCM physicians during pilot period. Also verifies on form open if Start Now checkbox will be available. Not available in hold session, if order preconfigured as PRN, if order is preconfigured with a one time or User Schedule frequency. If order is preconfigured with start now checked and a duration other than times, alert user to only use Times with Start Now. 03.05.2013 TMS Added call to FORM_MED_Irreg_Sched to populate Rx Comments and Rx Instructions for meal frequencies when pre-configured on a child order. CSR 31322 04.08.2013 TMS Added call to FORM_SCIP_Abx_Dosing MLM on form open CSR 31359 08.12.2013 TMS Added logic for PRN reason to be mandatory upon form open for Behav. Health patients. CSR 31639 08.14.2013 TMS Added logic to make PRN field visible if hidden on form for Behav. Health patients. CSR 31639 08.15.2013 TMS Changed prn reason to not mandatory until dept ensures reason indicated by physician. CSR 31639 10.08.2013 TMS Changed the users who can use the "now and then" functionality on form open from particular users as part of the pilot to all physician and physician extenders. CSR 26926 11.07.2013 TMS Commented out the users who can use the "now and then" functionality to allow nurses, secretaries and pharmacists access. CSR 26926 02.21.2014 TMS Added functionality for STAT and Then orders, modified to allow use of PRN with Stat/Now and then orders. Updated to use Total doses UDDI to populate the stop after field with appropriate value. CSR 31883 06.16.2014 TMS Add call to FORM_S2V_ORM_FORMOPEN to form open mlm calls for Admission Order Rec project. CSR 31688 06.17.2014 DW CSR# 32133 Added call to Automatic Medication Scheduling mlm 08.25.2014 TMS Added logic to form open for ORM orders on chemical restraint forms. If medical management indication is prefilled on an order template, remove read only control from frequency and indication to allow changing the preselected indication and allow entry of a frequency when chosen from the order browse. Trackit Ticket # 167748 02.25.2016 JML CSR 32396: Modified to call FORM_PERICARDITIS_PAIN_ORDER mlm to protect all medication relevant ordering fields. 04.27.2016 TMS Added coding for Order Management CSR 33465 05.31.2016 JML CSR 34091: Modified to call FORM_ANTIBIOTIC_ORDERS_PROTECT_DOSE for several antibiotic orders. 04.11.2017 TMS Modified to add FORM_Rx_Pediatric_Acetaminophen and Form_Rituxin as a called MLM from this MLM instead of having the reverse to keep this as the "master" MLM that calls others for form open, being done in preparation for using hidden default dosing. Added call to FORM_RX_Default_Medication_Values CSR 35364. 05.10.2017 JML CSR 35272: Modified to work with new Sepsis Unknown Source Antibiotic ED order set AND Sepsis Work Up Orders (ED) order set 09.14.2017 TMS CSR 35956: Added temporary alert message for hydromorphone shortage. 09.21.2017 TMS CSR 35956: Removed temporary alert message for hydromorphone shortage. 03.13.2018 TMS CSR 34822: Add Logic to call PRX_Sched_Logic to protect Zosyn extended infusion start date/time and frequency. 04.19.2018 TMS CSR 35320: Remove setting medications to {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} when order is placed from the anesthesia post op order sets for medications being ordered for PACU or OPSU. 05.16.2018 TMS CSR 33940: Add "With Dialysis Treatment" to Frequency retrievals that contain As Ordered. 01.29.2019 TMS CSR 37266: Remove setting medications to {{{SINGLE-QUOTE}}}Scheduled/Start Time{{{SINGLE-QUOTE}}} when order is placed from two new anesthesia post op order sets (Standard and Supplemental) for medications being ordered for PACU or OPSU. 09.26.2019 TMS CSR 38305: Added logic to set start time to Routine if location is Infusion Center. ;; keywords: Hold, requested Time, Start time; ;; knowledge: type: data-driven;; data: /********************Make Changes To Spelling And Flags In This Section*********************/ /* send_alert := "DoNotSend"; */ standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "ObjectsPlusXA.SCM.Forms"; using namespace "ObjectsPlusXA.SunriseClinicalManager.Forms"; /* //-------------------------------------------------------------------------- local_session := cds_session.local; //-------------------------------------------------------------------------- */ // 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; CalledBy := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; IrregFreqOrders := MLM {{{SINGLE-QUOTE}}}FORM_MED_Irreg_Sched{{{SINGLE-QUOTE}}}; SCIPAbxOrder := MLM {{{SINGLE-QUOTE}}}FORM_SCIP_Abx_Dosing{{{SINGLE-QUOTE}}}; AutoMedScheduling := MLM {{{SINGLE-QUOTE}}}FORM_Antibiotic_Scheduling{{{SINGLE-QUOTE}}}; AdmitORM := MLM {{{SINGLE-QUOTE}}}FORM_S2V_ORM_FormOpen{{{SINGLE-QUOTE}}}; AcetaminophenOrder := MLM {{{SINGLE-QUOTE}}}FORM_Rx_Pediatric_Acetaminophen{{{SINGLE-QUOTE}}}; OrderManagement := MLM {{{SINGLE-QUOTE}}}FORM_Rx_Medication_Retrieval{{{SINGLE-QUOTE}}}; RituxinCalc := MLM {{{SINGLE-QUOTE}}}FORM_Rituxin{{{SINGLE-QUOTE}}}; DefaultMedValues := MLM {{{SINGLE-QUOTE}}}FORM_RX_Default_Medication_Values{{{SINGLE-QUOTE}}}; ZosynOrder := MLM {{{SINGLE-QUOTE}}}FORM_PRX_SCHED_LOGIC{{{SINGLE-QUOTE}}}; //CSR 32396 JML Change Begin PericarditisOrder := MLM {{{SINGLE-QUOTE}}}FORM_PERICARDITIS_PAIN_ORDER{{{SINGLE-QUOTE}}}; Antibiotic_Stewardship_Orders := MLM {{{SINGLE-QUOTE}}}FORM_ANTIBIOTIC_ORDERS_PROTECT_DOSE{{{SINGLE-QUOTE}}}; AnesthesiaOS :=( "Anesthesia Post Op Orders", "Anesthesia Post Op Orders - Standard", "Anesthesia Post Op Orders - Supplemental", "Pediatric Medication PACU Post Op OS"); //List of specific OS names to modify MLM logic handling PericarditisOSName := "Pericarditis Pain Order Set"; ASP_OSName := ( "IntraAbdominal Antibiotic ED", "Pneumonia Antibiotic ED", "Pneumonia Antibiotic Outpatient ED", "Genitourinary Antibiotic", "Genitourinary Antibiotic ED", "IntraAbdominal Antibiotic", "Pneumonia Antibiotic", "Pneumonia Antibiotic Outpatient", "Skin Antibiotic Inpatient", "Skin Antibiotic Inpatient ED", "Skin Antibiotic Outpatient", "Skin Antibiotic Outpatient ED", "C Diff Antibiotic ED", "C Diff Antibiotic", "Sepsis Unknown Source Antibiotic", "Sepsis Unknown Source Antibiotic ED", "Antibiotic Guidelines ED", "Antibiotic Guidelines", "Septic Work Up Orders" ); //CSR 32396 JML Change End ASP_with_ExtZosyn := ("Skin Antibiotic Inpatient", "Pneumonia Antibiotic", "Sepsis Unknown Source Antibiotic", "IntraAbdominal Antibiotic"); // Set some needed fields if called_by_editor then client_guid := "9000001369400200"; visit_guid := visit_obj.GUID; chart_guid := "9000001918900170"; orderId := "1000002689073001"; called_by := "FormOpen"; else client_guid := this_communication.ClientGUID; visit_guid := this_communication.ClientVisitGUID; chart_guid := this_communication.ChartGuid; orderid := this_communication.ItemID; endif; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" ); stat_then := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then" ); TotalDosing := first of ( field_list WHERE field_list.DataItemName = "PRX_Dosing Total Doses"); disable_now := last of (field_list where field_list.DataItemName = "PRX_DosingNowDisabled" ); requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" ); requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" ); requested_time_value := requested_time.value; order_freq := first of (field_list where field_list.DataItemName = "FrequencyCode"); order_freq_value := order_freq.value; order_freq_summary := order_freq_value.FrequencySummary; newfrequency := order_freq.FrequencySummary; session_type := comm_obj.internalprocessingtype; Order_name:= comm_obj.name; Order_set_name := comm_obj.OrderSetName; nofrequency := ""; IsPRN_field := last of (field_list where field_list.DataItemName = "IsPRN" ); Reason_field := last of (field_list where field_list.DataItemName = "PRX_PRNCONDITION" ); StopAfter := first of (field_list.Value WHERE field_list.DataItemName="StopAfter" ); RX_Comments_field := last of (field_list where field_list.DataItemName = "Rx Comments"); RX_Instructions_field := last of (field_list where field_list.DataItemName = "Rx Instructions"); SCIP_Antibiotic := last of (field_list where field_list.DataItemName = "PRX_AntibioticNameforMLM"); SCIP_Antibiotic_value := SCIP_Antibiotic.value; BehavHealth := ("PSYE", "PSYW"); med_cb := last of (field_list where field_list.DataItemName = "NUR_Not Chemical Restraint" ); med_cb_value := med_cb.value; med_cond := last of (field_list where field_list.DataItemName = "NUR_Nonchemical Restraint Ind"); OneTimeFreq := ("As Ordered", "As-Directed", "Between Blood", "Given in Delivery Room", "Given in Infusion Center", "Given in NSY","", "Load", "Now", "Once", "Stat", "One Time", "Today", "Per-Protocol", "POST OP", "Post-Procedure", "Post-Transfusion", "PRE OP", "Pre-Procedure", "Pre-Transfusion", "", "", "With Dialysis Treatment"); continue_checking_order := TRUE; // fire_on_User := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT"); /* Get the current user{{{SINGLE-QUOTE}}}s occupation*/ /* userguid := this_communication.UserGUID; UserCode := read last {"Select occupationcode " ||" From cv3user with (nolock) " ||" Where Guid = " || SQL(userguid) }; continue_checking_order := UserCode in fire_on_User; */ CurrentLocationGuid := read last {"Select CurrentLocationGuid " ||" From cv3Clientvisit " ||" Where ClientGuid = " || SQL(Client_Guid) ||" and Guid = " || SQL(Visit_Guid) ||" and VisitStatus in ({{{SINGLE-QUOTE}}}ADM{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}PRE{{{SINGLE-QUOTE}}})" }; CurrentLocation := read last {"Select Name from cv3location " ||" Where Guid = " || SQL(CurrentLocationGuid) }; If exists Reason_field and CurrentLocation in BehavHealth then Reason_field.control_mandatory := FALSE; Reason_field.control_visible := TRUE; endif; If session_type = "Hold" then If exists order_freq and order_freq_summary = "STAT" then order_freq_value.FrequencySummary := NULL ; endif; start_now.control_read_only := true; start_now.value := false; stat_then.control_read_only := true; stat_then.value := false; TotalDosing.control_read_only := true; TotalDosing.value := ""; requested_time_value.ReqTimeCode := "Scheduled/Start Time"; endif; //CSR 32396 JML Change If ( CalledBy = "FormOpen" AND Order_set_name = PericarditisOSName ) then ( this_communication, this_form ) := call PericarditisOrder with ( this_communication, this_form, client_info_obj ); elseif ( ( CalledBy = "FormOpen" OR CalledBy = "FieldChange" ) AND ( Order_Set_Name IN ASP_OSName OR Order_Set_Name matches pattern "Transition Orders%" ) ) then ( this_communication, this_form ) := call Antibiotic_Stewardship_Orders with ( this_communication, this_form, client_info_obj ); If Order_Set_Name IN ASP_with_ExtZosyn then ( this_communication, this_form ) := call ZosynOrder with ( this_communication, this_form, client_info_obj ); endif; ( this_communication, this_form ) := call AutoMedScheduling with ( this_communication, this_form, client_info_obj ); elseIf ( CalledBy = "FormOpen" AND Order_set_name = "Piperacillin/Tazobactam Orders" ) then ( this_communication, this_form ) := call ZosynOrder with ( this_communication, this_form, client_info_obj ); Else (this_communication, this_form) := call AutoMedScheduling with (this_communication, this_form, client_info_obj); (this_communication, this_form) := call AdmitORM with (this_communication, this_form, client_info_obj); (this_communication, this_form) := call OrderManagement with (this_communication, this_form, client_info_obj); (this_communication, this_form) := call DefaultMedValues with (this_communication, this_form, client_info_obj); If Order_name matches pattern "%Acetaminophen%" then (this_communication, this_form) := call AcetaminophenOrder with (this_communication, this_form, client_info_obj); endif; // TMS removed on 9.21.2017 due to shipment arriving and supply not critically low // If Order_name matches pattern "%HYDROmorphone Inj%" or Order_name matches pattern "%HYDROmorphone Inj%" then // dialogResult := call {{{SINGLE-QUOTE}}}MessageBox{{{SINGLE-QUOTE}}}.Show with "\n Hydromorphone injection supply is critically low. \n\n Please consider ordering morphine injection. ","Alert","OK" as {{{SINGLE-QUOTE}}}MessageBoxButtons{{{SINGLE-QUOTE}}}; // endif; If Order_name = "Rituximab:" then (this_communication, this_form) := call RituxinCalc with (this_communication, this_form, client_info_obj); endif; If exists order_freq and order_freq_summary = "Now" then start_now.control_read_only := true; stat_then.control_read_only := true; TotalDosing.control_read_only := true; stopafter.number := null; stopafter.option := ""; else if exist Rx_comments_field then (this_communication, this_form) := call IrregFreqOrders with (this_communication, this_form, client_info_obj); endif; endif; // If order is on a chemical restraint med form and indication for // medication management is prepopulated, remove read only control // from frequency and indication 08.25/2014 - TMS If (exists med_cb and med_cb.Value = true) then order_freq.control_read_only := false; med_cond.control_read_only := false; endif; If exists order_freq and order_freq_summary in OneTimeFreq then start_now.control_read_only := true; stat_then.control_read_only := true; TotalDosing.control_read_only := true; endif; If exists SCIP_Antibiotic and SCIP_Antibiotic.value is not NULL then (this_communication, this_form) := call SCIPAbxOrder with (this_communication, this_form, client_info_obj); endif; /* If exists IsPRN_field and IsPRN_field.value = true then If exists start_now then start_now.value := false; start_now.control_read_only := true; stat_then.value := false; stat_then.control_read_only := true; TotalDosing.value := ""; TotalDosing.control_read_only := true; endif; endif; */ If session_type = "Hold" then If exists order_freq and order_freq_summary = "STAT" then order_freq_value.FrequencySummary := NULL ; endif; start_now.control_read_only := true; start_now.value := false; stat_then.control_read_only := true; stat_then.value := false; TotalDosing.control_read_only := true; TotalDosing.value := ""; If (Order_Set_Name in AnesthesiaOS or CurrentLocation matches pattern "Infus%") then requested_time_value.ReqTimeCode := "Routine"; else requested_time_value.ReqTimeCode := "Scheduled/Start Time"; endif; endif; if continue_checking_order = false then Start_Now.control_visible := FALSE; Stat_Then.control_visible := FALSE; TotalDosing.control_visible := FALSE; endif; if(Start_Now.Value = true) or (Stat_Then.Value = true) Then StopAfter.control_read_only := true; TotalDosing.control_read_only := false; else StopAfter.control_read_only := false; TotalDosing.control_read_only := true; /* if(StopAfter.option = "Days" OR StopAfter.option = "Hours" OR StopAfter.option = "Minutes") then this_communication.DisplayForm := "Yes"; this_communication.Message := "You can not select "|| StopAfter.option ||" in Stop After Window with Start Now Dosing Option. Please select {{{SINGLE-QUOTE}}}Times{{{SINGLE-QUOTE}}} option "; this_communication.MessageType := "Error"; stopafter.option := ""; endif; */ endif; endif; ;; evoke: ;; 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: