source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0C.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.1 KB
Line 
1OCXOZ0C ;SLC/RJS,CLA - Order Check Scan ;NOV 8,2009 at 18:44
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,221,243**;Dec 17,1997;Build 242
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 ;
13CHK302 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from CHK6+19^OCXOZ02.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK302 Variables
19 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
20 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
21 ; OCXDF(55) ---> Data Field: SITE FLAGGED RESULT (BOOLEAN)
22 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
23 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
24 ;
25 ; Local Extrinsic Functions
26 ; FILE(DFN,102, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SITE FLAGGED FINAL IMAGING RESULT)
27 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
28 ; PATLOC( ----------> PATIENT LOCATION
29 ;
30 I $L(OCXDF(55)),(OCXDF(55)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,102,"9,96,147") Q:OCXOERR
31 Q
32 ;
33CHK314 ; Look through the current environment for valid Event/Elements for this patient.
34 ; Called from CHK35+18^OCXOZ04.
35 ;
36 Q:$G(OCXOERR)
37 ;
38 ; Local CHK314 Variables
39 ; OCXDF(113) --> Data Field: LAB TEST ID (NUMERIC)
40 ; OCXDF(114) --> Data Field: LAB TEST PRINT NAME (FREE TEXT)
41 ;
42 ; Local Extrinsic Functions
43 ; FILE(DFN,103, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB TEST RESULTS ABNORMAL)
44 ;
45 I $L(OCXDF(113)) S OCXDF(114)=$$PRINTNAM^ORQQLR1(OCXDF(113)),OCXOERR=$$FILE(DFN,103,"12,13,96,114") Q:OCXOERR
46 Q
47 ;
48CHK324 ; Look through the current environment for valid Event/Elements for this patient.
49 ; Called from CHK34+16^OCXOZ04.
50 ;
51 Q:$G(OCXOERR)
52 ;
53 ; Local CHK324 Variables
54 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
55 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
56 ; OCXDF(113) --> Data Field: LAB TEST ID (NUMERIC)
57 ; OCXDF(114) --> Data Field: LAB TEST PRINT NAME (FREE TEXT)
58 ;
59 ; Local Extrinsic Functions
60 ; FILE(DFN,105, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: HL7 LAB ORDER RESULTS CRITICAL)
61 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
62 ;
63 S OCXDF(96)=$$ORDITEM(OCXDF(34)) I $L(OCXDF(113)) S OCXDF(114)=$$PRINTNAM^ORQQLR1(OCXDF(113)),OCXOERR=$$FILE(DFN,105,"12,13,96,114") Q:OCXOERR
64 Q
65 ;
66CHK336 ; Look through the current environment for valid Event/Elements for this patient.
67 ; Called from CHK6+20^OCXOZ02.
68 ;
69 Q:$G(OCXOERR)
70 ;
71 ; Local CHK336 Variables
72 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
73 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
74 ; OCXDF(55) ---> Data Field: SITE FLAGGED RESULT (BOOLEAN)
75 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
76 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
77 ;
78 ; Local Extrinsic Functions
79 ; FILE(DFN,109, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: SITE FLAGGED FINAL CONSULT RESULT)
80 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
81 ; PATLOC( ----------> PATIENT LOCATION
82 ;
83 I $L(OCXDF(55)),(OCXDF(55)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,109,"9,96,147") Q:OCXOERR
84 Q
85 ;
86CHK347 ; Look through the current environment for valid Event/Elements for this patient.
87 ; Called from CHK58+20^OCXOZ05.
88 ;
89 Q:$G(OCXOERR)
90 ;
91 ; Local CHK347 Variables
92 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
93 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
94 ; OCXDF(136) --> Data Field: CLOZAPINE ANC W/IN 7 FLAG (BOOLEAN)
95 ; OCXDF(137) --> Data Field: CLOZAPINE ANC W/IN 7 RESULT (NUMERIC)
96 ; OCXDF(139) --> Data Field: CLOZAPINE WBC W/IN 7 FLAG (BOOLEAN)
97 ; OCXDF(140) --> Data Field: CLOZAPINE WBC W/IN 7 RESULT (NUMERIC)
98 ;
99 ; Local Extrinsic Functions
100 ;
101 S OCXDF(137)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",3),";",2) I $L(OCXDF(137)) D CHK349
102 S OCXDF(136)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",3),";",1) I $L(OCXDF(136)),'(OCXDF(136)) D CHK371^OCXOZ0D
103 S OCXDF(139)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",2),";",1) I $L(OCXDF(139)),'(OCXDF(139)) D CHK375^OCXOZ0D
104 S OCXDF(140)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",2),";",2) I $L(OCXDF(140)) D CHK378^OCXOZ0D
105 Q
106 ;
107CHK349 ; Look through the current environment for valid Event/Elements for this patient.
108 ; Called from CHK347+15.
109 ;
110 Q:$G(OCXOERR)
111 ;
112 ; Local CHK349 Variables
113 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
114 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
115 ; OCXDF(136) --> Data Field: CLOZAPINE ANC W/IN 7 FLAG (BOOLEAN)
116 ; OCXDF(137) --> Data Field: CLOZAPINE ANC W/IN 7 RESULT (NUMERIC)
117 ;
118 ; Local Extrinsic Functions
119 ;
120 I (OCXDF(137)<1.5) S OCXDF(136)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",3),";",1) I $L(OCXDF(136)),(OCXDF(136)) D CHK353
121 I (OCXDF(137)>1.499) D CHK355
122 Q
123 ;
124CHK353 ; Look through the current environment for valid Event/Elements for this patient.
125 ; Called from CHK349+13.
126 ;
127 Q:$G(OCXOERR)
128 ;
129 ; Local CHK353 Variables
130 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
131 ; OCXDF(130) --> Data Field: CLOZAPINE LAB RESULTS (FREE TEXT)
132 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
133 ;
134 ; Local Extrinsic Functions
135 ; FILE(DFN,114, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CLOZAPINE ANC < 1.5)
136 ;
137 S OCXDF(130)=$P($$CLOZLABS^ORKLR(OCXDF(37),"",OCXDF(131)),"^",4),OCXOERR=$$FILE(DFN,114,"130") Q:OCXOERR
138 Q
139 ;
140CHK355 ; Look through the current environment for valid Event/Elements for this patient.
141 ; Called from CHK349+14.
142 ;
143 Q:$G(OCXOERR)
144 ;
145 ; Local CHK355 Variables
146 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
147 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
148 ; OCXDF(136) --> Data Field: CLOZAPINE ANC W/IN 7 FLAG (BOOLEAN)
149 ; OCXDF(137) --> Data Field: CLOZAPINE ANC W/IN 7 RESULT (NUMERIC)
150 ;
151 ; Local Extrinsic Functions
152 ;
153 S OCXDF(136)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",3),";",1) I $L(OCXDF(136)),(OCXDF(136)) D CHK358
154 I (OCXDF(137)<"2.0") S OCXDF(136)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",3),";",1) I $L(OCXDF(136)),(OCXDF(136)) D CHK505^OCXOZ0G
155 Q
156 ;
157CHK358 ; Look through the current environment for valid Event/Elements for this patient.
158 ; Called from CHK355+13.
159 ;
160 Q:$G(OCXOERR)
161 ;
162 ; Local CHK358 Variables
163 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
164 ; OCXDF(130) --> Data Field: CLOZAPINE LAB RESULTS (FREE TEXT)
165 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
166 ;
167 ; Local Extrinsic Functions
168 ; FILE(DFN,115, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CLOZAPINE ANC >= 1.5)
169 ;
170 S OCXDF(130)=$P($$CLOZLABS^ORKLR(OCXDF(37),"",OCXDF(131)),"^",4),OCXOERR=$$FILE(DFN,115,"130") Q:OCXOERR
171 Q
172 ;
173FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
174 ;
175 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
176 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
177 ;
178 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
179 ;
180 S OCXDATA(DFN,OCXELE)=1
181 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
182 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
183 ;
184 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
185 ;
186 Q 0
187 ;
188ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
189 Q:'$G(OIEN) ""
190 ;
191 N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
192 S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
193 Q $P(X,U,1)
194 ;
195PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
196 ;
197 N OCXP1,OCXP2
198 S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
199 S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
200 I OCXP2 D
201 .S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
202 .I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
203 .E S OCXP2=$P(OCXP2,"^",1)
204 .S:'$L(OCXP2) OCXP2="NO LOC"
205 I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
206 ;
207 S OCXP2=$G(^DPT(+$G(DFN),.1))
208 I $L(OCXP2) Q "I^"_OCXP2
209 Q "O^OUTPT"
210 ;
Note: See TracBrowser for help on using the repository browser.