maintenance: title: ACS_DUPLICATE_REFERENCE_LAB_ALERT;; filename: ACS_DUPLICATE_REFERENCE_LAB_ALERT;; arden: version 2.5;; version: 16.30;; institution: Allscripts;; author: Allscripts;; specialist: St Clair - Maria Pest;; date: 2017-12-21;; validation: testing;; library: purpose: Hard stop alert upon entry of Reference lab order that has already been ordered this admission. ;; explanation: Only fire for Inpatient Visits Identify which orders should not be duplicated during an admission by the order name ending in any of the following: (Mayo) (ITxM) (Prometheus) (Quest) (UPMC) Current Visit - Any Order which ends with this, check to see if it (the exact order) already exists, and stop its duplication. ;; keywords: Alert , Referenc Lab , Duplicate ;; knowledge: type: data-driven;; data: hardStop := true; // Evoking Events OrderInitEvent := event { OrderInit User Order: where Name matches pattern "%(Mayo)" OR Name matches pattern "%(ITxM)" OR Name matches pattern "%(Prometheus)" OR Name matches pattern "%(Quest)" OR Name matches pattern "%(UPMC)" }; // Defining the Evoking Object as ClientVisit. if called_by_editor then EvokingObject := read last {Order: This where Name matches pattern "%(Mayo)" OR Name matches pattern "%(ITxM)" OR Name matches pattern "%(Prometheus)" OR Name matches pattern "%(Quest)" OR Name matches pattern "%(UPMC)" }; endif; /* An alert is stored into the database */ Msg_alert:= Destination { Alert } with [ alert_type := warning , short_message := "Duplicate Reference Lab Order" , priority := "medium" , scope := "chart" , rule_group := "Duplicate Order" , rule_number := 1011 , Alert_dialog_settings := "" , Display_alert := True ]; if(hardStop)then Msg_alert.Alert_dialog_settings := "No Override Allowed"; endif; MyMessage := "Reference lab order (" || EvokingObject.Name || ") has already been ordered this admission."; query := "select count(*) from CV3Order where ClientGUID = " || EvokingObject.ClientGUID || " and ChartGUID = " || EvokingObject.ChartGUID || " and ClientVisitGUID = " || EvokingObject.ClientVisitGUID || " and Active = 1 and OrderStatusLevelNum not in (69,70) and Name = " || SQL(EvokingObject.Name); ExisitingDuplicateOrderCnt := read last {"" || query}; ;; priority: 50 ;; evoke: OrderInitEvent ; ;; logic: If ExisitingDuplicateOrderCnt > 0 Then conclude true; Else conclude false; Endif; ;; action: WRITE MyMessage At Msg_alert; ;; Urgency: 80;; end: