source: FOIAVistA/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@ 1061

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

initial load of FOIAVistA 6/30/08 version

File size: 2.1 KB
Line 
1XQALDATA ;ISC-SF/JLI - PROVIDE DATA ON ALERTS ;4/9/07 13:39
2 ;;8.0;KERNEL;**207,285,443**;Jul 10, 1995;Build 4
3 Q
4GETUSER(ROOT,XQAUSER,FRSTDATE,LASTDATE) ;
5 N XREF,XVAL,X,X2,X3,I,NCNT ; P443
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)),X2=$G(^(2)) 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)_$S($P(X2,U,3)'="":U_$P(X2,U,3),1:"") ; P443
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,NCNT
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 N XQ1,X,X1,X2,X3
29 ; ZEXCEPT: FRSTDATE,LASTDATE,NCNT,ROOT,XREF,XVAL -- from GETPAT or GETUSER
30 F XQ1=0:0 S XQ1=$O(^XTV(8992.1,XREF,XVAL,XQ1)) Q:XQ1'>0 D
31 . S X=$G(^XTV(8992.1,XQ1,0)),X1=$G(^(1)),X3=$G(^(3)),X2=$G(^(2)) Q:X=""
32 . I FRSTDATE'>0,'$D(^XTV(8992,"AXQA",$P(X,U))) Q
33 . I FRSTDATE>0,$P(X,U,2)<FRSTDATE Q
34 . I FRSTDATE>0,LASTDATE>0,$P(X,U,2)>LASTDATE Q
35 . S NCNT=NCNT+1
36 . 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)_$S($P(X2,U,3)'="":U_$P(X2,U,3),1:"") ; P443
37 S @ROOT=NCNT
38 Q
39GETUSER1(ROOT,XQAUSER,FRSTDATE,LASTDATE) ;
40 N NCNT,KEY
41 S:$G(XQAUSER)'>0 XQAUSER=DUZ
42 S:$G(FRSTDATE)'>0 FRSTDATE=0
43 S:$G(LASTDATE)'>0 LASTDATE=0
44 S NCNT=0 K @ROOT
45 I FRSTDATE=0 D Q
46 . 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
47 . . I $P(X,U,4)'="" S $P(^XTV(8992,XQAUSER,"XQA",I,0),U,4)="" ; MARK SEEN
48 . . S NCNT=NCNT+1
49 . . 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)
50 . . I X2'="" D
51 . . . 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)
52 . . . I $P(X2,U,3)'="" S NCNT=NCNT+1,@ROOT@(NCNT)=KEY_"-----"_$P(X2,U,3)_U_$P(X,U,2)
53 . . . Q
54 . S @ROOT=NCNT
55 . Q
56 Q
Note: See TracBrowser for help on using the repository browser.