maintenance: title: FORM_FUNC_ANTICOAGULANT_CHECK;; mlmname: FORM_FUNC_ANTICOAGULANT_CONFLICT_CHECK;; arden: version 2.5;; version: 5.50;; institution: St. Clair Hospital;; author: Juliet M. Law, Allscripts, Inc. Ext. 7461;; specialist: ;; date: 2012-03-28;; validation: testing;; library: purpose: Called from any Form or Order Set MLM. Used to check for existing or unsubmitted anticoagulant orders that conflict with current anticoagulant selection. ;; explanation: This MLM was written to be called from Forms and Order Sets that require a check for an anticoagulant conflict. Change History: 2012.03.28 JML Created 2012.05.09 JML Changed Lovenox duplicate med alert to soft stop 2012.05.16 JML Changed Heparin duplicate med alert to soft stop 2013.05.02 JML CSR #31334: Leapfrog changes; added alert support for Fondaparinux (Arixtra), Argatroban, and Apixaban (Eliquis) 2014.01.22 JML CSR #31334: Adding conflict checks for Warfarin and Xarelto to support ortho post op order sets. 2018.09.07 JML CSR 37062: Adding conflict check for Post Op Shoulder OS. 2018.11.16 JML CSR 37344/37345/37346: Added new DVT Anticoagulant Orders- Ortho Procedures order set; called from some ortho post op order sets. ;; keywords: anticoagulant, conflict, called mlm, func ;; knowledge: type: data-driven;; data: //Establish Communication, Form, ClientInfo objects (this_communication, this_form, client_info_obj, selectedMed) := argument; //Include standard .Net libraries standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; //Create local session object local_session := cds_session.local; //Define form values passed in through the Form and Communication Object field_list := this_form.fields; CallingField := this_communication.CallingFieldName; CallingEvent := this_communication.CallingEvent; //Patient GUIDs client_guid := this_communication.ClientGUID; visit_guid := this_communication.ClientVisitGUID; chart_guid := this_communication.ChartGUID; //Event values CallingEvent := this_communication.CallingEvent; CallingField := this_communication.CallingFieldName; //General variables to control logic flow stop := false; severity := ""; //Define anticoagulant medications that require conflict check (anticoagulant_meds) := READ {"SELECT ocmi.Name" || " FROM CV3OrderCatalogMasterItem ocmi WITH (NOLOCK)" || " WHERE ocmi.TherapeuticCategory = {{{SINGLE-QUOTE}}}coagulation modifiers | anticoagulants{{{SINGLE-QUOTE}}}" || " and ocmi.Name not like {{{SINGLE-QUOTE}}}zz%{{{SINGLE-QUOTE}}}" || " ORDER BY ocmi.Name"}; heparin_inj_meds := (anticoagulant_meds WHERE anticoagulant_meds IN ("Heparin Inj", "Heparin Inj -", "Heparin Inj-", "Heparin Inj.") ); heparin_iv_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Heparin%25,000%" OR anticoagulant_meds MATCHES PATTERN "Heparin Infusion%"); lovenox_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Enoxaparin%"); pradaxa_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Dabigatran%"); xarelto_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Rivaroxaban%"); warfarin_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Warfarin%"); arixtra_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Fondaparinux%"); argatroban_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Argatroban%"); apixaban_meds := (anticoagulant_meds WHERE anticoagulant_meds MATCHES PATTERN "Apixaban%"); //Check local session variable for unsubmitted orders if (((count local_session.SessionUnsubmittedAnticoagulantOrders) as number) > 0) then (existing_orders) := local_session.SessionUnsubmittedAnticoagulantOrders; order_count := count (existing_orders) as number; else //Check for existing orders (existing_orders) := read {"SELECT o.Name, o.TouchedWhen " || " FROM CV3Order o with (nolock) JOIN CV3OrderCatalogMasterItem ocmi with (nolock) " || " ON o.OrderCatalogMasterItemGUID = ocmi.GUID " || " WHERE o.ClientGUID = " || Sql(client_guid) || " AND o.ClientVisitGUID = " || Sql(visit_guid) || " AND o.ChartGUID = " || Sql(chart_guid) || " AND (o.Name LIKE {{{SINGLE-QUOTE}}}Enoxaparin%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Heparin%25,000%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Heparin Inj%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Dabigatran%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Rivaroxaban%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Warfarin%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Fondaparinux%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Argatroban%{{{SINGLE-QUOTE}}}" || " OR o.Name LIKE {{{SINGLE-QUOTE}}}Apixaban%{{{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}; order_count := count (existing_orders) as number; endif; if (order_count > 0) then //Patient has an existing (submitted or unsubmitted) anticoagulant medication order //Iterate through each existing order and determine if there is a conflict //Based on which new anticoagulant medication is selected on order set for existingItem IN existing_orders do if (selectedMed = "Heparin Inj" OR selectedMed matches pattern "%Heparin%" ) then if ((existingItem IN lovenox_meds) OR (existingItem IN pradaxa_meds) OR (existingItem IN xarelto_meds) OR (existingItem IN heparin_iv_meds) OR (existingItem IN arixtra_meds) OR (existingItem IN argatroban_meds) OR (existingItem IN apixaban_meds)) then //hard stop, no override stop := true; severity := "high"; stop_message := "Avoid concurrent use of " || selectedMed || " and " || existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders." || "\n\nYou MUST discontinue " || existingItem || " before " || selectedMed || " can be ordered."; elseif (existingItem IN heparin_inj_meds) then stop := true; severity := "low"; stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Heparin SQ." || " You MUST discontinue the previous Heparin SQ order before placing a new " || "Heparin SQ order, UNLESS the therapies will not be overlapping." || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}." || "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}."; endif; elseif (selectedMed matches pattern "Enoxaparin Inj%") then if ((existingItem IN heparin_iv_meds) OR (existingItem IN argatroban_meds)) then //soft stop, priority low, must acknowledge stop := true; severity := "low"; stop_message := selectedMed || " and " || existingItem || " should not be used together due to increased bleeding risk except when transitioning from " || existingItem || " to " || selectedMed || "." || "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}" || "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}"; elseif ((existingItem IN heparin_inj_meds) OR (existingItem IN pradaxa_meds) OR (existingItem IN xarelto_meds) OR (existingItem IN arixtra_meds) OR (existingItem IN apixaban_meds)) then //hard stop, no override stop := true; severity := "high"; stop_message := "Avoid concurrent use of " || selectedMed || " and " || existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders." || "\n\nYou MUST discontinue " || existingItem || " before " || selectedMed || " can be ordered."; elseif ((existingItem IN lovenox_meds)) then stop := true; severity := "low"; stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Enoxaparin." || " You MUST discontinue the previous Enoxaparin order before placing a new " || "Enoxaparin order, UNLESS the therapies will not be overlapping." || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}." || "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}."; endif; elseif (selectedMed = "Fondaparinux Inj") then if ((existingItem IN lovenox_meds) OR (existingItem IN heparin_inj_meds) OR (existingItem IN heparin_iv_meds) OR (existingItem IN pradaxa_meds) OR (existingItem IN xarelto_meds) OR (existingItem IN apixaban_meds)) then stop := true; severity := "high"; stop_message := "Avoid concurrent use of " || selectedMed || " and " || existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders." || "\n\nYou MUST discontinue " || existingItem || " before " || selectedMed || " can be ordered."; if (existingItem IN pradaxa_meds) then stop_message := stop_message || "\n\n" || "If CrCl is greater than or equal to 30 ml/min, begin Arixtra" || " 12 hours after last Pradaxa dose." || "\n \n If CrCl is less than 30 ml/min, begin Arixtra" || " 24 hours after last Pradaxa dose."; elseif (existingItem IN xarelto_meds) then stop_message := stop_message || "\n\n" || "When switching from Xarelto to Arixtra" || ", discontinue Xarelto and give Arixtra" || " when the next Xarelto dose would have been due."; endif; elseif (existingItem IN argatroban_meds) then stop := true; severity := "low"; stop_message := selectedMed || " and " || existingItem || " should not be used together due to increased bleeding risk except when transitioning from " || existingItem || " to " || selectedMed || "." || "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}" || "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}"; elseif (existingItem IN arixtra_meds) then stop := true; severity := "low"; stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Fondaparinux." || " You MUST discontinue the previous Fondaparinux order before placing a new " || "Fondaparinux order, UNLESS the therapies will not be overlapping." || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}." || "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}."; endif; elseif ( selectedMed matches pattern "Warfarin%" ) then if ( ( existingItem IN xarelto_meds ) OR ( existingItem IN apixaban_meds ) ) then stop := true; severity := "low"; stop_message := selectedMed || " and " || existingItem || " should not be used together" || " due to increased bleeding risk.\n\nContact physician to adjust orders." || "\n\nWhen converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " because " || existingItem || " affects the INR." || "\n\nUse Heparin or Lovenox with " || selectedMed || " as bridge therapy while waiting for the INR to rise if therapeutic levels are needed immediately." || "\n\nClick {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}} to contine ordering " || selectedMed || ", otherwise click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}."; endif; elseif ( selectedMed matches pattern "Rivaroxaban%" ) then if ( ( existingItem IN heparin_inj_meds ) OR ( existingItem IN lovenox_meds ) OR ( existingItem IN pradaxa_meds ) OR ( existingItem IN warfarin_meds ) OR ( existingItem IN arixtra_meds ) OR ( existingItem IN apixaban_meds ) ) then stop := true; severity := "high"; stop_message := "Avoid concurrent use of " || selectedMed || " and " || existingItem || " due to increased bleeding risk.\n\nContact physician to adjust orders."; if ( existingItem IN warfarin_meds ) then stop_message := stop_message || "\n\nWhen converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " and start " || selectedMed || " when INR is less than 3.0"; elseif ( existingItem IN arixtra_meds ) then stop_message := stop_message || "\n\nWhen converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " and start " || selectedMed || " 0-2 hours before the next " || existingItem || " dose would have been due."; elseif ( existingItem IN apixaban_meds ) then stop_message := stop_message || "\n\nWhen converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " and start " || selectedMed || " when the next " || existingItem || " dose would have been due."; elseif ( existingItem IN lovenox_meds ) then stop_message := stop_message || "\n\nWhen converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " and start " || selectedMed || " 0-2 hours before the next " || existingItem || " dose would have been due."; endif; elseif ( ( existingItem IN heparin_iv_meds ) OR ( existingItem IN argatroban_meds ) ) then stop := true; severity := "low"; stop_message := selectedMed || " and " || existingItem || " should not be used together due to increased bleeding risk" || " except when transitioning from " || existingItem || " to " || selectedMed || "." || "\n\nStart " || selectedMed || " when " || existingItem || " infusion is stopped." || "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}" || "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}"; elseif ( existingItem IN xarelto_meds ) then stop := true; severity := "low"; stop_message := "Duplicate Medication Alert!\n\nThis patient already has an order for Xarelto." || " You MUST discontinue the previous Xarelto order before placing a new " || "Xarelto order, UNLESS the therapies will not be overlapping." || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}." || "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}."; endif; elseif ( selectedMed matches pattern "Apixaban%" ) then if ( ( existingItem IN lovenox_meds ) OR ( existingItem IN arixtra_meds ) OR ( existingItem IN heparin_inj_meds ) OR ( existingItem IN warfarin_meds ) OR ( existingItem IN pradaxa_meds ) OR ( existingItem IN xarelto_meds ) ) then stop := true; severity := "high"; if ( existingItem IN warfarin_meds ) then stop_message := "When converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " and start " || selectedMed || " when INR less then 2.0."; else stop_message := "When converting from " || existingItem || " to " || selectedMed || ", discontinue " || existingItem || " and start " || selectedMed || " when the next " || existingItem || " dose would have been due."; endif; elseif ( ( existingItem IN heparin_iv_meds ) OR ( existingItem IN argatroban_meds ) ) then stop := true; severity := "low"; stop_message := selectedMed || " and " || existingItem || " should not be used together due to increased bleeding risk" || " except when transitioning from " || existingItem || " to " || selectedMed || "." || "\n\nStart " || selectedMed || " when " || existingItem || " infusion is stopped." || "\n\nIf your Patient is transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}" || "\n\nIf your Patient is NOT transitioning from " || existingItem || " to " || selectedMed || ", click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}"; elseif ( existingItem IN apixaban_meds ) then stop := true; severity := "low"; stop_message := "Duplicate Medication Alert! This patient already has an order for Apixaban." || " You MUST discontinue the previous Apixaban " || "order before placing a new Apixaban order, UNLESS the therapies will not be overlapping." || "\n\nIf this is a One Time dose, OR if the therapies will not overlap and will be given sequentially, click {{{SINGLE-QUOTE}}}Yes{{{SINGLE-QUOTE}}}." || "\n\nOtherwise, click {{{SINGLE-QUOTE}}}No{{{SINGLE-QUOTE}}}."; endif; endif; enddo; endif; ;; priority: 50 ;; evoke: ;; logic: conclude true; ;; action: //Return to calling function whether a stop // (i.e. conflict) is true, the message to display, // and the severity (i.e. hard or soft stop) return stop, stop_message, severity; ;; Urgency: 50;; end: