222 lines
11 KiB
Plaintext
222 lines
11 KiB
Plaintext
maintenance:
|
|
|
|
title: Duplicate Code Status Hard Stop;;
|
|
mlmname: SCH_dup_code_status_stop;;
|
|
arden: version 2;;
|
|
version: 4.50;;
|
|
institution: St Clair Hospital;;
|
|
author: Deborah Eiler, Debbie.Eiler@stclair.org, 866-248-4500 ext. 1318, Robert Spence Ext 1034;;
|
|
specialist: Eclipsys Corporation;;
|
|
date: 2006-12-07;;
|
|
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, FORM_PREVENT_DUP_CODE_STATUS 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
|
|
09.27.2017 - JML CSR# 26413 - Modified evoking event to not fire on "Code Status: Ethically unable to determine" order
|
|
|
|
(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 CODE STATUS ORDER INITIALIZATION
|
|
- LOOKS UP ANY ACTIVE EXISTING or UNSUBMITTED CODE STATUS ORDERS
|
|
- IF EXISTING ORDER THEN PRESENTS THEM TO THE USER FOR DC{{{SINGLE-QUOTE}}}ING.
|
|
- IF UNSUBMITTED ORDERS THEN PRESENTS A HARD STOP
|
|
|
|
IT DOES NOT CREATE A "HARD STOP". THAT IS DONE BY ANOTHER MLM ATTACHED TO THE
|
|
FORM: FORM_RS_prevent_dup_code_status.MLM.
|
|
|
|
|
|
|
|
;;
|
|
keywords: action on alerts, duplicate code status;
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
/******************Make Changes To Spelling And Flags In This Section******************/
|
|
|
|
//Triggering event: duplicate order
|
|
|
|
// 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;
|
|
/*
|
|
code_status_order := event{orderInit user order:
|
|
where typecode = "other"
|
|
and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
|
|
"Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)")};
|
|
|
|
code_status_order_enter := event{orderEnter user order:
|
|
where typecode = "other"
|
|
and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
|
|
"Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)")
|
|
};
|
|
*/
|
|
code_status_order := event{orderInit user order: where typecode = "other" and ( ( Name matches pattern "Code Status: %" or Name matches pattern "CPR%" or Name matches pattern "DNR%" ) AND Name <> "Code Status: Ethically unable to determine" ) };
|
|
code_status_order_enter := event{orderEnter user order: where typecode = "other" and ( ( Name matches pattern "Code Status: %" or Name matches pattern "CPR%" or Name matches pattern "DNR%" ) AND Name <> "Code Status: Ethically unable to determine" ) };
|
|
|
|
|
|
//Popup destination with ACTIONS ON ALERTS:
|
|
dup_existing_alert := destination{alert: reminder, "Duplicate Active Code Status!", high, chart, "Code Status Rule Group", 1};
|
|
|
|
//Popup destination with HARD STOP:
|
|
dup_unsubmitted_alert := destination{alert: reminder, "Duplicate Active Code Status!", high, chart, "Code Status Rule Group", 1, "", "No Override Allowed"};
|
|
|
|
//Message to display to the user:
|
|
dup_existing_msg := "{{+B}}{{+R}}Sorry, but you cannot proceed while there is an existing active code status order.{{-R}}{{-B}}{{+C}}\n\n"
|
|
|| "Please click the {{+B}}{{+U}}View Actions...{{-U}}{{-B}} button below, then dc the earlier Code Status order(s) or cancel this order, altogether." ;
|
|
|
|
dup_unsubmitted_msg := "{{+B}}{{+R}}Sorry, but only one patient code status order is permitted.{{-R}}{{-B}}{{+C}}\n\n"
|
|
|| "You have already added a code staus order in this Order Entry Session. Please remove the Code Status order you already entered or do not add this order." ;
|
|
|
|
|
|
/***************************************************************************JAB********/
|
|
|
|
// Declare the MLM that can be called by this MLM
|
|
create_aa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
|
|
|
|
if called_by_editor then
|
|
evokingobject := read last {order:this where typecode = "other" and name = "code status:"};
|
|
endif;
|
|
|
|
// Get the Client GUID and Evoking Object parameters:
|
|
(client_guid, chart_guid, visit_guid, evoking_order_name, evoking_order_guid, evoking_order_catalog_master_item_guid, evoking_significant_dtm )
|
|
:= read last { Order: clientguid, chartguid, clientvisitguid, Name, GUID, OrderCatalogMasterItemGUID, SignificantDtm REFERENCING EvokingObject };
|
|
|
|
|
|
ordername_substring := SUBSTRING 12 CHARACTERS STARTING AT 1 FROM evoking_order_name;
|
|
|
|
/*
|
|
// find unsubmitted code status orders rom this Order Entry Session
|
|
(unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
|
|
{UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid)
|
|
and name in ("Code Status: DNR/Limited Interventions" , "Code Status: DNR/Comfort Measures Only (CMO)", "Code Status: Full Treatment" , "Code Status: Full Code",
|
|
"Code Status: Limited Interventions", "Code Status: Comfort Measures Only (CMO)"
|
|
)};
|
|
*/
|
|
|
|
|
|
if ordername_substring = "Code Status:"
|
|
|
|
then
|
|
|
|
dup_lookup_items := " name like {{{SINGLE-QUOTE}}}Code Status: %{{{SINGLE-QUOTE}}} ";
|
|
|
|
// find unsubmitted code status orders rom this Order Entry Session
|
|
(unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
|
|
{UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid) and name matches pattern "Code Status: %" };
|
|
|
|
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}}} )";
|
|
|
|
// find unsubmitted code status orders rom this Order Entry Session
|
|
(unsub_name_list, unsub_guid_list, unsub_ocmi_guid_list ) := READ
|
|
{UnsubmittedOrders: Name, GUID, OrderCatalogMasterItemGUID WHERE TypeCode = "Other" AND (ClientGUID = client_guid) and (name matches pattern "CPR%" or name matches pattern "DNR%") };
|
|
|
|
endif;
|
|
|
|
// if found unsubmitted orders
|
|
if exist unsub_name_list then
|
|
found_unsubmitted_orders := true;
|
|
// if no unsubmitted orders then lets check database for existing orders
|
|
else
|
|
// check for existing active code status orders for the patient for this visit
|
|
(old_cs_lst, old_cs_ord_guid_lst, old_cs_ocmi_guid_lst ) := read
|
|
{" select name, GUID, OrderCatalogMasterItemGUID"
|
|
||" from cv3order "
|
|
||" where clientguid = " || sql(client_guid)
|
|
||" and chartguid = " || sql(chart_guid)
|
|
||" and clientvisitguid = " || sql(visit_guid)
|
|
||" and ( name <> {{{SINGLE-QUOTE}}}Code Status: Ethically unable to determine{{{SINGLE-QUOTE}}} 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};
|
|
|
|
// Create actionable object list and populate with old code status orders:
|
|
if exist old_cs_lst then
|
|
found_existing_orders := true;
|
|
aa_lst := ();
|
|
|
|
for i in 1 seqto count old_cs_lst do
|
|
|
|
//Create an AlertAction Object
|
|
alert_action := call create_aa_object with "CV3Order", "CV3Order";
|
|
|
|
// Set values for AlertAction Object
|
|
alert_action.EvokingEnterpriseItemID := evoking_order_catalog_master_item_guid;
|
|
alert_action.EvokingObjectID := evoking_order_guid;
|
|
alert_action.EvokingObjectName := evoking_order_name;
|
|
alert_action.ActionItemStatus := "Existing";
|
|
alert_action.ActionEvent := "DC-Cancel";
|
|
alert_action.ActionItemID := old_cs_ord_guid_lst[i];
|
|
alert_action.ActionItemName := old_cs_lst[i];
|
|
alert_action.ActionEnterpriseItemID := old_cs_ocmi_guid_lst[i] ;
|
|
alert_action.MLMName := "SCH_dup_code_status_stop";
|
|
alert_action.ShortMessage := "This is the EXISTING Code status Order to DC-Cancel";
|
|
|
|
aa_lst := aa_lst, alert_action;
|
|
|
|
enddo; //i in 1 seqto count old_cs_lst
|
|
|
|
endif; // exist old_cs_lst
|
|
|
|
endif; // if found unsubmitted
|
|
|
|
|
|
;;
|
|
evoke:
|
|
code_status_order or code_status_order_enter ;
|
|
;;
|
|
logic:
|
|
|
|
// 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 found_existing_orders or found_unsubmitted_orders then
|
|
if (found_existing_orders or found_unsubmitted_orders) and sessiontype <> "Discharge" then
|
|
|
|
conclude true;
|
|
endif;
|
|
;;
|
|
action:
|
|
if found_existing_orders then
|
|
write dup_existing_msg at dup_existing_alert;
|
|
attach aa_lst to dup_existing_alert;
|
|
elseif found_unsubmitted_orders then
|
|
write dup_unsubmitted_msg at dup_unsubmitted_alert;
|
|
endif;
|
|
;;
|
|
Urgency: 99;;
|
|
end:
|