Initial Checking with all 820 MLMs

This commit is contained in:
2020-02-02 00:54:01 -05:00
parent c59dc6de2e
commit 840d0432f4
828 changed files with 239162 additions and 0 deletions

View File

@@ -0,0 +1,620 @@
maintenance:
title: SCH_STATIN_MEDICATION_ALERTS;;
mlmname: SCH_STATIN_MEDICATION_ALERTS;;
arden: version 2.5;;
version: 6.10;;
institution: St Clair;;
author: Juliet M. Johns, Allscripts Corp;;
specialist: Juliet M. Johns;;
date: 2015-03-09;;
validation: testing;;
library:
purpose: Statin Medication Alerts
;;
explanation: MLM will read user dictionary table and display alerts based on statin medication conflicts.
Change history
03.09.2015 JML CSR 33124: Created.
12.10.2015 JML Moved to Production.
09.30.2019 TMS Updated alert to require reason when alert presented to user not in physician/physician extender
group. CSR 37977
;;
keywords: Statin Medication Alert
;;
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="Amlodipine 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;
ordered_statin := false;
rule_matches := false;
do_alert := false;
found_unsubmitted_meds := false;
msg_string := "";
alert_msg_lst := ();
//Declare the MLM that creates action on alert object
create_aoa_object := MLM {{{SINGLE-QUOTE}}}STD_Func_Create_Alert_Action_Object{{{SINGLE-QUOTE}}};
aoa_ActionItemStatus := "";
aoa_ActionItemID := "";
aoa_ActionItemName := "";
aoa_ActionEnterpriseItemID := "";
aa_lst := ();
statin_conflict_list := ("A|simvastatin|80|mg|=|||||",
"B|simvastatin|20|mg|>|amiodarone|mg||",
"B|simvastatin|20|mg|>|amiodarone|ml/hr||",
"B|simvastatin|20|mg|>|amlodipine|mg||",
"B|simvastatin|20|mg|>|amlodipine/benazepril|cap||",
"B|simvastatin|20|mg|>|ranolazine|mg||",
"B|simvastatin|10|mg|>|verapamil|mg||",
"B|simvastatin|10|mg|>|diltiazem|mg/hr||",
"B|simvastatin|10|mg|>|diltiazem|mL||",
"B|simvastatin|10|mg|>|diltiazem|mg||",
"B|simvastatin|10|mg|>|dronedarone|mg||",
"B|simvastatin|40|mg|>|ticagrelor|mg||",
"B|simvastatin|40|mg|>|niaspan|mg|2000|>",
"B|simvastatin|40|mg|>|niacin|mg|2000|>",
"B|lovastatin|40|mg|>|amiodarone|mg|",
"B|lovastatin|40|mg|>|amiodarone|ml/hr|",
"B|lovastatin|40|mg|>|niaspan|mg|2000|>",
"B|lovastatin|40|mg|>|niacin|mg|2000|>",
"B|lovastatin|40|mg|>|ticagrelor|mg||",
"B|lovastatin|20|mg|>|cyclosporine|mg||",
"B|lovastatin|20|mg|>|diltiazem|ml/hr||",
"B|lovastatin|20|mg|>|diltiazem|mL||",
"B|lovastatin|20|mg|>|diltiazem|mg||",
"B|lovastatin|20|mg|>|verapamil|mg||",
"B|lovastatin|20|mg|>|gemfibrozil|mg||",
"B|rosuvastatin|10|mg|>|gemfibrozil|mg||",
"C|rosuvastatin|5|mg|>|cyclosporine|mg||",
"C|fluvastatin|20|mg|>|cyclosporine|mg||",
"C|pravastatin|20|mg|>|cyclosporine|mg||",
"C|atorvastatin|20|mg|>|clarithromycin|mg||",
"C|pravastatin|40|mg|>|clarithromycin|mg||");
statin_order_enter := event { OrderEnter User Order: where TypeCode = "Medication"};
/* Get the current user{{{SINGLE-QUOTE}}}s occupation*/
(user_id,userguid) :=read last {UserInfo: idcode, guid};
UserCode, OrderRole := read last
{"Select occupationcode, orderroletype "
||" From cv3user with (nolock) "
||" Where Guid = " || SQL(userguid) };
fire_on_UserCPOE := ("MD","DO","DDS","DPM","PA","PA-C","CRNP","IT");
If usercode in fire_on_UserCPOE then
alert_settings := "";
UDDD_dictionary_name := "";
UDDD_is_restricted := FALSE;
else
alert_settings := "Must Comment";
UDDD_dictionary_name := "AlertAckComment";
UDDD_is_restricted := TRUE;
endif;
statin_alert_dest := destination {alert} with
[alert_type := "Warning",
short_message := "Statin Medication Alert",
priority := "Low",
scope := "Chart",
rule_group := "Statin Meds",
rule_number := 4055,
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];
//Retrieve values from Evoking Object
(ClientGUID, ChartGUID, VisitGUID,
evoking_OrderName, evoking_OrderGUID,
evoking_SignificantDtm, CatalogItemObj,
orderedUOMValue, orderedDoseValue) := read last { Order : ClientGUID, ChartGUID, ClientVisitGUID, Name, GUID, SignificantDtm,
OrderCatalogMasterItem, UOM, DosageLow
REFERENCING EvokingObject };
(CatalogClassTypeValueObj,
evoking_OrderCatalogMasterItemGUID) := read last {OrderCatalogMasterItem: CatalogClassTypeValue, GUID
REFERENCING CatalogItemObj};
//Retrieve initial medications involve in the statin custom user list
ClassTypeValue_code_list, ClassTypeValue_value_list := read {CatalogClassTypeValue: Code, Value
REFERENCING CatalogClassTypeValueObj where code = "PRX_StatinMedications"};
//Parse the medications involved in the statin custom user list
classvaluelist := call str_parse with ClassTypeValue_value_list[1],",";
classvalue := classvaluelist[1];
//Does ordered medication exist in the medications user list
if ( classvalue is not null ) then
//Is ordered medication (i.e. classvalue) a statin?
if ( classvalue matches pattern "%statin%" ) then
//Set boolean that user is trying to order a statin med
ordered_statin := true;
//Handle special Simvastatin 80mg case here
if ( classvalue = "simvastatin" AND orderedDoseValue = "80") then
rule_matches := true;
endif;
//Get list of unsubmitted orders that conflict with statin med
(unsub_med_list,
unsub_med_dose,
unsub_med_UOM,
unsub_oGUID,
unsub_oCatGUID) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID
WHERE ( ( NAME matches pattern "Amiodarone%" AND (UOM = "mg" OR UOM = "ml/hr"))
OR (NAME matches pattern "Amlodipine%" AND UOM = "mg")
OR ( NAME matches pattern "Amlodipine%" AND UOM = "cap")
OR (NAME matches pattern "Clarithromycin%" AND UOM = "mg")
OR (NAME matches pattern "Cyclosporine%" AND UOM = "mg")
OR (NAME matches pattern "Diltiazem%" AND UOM = "mg/hr")
OR ( NAME matches pattern "Diltiazem%" AND UOM = "mL")
OR ( NAME matches pattern "Diltiazem%" AND UOM = "mg")
OR (NAME matches pattern "Dronedarone%" AND UOM = "mg")
OR (NAME matches pattern "Gemfibrozil%" AND UOM = "mg")
OR (NAME matches pattern "Niaspan%" AND UOM = "mg")
OR (NAME matches pattern "Niacin%" AND UOM = "mg")
OR (NAME matches pattern "Ranolazine%" AND UOM = "mg")
OR (NAME matches pattern "Ticagrelor%" AND UOM = "mg")
OR (NAME matches pattern "Verapamil%" AND UOM = "mg") )};
if ( exists unsub_med_list ) then
found_unsubmitted_meds := true;
rule_matches := true;
else
//Get a list of relevant existing medications that conflict with statin med
(existing_meds_list,
existing_meds_name,
existing_meds_dose,
existing_meds_UOM,
existing_order_guid,
existing_oCat_guid) := read {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.ClientGUID = o.ClientGUID"
|| " AND cv.GUID = o.ClientVisitGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " JOIN CV3OrderAddnlInfo oai WITH (NOLOCK)"
|| " ON o.GUID = oai.GUID"
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|| " ON o.GUID = ot.OrderGUID"
|| " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
|| " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
|| " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
|| " AND ((o.Name LIKE {{{SINGLE-QUOTE}}}Amiodarone%{{{SINGLE-QUOTE}}} AND (ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}} OR ot.OrderUom = {{{SINGLE-QUOTE}}}ml/hr{{{SINGLE-QUOTE}}}))"
|| " OR (o.Name like {{{SINGLE-QUOTE}}}amlodipine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}ranolazine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}verapamil%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}diltiazem%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg/hr{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}diltiazem%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mL{{{SINGLE-QUOTE}}})"
|| " OR ( o.Name LIKE {{{SINGLE-QUOTE}}}diltiazem%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}dronedarone%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}ticagrelor%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}niaspan%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}niacin%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}cyclosporine%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}gemfibrozil%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}clarithromycin%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{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}}})"};
if ( exists existing_meds_list ) then
rule_matches := true;
endif;
endif;
else
//Ordered med was not a statin med
//Look for an unsubmitted order for a statin med
(unsub_statin_list,
unsub_statin_dose,
unsub_statin_UOM,
unsub_statin_oGUID,
unsub_statin_oCatGUID) := READ { Unsubmitted Order : Name, DosageLow, UOM, GUID, OrderCatalogMasterItemGUID
WHERE ( ( NAME matches pattern "Atorvastatin%" AND UOM = "mg")
OR (NAME matches pattern "Fluvastatin%" AND UOM = "mg")
OR (NAME matches pattern "Lovastatin%" AND UOM = "mg")
OR (NAME matches pattern "Pravastatin%" AND UOM = "mg")
OR (NAME matches pattern "Rosuvastatin%" AND UOM = "mg")
OR (NAME matches pattern "Simvastatin%" AND UOM = "mg")) };
if ( exists unsub_statin_list ) then
found_unsubmitted_meds := true;
rule_matches := true;
else
//Look for an existing med order for a statin on patient{{{SINGLE-QUOTE}}}s chart
(existing_statin_list,
existing_statin_med,
existing_statin_dose,
existing_statin_UOM,
existing_statin_oGUID,
existing_statin_oCatGUID) := read {"SELECT LEFT(o.Name, (CHARINDEX({{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}}, o.NAME, 1) - 1)), o.Name, ot.OrderDosageLow, ot.OrderUom, o.GUID, o.OrderCatalogMasterItemGUID"
|| " FROM CV3ClientVisit cv WITH (NOLOCK) JOIN CV3Order o WITH (NOLOCK)"
|| " ON cv.ClientGUID = o.ClientGUID"
|| " AND cv.GUID = o.ClientVisitGUID"
|| " AND cv.ChartGUID = o.ChartGUID"
|| " JOIN CV3OrderAddnlInfo oai WITH (NOLOCK)"
|| " ON o.GUID = oai.GUID"
|| " JOIN CV3OrderTask ot WITH (NOLOCK)"
|| " ON o.GUID = ot.OrderGUID"
|| " WHERE cv.ClientGUID = " || SQL(EvokingObject.ClientGUID)
|| " AND cv.GUID = " || SQL(EvokingObject.ClientVisitGUID)
|| " AND cv.ChartGUID = " || SQL(EvokingObject.ChartGUID)
|| " AND ((o.Name LIKE {{{SINGLE-QUOTE}}}simvastatin%{{{SINGLE-QUOTE}}} AND ot.OrderUOM = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name like {{{SINGLE-QUOTE}}}lovastatin%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}rosuvastatin%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}fluvastatin%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}pravastatin%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{SINGLE-QUOTE}}})"
|| " OR (o.Name LIKE {{{SINGLE-QUOTE}}}atorvastatin%{{{SINGLE-QUOTE}}} AND ot.OrderUom = {{{SINGLE-QUOTE}}}mg{{{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}}})"};
if ( exists existing_statin_list ) then
rule_matches := true;
endif;
endif; //End unsubmitted order found
endif; // End classvalue = statin med
if ( rule_matches ) then
//Loop through statin conflict rules list to determine if / where conflict exists
for i in ( 1 seqto ( count statin_conflict_list ) ) do
statin_rule := call str_parse with statin_conflict_list[i],"|";
rule_class_type := statin_rule[1]; //Class Type
rule_med := statin_rule[2]; //Statin Medication
rule_dose := statin_rule[3]; //Statin Dose
rule_uom := statin_rule[4]; //Statin UOM
rule_op := statin_rule[5]; //Operation for statin dose
rule_conflict := statin_rule[6]; //Med that conflicts with statin
rule_conflict_uom := statin_rule[7]; //Med UOM that conflicts with statin
rule_conflict_dose := statin_rule[8]; //Med dose that conflicts with statin
rule_conflict_op := statin_rule[9]; //Med operation that conflicts with statin
//Did we order a statin med?
if ( ordered_statin ) then
//Does the ordered med = the appropriate rule?
if ( rule_med = classvalue ) then
if ( rule_op = ">" ) then
//Does the ordered dose match the rule based on operator?
rule_matches := ( (orderedDoseValue as number) > (rule_dose as number) );
rule_matches := ( rule_matches AND ( (orderedUOMValue as string) = (rule_uom as string) ) );
elseif ( rule_op = "=" ) then
rule_matches := ( ( orderedDoseValue as number ) = ( rule_dose as number ) );
rule_matches := ( rule_matches AND ( ( orderedUOMValue as string ) = ( rule_uom as string ) ) );
else
rule_matches := false;
endif; //End rule_op check
//Ordered statin med matches a rule
if ( rule_matches ) then
//Handling special case for Simvastatin 80mg
if ( ( rule_conflict is null ) OR ( rule_conflict = "") )then
do_alert := true;
msg_string := "{{+B}}{{+R}}Simvastatin 80mg{{-R}}{{-B}} is limited to patients that have been taking this dose for "
|| "{{+B}}greater than 12 months{{-B}} without evidence of myopathy and are not currently taking or beginning"
|| " to take another drug that interacts with simvastatin.";
alert_msg_lst := alert_msg_lst, msg_string;
//Do we have unsubmitted meds?
elseif ( found_unsubmitted_meds ) then
//Conflict med in unsub list?
for k in ( 1 seqto count unsub_med_list ) do
//Check for compound drug
check_for_hash := FIND "/" IN STRING unsub_med_list[k] STARTING AT 1;
if ( ( check_for_hash as number ) <> 0 ) then
fnd_space_1 := FIND " " IN STRING unsub_med_list[k] STARTING AT 1;
compound_drug_1 := SUBSTRING (( fnd_space_1 as number ) - 1) CHARACTERS STARTING AT 1 FROM unsub_med_list[k]; //Amlodipine
srch_drug_2 := SUBSTRING ( LENGTH unsub_med_list[k] - ( check_for_hash as number ) ) CHARACTERS STARTING AT ( ( check_for_hash as number ) + 1 ) FROM unsub_med_list[k];
fnd_space_2 := FIND " " IN STRING srch_drug_2 STARTING AT 1;
compound_drug_2 := SUBSTRING ( ( fnd_space_2 AS number ) - 1 ) CHARACTERS STARTING AT 1 FROM srch_drug_2;
compound_drug := compound_drug_1 || "/" || compound_drug_2;
found := FIND LOWERCASE rule_conflict IN STRING LOWERCASE compound_drug STARTING AT 1;
else
found := FIND LOWERCASE rule_conflict IN STRING LOWERCASE unsub_med_list[k] STARTING AT 1;
endif;
if ( ( found as number ) <> 0 ) then
if ( rule_conflict_uom = unsub_med_uom[k] ) then
//Handling niaspan > 2000mg
if ( rule_conflict_dose = "" ) then
do_alert := true;
else
if ( rule_conflict_op = ">" ) then
do_alert := ( (unsub_med_dose[k] as number) > (rule_conflict_dose as number) );
else
do_alert := false;
endif;
endif;
if ( do_alert ) then
msg_string := "When using {{+B}}{{+R}}" || rule_med || "{{-R}}{{-B}} and {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}} together, ";
if ( rule_class_type = "B" ) then
msg_string := msg_string || "{{+B}}{{+R}}" || rule_med || "{{-B}}{{-R}} should not exceed {{+B}}{{+R}}" || rule_dose || rule_uom
|| "{{-R}}{{-B}} due to decreased metabolism and increased risk of toxicity.";
elseif ( rule_class_type = "C" ) then
msg_string := msg_string || " do not exceed {{+B}}{{+R}}" || rule_med || " " || rule_dose || rule_uom || "{{-R}}{{-B}}.";
endif;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.ObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Unsubmitted";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := unsub_oGUID[k];
alert_action.ActionItemName := unsub_med_list[k];
alert_action.ActionEnterpriseItemID := unsub_oCatGUID[k];
alert_action.MLMName := "SCH_STATIN_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the UNSUBMITTED Medication to DC-Cancel. This medication conflicts with the Statin medication you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
endif;
endif;
enddo;
else
//Conflict med in existing meds list?
if ( rule_conflict IN existing_meds_list AND rule_conflict_uom IN existing_meds_uom ) then
for j in ( 1 seqto count existing_meds_list ) do
if ( rule_conflict = existing_meds_list[j] ) then
if ( rule_conflict_dose = "" ) then
do_alert := true;
else
if ( rule_conflict_op = ">" ) then
do_alert := ( ( existing_meds_dose[j] as number ) > ( rule_conflict_dose as number ) );
else
do_alert := false;
endif;
endif;
if ( do_alert ) then
msg_string := "When using {{+B}}{{+R}}" || rule_med || "{{-R}}{{-B}} and {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}} together, ";
if ( rule_class_type = "B" ) then
msg_string := msg_string || "{{+B}}{{+R}}" || rule_med || "{{-B}}{{-R}} should not exceed {{+B}}{{+R}}" || rule_dose || rule_uom
|| "{{-R}}{{-B}} due to decreased metabolism and increased risk of toxicity.";
elseif ( rule_class_type = "C" ) then
msg_string := msg_string || " do not exceed {{+B}}{{+R}}" || rule_med || " " || rule_dose || rule_uom || "{{-R}}{{-B}}.";
endif;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.ObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Existing";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := existing_order_guid[j];
alert_action.ItemName := existing_meds_name[j];
alert_action.ActionEnterpriseItemID := existing_oCat_guid[j];
alert_action.MLMName := "SCH_STATIN_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the EXISTING Medication to DC-Cancel. This medication conflicts with the Statin medication you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
endif;
enddo;
endif;
endif;
endif;
endif; //End rule_med = classvalue
//Ordered med not a statin, but a conflicting med
else
if ( rule_conflict = classvalue AND rule_conflict_uom = orderedUOMValue ) then
if ( found_unsubmitted_meds ) then
for m IN ( 1 seqto count unsub_statin_list ) do
found := FIND LOWERCASE rule_med IN STRING LOWERCASE unsub_statin_list[m] STARTING AT 1;
if ( ( found as number ) <> 0 ) then
//Check our operator
if ( rule_op = ">" ) then
rule_matches := ( ( unsub_statin_dose[m] as number ) > ( rule_dose as number ) );
rule_matches := ( rule_matches AND ( ( unsub_statin_uom[m] as string ) = ( rule_uom as string ) ) );
else
rule_matches := false;
endif;
if ( rule_matches ) then
if ( rule_conflict_dose = "") then
do_alert := true;
else
if ( rule_conflict_op = ">" ) then
do_alert := ( ( orderedDoseValue as number ) > ( rule_conflict_dose as number ) );
else
do_alert := false;
endif;
endif;
if ( do_alert ) then
msg_string := "When using {{+B}}{{+R}}" || rule_med || "{{-R}}{{-B}} and {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}} together, ";
if ( rule_class_type = "B" ) then
msg_string := msg_string || "{{+B}}{{+R}}" || rule_med || "{{-R}}{{-B}} should not exceed {{+B}}{{+R}}" || rule_dose || rule_uom
|| "{{-R}}{{-B}} due to decreased metabolism and increased risk of toxicity.";
elseif ( rule_class_type = "C" ) then
msg_string := msg_string || " do not exceed {{+B}}{{+R}}" || rule_med || " " || rule_dose || rule_uom || "{{-R}}{{-B}}.";
endif;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.ObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Unsubmitted";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := unsub_statin_oGUID[m];
alert_action.ActionItemName := unsub_statin_list[m];
alert_action.ActionEnterpriseItemID := unsub_statin_oCatGuid[m];
alert_action.MLMName := "SCH_STATIN_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the UNSUBMITTED statin medication to DC-Cancel. This statin medication conflicts with the medication that you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
endif;
endif;
enddo;
else
if ( rule_med IN existing_statin_list ) then
for l IN ( 1 seqto count existing_statin_list ) do
//Check the operator
if ( rule_op = ">" ) then
rule_matches := ( ( existing_statin_dose[l] as number ) > ( rule_dose as number ) );
rule_matches := ( rule_matches AND ( ( existing_statin_uom[l] as string ) = ( rule_uom as string ) ) );
else
rule_matches := false;
endif;
if ( rule_matches ) then
if ( rule_conflict_dose = "" ) then
do_alert := true;
else
if ( rule_conflict_op = ">" ) then
do_alert := ( ( orderedDoseValue as number ) > ( rule_conflict_dose as number ) );
else
do_alert := false;
endif;
endif;
if ( do_alert )then
msg_string := "When using {{+B}}{{+R}}" || rule_med || "{{-R}}{{-B}} and {{+B}}{{+R}}" || rule_conflict || "{{-R}}{{-B}} together, ";
if ( rule_class_type = "B" ) then
msg_string := msg_string || "{{+B}}{{+R}}" || rule_med || "{{-R}}{{-B}} should not exceed {{+B}}{{+R}}" || rule_dose || rule_uom
|| "{{-R}}{{-B}} due to decreased metabolism and increased risk of toxicity.";
elseif ( rule_class_type = "C" ) then
msg_string := msg_string || " do not exceed {{+B}}{{+R}}" || rule_med || " " || rule_dose || rule_uom || "{{-R}}{{-B}}.";
endif;
alert_msg_lst := alert_msg_lst, msg_string;
alert_action := call create_aoa_object WITH "CV3Order", "CV3Order";
alert_action.EvokingEnterpriseItemID := evoking_OrderCatalogMasterItemGUID;
alert_action.EvokingObjectID := evoking_OrderGUID;
alert_action.EvokingObjectName := evoking_OrderName;
alert_action.ActionItemStatus := "Existing";
alert_action.ActionEvent := "DC-Cancel";
alert_action.ActionItemID := existing_statin_oGUID[l];
alert_action.ActionItemName := existing_statin_med[l];
alert_action.ActionEnterpriseItemID := existing_statin_oCatGUID[l];
alert_action.MLMName := "SCH_STATIN_MEDICATION_ALERTS";
alert_action.ShortMessage := "This is the EXISTING statin medication to DC-Cancel. This statin medication conflicts with the medication that you are trying to order.";
aa_lst := aa_lst, alert_action;
endif;
endif;
enddo;
endif;
endif;
endif;
endif; //End ordered_statin
enddo;
endif; //End rule matches = true
endif; // End classvalue is not null
;;
priority: 50
;;
evoke:
statin_order_enter;
;;
logic:
conclude do_alert;
;;
action:
if ( do_alert = true ) then
final_msg := "";
for i IN ( 1 seqto count alert_msg_lst ) do
if ( final_msg = "" ) then
final_msg := alert_msg_lst[i];
else
final_msg := final_msg || "\n\n" || alert_msg_lst[i];
endif;
enddo;
write final_msg at statin_alert_dest;
attach aa_lst to statin_alert_dest;
endif;
;;
Urgency: 50;;
end: