1 | OCXOZ0C ;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 | CHK302 ; 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 | ;
|
---|
33 | CHK314 ; 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 | ;
|
---|
48 | CHK324 ; 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 | ;
|
---|
66 | CHK336 ; 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 | ;
|
---|
86 | CHK347 ; 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 CHK374^OCXOZ0D
|
---|
103 | S OCXDF(139)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",2),";",1) I $L(OCXDF(139)),'(OCXDF(139)) D CHK379^OCXOZ0D
|
---|
104 | S OCXDF(140)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",2),";",2) I $L(OCXDF(140)) D CHK383^OCXOZ0D
|
---|
105 | Q
|
---|
106 | ;
|
---|
107 | CHK349 ; 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) S OCXDF(136)=$P($P($$CLOZLABS^ORKLR(OCXDF(37),7,OCXDF(131)),"^",3),";",1) I $L(OCXDF(136)),(OCXDF(136)) D CHK359^OCXOZ0D
|
---|
122 | Q
|
---|
123 | ;
|
---|
124 | CHK353 ; 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 | ; OCXDF(145) --> Data Field: CLOZAPINE WBC 3.0-3.5 TEXT (FREE TEXT)
|
---|
134 | ;
|
---|
135 | ; Local Extrinsic Functions
|
---|
136 | ; FILE(DFN,114, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CLOZAPINE ANC < 1.5)
|
---|
137 | ; MSGTEXT( ---------> MESSAGE TEXT
|
---|
138 | ;
|
---|
139 | S OCXDF(130)=$P($$CLOZLABS^ORKLR(OCXDF(37),"",OCXDF(131)),"^",4),OCXDF(145)=$$MSGTEXT("CLOZWBC30_35"),OCXOERR=$$FILE(DFN,114,"130,145") Q:OCXOERR
|
---|
140 | Q
|
---|
141 | ;
|
---|
142 | FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
|
---|
143 | ;
|
---|
144 | N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
|
---|
145 | S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
|
---|
146 | ;
|
---|
147 | Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
|
---|
148 | ;
|
---|
149 | S OCXDATA(DFN,OCXELE)=1
|
---|
150 | F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
|
---|
151 | .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
|
---|
152 | ;
|
---|
153 | M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
|
---|
154 | ;
|
---|
155 | Q 0
|
---|
156 | ;
|
---|
157 | MSGTEXT(ID) ; Compiler Function: MESSAGE TEXT
|
---|
158 | ;
|
---|
159 | N MSG
|
---|
160 | S MSG=""
|
---|
161 | ;
|
---|
162 | I ID="AMITRIPTYLINE" D
|
---|
163 | .S MSG="Amitriptyline can cause cognitive impairment and loss of"
|
---|
164 | .S MSG=MSG_" balance in older patients. Consider other antidepressant"
|
---|
165 | .S MSG=MSG_" medications on formulary."
|
---|
166 | ;
|
---|
167 | I ID="CHLORPROPAMIDE" D
|
---|
168 | .S MSG="Older patients may experience hypoglycemia with"
|
---|
169 | .S MSG=MSG_" Chlorpropamide due to its long duration and variable"
|
---|
170 | .S MSG=MSG_" renal secretion. They may also be at increased risk for"
|
---|
171 | .S MSG=MSG_" Chlorpropamide-induced SIADH."
|
---|
172 | ;
|
---|
173 | I ID="DIPYRIDAMOLE" D
|
---|
174 | .S MSG="Older patients can experience adverse reactions at high doses"
|
---|
175 | .S MSG=MSG_" of Dipyridamole (e.g., headache, dizziness, syncope, GI"
|
---|
176 | .S MSG=MSG_" intolerance.) There is also questionable efficacy at"
|
---|
177 | .S MSG=MSG_" lower doses."
|
---|
178 | ;
|
---|
179 | I ID="CLOZWBC30_35" D
|
---|
180 | .S MSG="WBC between 3.0 and 3.5 with no ANC - pharmacy cannot fill"
|
---|
181 | .S MSG=MSG_" clozapine order. Please order CBC/Diff with WBC and ANC"
|
---|
182 | .S MSG=MSG_" immediately."
|
---|
183 | ;
|
---|
184 | Q MSG
|
---|
185 | ;
|
---|
186 | ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
|
---|
187 | Q:'$G(OIEN) ""
|
---|
188 | ;
|
---|
189 | N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
|
---|
190 | S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
|
---|
191 | Q $P(X,U,1)
|
---|
192 | ;
|
---|
193 | PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
|
---|
194 | ;
|
---|
195 | N OCXP1,OCXP2
|
---|
196 | S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
|
---|
197 | S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
|
---|
198 | I OCXP2 D
|
---|
199 | .S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
|
---|
200 | .I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
|
---|
201 | .E S OCXP2=$P(OCXP2,"^",1)
|
---|
202 | .S:'$L(OCXP2) OCXP2="NO LOC"
|
---|
203 | I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
|
---|
204 | ;
|
---|
205 | S OCXP2=$G(^DPT(+$G(DFN),.1))
|
---|
206 | I $L(OCXP2) Q "I^"_OCXP2
|
---|
207 | Q "O^OUTPT"
|
---|
208 | ;
|
---|