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

XQALERT.m

Go to the documentation of this file.
  1. XQALERT ;ISF/JLI,ISD/HGW - ALERT HANDLER ;05/29/13 11:21
  1. ;;8.0;KERNEL;**1,65,125,173,285,366,513,602,632**;Jul 10, 1995;Build 3
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. SETUP ;SR.
  1. D SETUP^XQALSET
  1. Q
  1. ;
  1. SETUP1() ;SR.
  1. N I S I=$$SETUP1^XQALSET()
  1. Q I
  1. ;
  1. DISPLAY ;SR. Display recent new alerts
  1. ; ZEXCEPT: XQAUSER - global variable
  1. N X1,X2,XQACNT,XQJ
  1. I '$D(XQAUSER) S XQAUSER=DUZ
  1. I $$ACTVSURO^XQALSURO(XQAUSER)'>0 D RETURN^XQALSUR1(XQAUSER) ; P513
  1. Q:$O(^XTV(8992,DUZ,"XQA",0))'>0
  1. N X,XQI,XQX,XQX1,DIR,XQA,Y,XQON,XQOFF,XQ1ON,XQ1OFF,XQXDAT S XQX=0,XQX1=0,Y=1,DIR(0)="E" ; P285
  1. S XQACNT=0 D SORT
  1. F XQJ=0:0 D:XQX1&'(XQX1#20) ^DIR Q:'Y S XQJ=$O(^TMP("XQ",$J,"XQA",XQJ)) Q:XQJ'>0 S XQI=^TMP("XQ",$J,"XQA",XQJ),XQX=XQX+1,X=$G(^XTV(8992,XQAUSER,"XQA",XQI,0)) I $P(X,U,4) D
  1. . N XQXXX,XQXX,XQXY
  1. . S XQXXX=X,(XQXX,XQXY)=0,XQXX=$P(X,U,2) I XQXX'="" S XQXX=$O(^XTV(8992.1,"B",$E(XQXX,1,50),0)) I XQXX>0 S XQXY=$O(^XTV(8992.1,XQXX,20,"B",XQAUSER,0)) I XQXY>0 S XQXDAT=$$NOW^XLFDT(),$P(^XTV(8992.1,XQXX,20,XQXY,0),U,2)=XQXDAT ; P173
  1. . S XQON="$C(0)",XQOFF="$C(0)"
  1. . I $$CHKCRIT^XQALSUR2(XQXXX) D:'$D(XQ1ON) SETREV S XQON=XQ1ON,XQOFF=XQ1OFF ; P513 modified to add use data from file 8992.3 for identifying critical alerts
  1. . S X=XQXXX W:XQX1=0 $C(7) W !,@XQON,$P(X,U,3),@XQOFF S XQX1=XQX1+1,$P(^XTV(8992,XQAUSER,"XQA",XQI,0),U,4)="" I $D(^(2)) S X1=^(2) D ; P285
  1. . . S X2=$P(X1,U,3)
  1. . . W !?5,"*** FORWARDED BY: ",$P(^VA(200,+X1,0),U)," Generated: " S X1=$P($P(X,U,2),";",3) W $$DAT8(X1,1)
  1. . . I X2'="" W !?5,X2
  1. . I $P(X,U,5)="D" S XQA=$P(X,U,2) K ^XTV(8992,XQAUSER,"XQA",XQI) D S XQX=XQX-1 D:XQA'="" D
  1. . . I $G(XQXX)>0,$G(XQXY)>0 S $P(^XTV(8992.1,XQXX,20,XQXY,0),U,5)=XQXDAT
  1. . K XQXX,XQXY
  1. I XQX>0 W:XQX1=0 !!,"You have PENDING ALERTS" W !?10,"Enter ""VA to jump to VIEW ALERTS option",! ; ISL-0898-51279
  1. W:XQX1>0 !
  1. K XQI,XQX,XQX1,DIR,XQA,Y
  1. Q
  1. ;
  1. SORT ;SR. Sort alerts
  1. ; ZEXCEPT: XQAUSER,XQACNT - global variable
  1. N XQI,XQJ,XQX
  1. Q:$O(^XTV(8992,XQAUSER,"XQA",0))'>0
  1. K ^TMP("XQ",$J,"XQA")
  1. F XQI=9999999.999999:0 S XQI=$O(^XTV(8992,XQAUSER,"XQA",XQI),-1) Q:(XQI'>0)!(XQACNT>100) D ; P632 sort recent alerts
  1. . S XQX=^XTV(8992,XQAUSER,"XQA",XQI,0) ; zero node for the alert
  1. . S XQACNT=XQACNT+1
  1. . I $$CHKCRIT^XQALSUR2(XQX) D
  1. . . S XQJ=XQACNT ; critical alert
  1. . E D
  1. . . S XQJ=500000+XQACNT ; normal alert
  1. . S ^TMP("XQ",$J,"XQA",XQJ)=XQI ; IEN of the alert
  1. Q
  1. ;
  1. D ;
  1. ; ZEXCEPT: XQA
  1. K ^XTV(8992,"AXQA",XQA,DUZ),^XTV(8992,"AXQAN",$P(XQA,";"),DUZ)
  1. Q
  1. ;
  1. DAT8(FMDAT,TFLG) ;
  1. N X
  1. S X=$E(FMDAT,4,5)_"/"_$E(FMDAT,6,7)_"/"_$E(FMDAT,2,3)
  1. I $G(TFLG)>0 S FMDAT=FMDAT_"0000000",X=X_" "_$E(FMDAT,9,10)_":"_$E(FMDAT,11,12)_":"_$E(FMDAT,13,14)
  1. Q X
  1. ;
  1. DOIT ;OPT. Process Alerts [XQALERT]
  1. N XQALAST,XQALFWD,XQAUSER
  1. S XQAUSER=DUZ D DOIT^XQALERT1,COUNT^XQALDEL(0,XQAUSER)
  1. Q
  1. ;
  1. DELETE ;
  1. D DELETE^XQALDEL
  1. Q
  1. ;
  1. DELETEA ;
  1. D DELETEA^XQALDEL
  1. Q
  1. ;
  1. OLDDEL ;OPT.
  1. D OLDDEL^XQALDEL
  1. Q
  1. ;
  1. USERDEL ;OPT.
  1. D USERDEL^XQALDEL
  1. Q
  1. ;
  1. USER(ROOT,XQAUSER,FRSTDATE,LASTDATE) ; Returns current alerts for the user in an array located under root
  1. I '$D(XQAUSER) S XQAUSER=DUZ
  1. I $$ACTVSURO^XQALSURO(XQAUSER)'>0 D RETURN^XQALSUR1(XQAUSER) ; P366
  1. D GETUSER^XQALDATA(ROOT,XQAUSER,$G(FRSTDATE),$G(LASTDATE))
  1. Q
  1. ;
  1. PATIENT(ROOT,PATIENT,FRSTDATE,LASTDATE) ;
  1. I $G(PATIENT)'>0 Q
  1. D GETPAT^XQALDATA(ROOT,PATIENT,$G(FRSTDATE),$G(LASTDATE))
  1. Q
  1. ;
  1. ACTION(ALERTID) ;
  1. D ACTION^XQALDOIT(ALERTID)
  1. Q
  1. ;
  1. GETACT(ALERTID) ; Return to calling routine the information needed to act on the specified alert.
  1. ; On return the following variables are defined:
  1. ; XQAID = the full alert id
  1. ; XQADATA = Any data passed as XQADATA at the time the alert was generated
  1. ; XQAROU = Indicates routine to be run (includes tag if necessary)
  1. ; This value may have three meanings
  1. ; 1. A null value indicates no routine to be used (XQAOPT contains option name to be run)
  1. ; 2. A value of ^<space> indicates that the alert is information only (no routine or option action involved).
  1. ; 3. The name of the routine as ^ROUTINE or TAG^ROUTINE
  1. ; XQAOPT = Indicates the name of the option to be run if not null.
  1. ;
  1. ; ZEXCEPT: XQADATA,XQAID,XQAOPT,XQAROU
  1. N XQX,XQZ,XQAGETAC
  1. S XQAGETAC=1,XQX="",XQZ=""
  1. D ACTION^XQALDOIT(ALERTID)
  1. S XQAID=$P(XQX,U,2)
  1. S XQADATA=$S(XQZ'="":XQZ,1:$P(XQX,U,9,99))
  1. S XQAROU=$S($P(XQX,U,8)="":"",1:$P(XQX,U,7,8))
  1. S XQAOPT=$S($P(XQX,U,8)="":$P(XQX,U,7),1:"")
  1. Q
  1. ;
  1. SETREV ; Set on (XQ1ON) and off (XQ1OFF) variables for Reverse video ; P285
  1. ; ZEXCEPT: IOST,XQ1OFF,XQ1ON - global variables
  1. N XQ1ON1,XQ1OFF1
  1. S XQ1ON="$C(0)",XQ1OFF="$C(0)" I IOST(0)>0 D
  1. . S XQ1ON1=$$GET1^DIQ(3.2,IOST(0)_",",14) I XQ1ON1'="" S XQ1ON=XQ1ON1
  1. . S XQ1OFF1=$$GET1^DIQ(3.2,IOST(0)_",",15) I XQ1OFF1'="" S XQ1OFF=XQ1OFF1
  1. . Q
  1. Q