source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XQALDATA.m@ 623

Last change on this file since 623 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 1.9 KB
Line 
1XQALDATA ;ISC-SF/JLI - PROVIDE DATA ON ALERTS ;9/9/03 15:13
2 ;;8.0;KERNEL;**207,285**;Jul 10, 1995
3 Q
4GETUSER(ROOT,XQAUSER,FRSTDATE,LASTDATE) ;
5 N XREF,XVAL
6 S:$G(XQAUSER)'>0 XQAUSER=DUZ
7 S:$G(FRSTDATE)'>0 FRSTDATE=0
8 S:$G(LASTDATE)'>0 LASTDATE=0
9 S NCNT=0 K @ROOT
10 I FRSTDATE=0 D Q
11 . F I=0:0 S I=$O(^XTV(8992,XQAUSER,"XQA",I)) Q:I'>0 S X=^(I,0),X3=$G(^(3)) D
12 . . S NCNT=NCNT+1
13 . . S @ROOT@(NCNT)=$S($P(X3,U)'="":"G ",$P(X,U,7,8)="^ ":"I ",1:" ")_$P(X,U,3)_U_$P(X,U,2)
14 . S @ROOT=NCNT
15 S XREF="R"
16 S XVAL=XQAUSER
17 D CHKTRAIL
18 Q
19GETPAT(ROOT,PATIENT,FRSTDATE,LASTDATE) ;
20 N XREF,XVAL
21 S NCNT=0 K @ROOT
22 I $G(PATIENT)'>0 S @ROOT=0 Q
23 S XREF="C"
24 S XVAL=PATIENT
25 D CHKTRAIL
26 Q
27CHKTRAIL ;
28 F XQ1=0:0 S XQ1=$O(^XTV(8992.1,XREF,XVAL,XQ1)) Q:XQ1'>0 D
29 . S X=$G(^XTV(8992.1,XQ1,0)),X1=$G(^(1)),X3=$G(^(3)) Q:X=""
30 . I FRSTDATE'>0,'$D(^XTV(8992,"AXQA",$P(X,U))) Q
31 . I FRSTDATE>0,$P(X,U,2)<FRSTDATE Q
32 . I FRSTDATE>0,LASTDATE>0,$P(X,U,2)>LASTDATE Q
33 . S NCNT=NCNT+1
34 . S @ROOT@(NCNT)=$S($P(X3,U)'="":"G ",$P(X1,U,2,3)="^":"I ",$P(X1,U,2,3)="":"I ",1:" ")_$P(X1,U)_U_$P(X,U)
35 S @ROOT=NCNT
36 Q
37GETUSER1(ROOT,XQAUSER,FRSTDATE,LASTDATE) ;
38 N NCNT,KEY
39 S:$G(XQAUSER)'>0 XQAUSER=DUZ
40 S:$G(FRSTDATE)'>0 FRSTDATE=0
41 S:$G(LASTDATE)'>0 LASTDATE=0
42 S NCNT=0 K @ROOT
43 I FRSTDATE=0 D Q
44 . N X,X2,X3,X4,I S I="" F S I=$O(^XTV(8992,XQAUSER,"XQA",I),-1) Q:I'>0 S X=^(I,0),X2=$G(^(2)),X3=$G(^(3)),X4=$D(^(4)) D
45 . . I $P(X,U,4)'="" S $P(^XTV(8992,XQAUSER,"XQA",I,0),U,4)="" ; MARK SEEN
46 . . S NCNT=NCNT+1
47 . . S KEY=$S($P(X3,U)'="":"G ",X4>1:"L ",$P(X,U,7,8)="^ ":"I ",1:"R "),@ROOT@(NCNT)=KEY_$P(X,U,3)_U_$P(X,U,2)
48 . . I X2'="" D
49 . . . S NCNT=NCNT+1,@ROOT@(NCNT)=KEY_"-----Forwarded by: "_$$GET1^DIQ(200,($P(X2,U)_","),.01)_" Generated: "_$$DAT8^XQALERT($P(X2,U,2),1)_U_$P(X,U,2)
50 . . . I $P(X2,U,3)'="" S NCNT=NCNT+1,@ROOT@(NCNT)=KEY_"-----"_$P(X2,U,3)_U_$P(X,U,2)
51 . . . Q
52 . S @ROOT=NCNT
53 . Q
54 Q
Note: See TracBrowser for help on using the repository browser.