maintenance: title: SCH_ALERT_ON_SPECIALTY_COAGULATION;; mlmname: SCH_ALERT_ON_SPECIALTY_COAGULATION;; arden: version 2.5;; version: 5.50;; institution: Allscripts;; author: Shawn Head;; specialist: Maria Pest;; date: 2018-04-24;; validation: testing;; library: purpose: Generate an alert on Inpatient, Observation, and Emergency patients if specialty coaguation orders being entered (HARD STOP). ;; explanation: If user attempts to order a specialty coagulation order on an inpatient, observation, or emergency patient present a hard stop. These orders should be entered for outpatient and physician office orders only. 04-25-2018 STH CSR#: 36394 - Created 08-01-2018 STH CSR#: 36394 - Added logic to alert only once every 20 minutes per patient. This is due to the fact that the alert was presented multiple times when entering the orders through an order set. ;; keywords: Thrombotic Risk Profile (ITxM), Antithrombin III Activity (ITxM), APC Resistance (ITxM), Protein C Activity Plasma (ITxM) Factor V Leiden Mutation (ITxM), Factor X (ITxM), Protein S Activity Plasma (ITxM), Prothrombin Gene Variant (ITxM) ;; knowledge: type: data-driven;; data: //.Net libraries standard_libs := mlm {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; /*****************************************************************************************************************/ //Set to true if logging needed log_execution_info := false; //Set the text for this variable to indicate whether to send the message or not send_alert := "DoNotSend"; //Set the stop message stop_message := false; //Set Stop hard_stop := false; found_unsubmitted_orders := false; existing_orders := (); alert_priority := "High"; alert_dialog := "Must Comment"; alert_message := "Hypercoaguable Profiles/Component testing on Inpatients is not appropriate in a setting of acute thrombosis or current anticoagulant usage. \n\n{{+B}}Please consult Hematology with any questions.{{-B}}\nOffice phone: 412-831-1320"; //Define events coag_orderinit_event := event{OrderInit User Order : where name in ("Thrombotic Risk Profile (ITxM)","Antithrombin III Activity (ITxM)","APC Resistance (ITxM)","Protein C Activity Plasma (ITxM)","Factor V Leiden Mutation (ITxM)","Factor X (ITxM)","Protein S Activity Plasma (ITxM)","Prothrombin Gene Variant (ITxM)")}; //coag_orderenter_event := event{OrderEnter User Order : // where name in ("Thrombotic Risk Profile (ITxM)","Antithrombin III Activity (ITxM)","APC Resistance (ITxM)","Protein C Activity Plasma (ITxM)","Factor V Leiden Mutation (ITxM)","Factor X (ITxM)","Protein S Activity Plasma (ITxM)","Prothrombin Gene Variant (ITxM)")}; order_alert_dest := destination {alert} with [alert_type := "WARNING", short_message := "Specialty Coagulation Conflict", priority := alert_priority, scope := Chart, rule_group := "Specialty Coagulation Conflict Group", rule_number := 9000, send_with_order := send_alert, display_alert := true, alert_dialog_settings := alert_dialog, async_alert_dialog_settings := async_alert_dialog, document_name := "", document_conditional_text := (), ack_comment_UDDD := "Lab_Hypercoag Alert", ack_comment_UDDD_is_restricted := true]; /************************************************************************************************************/ if called_by_editor then evokingobject := read last {Order : THIS where Name = "Thrombotic Risk Profile (ITxM)"}; endif; //Capture current patient (clientGuid, clientName) := read last {ClientInfo : GUID, DisplayName}; (clientVisitGuid, chartGuid, TypeCode) := read last {ClientVisit : GUID, ChartGUID, TypeCode}; this_order := read last {Order : Name Referencing EvokingObject}; comm_obj := this_communication.primaryobj; Order_set_name := comm_obj.OrderSetName; //Only alert on patients that are currently listed as inpatient, observation, or emergency visit types. if (TypeCode in ("Inpatient","Observation","Emergency")) then AlertAlreadyFired := read last {" select guid From CV3AlertRepository with (nolock) where CreatedWhen >= dateadd(minute,-20,getdate()) and status = {{{SINGLE-QUOTE}}}ack{{{SINGLE-QUOTE}}} and AlertComments is not null and UserGUID = " || EVOKINGOBJECT.UserGUID || " and ClientGUID = " ||EVOKINGOBJECT.ClientGUID || " and ClientVisitGUID = " ||EVOKINGOBJECT.ClientVisitGUID }; if((count(AlertAlreadyFired) = 0) or (AlertAlreadyFired is null))then hard_stop := true; endif; endif; ;; priority: 50 ;; evoke: coag_orderinit_event; //COAG_orderenter_event; ;; logic: conclude hard_stop ;; action: write alert_message at order_alert_dest; ;; Urgency: 50;; end: