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/XQARPRT1.m@ 1492

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

initial load of FOIAVistA 6/30/08 version

File size: 9.2 KB
Line 
1XQARPRT1 ;sgh/mtz,JLI/OAK_OIFO-ROUTINE TO PROVIDE COUNTS OF ALERTS ; 2/17/04 7:57am
2 ;;8.0;KERNEL;**316,338**;Jul 10, 1995
3 ; based on an original routine AMNUALT
4EN1 ; OPT - generates a listing of the number of alerts a user has as well as last sign-on date, number of critical and/or abnomal imaging alerts, and the date of the oldest alert
5 N XQACRIT S XQACRIT=0
6EN2 ;
7 N XQASDT,XQAEDT,XQAC1,XQAORDER,Y,DIR,%ZIS,POP,ZTSAVE,ZTDESC,ZTRTN
8 N SHOWDIV,DIVISION,I,DATE,DIRUT,SERVICE,SERVSRT,ALLSERV,XQAWORDS
9 I 'XQACRIT D WORDS^XQARPRT2("A") K Y
10 S DIR(0)="NO",DIR("A")="Display users whose "_$S(XQACRIT:"CRITICAL ",1:"")_"ALERT count is at least"
11 S DIR("B")=$S(XQACRIT:10,1:100) D ^DIR K DIR Q:Y'>0 S XQAC1=Y
12 D DATES Q:Y'>0
13 D QUERYDIV Q:$D(DIRUT) D ORDER Q:XQAORDER'>0
14 S %ZIS="MQ" D ^%ZIS Q:POP I $D(IO("Q")) K IO("Q") S ZTRTN="DQ1^XQARPRT1",ZTDESC="How Many "_$S(XQACRIT:"Critical ",1:"")_"Alerts",ZTSAVE("*")="" D ^%ZTLOAD W:$G(ZTSK)>0 !,"Task number is ",ZTSK K ZTSK Q
15 G DQ1
16 ;
17CRITICAL ; OPT - generates a listing of users with more than a specified number of alerts containing CRITICAL or ABNORMAL IMAGING
18 N XQACRIT S XQACRIT=1
19 G EN2
20 ;
21DATES ;
22 S DIR(0)="DO",DIR("A")="START DATE"
23 D ^DIR K DIR Q:Y'>0
24 S XQASDT=Y
25 S DIR(0)="DO^"_XQASDT_":DT",DIR("A")="END DATE"
26 D ^DIR K DIR Q:Y'>0
27 S XQAEDT=Y_".24"
28 Q
29 ;
30QUERYDIV ;
31 S DIR(0)="Y",DIR("A")="Breakout by One or More Divisions",DIR("?")="Entering YES will result in the entries being grouped by DIVISION." D ^DIR K DIR S DIVISION=+Y Q:$D(DIRUT)
32 I DIVISION D Q:SHOWDIV'>0
33 . S DIR(0)="Y",DIR("A")="Show ALL Divisions",DIR("?",1)="Entering YES will result in the analysis being performed for ALL Divisons,",DIR("?")="A NO will result in prompts to select which division(S) you want listed."
34 . D ^DIR K DIR I +Y D I 1
35 . . S DIR(0)="S^1:Show only as 'Multiple Division';2:Show in EACH Division",DIR("A")="If a user has more than one division"
36 . . S DIR("?",1)="If New Person entries have multiple divisions, entering 1 will result in",DIR("?",2)="those entries being shown only under a heading of 'These users are assigned"
37 . . S DIR("?",3)="to multiple divisions', while entering 2 will result in the data for a",DIR("?",4)="specific New Person entry being shown under each division heading which",DIR("?")="that entry may select."
38 . . D ^DIR K DIR S SHOWDIV=+Y
39 . . Q
40 . E S SHOWDIV=2 D K DIRUT
41 . . F I=1:1 S DIR(0)="PO^4:EMZ",DIR("A")="Select "_$S(I>1:"Another ",1:"")_"Division: " D ^DIR K DIR Q:Y'>0 S DIVISION($P(Y,U,2))=""
42 . Q
43 Q
44 ;
45ORDER ;
46 S DIR(0)="SO^;1:By Name;2:By Number;3:By Service/Section;",DIR("A")="Select the ordering of results desired",DIR("?",1)="Select a number to indicate how you would like the selected entries to be"
47 S DIR("?",2)="listed by"_$S(DIVISION:" (Within Division)",1:"")_": the New Person entrie's Name; the Number of "_$S(DIVISION:"",1:$S(XQACRIT:"Critical ",1:"")_"Alerts,")
48 S DIR("?")=$S(DIVISION:$S(XQACRIT:"Critical ",1:"")_"Alerts, ",1:"")_"or by Service/Section"
49 D ^DIR K DIR S XQAORDER=+Y
50 I XQAORDER=3 D Q:$D(DIRUT)
51 . S DIR(0)="Y",DIR("A")="Show ALL Service/Sections",DIR("?",1)="Entering YES will result in the analysis being performed for ALL Services,",DIR("?")="A NO will result in prompts to select which Service(s) you want listed."
52 . D ^DIR K DIR Q:$D(DIRUT) S ALLSERV=+Y
53 . I 'ALLSERV D
54 . . S DIR(0)="PO^49:EMZ" F I=1:1 S DIR("A")="Select "_$S(I>1:"Another ",1:"")_"Service/Section" D ^DIR Q:Y'>0 S SERVICE($E($P(Y,U,2),1,17))=""
55 . . K DIR
56 . . Q
57 . S DIR(0)="SO^;1:By Name;2:By Number;",DIR("A")="Within Service/Section order results by" D ^DIR K DIR Q:$D(DIRUT) S SERVSRT=+Y
58 . Q
59 Q
60 ;
61DQ1 ;
62 N XQAGLOB,XQAN1
63 S XQAGLOB=$NA(^TMP("XQARPRT1",$J)) K @XQAGLOB
64 U IO
65 D G1,PRT
66 D ^%ZISC
67 K @XQAGLOB
68 Q
69 ;
70G1 ;gather
71 N COUNT,MSG,DATE
72 F XQAN1=0:0 S XQAN1=$O(^XTV(8992,XQAN1)) Q:XQAN1'>0 D
73 . S COUNT=0,OLDEST=0,NCRIT=0 F I=0:0 S I=$O(^XTV(8992,XQAN1,"XQA",I)) Q:I'>0 D
74 . . S DATE=$P($P(^XTV(8992,XQAN1,"XQA",I,0),U,2),";",3) S:OLDEST=0 OLDEST=DATE\1 I (DATE<XQASDT)!(DATE>XQAEDT) Q
75 . . S MSG=$$UP^XLFSTR($P(^XTV(8992,XQAN1,"XQA",I,0),U,3)) I (MSG["CRITICAL")!(MSG["ABNORMAL IMA") S NCRIT=NCRIT+1
76 . . I $D(XQAWORDS)'>0 S COUNT=COUNT+1
77 . . I $D(XQAWORDS)>1 D I MSG'="" S COUNT=COUNT+1
78 . . . N MSG1,I,J S MSG1=MSG F J=0:0 S J=$O(XQAWORDS(J)) Q:J'>0 S MSG=MSG1 D Q:MSG'=""
79 . . . . F I=0:0 S I=$O(XQAWORDS(J,I)) Q:I'>0 I MSG'[XQAWORDS(J,I) S MSG="" Q
80 . . . . Q
81 . . . Q
82 . . Q
83 . I $S(XQACRIT:NCRIT,1:COUNT)<XQAC1 Q
84 . S VALUE=COUNT_U_XQAN1_U_$$FMTE^XLFDT(OLDEST,"5DZ")_U_NCRIT_U_$$GET1^DIQ(200,XQAN1_",",.01)
85 . I DIVISION D I 1
86 . . K XQARRAY,XQADIV S XQADIV=0 D GETS^DIQ(200,XQAN1_",","16*","","XQARRAY") S:'$D(XQARRAY) XQADIV(0)="",XQADIV=1 I $D(XQARRAY) D
87 . . . N K,L S K="" F S K=$O(XQARRAY(200.02,K)) Q:K="" D
88 . . . . I $D(DIVISION)'>1 S XQADIV(XQARRAY(200.02,K,.01))="",XQADIV=XQADIV+1
89 . . . . E S L=XQARRAY(200.02,K,.01) I $D(DIVISION(L))>0 S XQADIV(L)="",XQADIV=XQADIV+1
90 . . . I XQADIV>1,SHOWDIV=1 K XQADIV S XQADIV(99999)="",XQADIV=1
91 . . . Q
92 . . S K=$S($D(DIVISION)'>1:"",1:0) F S K=$O(XQADIV(K)) Q:K="" S @XQAGLOB@("DIV",K,"NAME",$$GET1^DIQ(200,XQAN1_",",.01)_XQAN1)=VALUE
93 . . Q
94 . E S @XQAGLOB@("NAME",$$GET1^DIQ(200,XQAN1_",",.01)_XQAN1)=VALUE
95 . Q
96 Q
97 ;
98PRT ;print
99 N NAME,NUMBER,LSIGNON,VALUE,XQAGLOB1,DIVNAME
100 S XQAGLOB1=XQAGLOB
101 I DIVISION D I 1
102 . S DIVNAME="" F S DIVNAME=$O(@XQAGLOB@("DIV",DIVNAME)) Q:DIVNAME="" S XQAGLOB1=$NA(@XQAGLOB@("DIV",DIVNAME)) D HEADER,PRTLOC
103 E D HEADER,PRTLOC
104 Q
105 ;
106PRTLOC ;
107 N PRTLOC
108 S PRTLOC=$S(XQAORDER=1:"PRTNAME",XQAORDER=2:"PRTNUMBR",1:"PRTSERVC") D @PRTLOC
109 Q
110 ;
111HEADER ;
112 N XQACTR S XQACTR=0
113 W @IOF W " COUNT of ",$S($D(XQAWORDS)>1:"SELECTED ",1:""),"ALERTS - users with more than ",XQAC1," on ",$$FMTE^XLFDT($$NOW^XLFDT())
114 W !," for date range ",$$FMTE^XLFDT(XQASDT,"5DZ")," to ",$$FMTE^XLFDT(XQAEDT,"5DZ")
115 W !,"CRIT column indicates number of CRITICAL alerts and ABNORMAL IMAGING alerts"
116 D WORDHDR^XQARPRT2
117 W !!,?42,$S($D(XQAWORDS)>1:"Selected",1:" Total"),?70,"Oldest"
118 W !,"Name",?25,"Service/section",?43,"Alerts",?50,"Last Sign-on",?64,"CRIT Alert"
119 W !,"-----------------",?25,"-----------------",?43,"------",?50,"------------",?64,"---- ----------"
120 I $D(DIVNAME) D DIVPRINT
121 Q
122 ;
123PRTNAME ;
124 N NAME,NUMBER,VALUE,XQAN1,NCRIT,OLDEST,LSIGNON
125 S NAME="" F S NAME=$O(@XQAGLOB1@("NAME",NAME)) Q:NAME="" S VALUE=@XQAGLOB1@("NAME",NAME) D PRINTVAL
126 Q
127 ;
128PRTNUMBR ;
129 N NAME,NUMBER,NUMB,VALUE,XQAN1,NCRIT,OLDEST,LSIGNON
130 S NAME="" F S NAME=$O(@XQAGLOB1@("NAME",NAME)) Q:NAME="" D
131 . S NUMBER=$S(XQACRIT:$P(@XQAGLOB1@("NAME",NAME),U,4),1:+@XQAGLOB1@("NAME",NAME))
132 . S @XQAGLOB1@("NUMB",100000-NUMBER,NAME)=@XQAGLOB1@("NAME",NAME)
133 . Q
134 N NUMB S NUMB="" F S NUMB=$O(@XQAGLOB1@("NUMB",NUMB)) Q:NUMB="" S NAME="" F S NAME=$O(@XQAGLOB1@("NUMB",NUMB,NAME)) Q:NAME="" S VALUE=@XQAGLOB1@("NUMB",NUMB,NAME) D PRINTVAL
135 Q
136 ;
137PRTSERVC ;
138 N NAME,NUMBER,NUMB,VALUE,XQAN1,NCRIT,OLDEST,LSIGNON
139 S NAME="" F S NAME=$O(@XQAGLOB1@("NAME",NAME)) Q:NAME="" D
140 . S XQAN1=$P(@XQAGLOB1@("NAME",NAME),U,2)
141 . S SERVICE=$E($$GET1^DIQ(200,XQAN1_",",29),1,17) I SERVICE="" S SERVICE="<No Service>"
142 . I ALLSERV!$D(SERVICE(SERVICE)) D
143 . . I SERVSRT=1 S @XQAGLOB1@("SERV",SERVICE,NAME)=@XQAGLOB1@("NAME",NAME) Q
144 . . I SERVSRT=2 S @XQAGLOB1@("SERV",SERVICE,"NUMB",100000-@XQAGLOB1@("NAME",NAME),NAME)=@XQAGLOB1@("NAME",NAME)
145 . . Q
146 . Q
147 S SERVICE="" F S SERVICE=$O(@XQAGLOB1@("SERV",SERVICE)) Q:SERVICE="" D HEADER D
148 . I SERVSRT=1 S NAME="" F S NAME=$O(@XQAGLOB1@("SERV",SERVICE,NAME)) Q:NAME="" S VALUE=@XQAGLOB1@("SERV",SERVICE,NAME) D PRINTVAL
149 . I SERVSRT=2 F NUMB=0:0 S NUMB=$O(@XQAGLOB1@("SERV",SERVICE,"NUMB",NUMB)) Q:NUMB'>0 D
150 . . S NAME="" F S NAME=$O(@XQAGLOB1@("SERV",SERVICE,"NUMB",NUMB,NAME)) Q:NAME="" S VALUE=@XQAGLOB1@("SERV",SERVICE,"NUMB",NUMB,NAME) D PRINTVAL
151 . . Q
152 . Q
153 Q
154 ;
155PRINTVAL ;
156 N NAME
157 S NUMBER=+VALUE,XQAN1=$P(VALUE,U,2),NCRIT=$P(VALUE,U,4),OLDEST=$P(VALUE,U,3),NAME=$P(VALUE,U,5)
158 S SERVICE=$E($$GET1^DIQ(200,XQAN1_",",29),1,17)
159 S LSIGNON=$$GET1^DIQ(200,XQAN1_",",202)
160 I LSIGNON["@" S LSIGNON=$P(LSIGNON,"@")
161 I $Y>(IOSL-4) W @IOF D HEADER
162 W !,NAME,?25,SERVICE,?43,NUMBER,?50,LSIGNON,?64,NCRIT,?69,OLDEST
163 Q
164 ;
165DIVPRINT ;
166 I $Y>(IOSL-6) D HEADER
167 W !,?5,"Division: ",$S(DIVNAME=0:"These users are not assigned to a division",DIVNAME=99999:"These users are assigned to multiple divisions",1:DIVNAME)
168 Q
169 ;
170OLDEST() ; Returns date of oldest entry in alert tracking file
171 N OLDEST,I,J,FND
172 ; Use cross-ref, since if user data used to create entries in tracking file oldest may not be first in file
173 ; Make sure cross-ref is valid
174 S FND=0 F I=0:0 Q:FND S I=$O(^XTV(8992.1,"D",I)) Q:I'>0 F J=0:0 S J=$O(^XTV(8992.1,"D",I,J)) Q:J'>0 I $D(^XTV(8992.1,J,0)) S FND=1 Q
175 S OLDEST=I S:OLDEST'>0 OLDEST=DT+1
176 Q OLDEST\1
177 ;
178VIEWTRAK ; OPT. View an entry in the Alert Tracking file in Captioned mode
179 N DIR,X0,X1,DAARRAY
180 S X0=$O(^XTV(8992.1,0)),X1=$P(^XTV(8992.1,0),U,3)
181 S DIR(0)="NO^"_X0_":"_X1
182 F I=1:1 S DIR("A")=$S(I>1:"Another ",1:"")_"Internal Entry number in Alert Tracking File" D ^DIR K DIRUT Q:Y'>0 S DAARRAY(I)=+Y
183 K DIR Q:$D(DAARRAY)'>1
184 S %ZIS="MQ" D ^%ZIS Q:POP I $D(IO("Q")) K IO("Q") S ZTRTN="VIEWDQ^XQARPRT1",ZTDESC="List data from Alert Tracking file",ZTSAVE("*")="" D ^%ZTLOAD W:$G(ZTSK)>0 !,"Task number is ",ZTSK K ZTSK Q
185 ;
186VIEWDQ ;
187 N DIC,DA,DIC,XQAI,DR,DIQ
188 W @IOF
189 S DIQ(0)="CR"
190 F XQAI=0:0 S XQAI=$O(DAARRAY(XQAI)) Q:XQAI'>0 D
191 . S DA=DAARRAY(XQAI),DIC="^XTV(8992.1," D EN^DIQ
192 Q
Note: See TracBrowser for help on using the repository browser.