source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORB3U1.m@ 619

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

initial load of WorldVistAEHR

File size: 8.0 KB
Line 
1ORB3U1 ; slc/CLA - Utilities which support OE/RR 3 Notifications ;12/15/97
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**9,74,88,91,105,179,220,250**;Dec 17, 1997;Build 1
3 Q
4LIST(Y) ;return list of notifications from Notification File [#100.9]
5 ; RETURN IEN^NAME^URGENCY
6 N I,J,V
7 S I=1
8 S J=0 F S J=$O(^ORD(100.9,"B",J)) Q:J="" S V=0,V=$O(^ORD(100.9,"B",J,V)) S Y(I)=V_"^"_J_"^"_^ORD(100.9,V,3),I=I+1
9 Q
10 ;
11ALRTHX ;report the recipients for an alert, when received, action taken
12 N ORBDFN,ORBSDT,ORBEDT
13 ;prompt for patient (required):
14 K DIC S DIC="^DPT(",DIC("A")="PATIENT (req'd): ",DIC(0)="AEQNM" D ^DIC
15 I Y<1 K DIC,Y Q
16 S ORBDFN=+Y,ORBPT=$P(Y,U,2)
17 K DIC,Y,DUOUT,DTOUT
18 ;
19 S %DT="AET",%DT("A")="Start Date/Time (req'd): ",%DT("B")="T-30" D ^%DT
20 I Y<1 K %DT,Y Q
21 S ORBSDT=Y
22 ;
23 S %DT="AET",%DT("A")="End Date/Time (req'd): ",%DT("B")="NOW" D ^%DT
24 I Y<1 K %DT,Y Q
25 S ORBEDT=Y
26 ;
27 ;get alerts for this patient from the alert tracking file:
28 D PATIENT^XQALERT("^TMP(""ORB"",$J)",ORBDFN,ORBSDT,ORBEDT)
29 W !!,"Processing..."
30 ;
31 D EN^VALM("OR PATIENT ALERTS")
32 Q
33SELECT ;if one or more alerts selected, display/print recipient data:
34 N ORN,ORNUMS,ORI,ORJ,ORBAL,ORBAID,ORBSMSG,ORY,DESC,HDR
35 S ORNUMS=$P(XQORNOD(0),"=",2)
36 Q:'$L(ORNUMS)
37 D FULL^VALM1
38 ;
39 S ORJ=1
40 F ORI=1:1:$L(ORNUMS,",")-1 D
41 .S ORN=$P(ORNUMS,",",ORI)
42 .S ORBAL=$G(^TMP("OR",$J,"ALERTS","IDX",ORN)) I $L(ORBAL) D
43 ..S ORBAID=$P(ORBAL,U)
44 ..S ORBSMSG=$P(ORBAL,U,2)
45 ..S ORY(ORJ)="RECIPIENTS OF ALERT: "_ORBSMSG,ORJ=ORJ+1
46 ..D GETRECS(ORBAID) ;get recipient data
47 ..S ORJ=ORJ+1,ORY(ORJ)="",ORJ=ORJ+1,ORY(ORJ)="",ORJ=ORJ+1
48 S DESC="Recipients of a Kernel Alert"
49 S HDR="RECIPIENTS OF ALERTS FOR PATIENT: "_ORBPT
50 D OUTPUT(.ORY,DESC,HDR)
51 S VALMBCK="R"
52 Q
53LMHDR ; header for ListMgr display
54 S VALMHDR(1)="Alerts for "_ORBPT
55 Q
56LMHELP ; help for List Mgr display
57 N X
58 D FULL^VALM1 S VALMBCK="R"
59 W !!,"Enter the display number of the alert whose recipients you wish to review in detail."
60 W !!,"Press <return> to continue ..."
61 R X:DTIME
62 Q
63LMEXIT ; exit code for List Mgr display
64 D CLEAR^VALM1
65 K ORBPT,^TMP("OR",$J,"ALERTS"),XQORM("ALT"),^TMP("ORB",$J)
66 Q
67LMALT ; alternative selection code
68 D FULL^VALM1
69 S VALMBCK="R"
70 Q
71LMENTRY ; entry code for List Mgr display
72 N ORBA,ORBAID,ORBDT,ORBMSG,ORBX,ORNUM,ORDATA,ORAD,LCNT,NUM
73 N ORX,ORY,ORBMSGP1,ORBMSGP2
74 ;
75 D CLEAN^VALM10
76 ;
77 S ORBA="" F S ORBA=$O(^TMP("ORB",$J,ORBA)) Q:ORBA="" D
78 .S ORBX=$G(^TMP("ORB",$J,ORBA)) I $L(ORBX) D
79 ..S ORBAID=$P(ORBX,U,2)
80 ..Q:$P(ORBAID,",")'="OR" ;quit if not "OR" (OE/RR Notifications) alert
81 ..W "."
82 ..;
83 ..;get alert details:
84 ..D ALERTDAT^XQALBUTL(ORBAID,"ORAD")
85 ..S ORBMSG=ORAD(1.01) I $L(ORBMSG) D
86 ...S ORBDT=$P(ORAD(.02),U)
87 ...S ORDATA=$G(ORAD(2))
88 ...S ORNUM=""
89 ...I ORDATA["@" S ORNUM=$P(ORDATA,"@")
90 ...S ORNUM=$S(+$G(ORNUM)>0:"["_+ORNUM_"]",1:"")
91 ...S ORBMSG=$P(ORBMSG,"): ",2)
92 ...S ORBMSGP1=$P(ORBMSG,":",1) ;jeh
93 ...S ORBMSGP2=$P(ORBMSG,":",2,3) ;jeh
94 ...I $G(ORBMSGP1)="Order(s) needing clarification" D ;jeh Shorten output to make room for OR IEN
95 ....S ORBMSGP1="Order needs clarifying" ;jeh
96 ....S ORBMSG=ORBMSGP1_":"_ORBMSGP2 ;jeh
97 ...S ORBMSG=$E(ORBMSG_$S($L(ORNUM):" "_$G(ORNUM),1:"")_U_" ",1,60)
98 ...S ^TMP("OR",$J,"ALERTS","B",9999999-ORBDT_ORBAID)=ORBAID_U_$P(ORBMSG,U)_U_$$FMTE^XLFDT($E(ORBDT,1,12),"2")
99 ;
100 S (LCNT,NUM)=0
101 S ORX="" F S ORX=$O(^TMP("OR",$J,"ALERTS","B",ORX)) Q:ORX="" D
102 .S ORY=^TMP("OR",$J,"ALERTS","B",ORX)
103 .S ORBMSG=$P(ORY,U,2)
104 .S ORBDT=$P(ORY,U,3)
105 .S LCNT=LCNT+1,NUM=NUM+1
106 .S ^TMP("OR",$J,"ALERTS","IDX",NUM)=ORY ;alert id^text^date/time
107 .S ^TMP("OR",$J,"ALERTS",LCNT,0)=$$LJ^XLFSTR(NUM,4)_$$LJ^XLFSTR(ORBMSG,61)_$$LJ^XLFSTR(ORBDT,15)
108 .D CNTRL^VALM10(LCNT,1,5,IOINHI,IOINORM)
109 ;
110 S ^TMP("OR",$J,"ALERTS",0)=LCNT_U_NUM_U_"Patient Alerts"
111 S ^TMP("OR",$J,"ALERTS","#")=$O(^ORD(101,"B","OR SELECT ALERTS",0))_"^1:"_NUM
112 K VALMHDR
113 S VALMCNT=LCNT,VALMBG=1,VALMBCK="R"
114 Q
115GETRECS(ORBAID) ;get recipient data for an alert
116 N ORX,ORBI,ORBR,ORBHX
117 D AHISTORY^XQALBUTL(ORBAID,"ORBHX")
118 S:$L($G(ORBHX(20,0))) ORX=$P(ORBHX(20,0),U,4)
119 F ORBI=1:1:ORX D
120 .S ORBR=ORBHX(20,ORBI,0)
121 .S ORY(ORJ)="",ORJ=ORJ+1
122 .S ORY(ORJ)=$P(^VA(200,$P(ORBR,U),0),U),ORJ=ORJ+1
123 .S ORY(ORJ)=" 1st displayed to recipient: "_$$FMTE^XLFDT($P(ORBR,U,2),"1"),ORJ=ORJ+1
124 .S ORY(ORJ)=" 1st selected by recipient: "_$$FMTE^XLFDT($P(ORBR,U,3),"1"),ORJ=ORJ+1
125 .S ORY(ORJ)=" Processed by recipient: "_$$FMTE^XLFDT($P(ORBR,U,4),"1"),ORJ=ORJ+1
126 .S ORY(ORJ)=" Deleted: "_$$FMTE^XLFDT($P(ORBR,U,5),"1"),ORJ=ORJ+1
127 .S ORY(ORJ)=" Auto deleted: "_$$FMTE^XLFDT($P(ORBR,U,6),"1"),ORJ=ORJ+1
128 .S ORY(ORJ)=" Forwarded by: "_$S($P(ORBR,U,7):$P(^VA(200,$P(ORBR,U,7),0),U),1:""),ORJ=ORJ+1
129 .S ORY(ORJ)=" Forwarded to recipient: "_$$FMTE^XLFDT($P(ORBR,U,8),"1"),ORJ=ORJ+1
130 .S ORY(ORJ)=" Non-process deletion by: "_$S($P(ORBR,U,9):$P(^VA(200,$P(ORBR,U,9),0),U),1:""),ORJ=ORJ+1
131 Q
132RECIPS ;determine/report the list of recipients for a notification
133 N ORY,ORN,ORBDFN,ORNUM,ORBADUZ,DESC,HDR,ORBPR,ORDIV
134 ;prompt for patient (required):
135 K DIC S DIC="^DPT(",DIC("A")="PATIENT (req'd): ",DIC(0)="AEQNM" D ^DIC Q:Y<1
136 S ORBDFN=+Y
137 Q:$D(DUOUT)
138 K DIC,Y,DUOUT,DTOUT
139 ;
140 ;prompt for notification (required):
141 S DIC="^ORD(100.9,",DIC("A")="NOTIFICATION (req'd): ",DIC(0)="AEQN" D ^DIC Q:Y<1
142 S ORN=+Y
143 Q:$D(DUOUT)
144 K DIC,Y,DUOUT,DTOUT
145 ;
146 S ORBPR=$$GET^XPAR("DIV^SYS^PKG","ORB PROVIDER RECIPIENTS",ORN,"I")
147 ;
148 ;prompt for order num if notif processes order num or is a flagged oi:
149 I (ORN=32)!(ORN=41)!(ORN=60)!(ORN=61)!(ORN=64)!(ORN=65)!(ORBPR["O")!(ORBPR["E") D
150 .K DIR S DIR(0)="NAO^::2",DIR("A")="ORDER NUMBER: "
151 .S DIR("?",1)="This notification uses order number to help determine alert recipients."
152 .S DIR("?",2)="Enter the order number associated with the alert for most accurate results."
153 .S DIR("?",3)="Order number must be entered as a whole number (e.g. 458829)."
154 .;
155 .S DIR("?")=" "
156 .D ^DIR
157 .S ORNUM=+Y
158 .I +$G(ORNUM)>0 D
159 ..S ORDIV=$$ORDIV^ORB31(ORNUM)
160 ..S:+$G(ORDIV)>0 ORBPR=$$GET^XPAR(ORDIV_";DIV(4,^SYS^PKG","ORB PROVIDER RECIPIENTS",ORN,"I")
161 Q:$D(DUOUT)
162 K DIR,Y,X,DTOUT,DUOUT,DIRUT
163 ;
164 ; get recipients for Lab Threshold notif:
165 I ORN=68 D LABTHR^ORB3U2(.ORBADUZ,ORBDFN,$G(ORNUM))
166 ;
167 ;prompt for pkg-defined recips if normally occurs with notif:
168 I (ORN=21)!(ORN=22)!(ORN=23)!(ORN=27)!(ORN=30)!(ORN=51)!(ORN=52)!(ORN=53)!(ORN=63) D
169 .F K DIC,Y S DIC="^VA(200,",DIC(0)="AEQN",DIC("A")="RECIPIENT(S) FROM PACKAGE WHEN NOTIF WAS TRIGGERED: " D ^DIC Q:Y<1 S ORBADUZ(+Y)=""
170 Q:$D(DUOUT)
171 K DIC,Y,DUOUT,DTOUT
172 ;
173 ;prompt for recips entered at special GUI recipients prompts:
174 I (ORN=6)!(ORN=33) D
175 .F K DIC,Y S DIC="^VA(200,",DIC(0)="AEQN",DIC("A")="RECIPIENT(S) ENTERED AT GUI PROMPTS: " D ^DIC Q:Y<1 S ORBADUZ(+Y)=""
176 Q:$D(DUOUT)
177 K DIC,Y,DUOUT,DTOUT
178 ;
179 W !,"Processing, please stand by..."
180 ;determine recipients and why:
181 S ORY="1"
182 D UTL^ORB3(.ORY,ORN,ORBDFN,$G(ORNUM),.ORBADUZ,"","")
183 S DESC="Determine Notification Recipients Report"
184 S HDR="DETERMINE NOTIFICATION RECIPIENTS REPORT"
185 D OUTPUT(.ORY,DESC,HDR)
186 Q
187OUTPUT(ORY,ORBDESC,ORBHDR) ;prompt for device and send report
188 N POP
189 ;prompt for device:
190 S %ZIS="Q" ;prompt for Queueing
191 D ^%ZIS
192 Q:$G(POP)>0
193 I $D(IO("Q")) D ;queue the report
194 .S ZTRTN="PRINT^ORB3U1"
195 .S ZTSAVE("ORY(")="",ZTSAVE("ORBHDR")=""
196 .S ZTDESC=ORBDESC
197 .D ^%ZTLOAD
198 .K ZTDESC,ZTRTN,ZTSAVE
199 .I $D(ZTSK)[0 W !!?5,"Report canceled!"
200 .E W !!?5,"Report queued."
201 .D HOME^%ZIS
202 K %ZIS
203 I $D(IO("Q")) K IO("Q") Q
204PRINT ;print body of Determine Notification Recipients Report
205 N END,PAGE,X
206 S (END,PAGE,I)=0
207 U IO
208 D @("HDR"_(2-($E(IOST,1,2)="C-")))
209 F S I=$O(ORY(I)) Q:I=""!(END=1) D
210 .D HDR:$Y+5>IOSL
211 .Q:END=1
212 .W !,ORY(I)
213 I END=1 W !!," - Report Interrupted -",!
214 E W !!!," - End of Report -",!
215 I ($E(IOST,1,2)="C-") W !,"Press RETURN to continue: " R X:DTIME
216 D ^%ZISC
217 D:$G(ZTSK) KILL^%ZTLOAD
218 Q
219HDR ;print header of report
220 I PAGE,($E(IOST,1,2)="C-") D
221 .W !,"Press RETURN to continue or '^' to exit: "
222 .R X:DTIME S END='$T!(X="^")
223 Q:END=1
224HDR1 W:'($E(IOST,1,2)='"C-"&'PAGE) @IOF
225HDR2 S PAGE=PAGE+1 W ?20,ORBHDR
226 W ?(IOM-10),"Page: ",$J(PAGE,3),!!
227 Q
Note: See TracBrowser for help on using the repository browser.