source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0K.m@ 1757

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

initial load of FOIAVistA 6/30/08 version

File size: 7.4 KB
Line 
1OCXOZ0K ;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 ;
13R5R1B ; Send Order Check, Notication messages and/or Execute code for Rule #5 'ORDER FLAGGED FOR CLARIFICATION' Relation #1 'ORDER FLAGGED'
14 ; Called from R5R1A+10^OCXOZ0J.
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("R5R1B"))
23 ;
24 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
25 S OCXCMSG=""
26 S OCXNMSG="Order(s) needing clarification: Flagged "_$$GETDATA(DFN,"44^",115)_"."
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("R5R1B")=""
41 I $$NEWRULE(DFN,OCXNUM,5,1,6,OCXNMSG) D I 1
42 .D:($G(OCXTRACE)<5) EN^ORB3(6,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
43 Q
44 ;
45R5R2A ; Verify all Event/Elements of Rule #5 'ORDER FLAGGED FOR CLARIFICATION' Relation #2 'ORDER UNFLAGGED'
46 ; Called from EL134+5^OCXOZ0G.
47 ;
48 Q:$G(OCXOERR)
49 ;
50 ; Local Extrinsic Functions
51 ; MCE134( ----------> Verify Event/Element: 'ORDER UNFLAGGED'
52 ;
53 Q:$G(^OCXS(860.2,5,"INACT"))
54 ;
55 I $$MCE134 D R5R2B
56 Q
57 ;
58R5R2B ; Send Order Check, Notication messages and/or Execute code for Rule #5 'ORDER FLAGGED FOR CLARIFICATION' Relation #2 'ORDER UNFLAGGED'
59 ; Called from R5R2A+10.
60 ;
61 Q:$G(OCXOERR)
62 ;
63 ; Local Extrinsic Functions
64 ; GETDATA( ---------> GET DATA FROM THE ACTIVE DATA FILE
65 ;
66 Q:$D(OCXRULE("R5R2B"))
67 ;
68 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
69 S OCXCMSG=""
70 S OCXNMSG=""
71 ;
72 ;
73 ; Run Execute Code
74 ;
75 D UNFLAG^ORB3FUP1($$GETDATA(DFN,"134^",37))
76 Q:$G(OCXOERR)
77 Q
78 ;
79R6R1A ; Verify all Event/Elements of Rule #6 'ORDER REQUIRES CHART SIGNATURE' Relation #1 'SIGNATURE'
80 ; Called from EL45+5^OCXOZ0G.
81 ;
82 Q:$G(OCXOERR)
83 ;
84 ; Local Extrinsic Functions
85 ; MCE45( -----------> Verify Event/Element: 'ORDER REQUIRES CHART SIGNATURE'
86 ;
87 Q:$G(^OCXS(860.2,6,"INACT"))
88 ;
89 I $$MCE45 D R6R1B
90 Q
91 ;
92R6R1B ; Send Order Check, Notication messages and/or Execute code for Rule #6 'ORDER REQUIRES CHART SIGNATURE' Relation #1 'SIGNATURE'
93 ; Called from R6R1A+10.
94 ;
95 Q:$G(OCXOERR)
96 ;
97 ; Local Extrinsic Functions
98 ; NEWRULE( ---------> NEW RULE MESSAGE
99 ;
100 Q:$D(OCXRULE("R6R1B"))
101 ;
102 N OCXNMSG,OCXCMSG,OCXPORD,OCXFORD,OCXDATA,OCXNUM,OCXDUZ,OCXQUIT,OCXLOGS,OCXLOGD
103 S OCXCMSG=""
104 S OCXNMSG="Order released - requires chart signature."
105 ;
106 Q:$G(OCXOERR)
107 ;
108 ; Send Notification
109 ;
110 S (OCXDUZ,OCXDATA)="",OCXNUM=0
111 I ($G(OCXOSRC)="GENERIC HL7 MESSAGE ARRAY") D
112 .S OCXDATA=$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",2))_"|"_$G(^TMP("OCXSWAP",$J,"OCXODATA","ORC",3))
113 .S OCXDATA=$TR(OCXDATA,"^","@"),OCXNUM=+OCXDATA
114 I ($G(OCXOSRC)="CPRS ORDER PROTOCOL") D
115 .I $P($G(OCXORD),U,3) S OCXDUZ(+$P(OCXORD,U,3))=""
116 .S OCXNUM=+$P(OCXORD,U,2)
117 S:($G(OCXOSRC)="CPRS ORDER PRESCAN") OCXNUM=+$P(OCXPSD,"|",5)
118 S OCXRULE("R6R1B")=""
119 I $$NEWRULE(DFN,OCXNUM,6,1,5,OCXNMSG) D I 1
120 .D:($G(OCXTRACE)<5) EN^ORB3(5,DFN,OCXNUM,.OCXDUZ,OCXNMSG,.OCXDATA)
121 Q
122 ;
123R7R1A ; Verify all Event/Elements of Rule #7 'PATIENT ADMISSION' Relation #1 'ADMISSION'
124 ; Called from EL21+5^OCXOZ0G.
125 ;
126 Q:$G(OCXOERR)
127 ;
128 ; Local Extrinsic Functions
129 ; MCE21( -----------> Verify Event/Element: 'PATIENT ADMISSION'
130 ;
131 Q:$G(^OCXS(860.2,7,"INACT"))
132 ;
133 I $$MCE21 D R7R1B^OCXOZ0L
134 Q
135 ;
136CKSUM(STR) ; Compiler Function: GENERATE STRING CHECKSUM
137 ;
138 N CKSUM,PTR,ASC S CKSUM=0
139 S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
140 F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
141 Q +CKSUM
142 ;
143GETDATA(DFN,OCXL,OCXDFI) ; This Local Extrinsic Function returns runtime data
144 ;
145 N OCXE,VAL,PC S VAL=""
146 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)
147 Q VAL
148 ;
149MCE134() ; Verify Event/Element: ORDER UNFLAGGED
150 ;
151 ; OCXDF(37) -> PATIENT IEN data field
152 ;
153 N OCXRES
154 S OCXDF(37)=$P($G(OCXORD),"^",1) I $L(OCXDF(37)) S OCXRES(134,37)=OCXDF(37)
155 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),134)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),134))
156 Q 0
157 ;
158MCE21() ; Verify Event/Element: PATIENT ADMISSION
159 ;
160 ; OCXDF(37) -> PATIENT IEN data field
161 ;
162 N OCXRES
163 S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXRES(21,37)=OCXDF(37)
164 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),21)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),21))
165 Q 0
166 ;
167MCE45() ; Verify Event/Element: ORDER REQUIRES CHART SIGNATURE
168 ;
169 ; OCXDF(37) -> PATIENT IEN data field
170 ;
171 N OCXRES
172 S OCXDF(37)=$P($G(OCXORD),"^",1) I $L(OCXDF(37)) S OCXRES(45,37)=OCXDF(37)
173 Q:'(OCXDF(37)) 0 I $D(^TMP("OCXCHK",$J,OCXDF(37),45)) Q $G(^TMP("OCXCHK",$J,OCXDF(37),45))
174 Q 0
175 ;
176NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) ; Has this rule already been triggered for this order number
177 ;
178 ;
179 Q:'$G(OCXDFN) 0 Q:'$G(OCXRUL) 0
180 Q:'$G(OCXREL) 0 Q:'$G(OCXNOTF) 0 Q:'$L($G(OCXMESS)) 0
181 S OCXORD=+$G(OCXORD),OCXDFN=+OCXDFN
182 ;
183 N OCXNDX,OCXDATA,OCXDFI,OCXELE,OCXGR,OCXTIME,OCXCKSUM,OCXTSP,OCXTSPL
184 ;
185 S OCXTIME=(+$H)
186 S OCXCKSUM=$$CKSUM(OCXMESS)
187 ;
188 S OCXTSP=($H*86400)+$P($H,",",2)
189 S OCXTSPL=($G(^OCXD(860.7,"AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM))+$G(OCXTSPI,300))
190 ;
191 Q:(OCXTSPL>OCXTSP) 0
192 ;
193 K OCXDATA
194 S OCXDATA(OCXDFN,0)=OCXDFN
195 S OCXDATA("B",OCXDFN,OCXDFN)=""
196 S OCXDATA("AT",OCXTIME,OCXDFN,OCXRUL,+OCXORD,OCXCKSUM)=OCXTSP
197 ;
198 S OCXGR="^OCXD(860.7"
199 D SETAP(OCXGR_")",0,.OCXDATA,OCXDFN)
200 ;
201 K OCXDATA
202 S OCXDATA(OCXRUL,0)=OCXRUL_U_(OCXTIME)_U_(+OCXORD)
203 S OCXDATA(OCXRUL,"M")=OCXMESS
204 S OCXDATA("B",OCXRUL,OCXRUL)=""
205 S OCXGR=OCXGR_","_OCXDFN_",1"
206 D SETAP(OCXGR_")","860.71P",.OCXDATA,OCXRUL)
207 ;
208 K OCXDATA
209 S OCXDATA(OCXREL,0)=OCXREL
210 S OCXDATA("B",OCXREL,OCXREL)=""
211 S OCXGR=OCXGR_","_OCXRUL_",1"
212 D SETAP(OCXGR_")","860.712",.OCXDATA,OCXREL)
213 ;
214 S OCXELE=0 F S OCXELE=$O(^OCXS(860.2,OCXRUL,"C","C",OCXELE)) Q:'OCXELE D
215 .;
216 .N OCXGR1
217 .S OCXGR1=OCXGR_","_OCXREL_",1"
218 .K OCXDATA
219 .S OCXDATA(OCXELE,0)=OCXELE
220 .S OCXDATA(OCXELE,"TIME")=OCXTIME
221 .S OCXDATA(OCXELE,"LOG")=$G(OCXOLOG)
222 .S OCXDATA("B",OCXELE,OCXELE)=""
223 .K ^OCXD(860.7,OCXDFN,1,OCXRUL,1,OCXREL,1,OCXELE)
224 .D SETAP(OCXGR1_")","860.7122P",.OCXDATA,OCXELE)
225 .;
226 .S OCXDFI=0 F S OCXDFI=$O(^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)) Q:'OCXDFI D
227 ..N OCXGR2
228 ..S OCXGR2=OCXGR1_","_OCXELE_",1"
229 ..K OCXDATA
230 ..S OCXDATA(OCXDFI,0)=OCXDFI
231 ..S OCXDATA(OCXDFI,"VAL")=^TMP("OCXCHK",$J,OCXDFN,OCXELE,OCXDFI)
232 ..S OCXDATA("B",OCXDFI,OCXDFI)=""
233 ..D SETAP(OCXGR2_")","860.71223P",.OCXDATA,OCXDFI)
234 ;
235 Q 1
236 ;
237SETAP(ROOT,DD,DATA,DA) ; Set Rule Event data
238 M @ROOT=DATA
239 I +$G(DD) S @ROOT@(0)="^"_($G(DD))_"^"_($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
240 I '$G(DD) S $P(@ROOT@(0),U,3,4)=($P($G(@ROOT@(0)),U,3)+1)_"^"_$G(DA)
241 ;
242 Q
243 ;
244 ;
Note: See TracBrowser for help on using the repository browser.