Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PXRMNTFY

PXRMNTFY.m

Go to the documentation of this file.
  1. PXRMNTFY ;SLC/PKR - Routines for notifications. ;07/25/2012
  1. ;;2.0;CLINICAL REMINDERS;**24**;Feb 04, 2005;Build 193
  1. ;
  1. ;========================
  1. DELOPEN(DFN,ORN) ;Delete open OE/RR Notifications.
  1. N ALIST,IND,ORID,XQAID
  1. ;DBIA #10081
  1. D PATIENT^XQALERT("ALIST",DFN)
  1. F IND=1:1:ALIST D
  1. . S XQAID=$P(ALIST(IND),U,2)
  1. . S ORID=$P(XQAID,";",1)
  1. . I $P(ORID,",",3)=ORN D DELETE^XQALERT
  1. Q
  1. ;
  1. ;========================
  1. SUICIDE(EVENT,DFN,VISIT) ;Send an alert if the patient attempted or
  1. ;completed suicide, as marked by a health factor. This is called
  1. ;from DATACHGR^PXRMPINF which is invoked by the protocol PXK VISIT
  1. ;DATA EVENT.
  1. N DATE,HAFIEN,HFBIEN,HFSAIEN,HFSCIEN,MSG,VHFIEN
  1. S HFSAIEN=$$FIND1^DIC(9999999.64,"","","MH SUICIDE ATTEMPTED")
  1. S HFSCIEN=$$FIND1^DIC(9999999.64,"","","MH SUICIDE COMPLETED")
  1. S (MSG,VHFIEN)=""
  1. F S VHFIEN=$O(^XTMP(EVENT,VISIT,"HF",VHFIEN)) Q:VHFIEN="" D
  1. . S HFAIEN=$P($G(^XTMP(EVENT,VISIT,"HF",VHFIEN,0,"AFTER")),U,1)
  1. . S HFBIEN=$P($G(^XTMP(EVENT,VISIT,"HF",VHFIEN,0,"BEFORE")),U,1)
  1. .;If after is null then the health factor has been deleted so delete
  1. .;any open alerts.
  1. . I HFAIEN="",HFBIEN'="" D DELOPEN^PXRMNTFY(DFN,77) Q
  1. .;If the before and after are the same the HF is not new so do not
  1. .;send the alert.
  1. . I HFAIEN=HFBIEN Q
  1. . I HFAIEN=HFSAIEN S MSG="Suicide attempted"
  1. . I HFAIEN=HFSCIEN S MSG="Suicide completed"
  1. I MSG="" Q
  1. ;DBIA #2028
  1. S DATE=$P(^AUPNVSIT(VISIT,0),U,1)
  1. ;If DATE is more than 30 days in the past do not send the alert.
  1. I $$FMDIFF^XLFDT(DT,DATE)>30 Q
  1. S MSG=MSG_" on "_$$FMTE^XLFDT(DATE,"5Z")
  1. ;DBIA #1362
  1. D EN^ORB3(77,DFN,"","",MSG,"")
  1. Q
  1. ;