235 lines
7.8 KiB
Plaintext
235 lines
7.8 KiB
Plaintext
maintenance:
|
|
|
|
title: SCH_ALERT_ON_NITROGLYCERIN_ORDERS ;;
|
|
mlmname: SCH_ALERT_ON_NITROGLYCERIN_ORDERS;;
|
|
arden: version 2.5;;
|
|
version: 1.00;;
|
|
institution: ;;
|
|
author: Sandy Zhang ;;
|
|
specialist: Sandy Zhang ;;
|
|
date: 2017-07-28;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Generate a hard stop alert if nitroglycerin ointment or patch order exists and another is attempting to be ordered.
|
|
;;
|
|
explanation:
|
|
|
|
Change History:
|
|
2017.07.28 SZ CSR #33082 - Custom duplicate alert for nitroglycerin ointment and topical patch
|
|
;;
|
|
keywords:
|
|
;;
|
|
citations:
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
data:
|
|
|
|
//.Net libraries
|
|
standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
//Set the stop message
|
|
stop_message := false;
|
|
hard_stop := false;
|
|
|
|
//Capture current patient data
|
|
(clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName};
|
|
clientVisitGuid := read last {ClientVisit : GUID};
|
|
chartGuid := read last {ClientVisit : ChartGUID};
|
|
|
|
|
|
//Set med lists for later
|
|
(nitro_patch_meds) := ("Nitroglycerin 0.1mg/hr Patch", "Nitroglycerin 0.2mg/hr Patch", "Nitroglycerin 0.3mg/hr Patch"
|
|
, "Nitroglycerin 0.4mg/hr Patch", "Nitroglycerin 0.6mg/hr Patch");
|
|
|
|
(nitro_oint_meds) := ("Nitroglycerin 2% Oint");
|
|
|
|
|
|
|
|
/*************************** Possible Evoking Events ************************************/
|
|
|
|
// initiation of nitroglycerin ointment order
|
|
nitro_oint_event:= event{OrderInit User Order :
|
|
WHERE Name = "Nitroglycerin 2% Oint"};
|
|
|
|
// initiation of nitroglycerin patch order
|
|
nitro_patch_event := event{OrderInit User Order :
|
|
WHERE Name IN ("Nitroglycerin 0.1mg/hr Patch"
|
|
, "Nitroglycerin 0.2mg/hr Patch"
|
|
, "Nitroglycerin 0.3mg/hr Patch"
|
|
, "Nitroglycerin 0.4mg/hr Patch"
|
|
, "Nitroglycerin 0.6mg/hr Patch")};
|
|
|
|
// initiation of nitroglycerin ointment orderset
|
|
nitro_oint_orderset_event := event{OrderSetInit User OrderSet :
|
|
WHERE OrderSetName IN ("Nitroglycerin Ointment","Nitroglycerin Ointment")};
|
|
|
|
|
|
// initiation of nitroglycerin patch orderset
|
|
nitro_patch_orderset_event := event{OrderSetInit User OrderSet :
|
|
WHERE OrderSetName IN ("Nitroglycerin Patch")};
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
//Determine evoking event -
|
|
if (EvokingEvent = nitro_patch_event OR EvokingEvent = nitro_oint_event) then
|
|
|
|
(this_order_id, this_order) := read last {Order : GUID, Name Referencing EvokingObject};
|
|
else
|
|
(this_order_id, this_order) := read last {OrderSet : GUID, OrderSetName Referencing EvokingObject};
|
|
endif;
|
|
|
|
|
|
//Check for unsubmitted nitroglycerin orders
|
|
(existing_orders, origOrderSet) := READ { UnsubmittedOrders: Name, OrderSetName
|
|
WHERE Name matches pattern "Nitroglycerin 0.1mg/hr Patch%"
|
|
OR Name matches pattern "Nitroglycerin 0.2mg/hr Patch%"
|
|
OR Name matches pattern "Nitroglycerin 0.3mg/hr Patch%"
|
|
OR Name matches pattern "Nitroglycerin 0.4mg/hr Patch%"
|
|
OR Name matches pattern "Nitroglycerin 0.6mg/hr Patch%"
|
|
OR Name matches pattern "Nitroglycerin 2% Oint%"};
|
|
|
|
if (exist existing_orders) then
|
|
found_unsubmitted_order := "unbsubmitted orders were found :) ";
|
|
|
|
else
|
|
no_unsubmitted_order := "no unbsubmitted orders were found :( ";
|
|
|
|
//No unsubmitted nitroglycerin order - check for existing nitroglycerin active orders
|
|
(existing_orders,
|
|
origOrderSet) := read {"SELECT o.Name, o.OrderSetName, o.TouchedWhen"
|
|
|| " FROM CV3Order as o with (nolock) JOIN CV3OrderCatalogMasterItem AS ocmi with (nolock)"
|
|
|| " ON o.OrderCatalogMasterItemGUID = ocmi.GUID"
|
|
|| " WHERE o.ClientGUID = " || clientGuid
|
|
|| " AND o.ClientVisitGUID = " || clientVisitGuid
|
|
|| " AND o.ChartGUID = " || chartGuid
|
|
|| " AND (o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 2% Oint%{{{SINGLE-QUOTE}}}"
|
|
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.1mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
|
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.2mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
|
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.3mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
|
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.4mg/hr Patch%{{{SINGLE-QUOTE}}}"
|
|
|| " OR o.Name like {{{SINGLE-QUOTE}}}Nitroglycerin 0.6mg/hr Patch%{{{SINGLE-QUOTE}}})"
|
|
|| " AND"
|
|
|| " ((o.OrderStatusLevelNum > 15"
|
|
|| " AND o.OrderStatusLevelNum NOT IN ({{{SINGLE-QUOTE}}}69{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}70{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}100{{{SINGLE-QUOTE}}}))"
|
|
|| " OR o.OrderStatusCode = {{{SINGLE-QUOTE}}}HOLD{{{SINGLE-QUOTE}}})"
|
|
, primarytime = touchedWhen};
|
|
|
|
endif;
|
|
|
|
|
|
// if an existing order was detected
|
|
if (exist existing_orders) then
|
|
//Keep counter in case other nitroglycerin order exist that are not in conflict
|
|
i := 0;
|
|
|
|
//loop through existing, active patient orders
|
|
for orderItem in existing_orders do
|
|
i := i + 1;
|
|
|
|
// if ordering nitro ointment
|
|
if (EvokingEvent = nitro_oint_event) then
|
|
// and existing order is nitro patch then send alert
|
|
if ((orderItem in nitro_patch_meds)) then
|
|
stop_message := true;
|
|
existing_order_name := orderItem;
|
|
situation_1 := "ordering nitro ointment and existing order is nitro patch";
|
|
endif;
|
|
|
|
|
|
|
|
// if ordering nitro ointment from orderset
|
|
elseif (EvokingEvent = nitro_oint_orderset_event) then
|
|
// and existing order is nitro patch then send alert
|
|
if (orderItem in nitro_patch_meds) then
|
|
stop_message := true;
|
|
existing_order_name := orderItem;
|
|
situation_2 := "ordering nitro ointment from orderset and existing order is nitro patch ";
|
|
endif;
|
|
|
|
|
|
|
|
// if ordering nitro patch
|
|
elseif (EvokingEvent = nitro_patch_event) then
|
|
// and existing order is nitro ointment then send alert
|
|
if ((orderItem in nitro_oint_meds)) then
|
|
stop_message := true;
|
|
existing_order_name := orderItem;
|
|
situation_3 := "ordering nitro patch and existing order is nitro ointment";
|
|
endif;
|
|
|
|
|
|
|
|
// if ordering patch orderset
|
|
elseif (EvokingEvent = nitro_patch_orderset_event) then
|
|
// and existing order is nitro ointment then send alert
|
|
if ((orderItem in nitro_oint_meds)) then
|
|
stop_message := true;
|
|
existing_order_name := orderItem;
|
|
situation_4 := "ordering patch orderset and existing order is nitro ointment ";
|
|
endif;
|
|
endif;
|
|
enddo; //End loop through existing, active nitroglycerin patch/topical orders
|
|
endif; // End - if (exist existing_orders)
|
|
|
|
|
|
|
|
/************************************** Declare Alert Details ********************************/
|
|
|
|
// If stop message is true then set the alert message and fire hard stop alert
|
|
if (stop_message) then
|
|
|
|
// alert destination
|
|
order_alert_dest := destination {alert} with
|
|
[alert_type := warning,
|
|
short_message := "Nitroglycerin topical/patch Order Conflict",
|
|
priority := "High",
|
|
scope := Chart,
|
|
rule_group := "Nitroglycerin Conflict Group",
|
|
rule_number := 8050,
|
|
send_with_order := "DoNotSend",
|
|
alert_dialog_settings := "No Override Allowed",
|
|
display_alert := true];
|
|
|
|
// alert message
|
|
alert_message := "{{+B}}Avoid concurrent use of {{+R}}" || this_order || "{{-R}} and {{+R}}"
|
|
|| existing_order_name || "{{-R}}. Contact physician to adjust orders. {{-B}} ";
|
|
|
|
hard_stop := true;
|
|
|
|
endif;
|
|
|
|
/*******************************************************************************************/
|
|
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke:
|
|
|
|
nitro_patch_event;
|
|
nitro_oint_event;
|
|
nitro_patch_orderset_event;
|
|
nitro_oint_orderset_event;
|
|
|
|
;;
|
|
logic:
|
|
conclude hard_stop;
|
|
|
|
|
|
;;
|
|
action:
|
|
|
|
write alert_message at order_alert_dest;
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|