source: FOIAVistA/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/OCXOZ0B.m@ 1724

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

initial load of FOIAVistA 6/30/08 version

File size: 8.2 KB
Line 
1OCXOZ0B ;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 ;
13CHK241 ; Look through the current environment for valid Event/Elements for this patient.
14 ; Called from CHK236+16^OCXOZ0A.
15 ;
16 Q:$G(OCXOERR)
17 ;
18 ; Local CHK241 Variables
19 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
20 ; OCXDF(73) ---> Data Field: ORDERABLE ITEM IEN (NUMERIC)
21 ; OCXDF(79) ---> Data Field: PATIENT TOO BIG FOR SCANNER TEXT (FREE TEXT)
22 ; OCXDF(80) ---> Data Field: PATIENT TOO BIG FOR SCANNER DEVICE (FREE TEXT)
23 ;
24 ; Local Extrinsic Functions
25 ; CTMRI( -----------> CT MRI PHYSICAL LIMITS
26 ; FILE(DFN,72, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: PATIENT OVER CT OR MRI DEVICE LIMITATIONS)
27 ;
28 S OCXDF(79)=$P($$CTMRI(OCXDF(37),OCXDF(73)),"^",2),OCXDF(80)=$P($$CTMRI(OCXDF(37),OCXDF(73)),"^",3),OCXOERR=$$FILE(DFN,72,"79,80") Q:OCXOERR
29 Q
30 ;
31CHK247 ; Look through the current environment for valid Event/Elements for this patient.
32 ; Called from CHK182+19^OCXOZ08.
33 ;
34 Q:$G(OCXOERR)
35 ;
36 ; Local CHK247 Variables
37 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
38 ; OCXDF(64) ---> Data Field: FORMATTED RENAL LAB RESULTS (FREE TEXT)
39 ;
40 ; Local Extrinsic Functions
41 ; FILE(DFN,73, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CREATININE CLEARANCE ESTIMATE)
42 ; FLAB( ------------> FORMATTED LAB RESULTS
43 ;
44 S OCXDF(64)=$$FLAB(OCXDF(37),"SERUM CREATININE^SERUM UREA NITROGEN","SERUM SPECIMEN"),OCXOERR=$$FILE(DFN,73,"64,76") Q:OCXOERR
45 Q
46 ;
47CHK253 ; Look through the current environment for valid Event/Elements for this patient.
48 ; Called from CHK157+18^OCXOZ07.
49 ;
50 Q:$G(OCXOERR)
51 ;
52 ; Local CHK253 Variables
53 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
54 ; OCXDF(34) ---> Data Field: ORDER NUMBER (NUMERIC)
55 ; OCXDF(96) ---> Data Field: ORDERABLE ITEM NAME (FREE TEXT)
56 ;
57 ; Local Extrinsic Functions
58 ; FILE(DFN,110, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: STAT CONSULT RESULT)
59 ; FILE(DFN,75, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: STAT IMAGING RESULT)
60 ; ORDITEM( ---------> GET ORDERABLE ITEM FROM ORDER NUMBER
61 ;
62 I (OCXDF(2)="RA"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,75,"24,96") Q:OCXOERR
63 I (OCXDF(2)="GMRC"),$L(OCXDF(34)) S OCXDF(96)=$$ORDITEM(OCXDF(34)),OCXOERR=$$FILE(DFN,110,"24,96") Q:OCXOERR
64 Q
65 ;
66CHK264 ; Look through the current environment for valid Event/Elements for this patient.
67 ; Called from CHK151+18^OCXOZ07.
68 ;
69 Q:$G(OCXOERR)
70 ;
71 ; Local Extrinsic Functions
72 ; FILE(DFN,76, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: STAT LAB RESULT)
73 ;
74 S OCXOERR=$$FILE(DFN,76,"24,96") Q:OCXOERR
75 Q
76 ;
77CHK270 ; Look through the current environment for valid Event/Elements for this patient.
78 ; Called from CHK12+34^OCXOZ03.
79 ;
80 Q:$G(OCXOERR)
81 ;
82 ; Local CHK270 Variables
83 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
84 ; OCXDF(84) ---> Data Field: INPATIENT (BOOLEAN)
85 ; OCXDF(147) --> Data Field: PATIENT LOCATION (FREE TEXT)
86 ;
87 ; Local Extrinsic Functions
88 ; FILE(DFN,84, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: INPATIENT FOOD-DRUG REACTION)
89 ; PATLOC( ----------> PATIENT LOCATION
90 ; WARDRMBD( --------> WARD ROOM-BED
91 ;
92 S OCXDF(84)=$P($$WARDRMBD(OCXDF(37)),"^",1) I $L(OCXDF(84)),(OCXDF(84)) S OCXDF(147)=$P($$PATLOC(OCXDF(37)),"^",2),OCXOERR=$$FILE(DFN,84,"82,147") Q:OCXOERR
93 Q
94 ;
95CHK280 ; Look through the current environment for valid Event/Elements for this patient.
96 ; Called from CHK188+15^OCXOZ09.
97 ;
98 Q:$G(OCXOERR)
99 ;
100 ; Local CHK280 Variables
101 ; OCXDF(2) ----> Data Field: FILLER (FREE TEXT)
102 ; OCXDF(37) ---> Data Field: PATIENT IEN (NUMERIC)
103 ; OCXDF(125) --> Data Field: RECENT GLUCOPHAGE CREATININE TEXT (FREE TEXT)
104 ; OCXDF(127) --> Data Field: RECENT GLUCOPHAGE CREATININE DAYS (NUMERIC)
105 ;
106 ; Local Extrinsic Functions
107 ;
108 I ($E(OCXDF(2),1,2)="PS") S OCXDF(37)=$G(DFN) I $L(OCXDF(37)) S OCXDF(125)=$P($$GLCREAT^ORKPS(OCXDF(37)),"^",2),OCXDF(127)=$P($$GCDAYS^ORKPS(OCXDF(37)),"^",1) D CHK285
109 Q
110 ;
111CHK285 ; Look through the current environment for valid Event/Elements for this patient.
112 ; Called from CHK280+13.
113 ;
114 Q:$G(OCXOERR)
115 ;
116 ; Local Extrinsic Functions
117 ; FILE(DFN,86, -----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: GLUCOPHAGE ORDER)
118 ;
119 S OCXOERR=$$FILE(DFN,86,"125,127") Q:OCXOERR
120 Q
121 ;
122CHK293 ; Look through the current environment for valid Event/Elements for this patient.
123 ; Called from CHK113+20^OCXOZ06.
124 ;
125 Q:$G(OCXOERR)
126 ;
127 ; Local Extrinsic Functions
128 ; FILE(DFN,100, ----> FILE DATA IN PATIENT ACTIVE DATA FILE (Event/Element: CANCELED BY NON-ORIG ORDERING PROVIDER)
129 ;
130 S OCXOERR=$$FILE(DFN,100,"105") Q:OCXOERR
131 Q
132 ;
133CTMRI(DFN,OCXOI) ; Compiler Function: CT MRI PHYSICAL LIMITS
134 ;
135 N OCXDEV,OCXWTP,OCXHTP,OCXWTL,OCXHTL
136 S OCXDEV=$$TYPE^ORKRA(OCXOI)
137 Q:'((OCXDEV="MRI")!(OCXDEV="CT")) 0_U
138 S OCXWTP=$P($$WT^ORQPTQ4(DFN),U,2),OCXHTP=$P($$HT^ORQPTQ4(DFN),U,2)
139 I (OCXDEV="CT") S OCXWTL=$$GET^XPAR("ALL","ORK CT LIMIT WT",1,"Q"),OCXHTL=$$GET^XPAR("ALL","ORK CT LIMIT HT",1,"Q")
140 I (OCXDEV="CT"),(OCXWTL),(OCXWTP>OCXWTL) Q 1_U_"too heavy"_U_"CT scanner"
141 I (OCXDEV="CT"),(OCXHTL),(OCXHTP>OCXHTL) Q 1_U_"too tall"_U_"CT scanner"
142 I (OCXDEV="MRI") S OCXWTL=$$GET^XPAR("ALL","ORK MRI LIMIT WT",1,"Q"),OCXHTL=$$GET^XPAR("ALL","ORK MRI LIMIT HT",1,"Q")
143 I (OCXDEV="MRI"),(OCXWTL),(OCXWTP>OCXWTL) Q 1_U_"too heavy"_U_"MRI scanner"
144 I (OCXDEV="MRI"),(OCXHTL),(OCXHTP>OCXHTL) Q 1_U_"too tall"_U_"MRI scanner"
145 Q 0_U
146 ;
147FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
148 ;
149 N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
150 S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
151 ;
152 Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
153 ;
154 S OCXDATA(DFN,OCXELE)=1
155 F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
156 .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
157 ;
158 M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
159 ;
160 Q 0
161 ;
162FLAB(DFN,OCXLIST,OCXSPEC) ; Compiler Function: FORMATTED LAB RESULTS
163 ;
164 Q:'$G(DFN) "<Patient Not Specified>"
165 Q:'$L($G(OCXLIST)) "<Lab Tests Not Specified>"
166 N OCXLAB,OCXOUT,OCXPC,OCXSL,SPEC S OCXOUT="",SPEC=""
167 I $L($G(OCXSPEC)) S OCXSL=$$TERMLKUP(OCXSPEC,.OCXSL)
168 F OCXPC=1:1:$L(OCXLIST,U) S OCXLAB=$P(OCXLIST,U,OCXPC) I $L(OCXLAB) D
169 .N OCXX,OCXY,X,Y,DIC,TEST,SPEC,OCXTL,OCXA,OCXR
170 .S OCXTL="" Q:'$$TERMLKUP(OCXLAB,.OCXTL)
171 .S OCXX="",TEST=0 F S TEST=$O(OCXTL(TEST)) Q:'TEST D
172 ..I $L($G(OCXSL)) D
173 ...S SPEC=0 F S SPEC=$O(OCXSL(SPEC)) Q:'SPEC D
174 ....S OCXX=$$LOCL^ORQQLR1(DFN,TEST,SPEC) I $L(OCXX) D
175 .....S OCXA($P(OCXX,U,7))=OCXX
176 ..I '$L($G(OCXSL)) S OCXX=$$LOCL^ORQQLR1(DFN,TEST,"")
177 ..Q:'$L(OCXX)
178 .I $D(OCXA) S OCXR="",OCXR=$O(OCXA(OCXR),-1),OCXX=OCXA(OCXR)
179 .I $L(OCXX) D
180 ..S OCXY=$P(OCXX,U,2)_": "_$P(OCXX,U,3)_" "_$P(OCXX,U,4)
181 ..S OCXY=OCXY_" "_$S($L($P(OCXX,U,5)):"["_$P(OCXX,U,5)_"]",1:"")
182 ..I $L($P(OCXX,U,7)) S OCXY=OCXY_" "_$$FMTE^XLFDT($P(OCXX,U,7),"2P")
183 .S:$L(OCXOUT) OCXOUT=OCXOUT_" " S OCXOUT=OCXOUT_$G(OCXY)
184 Q:'$L(OCXOUT) "<Results Not Found>" Q OCXOUT
185 ;
186ORDITEM(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 ;
193PATLOC(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 ;
209TERMLKUP(OCXTERM,OCXLIST) ;
210 Q $$TERM^OCXOZ01(OCXTERM,.OCXLIST)
211 ;
212WARDRMBD(DFN) ; Compiler Function: WARD ROOM-BED
213 ;
214 Q:'$G(DFN) 0
215 N OUT S OUT=$G(^DPT(DFN,.1)) Q:'$L(OUT) 0
216 S OUT=1_"^"_OUT_" "_$G(^DPT(DFN,.101)) Q OUT
217 ;
Note: See TracBrowser for help on using the repository browser.