source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0E.m@ 1361

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

revised back to 6/30/08 version

File size: 8.1 KB
Line 
1OCXOZ0E ;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 ;
13CHK400 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from CHK383+15^OCXOZ0D.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK400 Variables
19 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
20 ; OCXDF(130) --> Data Field: CLOZAPINE LAB RESULTS (FREE TEXT)
21 ; OCXDF(131) --> Data Field: PHARMACY LOCAL ID (FREE TEXT)
22 ; OCXDF(145) --> Data Field: CLOZAPINE WBC 3.0-3.5 TEXT (FREE TEXT)
23 ;
24 ; Local Extrinsic Functions
25 ; FILE(DFN,121, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CLOZAPINE WBC >= 3.5)
26 ; MSGTEXT( ---------> MESSAGE TEXT
27 ;
28 S OCXDF(130)=$P($$CLOZLABS^ORKLR(OCXDF(37),"",OCXDF(131)),"^",4),OCXDF(145)=$$MSGTEXT("CLOZWBC30_35"),OCXOERR=$$FILE(DFN,121,"130,145") Q:OCXOERR
29 Q
30 ;
31CHK406 ; Look through the current environment for valid Event/Elements for this patient.
32 ; Called from CHK58+21^OCXOZ05.
33 ;
34 Q:$G(OCXOERR)
35 ;
36 ; Local CHK406 Variables
37 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
38 ; OCXDF(62) ---> Data Field: PATIENT AGE (NUMERIC)
39 ; OCXDF(141) --> Data Field: AMITRIPTYLINE TEXT (FREE TEXT)
40 ; OCXDF(143) --> Data Field: DANGEROUS MEDS FOR PT > 64 NAME (FREE TEXT)
41 ;
42 ; Local Extrinsic Functions
43 ; MSGTEXT( ---------> MESSAGE TEXT
44 ;
45 I (OCXDF(143)["AMITRIPTYLINE") S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXDF(62)=$$AGE^ORQPTQ4(OCXDF(37)),OCXDF(141)=$$MSGTEXT("AMITRIPTYLINE") D CHK411
46 I (OCXDF(143)["CHLORPROPAMIDE") S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXDF(62)=$$AGE^ORQPTQ4(OCXDF(37)),OCXDF(141)=$$MSGTEXT("AMITRIPTYLINE") D CHK418
47 I (OCXDF(143)["DIPYRIDAMOLE") S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXDF(62)=$$AGE^ORQPTQ4(OCXDF(37)),OCXDF(141)=$$MSGTEXT("AMITRIPTYLINE") D CHK425
48 Q
49 ;
50CHK411 ; Look through the current environment for valid Event/Elements for this patient.
51 ; Called from CHK406+14.
52 ;
53 Q:$G(OCXOERR)
54 ;
55 ; Local CHK411 Variables
56 ; OCXDF(142) --> Data Field: CHLORPROPAMIDE TEXT (FREE TEXT)
57 ; OCXDF(144) --> Data Field: DIPYRIDAMOLE TEXT (FREE TEXT)
58 ;
59 ; Local Extrinsic Functions
60 ; FILE(DFN,122, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: AMITRIPTYLINE ORDER)
61 ; MSGTEXT( ---------> MESSAGE TEXT
62 ;
63 S OCXDF(142)=$$MSGTEXT("CHLORPROPAMIDE"),OCXDF(144)=$$MSGTEXT("DIPYRIDAMOLE"),OCXOERR=$$FILE(DFN,122,"62,141,142,144") Q:OCXOERR
64 Q
65 ;
66CHK418 ; Look through the current environment for valid Event/Elements for this patient.
67 ; Called from CHK406+15.
68 ;
69 Q:$G(OCXOERR)
70 ;
71 ; Local CHK418 Variables
72 ; OCXDF(142) --> Data Field: CHLORPROPAMIDE TEXT (FREE TEXT)
73 ; OCXDF(144) --> Data Field: DIPYRIDAMOLE TEXT (FREE TEXT)
74 ;
75 ; Local Extrinsic Functions
76 ; FILE(DFN,123, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CHLORPROPAMIDE ORDER)
77 ; MSGTEXT( ---------> MESSAGE TEXT
78 ;
79 S OCXDF(142)=$$MSGTEXT("CHLORPROPAMIDE"),OCXDF(144)=$$MSGTEXT("DIPYRIDAMOLE"),OCXOERR=$$FILE(DFN,123,"62,141,142,144") Q:OCXOERR
80 Q
81 ;
82CHK425 ; Look through the current environment for valid Event/Elements for this patient.
83 ; Called from CHK406+16.
84 ;
85 Q:$G(OCXOERR)
86 ;
87 ; Local CHK425 Variables
88 ; OCXDF(142) --> Data Field: CHLORPROPAMIDE TEXT (FREE TEXT)
89 ; OCXDF(144) --> Data Field: DIPYRIDAMOLE TEXT (FREE TEXT)
90 ;
91 ; Local Extrinsic Functions
92 ; FILE(DFN,124, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: DIPYRIDAMOLE ORDER)
93 ; MSGTEXT( ---------> MESSAGE TEXT
94 ;
95 S OCXDF(142)=$$MSGTEXT("CHLORPROPAMIDE"),OCXDF(144)=$$MSGTEXT("DIPYRIDAMOLE"),OCXOERR=$$FILE(DFN,124,"62,141,142,144") Q:OCXOERR
96 Q
97 ;
98CHK434 ; Look through the current environment for valid Event/Elements for this patient.
99 ; Called from CHK164+16^OCXOZ08.
100 ;
101 Q:$G(OCXOERR)
102 ;
103 ; Local CHK434 Variables
104 ; OCXDF(62) ---> Data Field: PATIENT AGE (NUMERIC)
105 ; OCXDF(141) --> Data Field: AMITRIPTYLINE TEXT (FREE TEXT)
106 ; OCXDF(142) --> Data Field: CHLORPROPAMIDE TEXT (FREE TEXT)
107 ; OCXDF(144) --> Data Field: DIPYRIDAMOLE TEXT (FREE TEXT)
108 ;
109 ; Local Extrinsic Functions
110 ; MSGTEXT( ---------> MESSAGE TEXT
111 ;
112 I (OCXDF(62)>64) S OCXDF(141)=$$MSGTEXT("AMITRIPTYLINE"),OCXDF(142)=$$MSGTEXT("CHLORPROPAMIDE"),OCXDF(144)=$$MSGTEXT("DIPYRIDAMOLE") D CHK438
113 Q
114 ;
115CHK438 ; Look through the current environment for valid Event/Elements for this patient.
116 ; Called from CHK434+14.
117 ;
118 Q:$G(OCXOERR)
119 ;
120 ; Local Extrinsic Functions
121 ; FILE(DFN,125, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: MED ORDER FOR PT > 64)
122 ;
123 S OCXOERR=$$FILE(DFN,125,"62,141,142,144") Q:OCXOERR
124 Q
125 ;
126CHK444 ; Look through the current environment for valid Event/Elements for this patient.
127 ; Called from CHK1+33^OCXOZ02.
128 ;
129 Q:$G(OCXOERR)
130 ;
131 ; Local CHK444 Variables
132 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
133 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
134 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
135 ; OCXDF(146) --> Data Field: INPT/OUTPT (FREE TEXT)
136 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
137 ;
138 ; Local Extrinsic Functions
139 ; FILE(DFN,127, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: INPATIENT)
140 ; FILE(DFN,128, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: OUTPATIENT)
141 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
142 ; PATLOC( ----------> PATIENT LOCATION
143 ;
144 I (OCXDF(146)="I"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,127,"9,96,147") Q:OCXOERR
145 I (OCXDF(146)="O"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,128,"9,96,147") Q:OCXOERR
146 Q
147 ;
148FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
149 ;
150 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
151 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
152 ;
153 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
154 ;
155 S OCXDATA(DFN,OCXELE)=1
156 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
157 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
158 ;
159 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
160 ;
161 Q 0
162 ;
163MSGTEXT(ID) ; Compiler Function: MESSAGE TEXT
164 ;
165 N MSG
166 S MSG=""
167 ;
168 I ID="AMITRIPTYLINE" D
169 .S MSG="Amitriptyline can cause cognitive impairment and loss of"
170 .S MSG=MSG_" balance in older patients. Consider other antidepressant"
171 .S MSG=MSG_" medications on formulary."
172 ;
173 I ID="CHLORPROPAMIDE" D
174 .S MSG="Older patients may experience hypoglycemia with"
175 .S MSG=MSG_" Chlorpropamide due to its long duration and variable"
176 .S MSG=MSG_" renal secretion. They may also be at increased risk for"
177 .S MSG=MSG_" Chlorpropamide-induced SIADH."
178 ;
179 I ID="DIPYRIDAMOLE" D
180 .S MSG="Older patients can experience adverse reactions at high doses"
181 .S MSG=MSG_" of Dipyridamole (e.g., headache, dizziness, syncope, GI"
182 .S MSG=MSG_" intolerance.) There is also questionable efficacy at"
183 .S MSG=MSG_" lower doses."
184 ;
185 I ID="CLOZWBC30_35" D
186 .S MSG="WBC between 3.0 and 3.5 with no ANC - pharmacy cannot fill"
187 .S MSG=MSG_" clozapine order. Please order CBC/Diff with WBC and ANC"
188 .S MSG=MSG_" immediately."
189 ;
190 Q MSG
191 ;
192ORDITEM(OIEN) ; Compiler Function: GET ORDERABLE ITEM FROM ORDER NUMBER
193 Q:'$G(OIEN) ""
194 ;
195 N OITXT,X S OITXT=$$OI^ORQOR2(OIEN) Q:'OITXT "No orderable item found."
196 S X=$G(^ORD(101.43,+OITXT,0)) Q:'$L(X) "No orderable item found."
197 Q $P(X,U,1)
198 ;
199PATLOC(DFN) ; Compiler Function: PATIENT LOCATION
200 ;
201 N OCXP1,OCXP2
202 S OCXP1=$G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",2))
203 S OCXP2=$P($G(^TMP("OCXSWAP",$J,"OCXODATA","PV1",3)),"^",1)
204 I OCXP2 D
205 .S OCXP2=$P($G(^SC(+OCXP2,0)),"^",1,2)
206 .I $L($P(OCXP2,"^",2)) S OCXP2=$P(OCXP2,"^",2)
207 .E S OCXP2=$P(OCXP2,"^",1)
208 .S:'$L(OCXP2) OCXP2="NO LOC"
209 I $L(OCXP1),$L(OCXP2) Q OCXP1_"^"_OCXP2
210 ;
211 S OCXP2=$G(^DPT(+$G(DFN),.1))
212 I $L(OCXP2) Q "I^"_OCXP2
213 Q "O^OUTPT"
214 ;
Note: See TracBrowser for help on using the repository browser.