Initial Checking with all 820 MLMs
This commit is contained in:
201
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm
Normal file
201
MLMStripper/bin/Debug/SCH/SCH_ALERT_ON_FENTANYL_ORDERS.mlm
Normal file
@@ -0,0 +1,201 @@
|
||||
maintenance:
|
||||
|
||||
title: SCH_ALERT_ON_FENTANYL_ORDERS ;;
|
||||
mlmname: SCH_ALERT_ON_FENTANYL_ORDERS;;
|
||||
arden: version 2.5;;
|
||||
version: 1.00;;
|
||||
institution: St.Clair Hospital ;;
|
||||
author: Sandy Zhang ;;
|
||||
specialist: Rob Stewart ;;
|
||||
date: 2017-06-21;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
;;
|
||||
explanation:
|
||||
|
||||
Change History
|
||||
|
||||
06.19.2017 SZ CSR 35469: Fentanyl/Duragesic Patch Indication Alert
|
||||
;;
|
||||
keywords: fentanyl transdermal patch, duragesic, alert
|
||||
;;
|
||||
citations:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
|
||||
// MLM evoked on these Fentanyl order sets
|
||||
fentanyl_orderset_event := event{OrderSetInit User OrderSet :
|
||||
WHERE OrderSetName IN ("Fentanyl 125mcg Patch"
|
||||
, "Fentanyl Patch"
|
||||
, "Fentanyl Other Orders")};
|
||||
|
||||
// MLM evoked on Fentanyl Patch orders
|
||||
fentanyl_order_event := event{OrderInit User Order :
|
||||
WHERE Name matches pattern "%Fentanyl%" and Name matches pattern "%patch%" };
|
||||
|
||||
// MLM evoked on Duragesic Patch orders
|
||||
//duragesic_order_event := event{OrderInit User Order :
|
||||
// WHERE Name matches pattern "%Duragesic%" and Name matches pattern "%patch%" };
|
||||
|
||||
|
||||
|
||||
// grab relevant guids
|
||||
ClientGuid := EVOKINGOBJECT.ClientGUID;
|
||||
ChartGuid := EVOKINGOBJECT.ChartGUID;
|
||||
userguid := read last {UserInfo: GUID};
|
||||
VisitGuid := EVOKINGOBJECT.ClientVisitGUID;
|
||||
|
||||
// By default, the Fentanyl patch/duragesic alert IS displayed to user upon FormOpen of fentanyl patch/duragesic order
|
||||
// If it meets any of these 3 exceptions then the alert is not shown:
|
||||
// 1) User is a pain management or palliative care specialist
|
||||
// 2) If patient was already prescribed fentanyl patch/duragesic during this visit
|
||||
// 3) If fentanyl patch/duragesic is a home med and listed in their OMR
|
||||
|
||||
show_alert := "Yes";
|
||||
|
||||
//med_extension := EVOKINGOBJECT.MedicationExtension;
|
||||
//order_user_data := EVOKINGOBJECT.OrderUserData;
|
||||
|
||||
|
||||
/************************* exception 1 *****************************************/
|
||||
// grab the ordering provider guid
|
||||
if (EvokingEventType = "OrderInit") then
|
||||
(OrderingProviderGuid) := read last {Order: CareProviderGuid REFERENCING EvokingObject};
|
||||
endif;
|
||||
|
||||
// For ordersets, CareProviderGuid doesn{{{SINGLE-QUOTE}}}t exist so we{{{SINGLE-QUOTE}}}ll use userguid instead since that{{{SINGLE-QUOTE}}}s the best we can do
|
||||
if (EvokingEventType = "OrderSetInit") then
|
||||
(OrderingProviderGuid) := userguid;
|
||||
endif;
|
||||
|
||||
|
||||
exception_discpline := ("pain management", "palliative care", "palliative care/internal med");
|
||||
exception_physicians := ("Erlanger, Daniel B","Platto, Michael J");
|
||||
|
||||
|
||||
// SQL to get the discipline/specialty of the ordering provider
|
||||
(ordering_provider_discipline, ordering_provider_name) := read last {
|
||||
"select cp.Discipline, cp.displayname"
|
||||
||" from CV3User u"
|
||||
||" join CV3OrganizationalUnit ou on ou.GUID = u.OrgUnitGUID"
|
||||
||" join CV3CareProvider cp on cp.GUID = u.GUID"
|
||||
||" where u.Active = 1"
|
||||
||" and u.GUID = " || sql(OrderingProviderGuid)
|
||||
};
|
||||
|
||||
// if the ordering provider is a pain management or palliative care specialist then don{{{SINGLE-QUOTE}}}t show the alert
|
||||
if (ordering_provider_discipline is in exception_discpline) then
|
||||
show_alert := "No";
|
||||
discipline_bypassed := "yay the provider{{{SINGLE-QUOTE}}}s DISCIPLINE has bypassed this alert";
|
||||
endif;
|
||||
|
||||
|
||||
if (ordering_provider_name is in exception_physicians) then
|
||||
show_alert := "No";
|
||||
provider_bypassed := "yay the provider has bypassed this alert";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
/************************* exception 2 *****************************************/
|
||||
// SQL to see if patient was already ordered Fentanyl during this visit
|
||||
existing_fentanyl_order := read last {
|
||||
"select ocmi.Name"
|
||||
||" from cv3ordercatalogmasteritem ocmi with (nolock)"
|
||||
||" join cv3order o with (nolock) on o.ordercatalogmasteritemguid = ocmi.guid"
|
||||
||" where"
|
||||
||" o.clientguid = " || sql(ClientGuid)
|
||||
||" and o.chartguid = " || sql(ChartGuid)
|
||||
||" and o.clientvisitguid = " || sql(VisitGuid)
|
||||
||" and ocmi.Name like {{{SINGLE-QUOTE}}}%fentanyl%{{{SINGLE-QUOTE}}}"
|
||||
||" and ocmi.Name like {{{SINGLE-QUOTE}}}%patch%{{{SINGLE-QUOTE}}}"
|
||||
};
|
||||
|
||||
// if fentanyl patch order exists from this visit then don{{{SINGLE-QUOTE}}}t show alert
|
||||
if exist existing_fentanyl_order then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
|
||||
/************************* exception 3 *****************************************/
|
||||
// SQL to see if fentanyl patch/duragesic is a home med and already in OMR
|
||||
existing_fentanyl_omr := read last {
|
||||
"SELECT p.DrugName"
|
||||
||" FROM SXAAMBClientPrescription p with (nolock) JOIN SXAAMBDrugCategoryXRef xr with (nolock)"
|
||||
||" ON p.GenericNameID = xr.GenericNameID"
|
||||
||" JOIN SXAAMBDrugCategory dc with (nolock)"
|
||||
||" ON xr.DrugCategoryID = dc.DrugCategoryID"
|
||||
||" WHERE p.ClientGUID = " || sql(ClientGuid)
|
||||
||" and ((p.DrugName like {{{SINGLE-QUOTE}}}%fentanyl%{{{SINGLE-QUOTE}}} and p.DrugName like {{{SINGLE-QUOTE}}}%transdermal%{{{SINGLE-QUOTE}}}) "
|
||||
||" or (p.DrugName like {{{SINGLE-QUOTE}}}%duragesic%{{{SINGLE-QUOTE}}}))"
|
||||
};
|
||||
|
||||
// if fentanyl patch/duragesic is a home med and exists in OMR then don{{{SINGLE-QUOTE}}}t show alert
|
||||
if exist existing_fentanyl_omr then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
/************************* other exceptions *****************************************/
|
||||
// Don{{{SINGLE-QUOTE}}}t fire on fentanyl patch removal orders
|
||||
if (EVOKINGOBJECT.Name matches pattern "%removal%") then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
// don{{{SINGLE-QUOTE}}}t fire on fentanyl patch orders that are part of an order set
|
||||
if exists EVOKINGOBJECT.OrderSet then
|
||||
show_alert := "No";
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
// alert message content
|
||||
alert_message := "\nFentanyl Transdermal Patch (Duragesic®) is used ONLY in patients with: " ||
|
||||
"\n " ||
|
||||
"\n1) {{+B}}CHRONIC{{-B}}, severe PAIN requiring long-term, around-the-clock analgesia." ||
|
||||
"\n " ||
|
||||
"\n{{+R}}AND{{-R}}" ||
|
||||
"\n " ||
|
||||
"\n2) {{+B}}OPIOID-TOLERANCE{{-B}}:" ||
|
||||
"\ntaking AT LEAST 60 mg PO morphine OR 30 mg oxycodone OR 8 mg PO hydromorphone OR an equianalgesic-dose of another opioid for 7 DAYS OR MORE" ||
|
||||
"\n ";
|
||||
|
||||
|
||||
// alert destination
|
||||
order_alert_dest := destination {alert} with
|
||||
[alert_type := warning,
|
||||
short_message := "Fentanyl Transdermal Patch (Duragesic®)",
|
||||
priority := "High",
|
||||
scope := Chart,
|
||||
rule_group := "Fentanyl patch",
|
||||
rule_number := 8000,
|
||||
send_with_order := "DoNotSend",
|
||||
alert_dialog_settings := "Must Acknowledge",
|
||||
display_alert := true];
|
||||
|
||||
|
||||
;;
|
||||
priority: 50
|
||||
;;
|
||||
evoke: fentanyl_orderset_event;
|
||||
fentanyl_order_event;
|
||||
;;
|
||||
logic:
|
||||
|
||||
/************************* Main Rule *****************************************/
|
||||
// if no exceptions stopped the alert from showing then proceed with alert
|
||||
if (show_alert = "Yes") then
|
||||
conclude true;
|
||||
else
|
||||
conclude false;
|
||||
endif;
|
||||
;;
|
||||
action:
|
||||
write alert_message at order_alert_dest;
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user