1 | OCXOZ0P ;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 | ;
|
---|
13 | R24R1B ; Send Order Check, Notication messages and/or Execute code for Rule #24 'ORDERER FLAGGED RESULTS AVAILABLE' Relation #1 'ORDER FLAGGED FOR RESULTS AND (LAB RESULT OR IMAGI...'
|
---|
14 | ; Called from R24R1A+14^OCXOZ0O.
|
---|
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("R24R1B"))
|
---|
23 | ;
|
---|
24 | N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
|
---|
25 | S OCXCMSG=""
|
---|
26 | S OCXNMSG="Requested results available: "_$$GETDATA(DFN,"5^49^55^101",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("R24R1B")=""
|
---|
41 | I $$NEWRULE(DFN,OCXNUM,24,1,33,OCXNMSG) D I 1
|
---|
42 | .D:($G(OCXTRACE)<5) EN^ORB3(33,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
|
---|
43 | Q
|
---|
44 | ;
|
---|
45 | R28R1A ; Verify all Event/Elements of Rule #28 'STAT ORDER PLACED' Relation #1 'NEW OBR STAT OR NEW ORC STAT'
|
---|
46 | ; Called from EL60+5^OCXOZ0H, and EL61+5^OCXOZ0H.
|
---|
47 | ;
|
---|
48 | Q:$G(OCXOERR)
|
---|
49 | ;
|
---|
50 | ; Local Extrinsic Functions
|
---|
51 | ; MCE60( -----------> Verify Event/Element: 'NEW OBR STAT ORDER'
|
---|
52 | ; MCE61( -----------> Verify Event/Element: 'NEW ORC STAT ORDER'
|
---|
53 | ;
|
---|
54 | Q:$G(^OCXS(860.2,28,"INACT"))
|
---|
55 | ;
|
---|
56 | I $$MCE60 D R28R1B
|
---|
57 | I $$MCE61 D R28R1B
|
---|
58 | Q
|
---|
59 | ;
|
---|
60 | R28R1B ; Send Order Check, Notication messages and/or Execute code for Rule #28 'STAT ORDER PLACED' Relation #1 'NEW OBR STAT OR NEW ORC STAT'
|
---|
61 | ; Called from R28R1A+11.
|
---|
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("R28R1B"))
|
---|
70 | ;
|
---|
71 | N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
|
---|
72 | S OCXCMSG=""
|
---|
73 | S OCXNMSG="STAT order: "_$$GETDATA(DFN,"60^61",96)
|
---|
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("R28R1B")=""
|
---|
88 | I $$NEWRULE(DFN,OCXNUM,28,1,43,OCXNMSG) D I 1
|
---|
89 | .D:($G(OCXTRACE)<5) EN^ORB3(43,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
|
---|
90 | Q
|
---|
91 | ;
|
---|
92 | R32R1A ; Verify all Event/Elements of Rule #32 'PATIENT TRANSFERRED FROM PSYCHIATRY TO A...' Relation #1 'FROM PSYCH WARD'
|
---|
93 | ; Called from EL42+5^OCXOZ0H.
|
---|
94 | ;
|
---|
95 | Q:$G(OCXOERR)
|
---|
96 | ;
|
---|
97 | ; Local Extrinsic Functions
|
---|
98 | ; MCE42( -----------> Verify Event/Element: 'PATIENT TRANSFERRED FROM PSYCH WARD'
|
---|
99 | ;
|
---|
100 | Q:$G(^OCXS(860.2,32,"INACT"))
|
---|
101 | ;
|
---|
102 | I $$MCE42 D R32R1B
|
---|
103 | Q
|
---|
104 | ;
|
---|
105 | R32R1B ; Send Order Check, Notication messages and/or Execute code for Rule #32 'PATIENT TRANSFERRED FROM PSYCHIATRY TO A...' Relation #1 'FROM PSYCH WARD'
|
---|
106 | ; Called from R32R1A+10.
|
---|
107 | ;
|
---|
108 | Q:$G(OCXOERR)
|
---|
109 | ;
|
---|
110 | ; Local Extrinsic Functions
|
---|
111 | ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
|
---|
112 | ; NEWRULE( ---------> NEW RULE MESSAGE
|
---|
113 | ;
|
---|
114 | Q:$D(OCXRULE("R32R1B"))
|
---|
115 | ;
|
---|
116 | N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
|
---|
117 | S OCXCMSG=""
|
---|
118 | S OCXNMSG="Transfer from Psych ward: "_$$GETDATA(DFN,"42^",95)_" to ward: "_$$GETDATA(DFN,"42^",90)
|
---|
119 | ;
|
---|
120 | Q:$G(OCXOERR)
|
---|
121 | ;
|
---|
122 | ; Send Notification
|
---|
123 | ;
|
---|
124 | S (OCXDUZ,OCXDATA)="",OCXNUM=0
|
---|
125 | I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
|
---|
126 | .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
|
---|
127 | .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
|
---|
128 | I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
|
---|
129 | .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
|
---|
130 | .S OCXNUM=+$P(OCXORD,U,2)
|
---|
131 | S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
|
---|
132 | S OCXRULE("R32R1B")=""
|
---|
133 | I $$NEWRULE(DFN,OCXNUM,32,1,36,OCXNMSG) D I 1
|
---|
134 | .D:($G(OCXTRACE)<5) EN^ORB3(36,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
|
---|
135 | Q
|
---|
136 | ;
|
---|
137 | CKSUM(STR) ; Compiler Function: GENERATE STRING CHECKSUM
|
---|
138 | ;
|
---|
139 | N CKSUM,PTR,ASC S CKSUM=0
|
---|
140 | S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
---|
141 | F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
|
---|
142 | Q +CKSUM
|
---|
143 | ;
|
---|
144 | GETDATA(DFN,OCXL,OCXDFI) ; This Local Extrinsic Function returns runtime data
|
---|
145 | ;
|
---|
146 | N OCXE,VAL,PC S VAL=""
|
---|
147 | 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)
|
---|
148 | Q VAL
|
---|
149 | ;
|
---|
150 | MCE42() ; Verify Event/Element: PATIENT TRANSFERRED FROM PSYCH WARD
|
---|
151 | ;
|
---|
152 | ; OCXDF(37) -> PATIENT IEN data field
|
---|
153 | ;
|
---|
154 | N OCXRES
|
---|
155 | S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(42,37)=OCXDF(37)
|
---|
156 | Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),42)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),42))
|
---|
157 | Q 0
|
---|
158 | ;
|
---|
159 | MCE60() ; Verify Event/Element: NEW OBR STAT ORDER
|
---|
160 | ;
|
---|
161 | ;
|
---|
162 | N OCXRES
|
---|
163 | I $L(OCXDF(37)) S OCXRES(60,37)=OCXDF(37)
|
---|
164 | Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),60)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),60))
|
---|
165 | Q 0
|
---|
166 | ;
|
---|
167 | MCE61() ; Verify Event/Element: NEW ORC STAT ORDER
|
---|
168 | ;
|
---|
169 | ;
|
---|
170 | N OCXRES
|
---|
171 | I $L(OCXDF(37)) S OCXRES(61,37)=OCXDF(37)
|
---|
172 | Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),61)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),61))
|
---|
173 | Q 0
|
---|
174 | ;
|
---|
175 | NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) ; Has this rule already been triggered for this order number
|
---|
176 | ;
|
---|
177 | ;
|
---|
178 | Q:'$G(OCXDFN) 0 Q:'$G(OCXRUL) 0
|
---|
179 | Q:'$G(OCXREL) 0 Q:'$G(OCXNOTF) 0 Q:'$L($G(OCXMESS)) 0
|
---|
180 | S OCXORD=+$G(OCXORD),OCXDFN=+OCXDFN
|
---|
181 | ;
|
---|
182 | N OCXNDX,OCXDATA,OCXDFI,OCXELE,OCXGR,OCXTIME,OCXCKSUM,OCXTSP,OCXTSPL
|
---|
183 | ;
|
---|
184 | S OCXTIME=(+$H)
|
---|
185 | S OCXCKSUM=$$CKSUM(OCXMESS)
|
---|
186 | ;
|
---|
187 | S OCXTSP=($H*86400)+$P($H,",",2)
|
---|
188 | S OCXTSPL=($G(^OCXD(860.7,"AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM))+$G(OCXTSPI,300))
|
---|
189 | ;
|
---|
190 | Q:(OCXTSPL>OCXTSP) 0
|
---|
191 | ;
|
---|
192 | K OCXDATA
|
---|
193 | S OCXDATA(OCXDFN,0)=OCXDFN
|
---|
194 | S OCXDATA("B",OCXDFN,OCXDFN)=""
|
---|
195 | S OCXDATA("AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM)=OCXTSP
|
---|
196 | ;
|
---|
197 | S OCXGR="^OCXD(860.7"
|
---|
198 | D SETAP(OCXGR_")",0,.OCXDATA,OCXDFN)
|
---|
199 | ;
|
---|
200 | K OCXDATA
|
---|
201 | S OCXDATA(OCXRUL,0)=OCXRUL_U_(OCXTIME)_U_(+OCXORD)
|
---|
202 | S OCXDATA(OCXRUL,"M")=OCXMESS
|
---|
203 | S OCXDATA("B",OCXRUL,OCXRUL)=""
|
---|
204 | S OCXGR=OCXGR_","_OCXDFN_",1"
|
---|
205 | D SETAP(OCXGR_")","860.71P",.OCXDATA,OCXRUL)
|
---|
206 | ;
|
---|
207 | K OCXDATA
|
---|
208 | S OCXDATA(OCXREL,0)=OCXREL
|
---|
209 | S OCXDATA("B",OCXREL,OCXREL)=""
|
---|
210 | S OCXGR=OCXGR_","_OCXRUL_",1"
|
---|
211 | D SETAP(OCXGR_")","860.712",.OCXDATA,OCXREL)
|
---|
212 | ;
|
---|
213 | S OCXELE=0 F S OCXELE=$O(^OCXS(860.2,OCXRUL,"C","C",OCXELE)) Q:'OCXELE D
|
---|
214 | .;
|
---|
215 | .N OCXGR1
|
---|
216 | .S OCXGR1=OCXGR_","_OCXREL_",1"
|
---|
217 | .K OCXDATA
|
---|
218 | .S OCXDATA(OCXELE,0)=OCXELE
|
---|
219 | .S OCXDATA(OCXELE,"TIME")=OCXTIME
|
---|
220 | .S OCXDATA(OCXELE,"LOG")=$G(OCXOLOG)
|
---|
221 | .S OCXDATA("B",OCXELE,OCXELE)=""
|
---|
222 | .K ^OCXD(860.7,OCXDFN,1,OCXRUL,1,OCXREL,1,OCXELE)
|
---|
223 | .D SETAP(OCXGR1_")","860.7122P",.OCXDATA,OCXELE)
|
---|
224 | .;
|
---|
225 | .S OCXDFI=0 F S OCXDFI=$O(^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)) Q:'OCXDFI D
|
---|
226 | ..N OCXGR2
|
---|
227 | ..S OCXGR2=OCXGR1_","_OCXELE_",1"
|
---|
228 | ..K OCXDATA
|
---|
229 | ..S OCXDATA(OCXDFI,0)=OCXDFI
|
---|
230 | ..S OCXDATA(OCXDFI,"VAL")=^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)
|
---|
231 | ..S OCXDATA("B",OCXDFI,OCXDFI)=""
|
---|
232 | ..D SETAP(OCXGR2_")","860.71223P",.OCXDATA,OCXDFI)
|
---|
233 | ;
|
---|
234 | Q 1
|
---|
235 | ;
|
---|
236 | SETAP(ROOT,DD,DATA,DA) ; Set Rule Event data
|
---|
237 | M @ROOT=DATA
|
---|
238 | I +$G(DD) S @ROOT@(0)="^"_($G(DD))_"^"_($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
|
---|
239 | I '$G(DD) S $P(@ROOT@(0),U,3,4)=($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
|
---|
240 | ;
|
---|
241 | Q
|
---|
242 | ;
|
---|
243 | ;
|
---|