maintenance: title: Medical Schedule Logic and Rules;; mlmname: FORM_PRX_SCHED_LOGIC;; arden: version 2;; version: 4.50;; institution: St Clair Isolation Set MLM;; author: Eclipsys Corp;; specialist: Shawn Head;; date: 2013-12-03;; validation: testing;; library: purpose: MLM that can be used for any schedule related logic moving forward. ;; explanation: This MLM is called from the medication form(s) where assigned. Design should drive schedule decision/logic/rules related to medication scheduling, alerts, ect... Originally created to handle orders Scheduled date/time not being set to STAT unless the frequency is STAT also. Change History 2013.12.03 - STH CSR#: 31706 - Created MLM 2014.03.21 - STH HDT#: 1478552 Logic commented out due to issues with Stat and Then Dosing. 2016.09.28 TMS HDT#: 1478552 Restored MLM to original version, added check for {{{SINGLE-QUOTE}}}PRX_Dosing Addl Dose{{{SINGLE-QUOTE}}} field to ignore logic if value is true, meaning order was generated as a STAT/Now and then order. 2018.03.13 TMS CSR#: 34822 Add logic to protect frequency, start date and start time on Zosyn Piperacillin/Tazobactam orders when entered as an extended infusion ;; keywords: Called MLMs, Form fields, schedule ;; 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; comm_obj := this_communication.primaryobj; /*******************Make Changes To Spelling And Flags In This Section*******************/ /* These variables must containt he same wording as the options in the drop down list */ /***************************************************************************************/ // Initialize error message error_message:=""; // References the LOCAL SESSION object local_session := cds_session.local; standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; // Obtain common fields passed in the Form object to the Field object //commented out ones are just not being used; however left incase you need them. field_list:= this_form.fields; requested_date := last of (field_list where field_list.DataItemName = "RequestedDate" ); requested_time := last of (field_list where field_list.DataItemName = "RequestedTime" ); //stop_after:= last of (field_list where field_list.DataItemName = "StopAfter" ); //stop_after_Value := stop_after.value; //stop_date := last of (field_list where field_list.DataItemName = "StopDate" ); //stop_time := last of (field_list where field_list.DataItemName = "StopTime" ); //stop_time_value := stop_time.value ; //is_prn := last of (field_list where field_list.DataItemName = "IsPRN" ); regular_freq := last of (field_list where field_list.DataItemName = "FrequencyCode"); requested_time_value := requested_time.value; regular_freq_value := regular_freq.value; start_now := last of (field_list where field_list.DataItemName = "PRX_Dosing Start Now" ); start_now_value := start_now.value; stat_and_then := last of (field_list where field_list.DataItemName = "PRX_Dosing Stat and Then" ); stat_and_then_value := stat_and_then.value; AddlDose := last of (field_list where field_list.DataItemName = "PRX_Dosing Addl Dose" ); AddlDose_value := AddlDose.value; //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"); //FreqText := " "; //REQUESTEDTIME-BEGIN field logic. Use this section to if (this_communication.CallingFieldName = "RequestedTime") then if AddlDose_value = false then //Check to see if selected time code is STAT. If yes also verify the frequency is STAT //This forces the order to have both a frequency and start time of STAT to prevent users from //"scheduling" a STAT order which should never occur. if (requested_time_value.ReqTimeCode = "STAT") and (regular_freq_value.FrequencySummary <> "STAT") then error_msg := "You cannot enter a Start Time of STAT with a frequency of " || regular_freq_value.FrequencySummary || ". Please select the Give a STAT Dose checkbox to begin the medication immediately, or change the frequency to STAT."; this_communication.Message := error_msg; this_communication.MessageType := "Error"; requested_time_value.ReqTimeCode := ""; elseif ((requested_time_value.ReqTimeCode <> "STAT") and (regular_freq_value.FrequencySummary = "STAT")) then requested_time_value.ReqTimeCode := "STAT"; endif; //REQUESTEDTIME-END field logic. End of section. endif; endif; If ((this_communication.CallingEvent = "FormOpen") or (this_communication.CallingEvent = "Fieldchange" and this_communication.CallingFieldName = "MLM_From Order Set") or (this_communication.CallingEvent = "Fieldchange" and this_communication.CallingFieldName = "RequestedTime") ) and ((comm_obj.OrderSetName in ("Piperacillin/Tazobactam Orders", "Pneumonia Antibiotic", "IntraAbdominal Antibiotic", "Sepsis Unknown Source Antibiotic", "Skin Antibiotic Inpatient", "Urology (CPOE OS)", "Pulmonary (CPOE OS)", "CCM Admission Orders", "Piperacillin/Tazobactam Orders" ) or (comm_obj.OrderSetName matches pattern "Transition Orders%") and comm_obj.Name = "Piperacillin/Tazobactam:")) then regular_freq.Control_Read_Only := true; requested_time.Control_Read_Only := true; requested_date.Control_Read_Only := true; endif; ;; 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: