source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0N.m@ 757

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

initial load of FOIAVistA 6/30/08 version

File size: 7.8 KB
Line 
1OCXOZ0N ;SLC/RJS,CLA - Order Check Scan ;SEP 4,2007 at 23:12
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5 ; ***************************************************************
6 ; ** Warning: This routine is automatically generated by the **
7 ; ** Rule Compiler (^OCXOCMP) and ANY changes to this routine **
8 ; ** will be lost the next time the rule compiler executes. **
9 ; ***************************************************************
10 ;
11 Q
12 ;
13R18R1B ; Send Order Check, Notication messages and/or Execute code for Rule #18 'STAT RESULTS AVAILABLE' Relation #1 'STAT LAB RESULT'
14 ; Called from R18R1A+10^OCXOZ0M.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local Extrinsic Functions
19 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
20 ; NEWRULE( ---------> NEW RULE MESSAGE
21 ;
22 Q:$D(OCXRULE("R18R1B"))
23 ;
24 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
25 S OCXCMSG=""
26 S OCXNMSG="STAT lab results: ["_$$GETDATA(DFN,"76^",96)_"]"
27 ;
28 Q:$G(OCXOERR)
29 ;
30 ; Send Notification
31 ;
32 S (OCXDUZ,OCXDATA)="",OCXNUM=0
33 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
34 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
35 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
36 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
37 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
38 .S OCXNUM=+$P(OCXORD,U,2)
39 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
40 S OCXRULE("R18R1B")=""
41 I $$NEWRULE(DFN,OCXNUM,18,1,44,OCXNMSG) D I 1
42 .D:($G(OCXTRACE)<5) EN^ORB3(44,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
43 Q
44 ;
45R18R2A ; Verify all Event/Elements of Rule #18 'STAT RESULTS AVAILABLE' Relation #2 'STAT IMAGING RESULT'
46 ; Called from EL75+5^OCXOZ0G.
47 ;
48 Q:$G(OCXOERR)
49 ;
50 ; Local Extrinsic Functions
51 ; MCE75( -----------> Verify Event/Element: 'STAT IMAGING RESULT'
52 ;
53 Q:$G(^OCXS(860.2,18,"INACT"))
54 ;
55 I $$MCE75 D R18R2B
56 Q
57 ;
58R18R2B ; Send Order Check, Notication messages and/or Execute code for Rule #18 'STAT RESULTS AVAILABLE' Relation #2 'STAT IMAGING RESULT'
59 ; Called from R18R2A+10.
60 ;
61 Q:$G(OCXOERR)
62 ;
63 ; Local Extrinsic Functions
64 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
65 ; NEWRULE( ---------> NEW RULE MESSAGE
66 ;
67 Q:$D(OCXRULE("R18R2B"))
68 ;
69 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
70 S OCXCMSG=""
71 S OCXNMSG="STAT imaging results: "_$$GETDATA(DFN,"75^",24)
72 ;
73 Q:$G(OCXOERR)
74 ;
75 ; Send Notification
76 ;
77 S (OCXDUZ,OCXDATA)="",OCXNUM=0
78 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
79 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
80 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
81 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
82 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
83 .S OCXNUM=+$P(OCXORD,U,2)
84 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
85 S OCXRULE("R18R2B")=""
86 I $$NEWRULE(DFN,OCXNUM,18,2,44,OCXNMSG) D I 1
87 .D:($G(OCXTRACE)<5) EN^ORB3(44,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
88 Q
89 ;
90R18R3A ; Verify all Event/Elements of Rule #18 'STAT RESULTS AVAILABLE' Relation #3 'STAT CONSULT RESULT'
91 ; Called from EL110+5^OCXOZ0G.
92 ;
93 Q:$G(OCXOERR)
94 ;
95 ; Local Extrinsic Functions
96 ; MCE110( ----------> Verify Event/Element: 'STAT CONSULT RESULT'
97 ;
98 Q:$G(^OCXS(860.2,18,"INACT"))
99 ;
100 I $$MCE110 D R18R3B
101 Q
102 ;
103R18R3B ; Send Order Check, Notication messages and/or Execute code for Rule #18 'STAT RESULTS AVAILABLE' Relation #3 'STAT CONSULT RESULT'
104 ; Called from R18R3A+10.
105 ;
106 Q:$G(OCXOERR)
107 ;
108 ; Local Extrinsic Functions
109 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
110 ; NEWRULE( ---------> NEW RULE MESSAGE
111 ;
112 Q:$D(OCXRULE("R18R3B"))
113 ;
114 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
115 S OCXCMSG=""
116 S OCXNMSG="STAT consult results: "_$$GETDATA(DFN,"110^",24)
117 ;
118 Q:$G(OCXOERR)
119 ;
120 ; Send Notification
121 ;
122 S (OCXDUZ,OCXDATA)="",OCXNUM=0
123 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
124 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
125 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
126 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
127 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
128 .S OCXNUM=+$P(OCXORD,U,2)
129 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
130 S OCXRULE("R18R3B")=""
131 I $$NEWRULE(DFN,OCXNUM,18,3,44,OCXNMSG) D I 1
132 .D:($G(OCXTRACE)<5) EN^ORB3(44,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
133 Q
134 ;
135R19R1A ; Verify all Event/Elements of Rule #19 'PATIENT DISCHARGE' Relation #1 'DISCHARGE'
136 ; Called from EL56+5^OCXOZ0G.
137 ;
138 Q:$G(OCXOERR)
139 ;
140 ; Local Extrinsic Functions
141 ; MCE56( -----------> Verify Event/Element: 'PATIENT DISCHARGE'
142 ;
143 Q:$G(^OCXS(860.2,19,"INACT"))
144 ;
145 I $$MCE56 D R19R1B^OCXOZ0O
146 Q
147 ;
148CKSUM(STR) ; Compiler Function: GENERATE STRING CHECKSUM
149 ;
150 N CKSUM,PTR,ASC S CKSUM=0
151 S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
152 F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
153 Q +CKSUM
154 ;
155GETDATA(DFN,OCXL,OCXDFI) ; This Local Extrinsic Function returns runtime data
156 ;
157 N OCXE,VAL,PC S VAL=""
158 F PC=1:1:$L(OCXL,U) S OCXE=$P(OCXL,U,PC) I OCXE S VAL=$G(^TMP("OCXCHK",$J,DFN,OCXE,OCXDFI)) Q:$L(VAL)
159 Q VAL
160 ;
161MCE110() ; Verify Event/Element: STAT CONSULT RESULT
162 ;
163 ;
164 N OCXRES
165 I $L(OCXDF(37)) S OCXRES(110,37)=OCXDF(37)
166 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),110)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),110))
167 Q 0
168 ;
169MCE56() ; Verify Event/Element: PATIENT DISCHARGE
170 ;
171 ; OCXDF(37) -> PATIENT IEN data field
172 ;
173 N OCXRES
174 S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(56,37)=OCXDF(37)
175 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),56)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),56))
176 Q 0
177 ;
178MCE75() ; Verify Event/Element: STAT IMAGING RESULT
179 ;
180 ;
181 N OCXRES
182 I $L(OCXDF(37)) S OCXRES(75,37)=OCXDF(37)
183 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),75)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),75))
184 Q 0
185 ;
186NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) ; Has this rule already been triggered for this order number
187 ;
188 ;
189 Q:'$G(OCXDFN) 0 Q:'$G(OCXRUL) 0
190 Q:'$G(OCXREL) 0 Q:'$G(OCXNOTF) 0 Q:'$L($G(OCXMESS)) 0
191 S OCXORD=+$G(OCXORD),OCXDFN=+OCXDFN
192 ;
193 N OCXNDX,OCXDATA,OCXDFI,OCXELE,OCXGR,OCXTIME,OCXCKSUM,OCXTSP,OCXTSPL
194 ;
195 S OCXTIME=(+$H)
196 S OCXCKSUM=$$CKSUM(OCXMESS)
197 ;
198 S OCXTSP=($H*86400)+$P($H,",",2)
199 S OCXTSPL=($G(^OCXD(860.7,"AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM))+$G(OCXTSPI,300))
200 ;
201 Q:(OCXTSPL>OCXTSP) 0
202 ;
203 K OCXDATA
204 S OCXDATA(OCXDFN,0)=OCXDFN
205 S OCXDATA("B",OCXDFN,OCXDFN)=""
206 S OCXDATA("AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM)=OCXTSP
207 ;
208 S OCXGR="^OCXD(860.7"
209 D SETAP(OCXGR_")",0,.OCXDATA,OCXDFN)
210 ;
211 K OCXDATA
212 S OCXDATA(OCXRUL,0)=OCXRUL_U_(OCXTIME)_U_(+OCXORD)
213 S OCXDATA(OCXRUL,"M")=OCXMESS
214 S OCXDATA("B",OCXRUL,OCXRUL)=""
215 S OCXGR=OCXGR_","_OCXDFN_",1"
216 D SETAP(OCXGR_")","860.71P",.OCXDATA,OCXRUL)
217 ;
218 K OCXDATA
219 S OCXDATA(OCXREL,0)=OCXREL
220 S OCXDATA("B",OCXREL,OCXREL)=""
221 S OCXGR=OCXGR_","_OCXRUL_",1"
222 D SETAP(OCXGR_")","860.712",.OCXDATA,OCXREL)
223 ;
224 S OCXELE=0 F S OCXELE=$O(^OCXS(860.2,OCXRUL,"C","C",OCXELE)) Q:'OCXELE D
225 .;
226 .N OCXGR1
227 .S OCXGR1=OCXGR_","_OCXREL_",1"
228 .K OCXDATA
229 .S OCXDATA(OCXELE,0)=OCXELE
230 .S OCXDATA(OCXELE,"TIME")=OCXTIME
231 .S OCXDATA(OCXELE,"LOG")=$G(OCXOLOG)
232 .S OCXDATA("B",OCXELE,OCXELE)=""
233 .K ^OCXD(860.7,OCXDFN,1,OCXRUL,1,OCXREL,1,OCXELE)
234 .D SETAP(OCXGR1_")","860.7122P",.OCXDATA,OCXELE)
235 .;
236 .S OCXDFI=0 F S OCXDFI=$O(^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)) Q:'OCXDFI D
237 ..N OCXGR2
238 ..S OCXGR2=OCXGR1_","_OCXELE_",1"
239 ..K OCXDATA
240 ..S OCXDATA(OCXDFI,0)=OCXDFI
241 ..S OCXDATA(OCXDFI,"VAL")=^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)
242 ..S OCXDATA("B",OCXDFI,OCXDFI)=""
243 ..D SETAP(OCXGR2_")","860.71223P",.OCXDATA,OCXDFI)
244 ;
245 Q 1
246 ;
247SETAP(ROOT,DD,DATA,DA) ; Set Rule Event data
248 M @ROOT=DATA
249 I +$G(DD) S @ROOT@(0)="^"_($G(DD))_"^"_($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
250 I '$G(DD) S $P(@ROOT@(0),U,3,4)=($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
251 ;
252 Q
253 ;
254 ;
Note: See TracBrowser for help on using the repository browser.