maintenance: title: SCH_POST_HOSPITAL_CARE_ORDERS;; mlmname: SCH_POST_HOSPITAL_CARE_ORDERS;; arden: version 2.5;; version: 5.00;; institution: St.Clair Hospital;; author: Dan Bredl;; specialist: Don Warnick ;; date: 2012-02-16;; validation: testing;; library: purpose: Hard stop when attempting to save the Post Hospital Care Orders Structured Note with past start/stop dates ;; explanation: Stops the nurse from saving the structured note when the discharge meds have the bad dates. change history 02.16.2012 DW CSR# 26841 - Created 03.30.2012 DW CSR# 26841 - Made a few exceptions to the RN alert for nurses in non-inpatient departments 04.24.2012 DW CSR# 30707 - Changed name of the document per Collaborative Care 07.08.2015 STH CSR# 32070 - Updated statement that appears to user per Debbie Eiler{{{SINGLE-QUOTE}}}s request. 07.14.2015 STH Ticket #: 1801808 - Update to allow saving Discharge Instructions with medications that have dates in the past when the patients status is anything other than ADM (for admitted). 06.19.2019 BB CSR# 38305 - Infusion Center went Live with with Enterprise Scheduling, and a subset of users began to receive an OMR alert when entering Discahrge Instructions (Posh Hospital Care Orders). This was due to the creation of a new Infusion Security group [Infusion Ovride], and needs added in the exclusions in this MLM. ;; keywords: ClientDocument; OMP; Dates; ;; knowledge: type: data-driven;; data: /*******************Make Changes To Spelling And Flags In This Section*******************/ send_alert := "DoNotSend"; log_execution_info := false; Post_Hospital_Care_Orders_Enter := event { ClientDocumentEnter User ClientDocument: WHERE DocumentName = "Discharge Instructions (Post Hospital Care Orders)"}; Post_Hospital_Care_Orders_Modify:= event { ClientDocumentModify User ClientDocument: WHERE DocumentName = "Discharge Instructions (Post Hospital Care Orders)"}; alert_details:= destination { Alert: warning, "Must acknowledege alert", high, chart, "Warning orders exist for patient", 14005, send_alert, "No Override Allowed" }; ( OccupationCode, userguid) := read last { UserInfo: occupationcode, guid}; (securitygroup) := read { " select sg.code from cv3user u with (nolock) " || " left join cv3usersecuritygroup as usg with (nolock) on usg.userguid=u.guid " || " join cv3securitygroup as sg with (nolock) on sg.guid = usg.securitygroupguid " || " where u.GUID = " || userguid || " and sg.code in ({{{SINGLE-QUOTE}}}Case Mgt{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}CardPulm Nurse{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}infusion{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Infusion Ovride{{{SINGLE-QUOTE}}},{{{SINGLE-QUOTE}}}Wound Center{{{SINGLE-QUOTE}}}, {{{SINGLE-QUOTE}}}ETRN{{{SINGLE-QUOTE}}}) " || " and sg.active = 1 and usg.expirydtm is null " }; (clientGuid, chartGuid, visitguid) := read last {ClientDocument: clientGuid, chartguid, clientvisitguid REFERENCING EvokingObject}; Admit_status := read last {" select VisitStatus from CV3ClientVisit with (nolock) " || " where clientguid = " || sql(clientGuid) || " and chartguid = " || sql(chartGuid) || " and guid = " || sql(visitguid)}; if called_by_editor then clientguid := "9000001923700200"; clientvisitguid:= "9000002931500270"; chartguid := "9000002931500170"; endif; // if called_by if (OccupationCode = "RN" OR OccupationCode = "GN" OR OccupationCode = "SN") and (not exists securitygroup) then isRn := "yes"; else isRn := "no"; endif; (OMPMedsWithBadDates) := read { " SET CONCAT_NULL_YIELDS_NULL off select p.DrugName + {{{SINGLE-QUOTE}}} {{{SINGLE-QUOTE}}} + p.Instructions" || " from sxaambclientprescription p with (nolock) " || " where p.statustype = 1 and p.ClientGuid = " || clientGuid || " " || " and " || " ( " || " (convert(char(11), p.startdate,20)< convert(char(11), getdate(),20) and p.enddate is null) " || " or " || " (convert(char(11), p.enddate,20)< convert(char(11), getdate(),20) and p.startdate is null) " || " or " || " (convert(char(11), p.startdate,20)< convert(char(11), getdate(),20) and convert(char(11), p.enddate,20) < convert(char(11), getdate(),20)) " || " ) " }; One_OMPMedWithBadDates := " "; All_OMPMedsWithBadDates:= " "; for i in 1 seqto count OMPMedsWithBadDates do One_OMPMedWithBadDates := OMPMedsWithBadDates [i]; All_OMPMedsWithBadDates := All_OMPMedsWithBadDates || " \n\n " || One_OMPMedWithBadDates ; enddo; ;; evoke: Post_Hospital_Care_Orders_Enter ; Post_Hospital_Care_Orders_Modify; ;; logic: if exists OMPMedsWithBadDates and isRn = "yes" and admit_status = "ADM" then conclude true; else conclude false; endif; ;; action: write "There are medications in the Outpatient Medication List that have start/stop dates in the past. Please revise/remove those dates. \n {{+B}}{{+R}}" || All_OMPMedsWithBadDates at alert_details; ;; end: