653 lines
29 KiB
Plaintext
653 lines
29 KiB
Plaintext
maintenance:
|
|
|
|
title: Dosing alerts for out of range lab values;;
|
|
mlmname: SCH_Drug_Lab_Alerts;;
|
|
arden: version 2;;
|
|
version: 5.50;;
|
|
institution: St Clair;;
|
|
author: Teresa Spicuzza, Allscripts Corp;;
|
|
specialist: Teresa Spicuzza;;
|
|
date: 2012-07-02;;
|
|
validation: testing;;
|
|
|
|
library:
|
|
purpose: Renal Dosing Recommendations
|
|
;;
|
|
|
|
explanation: MLM will read table and provide dosing alerts based upon medication and specific lab values.
|
|
|
|
Change history
|
|
06.06.2013 TMS Created for CSR 31334
|
|
06.25.2014 TMS Modify retrieval of class type to correct issue with mlm not always firing.
|
|
06.09.2015 TMS Added rules E, F, G, and H as well as retrievals for Argatroban
|
|
and potassium medications, active and unsubmitted. CSR 33467
|
|
06.03.2016 TMS Added drug levels for Valproic Acid, Phenytoin, and Carbamazepine. CSR 34690
|
|
04.18.2017 TMS added exclusion for Hi CPK with Statin Drugs if patient has diagnosis
|
|
of STEMI or NSTEM for this visit CSR 34043
|
|
05.08.2017 TMS Updated with additional rules for potassium and products containing
|
|
trimethoprim. CSR 35636
|
|
09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
|
|
group. CSR 37977
|
|
|
|
;;
|
|
keywords: Drug Lab Dosing
|
|
|
|
;;
|
|
knowledge:
|
|
type: data-driven;;
|
|
|
|
data:
|
|
|
|
// Specify which .NET assemblies need to be loaded for ObjectsPlus
|
|
standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}};
|
|
include standard_libs;
|
|
|
|
error_occurred := false;
|
|
error_message := "";
|
|
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
|
log_execution_info := false;
|
|
|
|
//Set the text for this variable to indicate whether to send the message or not
|
|
send_alert := "DoNotSend";
|
|
|
|
//--------------------------------------------------------------------
|
|
if called_by_editor
|
|
then
|
|
EvokingObject := read last {Order: THIS
|
|
where Name="Loratadine 10mg Tab" };
|
|
endif;
|
|
SP := " ";
|
|
CR := 13 formatted with "%c";
|
|
LF := 10 formatted with "%c";
|
|
CRLF:= CR||LF;
|
|
TAB := 9 formatted with "%c";
|
|
messageA := SP;
|
|
messageB := SP;
|
|
messageC := SP;
|
|
doalert := false;
|
|
order_enter_event := event { OrderEnter User Order: where TypeCode = "Medication"};
|
|
|
|
(CatalogItemObj, FrequencyValue, UOMValue, DoseValue, OrderName, OrderRoute, AdminIns,
|
|
UserSchedType ,UserSchedDays, UserSchedDoses, PRN, OrderSummaryLine, OrdComponentObj, OrderGuid) := read last {Order: OrderCatalogMasterItem, FrequencyCode,
|
|
UOM, DosageLow, Name, OrderRouteCode, AdminInstructions, Interval, DaysInInterval, DoseMultiplier, IsPRN, SummaryLine, OrderComponent, Guid
|
|
REFERENCING EvokingObject};
|
|
ClassTypeGuid := read last
|
|
{ " select guid from CV3ClassType where Code = {{{SINGLE-QUOTE}}}PRX_DrugLabAlerts{{{SINGLE-QUOTE}}}" };
|
|
|
|
ClassValue := read last { " select value from CV3CatalogClassTypeValue "
|
|
|| " where CatalogMasterGuid = " || SQL (CatalogItemObj.GUID) || " and classtypeguid = " || SQL (classtypeguid) };
|
|
|
|
|
|
xComponentCatalogGuidList := read {OrderComponent: OrderCatalogMasterItemGUID
|
|
REFERENCING OrdComponentObj};
|
|
ComponentCatalogGuidList := (999);
|
|
for i in 1 seqto count xComponentCatalogGuidList do
|
|
ComponentCatalogGuidList := ComponentCatalogGuidList ||"," || xComponentCatalogGuidList [i];
|
|
enddo;
|
|
|
|
If count (ComponentCatalogGuidList) > 0 then
|
|
|
|
CompClassValue := read last
|
|
{ " Select ctv.value from CV3CatalogClassTypeValue ctv "
|
|
|| " join CV3OrderCatalogMasterItem ocmi on ocmi.GUID = ctv.CatalogMasterGUID "
|
|
|| " where ctv.ClassTypeGUID = " || SQL(ClassTypeGuid) || " and ocmi.Guid in (" || ComponentCatalogGuidList ||")" };
|
|
|
|
endif;
|
|
|
|
If classvalue is null and compclassvalue is null then
|
|
continue := "no";
|
|
else
|
|
continue := "yes";
|
|
endif;
|
|
|
|
if continue = "yes" then
|
|
/* Get the OrderAdditionalInfo object pointer */
|
|
OrderAdditionalInfoObj := read last { Order: OrderAdditionalInfo
|
|
REFERENCING EvokingObject };
|
|
|
|
/* Get information from the OrderAdditionalInfo object */
|
|
(SummaryLine, FreqfromTime,FreqUOM ) := read last { OrderAdditionalInfo: FreqSummaryLine ,FreqFromTime, FreqUOM
|
|
REFERENCING OrderAdditionalInfoObj };
|
|
|
|
|
|
|
|
fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
|
|
fire_on_User := ("RN","RPh");
|
|
|
|
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
|
|
(user_id,userguid) :=read last {UserInfo: idcode, guid};
|
|
|
|
UserCode := read last
|
|
{"Select occupationcode "
|
|
||" From cv3user with (nolock) "
|
|
||" Where Guid = " || SQL(userguid) };
|
|
|
|
If usercode in fire_on_UserCPOE then
|
|
alert_settings := "";
|
|
UDDD_dictionary_name := "";
|
|
UDDD_is_restricted := FALSE;
|
|
continue_processing := true;
|
|
elseif usercode in fire_on_User then
|
|
alert_settings := "Must Comment";
|
|
UDDD_dictionary_name := "AlertAckComment";
|
|
UDDD_is_restricted := TRUE;
|
|
continue_processing := true;
|
|
else continue_processing := false;
|
|
endif;
|
|
|
|
dose_alert_dest := destination {alert} with
|
|
[alert_type := "Warning",
|
|
short_message := "Dosing Recommendation",
|
|
priority := "Low",
|
|
scope := "Chart",
|
|
rule_group := "Adjust Dosing",
|
|
rule_number := 4052,
|
|
send_with_order := send_alert,
|
|
alert_dialog_settings := alert_settings,
|
|
ack_comment_UDDD := UDDD_dictionary_name,
|
|
ack_comment_UDDD_is_restricted := UDDD_is_restricted,
|
|
display_alert := true];
|
|
|
|
|
|
|
|
(ClientVisitGuid, ChartGuid, ClientGuid, CurrentLocation, LocationGuid, VisitStatus, AdmitDtm) := read last {ClientVisit: GUID, ChartGUID, ClientGUID, CurrentLocation, CurrentLocationGUID, VisitStatus, AdmitDtm };
|
|
(UserGUID ) := read last { UserInfo: GUID };
|
|
|
|
//Check for existence of STEMI or NSTEMI health issue for this visit
|
|
Stemi_Nstemi := READ LAST {"SELECT 1 "
|
|
|| " FROM CV3HealthIssueDeclaration hid WITH (NOLOCK) JOIN CV3CodedHealthIssue chi WITH (NOLOCK)"
|
|
|| " ON hid.CodedHealthIssueGUID = chi.GUID"
|
|
|| " WHERE hid.ClientGUID = " || SQL(ClientGUID)
|
|
|| " AND hid.ClientVisitGUID = " || SQL(ClientVisitGuid)
|
|
|| " AND hid.ChartGUID = " || SQL(ChartGUID)
|
|
|| " AND hid.Active = 1"
|
|
|| " AND hid.Status = {{{SINGLE-QUOTE}}}Active{{{SINGLE-QUOTE}}}"
|
|
|| " AND hid.TypeCode = {{{SINGLE-QUOTE}}}Problem-Visit{{{SINGLE-QUOTE}}}"
|
|
|| " AND ( ( chi.Description LIKE {{{SINGLE-QUOTE}}}%STEMI%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%STEMI%{{{SINGLE-QUOTE}}} ) "
|
|
|| " OR ( chi.Description LIKE {{{SINGLE-QUOTE}}}%NSTEMI%{{{SINGLE-QUOTE}}} OR chi.ShortName LIKE {{{SINGLE-QUOTE}}}%NSTEMI%{{{SINGLE-QUOTE}}} ) )" };
|
|
|
|
|
|
KName, KValue, KUom, KDone, KAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Potassium Plasma/Serum{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
If (KValue as number) >= 5.0 or KAbn = "HH" then Hi_K := true; else Hi_K := false; endif;
|
|
If (KValue as number) > 4.5 and (KValue as number) < 5.0 then Mid_K := true; else Mid_K := false; endif;
|
|
If (KValue as number) < 3.5 or KAbn = "LL" then Lo_K := true; else Lo_K := false; endif;
|
|
|
|
NaName, NaValue, NaUom, NaDone, NaAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Sodium Plasma/Serum{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
If (NaValue as number) < 133.0 or NaAbn = "LL" then Lo_Na := true; else Lo_Na := false; endif;
|
|
|
|
AstName, AstValue, AstUom, AstDone := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}AST/SGOT{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
If (ASTValue as number) > 150 or ASTValue = ">150.0" then Hi_AST := true; else Hi_AST := false; endif;
|
|
|
|
AltName, AltValue, AltUom, AltDone := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}ALT/SGPT{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
|
|
If (ALTValue as number) > 150 then Hi_ALT := true; else Hi_ALT := false; endif;
|
|
|
|
|
|
PhenytoinName, PhenytoinValue, PhenytoinUom, PhenytoinDone, PhenytoinAbn:= read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Dilantin Serum (Phenytoin){{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
|
|
If (PhenytoinValue as number) > 20 or PhenytoinAbn = "HH" then Hi_Phenytoin := true; else Hi_Phenytoin := false; endif;
|
|
|
|
CarbamazepineName, CarbamazepineValue, CarbamazepineUom, CarbamazepineDone, CarbamazepineAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Carbamazepine Serum (Tegretol){{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
|
|
If (CarbamazepineValue as number) > 15 or CarbamazepineAbn = "HH" then Hi_Carbamazepine := true; else Hi_Carbamazepine := false; endif;
|
|
|
|
ValproicName, ValproicValue, ValproicUom, ValproicDone, ValproicAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= " || SQL(AdmitDtm)
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Valproic Acid Plasma (Depakote Plasma){{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
|
|
If (ValproicValue as number) > 125 or ValproicValue = ">150.0" then Hi_Valproic := true; else Hi_Valproic := false; endif;
|
|
|
|
|
|
DigName, DigValue, DigUom, DigDone, DigAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}Digoxin Plasma/Serum{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
If (DigValue as number) > 2.2 or DigAbn = "HH" then Hi_Dig := true; else Hi_Dig := false; endif;
|
|
Digibind_Addendum := "**NOTE** Digibind can falsely elevate serum digoxin levels for several days or even longer in patients with renal dysfunction. "
|
|
|| "If your patient has recently received digibind, digoxin levels cannot be reliably interpreted.";
|
|
|
|
CPKName, CPKValue, CPKUom, CPKDone, CPKAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, bo.UnitOfMeasure, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}CPK Total{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
If CPKAbn = "H" or CPKABn = "HH" then Hi_CPK := true; else Hi_CPK := false; endif;
|
|
|
|
|
|
INRName, INRValue, INRDone, INRAbn := read last
|
|
{"Select top 1 bo.ItemName, bo.value, o.performeddtm, bo.AbnormalityCode "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " join cv3basicobservation as bo with (nolock) "
|
|
|| " on o.clientguid = bo.clientguid "
|
|
|| " and o.chartguid = bo.chartguid "
|
|
|| " and o.guid = bo.orderguid "
|
|
|| " and bo.status = {{{SINGLE-QUOTE}}}F{{{SINGLE-QUOTE}}} "
|
|
|| " and bo.Active = 1 "
|
|
|| " And bo.IsHistory = 0 "
|
|
|| " join cv3ordercatalogmasteritem as ocmi with (nolock) "
|
|
|| " on ocmi.guid = o.ordercatalogmasteritemguid "
|
|
|| " and ocmi.active = 1 "
|
|
|| " where o.clientguid = " || SQL(ClientGuid)
|
|
|| " and o.performeddtm >= (DATEADD(hour, -336, getdate())) "
|
|
|| " and bo.itemname = {{{SINGLE-QUOTE}}}INR{{{SINGLE-QUOTE}}} "
|
|
|| " order by o.performeddtm desc "
|
|
};
|
|
If (INRValue as number) >= 3.3 or INRAbn = "HH" then Hi_INR := true; else Hi_INR := false; endif;
|
|
|
|
|
|
If (Hi_ALT = true) or (Hi_AST = true) or (Hi_K = true) or (Mid_K = true) or (Lo_K = true) or (Lo_Na = true) or (Hi_Dig = true)
|
|
or (Hi_INR = true) or (Hi_CPK = true) or (Hi_Phenytoin = true) or (Hi_Carbamazepine = true) or (Hi_Valproic = true) then
|
|
|
|
continue := "Yes";
|
|
|
|
else continue := "No";
|
|
endif;
|
|
|
|
|
|
KSupplement := read last
|
|
{"Select top 1 o.name "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " where (o.name like {{{SINGLE-QUOTE}}}%Potassium Chloride%{{{SINGLE-QUOTE}}} "
|
|
|| " or o.name = {{{SINGLE-QUOTE}}}Phosphorous Supplement 1.25gm Packet{{{SINGLE-QUOTE}}} "
|
|
|| " or o.name like {{{SINGLE-QUOTE}}}%Potassium Phosphate%{{{SINGLE-QUOTE}}}) "
|
|
|| " and ClientGUID = " || SQL(ClientGuid)
|
|
|| " and ClientVisitGUID= " || SQL(ClientVisitGuid)
|
|
|| " and OrderStatusLevelNum > 15 "
|
|
|| " and OrderStatusLevelNum not in (69, 70) "
|
|
};
|
|
Argatroban := read last
|
|
{"Select top 1 o.name "
|
|
|| " From cv3order as o with (nolock) "
|
|
|| " where o.name like {{{SINGLE-QUOTE}}}%Argatroban%{{{SINGLE-QUOTE}}} "
|
|
|| " and ClientGUID = " || SQL(ClientGuid)
|
|
|| " and ClientVisitGUID= " || SQL(ClientVisitGuid)
|
|
|| " and OrderStatusLevelNum > 15 "
|
|
|| " and OrderStatusLevelNum not in (69, 70) "
|
|
};
|
|
|
|
(unsubmitted_KCL) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%potassium chloride%"};
|
|
(unsubmitted_KCL_IV) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "% KCl %"};
|
|
(unsubmitted_KPhos) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Phosphorous Supplement 1.25gm Packet%"};
|
|
(unsubmitted_KPhos_IV) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Potassium Phosphate%"};
|
|
(unsubmitted_Argatroban) := READ {UnsubmittedOrders: Name WHERE Name MATCHES PATTERN "%Argatroban %"};
|
|
KCL_Ordered := count (unsubmitted_KCL) + count (unsubmitted_KCL_IV) + count (unsubmitted_KPhos) + count (unsubmitted_KPhos_IV);
|
|
Argatroban_Ordered := count (unsubmitted_Argatroban);
|
|
|
|
If ((KCL_Ordered as number) > 0 ) or (KSupplement is not null) then
|
|
|
|
Pt_on_KCL := "yes";
|
|
else
|
|
Pt_on_KCL := "no";
|
|
endif;
|
|
|
|
If ((Argatroban_Ordered as number) > 0 ) or (Argatroban is not null) then
|
|
|
|
Pt_On_Argatroban := "yes";
|
|
else
|
|
Pt_on_Argatroban := "no";
|
|
endif;
|
|
else continue := "No";
|
|
endif;
|
|
|
|
if continue = "yes" then
|
|
|
|
alert_message := "";
|
|
medlist := ();
|
|
medlist := read { "select value from cv3userdictionaryvalue v with (nolock)"
|
|
|| " where userdictionarycode = {{{SINGLE-QUOTE}}}PRX_DrugLabAlerts{{{SINGLE-QUOTE}}} "
|
|
|| " and active = {{{SINGLE-QUOTE}}}1{{{SINGLE-QUOTE}}} "
|
|
};
|
|
|
|
|
|
|
|
NumRules:= count medlist;
|
|
for k in (1 seqto (NumRules)) do
|
|
rules := call str_parse with medlist[k],"|";
|
|
|
|
RuleClass := rules[1];
|
|
RuleType := rules[2];
|
|
RuleTestName := rules[3];
|
|
RuleParam := rules[4];
|
|
RuleLabValue := rules[5];
|
|
RuleLabUom := rules[6];
|
|
RuleMsg := rules[7];
|
|
|
|
|
|
|
|
|
|
If (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "A" and Lo_Na = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||NaName ||" on " || NaDone || " is " || NaValue || SP || NaUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "B" and Hi_K = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "C" and (Hi_AST = true or Hi_ALT = true) and Stemi_NStemi is null then
|
|
|
|
If Hi_AST = true and Hi_ALT = false then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
elseif Hi_AST = false and Hi_ALT = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
elseif Hi_AST = true and Hi_ALT = true then
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
|
|| " and " || AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
|
|
|
|
else
|
|
alert_message := " ";
|
|
endif;
|
|
|
|
doalert := true;
|
|
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "D" and (Hi_AST = true or Hi_ALT = true) then
|
|
|
|
If Hi_AST = true and Hi_ALT = false then
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
elseif Hi_AST = false and Hi_ALT = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
elseif Hi_AST = true and Hi_ALT = true then
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||AltName ||" on " || AltDone || " is " || AltValue || SP || AltUom
|
|
|| " and " || AstName ||" on " || AstDone || " is " || AstValue || SP || AstUom
|
|
|| " \n Ordered: {{+R}}"||RuleClass || " " || DoseValue || UomValue|| ", " || FrequencyValue
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
else
|
|
alert_message := " ";
|
|
endif;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "E" and Lo_K = true and Pt_on_KCL = "no" then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "F" and Hi_CPK = true and Stemi_NStemi is null then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||CPKName ||" on " || CPKDone || " is " || CPKValue || SP || CPKUom
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "G" and Hi_Dig = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||DigName ||" on " || DigDone || " is " || DigValue || SP || DigUom
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" || CRLF || Digibind_Addendum ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "H" and Hi_INR = true and Pt_On_Argatroban = "no" then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||INRName ||" on " || INRDone || " is " || INRValue || SP
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "I" and Hi_Phenytoin = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||PhenytoinName ||" on " || PhenytoinDone || " is " || PhenytoinValue || SP || PhenytoinUOM
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || PhenytoinName || " " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "J" and Hi_Carbamazepine = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||CarbamazepineName ||" on " || CarbamazepineDone || " is " || CarbamazepineValue || SP || CarbamazepineUOM
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || CarbamazepineName || " " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "K" and Hi_Valproic = true then
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||ValproicName ||" on " || ValproicDone || " is " || ValproicValue || SP || ValproicUOM
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || ValproicName || " " || Rulemsg || "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
elseif (RuleClass = classvalue or RuleClass = CompClassValue) and ruletype = "L" and Mid_K = true then
|
|
If classvalue = "Trimethoprim" or classvalue = "Sulfamethoxazole/trimethoprim" then AddtoMsg := "Consider alternative antibiotic therapy OR use with caution and monitor potassium levels closely "
|
|
|| "ESPECIALLY if the patient is also ordered other medications that increase potassium levels such as an ACEI, ARB, spironolactone, or potassium supplements.";
|
|
else AddtoMsg := " ";
|
|
endif;
|
|
|
|
alert_message := alert_message || CRLF || CRLF || "{{+B}} This patient{{{SINGLE-QUOTE}}}s last " ||KName ||" on " || KDone || " is " || KValue || SP || KUom
|
|
|| " \n Ordered: {{+R}}"||OrderName|| " " || FrequencyValue || ", "
|
|
|| "\n\n " || Rulemsg ||" "||AddtoMsg|| "{{-R}} {{-B}}" ;
|
|
|
|
doalert := true;
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
nomessage := "";
|
|
endif;
|
|
|
|
|
|
enddo;
|
|
|
|
|
|
|
|
endif;
|
|
|
|
|
|
;;
|
|
priority: 50
|
|
;;
|
|
evoke: order_enter_event;
|
|
|
|
;;
|
|
logic:
|
|
|
|
if called_by_editor
|
|
then
|
|
conclude false;
|
|
endif;
|
|
|
|
//----------------------------------------------------------------
|
|
// If there is no evoking object then do nothing, this can
|
|
// only be true for the MLM Editor
|
|
//----------------------------------------------------------------
|
|
if EvokingObject is null
|
|
then
|
|
conclude false;
|
|
endif;
|
|
if continue = "no"
|
|
then
|
|
conclude false;
|
|
endif;
|
|
|
|
|
|
conclude doalert;
|
|
|
|
;;
|
|
action:
|
|
|
|
write alert_message at dose_alert_dest
|
|
;;
|
|
Urgency: 50;;
|
|
end:
|