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/XQARPRT2.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 8.8 KB
Line 
1XQARPRT2 ;DCN/BUF,JLI/OAK-OIFO - LOOKUP PROVIDER ALERTS ;4/9/07 10:16
2 ;;8.0;KERNEL;**316,443**;Jul 10, 1995;Build 4
3 ; Based on the original routine AEKALERT
4 Q
5EN ; OPT - interactive lists alerts from start date for a single user based on contents of alert tracking file
6 N DIR,XQADOC S DIR(0)="PO^200:EMZ" D ^DIR K DIR Q:$D(DIRUT) Q:Y'>0 S XQADOC=+Y
7EN1 ;
8 N XQASDATE,XQAWORDS,XQADISP,%ZIS,ZTRTN,ZTDESC,ZTSAVE,POP,XQAU1N4
9 D DATES Q:Y'>0
10 D WORDS() Q:$D(DIRUT) K Y
11 S %ZIS="MQ" D ^%ZIS Q:POP I $D(IO("Q")) K IO("Q") S ZTRTN="DQ1^XQARPRT2",ZTDESC="List of User Alerts",ZTSAVE("*")="" D ^%ZTLOAD W:$G(ZTSK)>0 !,"Task number is ",ZTSK K ZTSK Q
12DQ1 ;
13 N XQANWID,XQAIEN,XQADATE,XQANODE0,XQACTR,HEADERID,XQATOT
14 S HEADERID="User "_$$GET1^DIQ(200,XQADOC_",",.01)_" (DFN="_XQADOC_")"
15 U IO
16 D HEADER(HEADERID,1)
17 S XQAIEN=$O(^XTV(8992.1,"D",XQASDATE-.0000001)) I XQAIEN>0 S XQAIEN=$O(^(XQAIEN,0)) ; find starting point instead of having to work up through x-ref
18 I XQAIEN>0 F S XQAIEN=$O(^XTV(8992.1,"R",XQADOC,XQAIEN)) Q:XQAIEN'>0 D Q:$D(DIRUT)!(XQADATE>XQAEDATE)
19 . S XQANODE0=$G(^XTV(8992.1,XQAIEN,0)),XQADATE=$P(XQANODE0,"^",2) Q:(XQADATE<XQASDATE)!(XQADATE>XQAEDATE)
20 . D PRNTATRK(XQAIEN)
21 D HEADER(HEADERID,0)
22 D ^%ZISC
23 K XQADATE,XQACTR,DATA,DIR,DIRUT,XQADOC,XQAIEN,XQANODE0,XQASDATE,Y
24 Q
25 ;
26WORDS(TYPE) ; Allow user to select alerts containing only certain words
27 S DIR(0)="Y",DIR("A")="Do you want to "_$S($G(TYPE)'="":"count",1:"list")_" only alerts containing specific words or phrase(s)"
28 S DIR("?",1)="You can enter one or more words or phrases which you want to be used to"
29 S DIR("?",2)="select the alerts to be listed. If you enter NO, all for the selected"
30 S DIR("?",3)="individual in the selected time period will be selected. If you enter"
31 S DIR("?",4)="YES, you will be prompted to enter a word or phrase. You will be prompted"
32 S DIR("?",5)="again, and you may enter as many word or phrase entries as you want."
33 S DIR("?",6)="Comparisons will NOT be case specific."
34 S DIR("?",7)=""
35 S DIR("?",8)="HOWEVER ALL WORDS OR PHRASES ENTERED MUST BE IN THE MESSAGE FOR AN ALERT"
36 S DIR("?")="TO BE SELECTED."
37 D ^DIR K DIR Q:Y'>0
38 ;
39 F J=1:1 W:J>1 !?7,"--- OR ---",!,"Enter another set of words or phrases that should",!,"be matched independently of the previous entr"_$S(J>2:"ies",1:"y") D Q:'$D(XQAWORDS(J))
40 . W !?10,"ALL words or phrases connected by -AND- must appear in the",!?10,"message for an alert to be selected"
41 . S DIR("?",1)="Enter a word, at least three characters long, or phrase, without regard to"
42 . S DIR("?",2)="case, that you want to be required for selection of alerts to be listed."
43 . S DIR("?",3)="If more than one word or phrase are specified, ALL of them must be in alerts"
44 . S DIR("?")="which will be listed."
45 . F I=1:1 S DIR(0)="FO^3:",DIR("A")="Enter "_$S(I=1:"a",1:"another")_" word or phrase" W:I>1 !?10,"-AND-" D ^DIR Q:(Y="")!(Y["^") S XQAWORDS(J,I)=$$UP^XLFSTR(Y)
46 . K DIR,DIRUT
47 . Q
48 ;
49 I $D(XQAWORDS)>1,$G(TYPE)="" D
50 . S DIR(0)="SO^1:Both Action and Info Only;2:Action Alerts;3:Info Only Alerts",DIR("?",1)="Select whether alerts listed should be alerts involving actions (2), info",DIR("?")="only or text only alerts (3), or both (1)."
51 . S DIR("A")="Select Alert Type(s) desired",DIR("B")=1 D ^DIR K DIR S:Y'>0 Y=1 K DIRUT S XQADISP=+Y
52 . Q
53 Q
54 ;
55USER ;USER ENTRY POINT
56 N DIR,XQADOC S XQADOC=DUZ
57 G EN1
58 ;
59DATES ;
60 S DIR(0)="DO^::EX",DIR("B")="TODAY",DIR("A")="START DATE" D ^DIR K DIR Q:Y'>0 S XQASDATE=+Y
61 I XQASDATE<$$OLDEST() W !?10,"The earliest date in the alert tracking file is ",$$FMTE^XLFDT($$OLDEST(),"D") S XQASDATE=$$OLDEST()
62 I $D(XQA1U4N) W !,"*** WARNING ***: Do not specify too many days - each entry in the Alert Tracking",!,"file must be checked for the date range specified.",! S DIR("B")=$$FMTE^XLFDT(XQASDATE)
63 S DIR(0)="DO^"_XQASDATE_":DT",DIR("A")="END DATE" D ^DIR K DIR Q:$D(DIRUT) I Y>0 S XQAEDATE=Y+.24
64 Q
65 ;
66PRNTATRK(IEN) ; Print data for an entry from the alert tracking file
67 N XQANODE0,XQADATE,Y,XQANEN,XQAMSG,XQAOPT,XQAROU,XQAMSGUC
68 S XQANODE0=$G(^XTV(8992.1,IEN,0)),XQADATE=$P(XQANODE0,"^",2)
69 S XQAMSG=$G(^XTV(8992.1,IEN,1)),XQAOPT=$P(XQAMSG,U,2),XQAROU=$P(XQAMSG,U,3,4),XQAMSG=$P(XQAMSG,U)
70 S XQAOPT=$S(XQAOPT>0:" [OPT]",1:"") S XQAROU=$S((XQAROU'="")&(XQAROU'="^"):" [ROU]",1:"") S XQAOPT=$S(XQAOPT'="":XQAOPT,XQAROU'="":XQAROU,1:" ")
71 I $D(XQAWORDS)>1 S XQAMSGUC=$$UP^XLFSTR(XQAMSG) D Q:XQAMSGUC=""
72 . N XQAMSG1,J,I S XQAMSG1=XQAMSGUC F J=0:0 S J=$O(XQAWORDS(J)) Q:J'>0 S XQAMSGUC=XQAMSG1 D Q:XQAMSGUC'=""
73 . . F I=0:0 S I=$O(XQAWORDS(J,I)) Q:I'>0 I XQAMSGUC'[XQAWORDS(J,I) S XQAMSGUC="" Q
74 . . I XQAMSGUC'="",XQADISP'=1 D
75 . . . I XQADISP=2,XQAOPT="",XQAROU="" S XQAMSGUC=""
76 . . . I XQADISP=3,(XQAOPT'="")!(XQAROU'="") S XQAMSGUC=""
77 . . . Q
78 . . Q
79 . Q
80 S XQANEN=$$FMTE^XLFDT(XQADATE,"5Z")_XQAOPT_" ien="_IEN
81 W !,$E(XQAMSG,1,IOM-1) W !?35,XQANEN S XQATOT=XQATOT+1
82 S XQACTR=XQACTR+2 I XQACTR>(IOSL-4) D Q:$D(DIRUT) S XQACTR=0
83 . I $D(ZTQUEUED) W @IOF
84 . E U IO(0) S DIR(0)="E" D ^DIR K DIR W !
85 . U IO
86 . Q
87 Q
88 ;
89HEADER(XQANAME,DOFF) ; Output header at start of report XQANAME indicates who report is for
90 W:DOFF @IOF W:'DOFF ! W $S('DOFF:"Found "_XQATOT_" ",1:""),$S($D(XQAWORDS)>1:"Selected ",1:""),"Alerts for ",XQANAME,!," for dates ",$$FMTE^XLFDT(XQASDATE)," through "
91 N OUTDATE S OUTDATE=$$FMTE^XLFDT(XQAEDATE,"D") I 'DOFF,$D(XQADATE),XQADATE<XQAEDATE,'$D(ZTQUEUED) S OUTDATE=$$FMTE^XLFDT(XQADATE)
92 W OUTDATE S XQACTR=2
93 D WORDHDR
94 W ! S XQACTR=XQACTR+1
95 S XQATOT=0
96 Q
97 ;
98WORDHDR ;
99 N I,J
100 F I=0:0 S I=$O(XQAWORDS(I)) Q:I'>0 W:I>1 !?10,"--- OR ---" D
101 . F J=0:0 S J=$O(XQAWORDS(I,J)) Q:J'>0 W !?5,$S(J=1:"Selected alerts containing:",1:" and containing:"),?35,XQAWORDS(I,J) S XQACTR=XQACTR+1
102 . Q
103 Q
104DTPT ; OPT - GIVEN DATE AND PATIENT, TAKE A LOOK AT ALL USING 'D' X-REF
105 ; for one day and for 1 patient list data in alert tracking file related to patient
106 N DIR,XQANAME,XQADFN,XQA1U4N,XQASDATE,XQAEDATE,XQA1U4NP,XQAWORDS
107 S DIR(0)="PO^2:EMZ" D ^DIR Q:Y'>0 S XQANAME=$P(Y,"^",2),XQADFN=+Y,XQA1U4N=$$GET1^DIQ(2,XQADFN_",",.0905),XQA1U4NP="("_XQA1U4N_")"
108 D CHEKSCAN(XQADFN) Q:$D(DIRUT)
109 D DATES Q:Y'>0
110 D WORDS() K Y Q:$D(DIRUT)
111 S %ZIS="MQ" D ^%ZIS Q:POP I $D(IO("Q")) K IO("Q") S ZTRTN="DTPTDQ^XQARPRT2",ZTDESC="List of Patient Alerts",ZTSAVE("*")="" D ^%ZTLOAD W:$G(ZTSK)>0 !,"Task number is ",ZTSK K ZTSK Q
112DTPTDQ ;
113 N XQANWID,FOUND,ONE,ZERO,XQACTR,XQAIEN,XQATYPE,XQADATE,HEADERID,XQATOT
114 S HEADERID="Patient "_$$GET1^DIQ(2,XQADFN_",",.01)_" ("_$$GET1^DIQ(2,XQADFN_",",.0905)_")"
115 D HEADER(HEADERID,1)
116 S XQADATE=XQASDATE-0.0000001 F S XQADATE=$O(^XTV(8992.1,"D",XQADATE)) Q:(XQADATE'>0)!(XQADATE>XQAEDATE) D Q:$D(DIRUT)
117 . S XQAIEN=0 F S XQAIEN=$O(^XTV(8992.1,"D",XQADATE,XQAIEN)) Q:XQAIEN="" S ONE=$G(^XTV(8992.1,XQAIEN,1)),ZERO=$G(^(0)),XQATYPE=$E(ZERO,1,3) D Q:$D(DIRUT)
118 . . S FOUND=0
119 . . I (XQATYPE="DVB")!(XQATYPE="OR,") I $P(ZERO,U,4)=XQADFN S FOUND=1
120 . . I (XQATYPE="GMA"),$P(ONE,U)[XQANAME S FOUND=1
121 . . I (XQATYPE="TIU"),$P(ONE,U)[$E(XQANAME,1,9),$P(ONE,U)[XQA1U4NP S FOUND=1
122 . . I FOUND D PRNTATRK(XQAIEN)
123 . . Q
124 . Q
125 D HEADER(HEADERID,0)
126 Q
127 ;
128CHEKSCAN(XQADFN) ; Output a list of dates when OR, and DVB alerts are found
129 N DIR,OLDEST,X,Y,XQASDATE,XX,CNT,COL,BASECNT,I
130 W !!! S DIR(0)="Y",DIR("A")="Do you want to scan for a list of dates that have at least some alerts for this patient",DIR("A",1)="The quick scan method used here will not pick up some alerts,"
131 S DIR("A",2)="but should give an indication of when alerts might be found.",DIR("A",3)=""
132 D ^DIR K DIR Q:$D(DIRUT) I Y D
133 . K ^TMP("XQARPRT2",$J)
134 . N OLDEST S OLDEST=$$FMTE^XLFDT($$OLDEST(),"5DZ")
135 . S DIR(0)="SO^;1:1 Week ago;2:1 month ago;3:3 months ago;4:6 months ago;5:1 year ago;6:As far back as possible",DIR("A")="Select a period for starting",DIR("A",1)="The oldest entry in your Alert Tracking file is from "_OLDEST,DIR("A",2)=""
136 . D ^DIR K DIR Q:Y'>0
137 . S X=$S(Y=1:"1W",Y=2:"1M",Y=3:"3M",Y=4:"6M",Y=5:"12M",1:"1000M"),X="T-"_X D ^%DT S XQASDATE=Y
138 . F I=0:0 S I=$O(^XTV(8992.1,"C",XQADFN,I)) Q:I'>0 S ZERO=$P(^XTV(8992.1,I,0),U,2) I ZERO'<XQASDATE S ^TMP("XQARPRT2",$J,(ZERO\1))=$G(^TMP("XQARPRT2",$J,(ZERO\1)))+1
139 . ; Output date and number found in vertical columns, with (if lots of dates) three columns per screen
140 . I $D(^TMP("XQARPRT2",$J)) W !,"Dates and number of alerts found in () [may not be all of them]"
141 . ; S CNT=0,COL=1,BASECNT=0 F I=0:0 S I=$O(^TMP("XQARPRT2",$J,I)) Q:I'>0 S CNT=CNT+1,XX(CNT)=$G(XX(CNT))_$$FMTE^XLFDT(I,"5DZ")_" ("_^(I)_")"_" " I (CNT-BASECNT)>(IOSL-4) S COL=COL+1 S:'(COL#3) BASECNT=CNT S CNT=BASECNT
142 . S CNT=2 F I=0:0 S I=$O(^TMP("XQARPRT2",$J,I)) Q:I'>0 S CNT=CNT+1,XX(CNT\3)=$G(XX(CNT\3))_$$FMTE^XLFDT(I,"5DZ")_" ("_^(I)_")"_" "
143 . F I=0:0 S I=$O(XX(I)) Q:I'>0 W !,XX(I)
144 . Q
145 Q
146 ;
147VIEWTRAK ; OPT. View an entry in the Alert Tracking file in Captioned mode
148 D VIEWTRAK^XQARPRT1
149 Q
150 ;
151OLDEST() ; Returns date of oldest entry in alert tracking file
152 Q $$OLDEST^XQARPRT1()
Note: See TracBrowser for help on using the repository browser.