maintenance: title: code status order stop;; mlmname: FORM_prevent_dup_code_status;; arden: version 2;; version: 4.50;; institution: St Clair Hospital;; author: Deborah Eiler, Debbie.Eiler@stclair.org, 866-248-4500 ext. 1318;; specialist: Eclipsys Corporation;; date: 2006-10-19;; validation: testing;; library: purpose: If the patient has an existing code status I would like for an MLM to fire an alert to stop the order entry. If the comment type of an existing Code Status is active, fire an alert to Stop the order. ;; explanation: IMPORTANT NOTE: Each time this MLM is updated, SCH_DUP_CODE_STATUS_STOP may also need to be updated Change history 11.09.2012 DJW CSR# 26830 - Simplification of Code Status classifications. Reduced from 7 to 3 choices 07.30.2012 - DJW CSR# 30963 - Altered logic to prevent duplicate status order even if in Discharge Session 10.05.2012 - DJW CSR# 30963 - Revert to prior logic - allow duplicate status order even if in Discharge Session 12.18.2012 - DJW CSR# 31242 - Change "...Full Treatment" to "...Full Code". Remove CPR/DNR codes 01.24.2013 - DJW CSR# 31242 - Altered code again {{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}} 02.09.2016 - DJW CSR# 33949 - Change to wording of Code Status and CPR orders (D Eiler, 10-2-06): Code Status order is currently configured to display in the Patient Header as a comment. I have added duplicate checking alerts. If the user keeps the new order and discontinues the current order from the duplicate check alert, the new order will overlay what is displayed in the Patient Header. This is what we want to happen. But… if the user ignores the duplicate checking alert and proceeds with the order entry, the new code status will overlay in the Patient Header but there will be two code status orders on the order tab. If the user discontinues one of these code status orders the code status in the Patient Header is removed. This is a problem. We must be able to rely on the display of the code status in the Patient Header. I have a warning message at the onset of code status order entry but it does not stop the process. THIS MLM: - TRIGGERS ON FORMOPEN - LOOKS UP ANY ACTIVE EXISTING CODE STATUS ORDERS - PRESENTS AN ERROR MESSAGE (I.E. HARD STOP) IF EXISTTING ORDERS ARE FOUND. THIS MLM WORKS IN CONJUNCTION WITH THE ORDER-TRIGGERED MLM: SCH_dup_code_status_stop. ;; keywords: hard stop, duplicate code status; ;; knowledge: type: data-driven;; data: /***********************Make Changes To Spelling And Flags In This Section*********************/ /***********************************************************************************JAB********/ // 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; // Declare the MLM that can be called by this MLM //FORM_NUR_CodeStatus := MLM {{{SINGLE-QUOTE}}}FORM_NUR_CodeStatus{{{SINGLE-QUOTE}}}; // Call original field processing MLM // (this_communication, this_form) := call FORM_NUR_CodeStatus // with this_communication, this_form, client_info_obj; // Assigns fields passed in the Form object to the Field object field_list:= this_form.fields; CallingForm := this_form.name; CallingEvent := this_communication.CallingEvent; ItemEvent := this_communication.ItemEvent; CallingField := this_communication.CallingFieldName; // 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; worksheetInfo := call {{{SINGLE-QUOTE}}}OrderEntryBatch{{{SINGLE-QUOTE}}}.GetCurrent; if worksheetinfo.sessiontype = "Discharge" then sessiontype := "Discharge"; else sessiontype := "Other"; endif; ordername := read last {" select name from cv3ordercatalogmasteritem where guid = " || sql(this_communication.ItemID)}; ordername_substring := SUBSTRING 12 CHARACTERS STARTING AT 1 FROM ordername; if ordername_substring = "Code Status:" then dup_lookup_items := " name like {{{SINGLE-QUOTE}}}Code Status: %{{{SINGLE-QUOTE}}} "; else dup_lookup_items := " ( name in ({{{SINGLE-QUOTE}}}Code Status: Full Code{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}) or name like {{{SINGLE-QUOTE}}}cpr%{{{SINGLE-QUOTE}}} or name like {{{SINGLE-QUOTE}}}dnr%{{{SINGLE-QUOTE}}}) "; endif; // 11/07/06 - Kathy Kennedy updated to look only at the individual visit // 11/09/11 - Don Warnick added 3 "go-forward" statuses, all on the last line of the SQL (old 7 may be removed after the transition) // 02/09/16 - Don Warnick replaced this lookup with one customized by order name, separating code status from cpr order values /* ||" and name in (" ||" {{{SINGLE-QUOTE}}}Code Status: DNR/Limited Interventions{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: DNR/Comfort Measures Only (CMO){{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Code Status: Full Treatment{{{SINGLE-QUOTE}}} , {{{SINGLE-QUOTE}}}Code Status: Full Code{{{SINGLE-QUOTE}}}, " ||" {{{SINGLE-QUOTE}}}Code Status: Limited Interventions{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}Code Status: Comfort Measures Only (CMO){{{SINGLE-QUOTE}}} " ||") " */ (old_cs_lst, old_cs_summ_lst, old_status_lst, old_ln_lst, old_cs_ord_guid_lst, old_cs_ocmi_guid_lst, old_sig_t_lst) := read {" select name, summaryline, status, orderstatuslevelnum, " ||" GUID, OrderCatalogMasterItemGUID, significantdtm " ||" from cv3order " ||" where clientguid = " || sql(client_info_obj.guid) ||" and chartguid = " || sql(this_communication.chartguid) ||" and clientvisitguid = " || sql(this_communication.clientvisitguid) ||" and " || dup_lookup_items ||" and typecode like {{{SINGLE-QUOTE}}}other{{{SINGLE-QUOTE}}} " ||" and status like {{{SINGLE-QUOTE}}}active{{{SINGLE-QUOTE}}} " ||" and orderstatuslevelnum <= 50 " ||" and active = 1 " , primarytime = significandtm}; // 11/30/2011 - Don Warnick - ok to have duplicate for discharge order reconcilliation // 07/30/2012 - Don Warnick - reversed the logic....now not ok to have a duplicate // 10/05/2012 - Don Warnick - reversed the reversal...now ok to have a duplicate in discharge session // if exists old_cs_lst then if exists old_cs_lst and sessiontype <> "Discharge" then //display a message to the user this_communication.Message := "You cannot proceed with this order until the other active Code Status " || "order(s) has been discontinued!!"; this_communication.MessageType := "Error"; // if CallingEvent="FormOpen" then this_communication.DisplayForm := "NO"; // 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: