source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0M.m@ 1686

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

revised back to 6/30/08 version

File size: 8.3 KB
Line 
1OCXOZ0M ;SLC/RJS,CLA - Order Check Scan ;DEC 27,2007 at 06:00
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 ;
13R11R2B ; Send Order Check, Notication messages and/or Execute code for Rule #11 'IMAGING REQUEST CANCELLED/HELD' Relation #2 'ON HOLD AND CANCELED BY NON-ORIG ORDERER'
14 ; Called from R11R2A+12^OCXOZ0L.
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("R11R2B"))
23 ;
24 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
25 S OCXCMSG=""
26 S OCXNMSG="Imaging request held: "_$$GETDATA(DFN,"30^100",105)
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("R11R2B")=""
41 I $$NEWRULE(DFN,OCXNUM,11,2,26,OCXNMSG) D I 1
42 .D:($G(OCXTRACE)<5) EN^ORB3(26,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
43 Q
44 ;
45R11R3A ; Verify all Event/Elements of Rule #11 'IMAGING REQUEST CANCELLED/HELD' Relation #3 'DISCONTINUED AND CANCELED BY NON-ORIG ORDERER'
46 ; Called from EL100+7^OCXOZ0G, and EL32+5^OCXOZ0G.
47 ;
48 Q:$G(OCXOERR)
49 ;
50 ; Local Extrinsic Functions
51 ; MCE100( ----------> Verify Event/Element: 'CANCELED BY NON-ORIG ORDERING PROVIDER'
52 ; MCE32( -----------> Verify Event/Element: 'RADIOLOGY ORDER DISCONTINUED'
53 ;
54 Q:$G(^OCXS(860.2,11,"INACT"))
55 ;
56 I $$MCE32 D
57 .I $$MCE100 D R11R3B
58 Q
59 ;
60R11R3B ; Send Order Check, Notication messages and/or Execute code for Rule #11 'IMAGING REQUEST CANCELLED/HELD' Relation #3 'DISCONTINUED AND CANCELED BY NON-ORIG ORDERER'
61 ; Called from R11R3A+12.
62 ;
63 Q:$G(OCXOERR)
64 ;
65 ; Local Extrinsic Functions
66 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
67 ; NEWRULE( ---------> NEW RULE MESSAGE
68 ;
69 Q:$D(OCXRULE("R11R3B"))
70 ;
71 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
72 S OCXCMSG=""
73 S OCXNMSG="Imaging request discontinued: "_$$GETDATA(DFN,"32^100",105)
74 ;
75 Q:$G(OCXOERR)
76 ;
77 ; Send Notification
78 ;
79 S (OCXDUZ,OCXDATA)="",OCXNUM=0
80 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
81 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
82 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
83 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
84 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
85 .S OCXNUM=+$P(OCXORD,U,2)
86 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
87 S OCXRULE("R11R3B")=""
88 I $$NEWRULE(DFN,OCXNUM,11,3,26,OCXNMSG) D I 1
89 .D:($G(OCXTRACE)<5) EN^ORB3(26,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
90 Q
91 ;
92R16R1A ; Verify all Event/Elements of Rule #16 'SERVICE ORDER REQUIRES CHART SIGNATURE' Relation #1 'SERVICE'
93 ; Called from EL46+5^OCXOZ0G.
94 ;
95 Q:$G(OCXOERR)
96 ;
97 ; Local Extrinsic Functions
98 ; MCE46( -----------> Verify Event/Element: 'SERVICE ORDER REQUIRES CHART SIGNATURE'
99 ;
100 Q:$G(^OCXS(860.2,16,"INACT"))
101 ;
102 I $$MCE46 D R16R1B
103 Q
104 ;
105R16R1B ; Send Order Check, Notication messages and/or Execute code for Rule #16 'SERVICE ORDER REQUIRES CHART SIGNATURE' Relation #1 'SERVICE'
106 ; Called from R16R1A+10.
107 ;
108 Q:$G(OCXOERR)
109 ;
110 ; Local Extrinsic Functions
111 ; NEWRULE( ---------> NEW RULE MESSAGE
112 ;
113 Q:$D(OCXRULE("R16R1B"))
114 ;
115 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
116 S OCXCMSG=""
117 S OCXNMSG="Service order - requires chart signature."
118 ;
119 Q:$G(OCXOERR)
120 ;
121 ; Send Notification
122 ;
123 S (OCXDUZ,OCXDATA)="",OCXNUM=0
124 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
125 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
126 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
127 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
128 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
129 .S OCXNUM=+$P(OCXORD,U,2)
130 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
131 S OCXRULE("R16R1B")=""
132 I $$NEWRULE(DFN,OCXNUM,16,1,28,OCXNMSG) D I 1
133 .D:($G(OCXTRACE)<5) EN^ORB3(28,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
134 Q
135 ;
136R18R1A ; Verify all Event/Elements of Rule #18 'STAT RESULTS AVAILABLE' Relation #1 'STAT LAB RESULT'
137 ; Called from EL76+5^OCXOZ0G.
138 ;
139 Q:$G(OCXOERR)
140 ;
141 ; Local Extrinsic Functions
142 ; MCE76( -----------> Verify Event/Element: 'STAT LAB RESULT'
143 ;
144 Q:$G(^OCXS(860.2,18,"INACT"))
145 ;
146 I $$MCE76 D R18R1B^OCXOZ0N
147 Q
148 ;
149CKSUM(STR) ; Compiler Function: GENERATE STRING CHECKSUM
150 ;
151 N CKSUM,PTR,ASC S CKSUM=0
152 S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
153 F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
154 Q +CKSUM
155 ;
156GETDATA(DFN,OCXL,OCXDFI) ; This Local Extrinsic Function returns runtime data
157 ;
158 N OCXE,VAL,PC S VAL=""
159 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)
160 Q VAL
161 ;
162MCE100() ; Verify Event/Element: CANCELED BY NON-ORIG ORDERING PROVIDER
163 ;
164 ;
165 N OCXRES
166 I $L(OCXDF(37)) S OCXRES(100,37)=OCXDF(37)
167 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),100)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),100))
168 Q 0
169 ;
170MCE32() ; Verify Event/Element: RADIOLOGY ORDER DISCONTINUED
171 ;
172 ;
173 N OCXRES
174 I $L(OCXDF(37)) S OCXRES(32,37)=OCXDF(37)
175 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),32)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),32))
176 Q 0
177 ;
178MCE46() ; Verify Event/Element: SERVICE ORDER REQUIRES CHART SIGNATURE
179 ;
180 ; OCXDF(37) -> PATIENT IEN data field
181 ;
182 N OCXRES
183 S OCXDF(37)=$P($G(OCXORD),"^",1) I $L(OCXDF(37)) S OCXRES(46,37)=OCXDF(37)
184 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),46)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),46))
185 Q 0
186 ;
187MCE76() ; Verify Event/Element: STAT LAB RESULT
188 ;
189 ;
190 N OCXRES
191 I $L(OCXDF(37)) S OCXRES(76,37)=OCXDF(37)
192 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),76)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),76))
193 Q 0
194 ;
195NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) ; Has this rule already been triggered for this order number
196 ;
197 ;
198 Q:'$G(OCXDFN) 0 Q:'$G(OCXRUL) 0
199 Q:'$G(OCXREL) 0 Q:'$G(OCXNOTF) 0 Q:'$L($G(OCXMESS)) 0
200 S OCXORD=+$G(OCXORD),OCXDFN=+OCXDFN
201 ;
202 N OCXNDX,OCXDATA,OCXDFI,OCXELE,OCXGR,OCXTIME,OCXCKSUM,OCXTSP,OCXTSPL
203 ;
204 S OCXTIME=(+$H)
205 S OCXCKSUM=$$CKSUM(OCXMESS)
206 ;
207 S OCXTSP=($H*86400)+$P($H,",",2)
208 S OCXTSPL=($G(^OCXD(860.7,"AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM))+$G(OCXTSPI,300))
209 ;
210 Q:(OCXTSPL>OCXTSP) 0
211 ;
212 K OCXDATA
213 S OCXDATA(OCXDFN,0)=OCXDFN
214 S OCXDATA("B",OCXDFN,OCXDFN)=""
215 S OCXDATA("AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM)=OCXTSP
216 ;
217 S OCXGR="^OCXD(860.7"
218 D SETAP(OCXGR_")",0,.OCXDATA,OCXDFN)
219 ;
220 K OCXDATA
221 S OCXDATA(OCXRUL,0)=OCXRUL_U_(OCXTIME)_U_(+OCXORD)
222 S OCXDATA(OCXRUL,"M")=OCXMESS
223 S OCXDATA("B",OCXRUL,OCXRUL)=""
224 S OCXGR=OCXGR_","_OCXDFN_",1"
225 D SETAP(OCXGR_")","860.71P",.OCXDATA,OCXRUL)
226 ;
227 K OCXDATA
228 S OCXDATA(OCXREL,0)=OCXREL
229 S OCXDATA("B",OCXREL,OCXREL)=""
230 S OCXGR=OCXGR_","_OCXRUL_",1"
231 D SETAP(OCXGR_")","860.712",.OCXDATA,OCXREL)
232 ;
233 S OCXELE=0 F S OCXELE=$O(^OCXS(860.2,OCXRUL,"C","C",OCXELE)) Q:'OCXELE D
234 .;
235 .N OCXGR1
236 .S OCXGR1=OCXGR_","_OCXREL_",1"
237 .K OCXDATA
238 .S OCXDATA(OCXELE,0)=OCXELE
239 .S OCXDATA(OCXELE,"TIME")=OCXTIME
240 .S OCXDATA(OCXELE,"LOG")=$G(OCXOLOG)
241 .S OCXDATA("B",OCXELE,OCXELE)=""
242 .K ^OCXD(860.7,OCXDFN,1,OCXRUL,1,OCXREL,1,OCXELE)
243 .D SETAP(OCXGR1_")","860.7122P",.OCXDATA,OCXELE)
244 .;
245 .S OCXDFI=0 F S OCXDFI=$O(^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)) Q:'OCXDFI D
246 ..N OCXGR2
247 ..S OCXGR2=OCXGR1_","_OCXELE_",1"
248 ..K OCXDATA
249 ..S OCXDATA(OCXDFI,0)=OCXDFI
250 ..S OCXDATA(OCXDFI,"VAL")=^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)
251 ..S OCXDATA("B",OCXDFI,OCXDFI)=""
252 ..D SETAP(OCXGR2_")","860.71223P",.OCXDATA,OCXDFI)
253 ;
254 Q 1
255 ;
256SETAP(ROOT,DD,DATA,DA) ; Set Rule Event data
257 M @ROOT=DATA
258 I +$G(DD) S @ROOT@(0)="^"_($G(DD))_"^"_($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
259 I '$G(DD) S $P(@ROOT@(0),U,3,4)=($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
260 ;
261 Q
262 ;
263 ;
Note: See TracBrowser for help on using the repository browser.