maintenance: title: Repeat Orders -- Add Order GUID to form;; filename: FORM_ID_RepeatOrders;; arden: version 2;; version: 4.50;; institution: Eclipsys;; author: Sharon Kelly;; specialist: Robert Spence;; date: 2007-05-01;; validation: testing;; library: purpose: This MLM is being used as a way to suppress the transmission of orders from SCM to the St. Claire ancillary Deficiency System if an order is a repeating order and not the first of the set of repeating orders. St. Claire wants only the first of a set of repeating orders to be sent to the deficiency system. This MLM fires on FormClose when a user is entering or modifying an order. It distinguishes between whether the order which is the context of the MLM is the master of a repeat order or a non-repeat order by checking the control_read_only property of the RequestedTime field on the order form. That control is set by the system to be TRUE if the order is a repeat order; otherwise it will be FALSE on FormClose. This MLM will check the value of the control_read_only of RequestedTime. If it is TRUE, this MLM will populate the hidden field on the form with the OrderGUID of the current order (which is the master repeat order). That value will be propagated to all the children -- the repeat instances generated from the master. An interface process will read the hidden field transmitted in the HL7 message -- if the field is present and populated, the interface will use the master order GUID stored in the message to determine whether or not this is the initial repeat or a subsequent one. ;; explanation: This MLM is called on FormClose of any order using the form to which this MLM is attached. The intention is to "mark" repeating orders. When the initial order of a repeating group of orders is entered. It populates a hidden TEST_RepeatOrderID field with the OrderGUID of the Primary Object (the order being entered). No message is sent displayed to the user. The order form must be configured with the TEST_RepeatOrderID field and this MLM must be triggered by FormClose. change history 05.03 RS Changed fields on GUID per interface Attached MLM to LAB Chemistry form{{{SINGLE-QUOTE}}}s on close 01.28.2008 DW Added logic to end the MLM if the MLM_Form_Update_Flag is on the form and is unchecked (will check the field to indicate open for modification) 02.25.2009 DW Revised the 01.28.2009 logic to bypass the edits if the form is accessd by a physician 12.03.2015 JML Removed "test" code that was never moved to PRD that was causing the order to not create. 04.04.2016 STH CSR#: 32165 - Update MLM to call GMS developed MLM that was created to update a field as not required if the conditional order check box is selected. {GO Live targeted for 4/27/2016} ;; keywords: Called MLMs, Form fields, PRN ;; 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; /*******************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:=""; call_conditional_mlm_logic := mlm {{{SINGLE-QUOTE}}}Form_Lab_ConditionalOrder_PriorityTime{{{SINGLE-QUOTE}}}; // Assigns fields passed in the Form object to the Field object and the name of the form field_list:= this_form.fields; CallingField :=this_communication.CallingFieldName; CallingEvent := this_communication.CallingEvent; FormType := this_communication.FormType; form_name := this_form.Name; /*-------------------------------------------*/ /* Retrieve info from other argument objects */ /*-------------------------------------------*/ //Capture the Ordering Method (Item Event), the OrderGUID, and the OrderCatalogMasterItemGUID Order_Method := this_communication.ItemEvent; // Could be UserEnter, UserModify, UserEditUnsubmitted, SystemEnter, or SystemModify. Order_GUID := this_communication.PrimaryObj.GUID; Order_GUID_string := Order_GUID AS String; RepeatOrderID_field := first of (field_list where field_list.DataItemName = "REPEAT_ORDER_GUID"); // RepeatOrderMarker_field := first of (field_list where field_list.DataItemName = "REPEAT_ORDER_MARKER"); RequestedTime_field := first of (field_list where field_list.DataItemName = "RequestedTime"); Time_Val:= RequestedTime_Field.Value; Time_Code := Time_Val.ReqTimeCode; // If this is a Repeat order (which it is if the RequestedTime field has been set to ReadOnly), populate // the hidden field with the OrderGUID of this order (which is the master order). If it is not a repeat order (either configured // as Not Repeatable or user did n{{{SINGLE-QUOTE}}}t select a repeat option on a repeatable order), do nothing (leave hidden field NULL) // Order_Method: "UserEntry", "UserModify" , "UserEditUnsubmitted", "SystemEnter", "SystemModify" // Change per 08/14/2007 problems If repeat order is already valued, do nothing. If (Time_Code Is Null) Then if RequestedTime_field.control_read_only = true then RepeatOrderID_field.Value := Order_GUID_string; endif; endif; /**** FOR DEBUGGING PURPOSES -- Commented out for Production **************** this_communication.DisplayForm := "Yes"; // FOR DEBUGGING PURPOSES: display a message to the user this_communication.Message := "Form Name = "|| form_name || "\nCallingEvent = " || Order_method || "\nOrder GUID = " || Order_GUID_string || "\nTime UOM= " || Time_Code; this_communication.MessageType := "Informational"; ******************************************************************************************/ (this_communication, this_form) := call call_conditional_mlm_logic with (this_communication, this_form,client_info_obj); ;; 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: