1 | ORY26705 ;SLC/RJS,CLA - OCX PACKAGE RULE TRANSPORT ROUTINE (Delete after Install of OR*3*267) ;OCT 23,2006 at 10:42
|
---|
2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**267**;Dec 17,1997;Build 6
|
---|
3 | ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
|
---|
4 | ;
|
---|
5 | S ;
|
---|
6 | ;
|
---|
7 | D DOT^ORY267ES
|
---|
8 | ;
|
---|
9 | ;
|
---|
10 | K REMOTE,LOCAL,OPCODE,REF
|
---|
11 | F LINE=1:1:500 S TEXT=$P($T(DATA+LINE),";",2,999) Q:TEXT I $L(TEXT) D Q:QUIT
|
---|
12 | .S ^TMP("OCXRULE",$J,$O(^TMP("OCXRULE",$J,"A"),-1)+1)=TEXT
|
---|
13 | ;
|
---|
14 | G ^ORY26706
|
---|
15 | ;
|
---|
16 | Q
|
---|
17 | ;
|
---|
18 | DATA ;
|
---|
19 | ;
|
---|
20 | ;;D^ ; S OCXDAY=OCXDT-$P(OCXCNT,U,OCXMON-1)+1
|
---|
21 | ;;R^"860.8:",100,17
|
---|
22 | ;;D^ ; I OCXF S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
|
---|
23 | ;;R^"860.8:",100,18
|
---|
24 | ;;D^ ; E S OCXMON=$E(OCXMON+100,2,3)
|
---|
25 | ;;R^"860.8:",100,19
|
---|
26 | ;;D^ ; S OCXAP=$S('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
|
---|
27 | ;;R^"860.8:",100,20
|
---|
28 | ;;D^ ; I OCXF S OCXHR=OCXHR#12 S:'OCXHR OCXHR=12
|
---|
29 | ;;R^"860.8:",100,21
|
---|
30 | ;;D^ ; Q:'OCXF $E(OCXMON+100,2,3)_"/"_$E(OCXDAY+100,2,3)_$S((OCXCYR=OCXYR):" "_OCXHR_":"_OCXMIN,1:"/"_$E(OCXYR,3,4))
|
---|
31 | ;;R^"860.8:",100,22
|
---|
32 | ;;D^ ; Q:(OCXHR+OCXMIN+OCXSEC) OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
|
---|
33 | ;;R^"860.8:",100,23
|
---|
34 | ;;D^ ; Q OCXMON_" "_OCXDAY_","_OCXYR
|
---|
35 | ;;R^"860.8:",100,24
|
---|
36 | ;;D^ ; ;
|
---|
37 | ;;EOR^
|
---|
38 | ;;KEY^860.8:^ELAPSED ORDER CHECK TIME LOGGER
|
---|
39 | ;;R^"860.8:",.01,"E"
|
---|
40 | ;;D^ELAPSED ORDER CHECK TIME LOGGER
|
---|
41 | ;;R^"860.8:",.02,"E"
|
---|
42 | ;;D^TIMELOG
|
---|
43 | ;;R^"860.8:",100,1
|
---|
44 | ;;D^ ;TIMELOG(OCXMODE,OCXCALL) ; Log an entry in the Elapsed time log.
|
---|
45 | ;;R^"860.8:",100,2
|
---|
46 | ;;D^ ; ;
|
---|
47 | ;;R^"860.8:",100,3
|
---|
48 | ;;D^ ; ;
|
---|
49 | ;;R^"860.8:",100,4
|
---|
50 | ;;D^ ; Q 0
|
---|
51 | ;;R^"860.8:",100,5
|
---|
52 | ;;D^ ; ;
|
---|
53 | ;;EOR^
|
---|
54 | ;;KEY^860.8:^EQUALS TERM OPERATOR
|
---|
55 | ;;R^"860.8:",.01,"E"
|
---|
56 | ;;D^EQUALS TERM OPERATOR
|
---|
57 | ;;R^"860.8:",.02,"E"
|
---|
58 | ;;D^EQTERM
|
---|
59 | ;;R^"860.8:",100,1
|
---|
60 | ;;D^ ;EQTERM(DATA,TERM) ;
|
---|
61 | ;;R^"860.8:",100,2
|
---|
62 | ;;D^ ; ;
|
---|
63 | ;;R^"860.8:",100,3
|
---|
64 | ;;D^T+; I $G(OCXTRACE) W !,"%%%%",?20," Execution trace DATA: ",$G(DATA)," TERM: ",$G(TERM)
|
---|
65 | ;;R^"860.8:",100,4
|
---|
66 | ;;D^ ; N OCXF,OCXL
|
---|
67 | ;;R^"860.8:",100,5
|
---|
68 | ;;D^ ; ;
|
---|
69 | ;;R^"860.8:",100,6
|
---|
70 | ;;D^ ; S OCXL="",OCXF=$$TERMLKUP(TERM,.OCXL)
|
---|
71 | ;;R^"860.8:",100,7
|
---|
72 | ;;D^T-; Q:'OCXF 0
|
---|
73 | ;;R^"860.8:",100,8
|
---|
74 | ;;D^T+; I 'OCXF W:$G(OCXTRACE) !,"%%%%",?20," Term '",TERM,"' not in Order Check National Term File" Q 0
|
---|
75 | ;;R^"860.8:",100,9
|
---|
76 | ;;D^T+; I '$O(OCXL(0)) W:$G(OCXTRACE) !,"%%%%",?20," There are no local terms listed for the National Term '",TERM,"'." Q 0
|
---|
77 | ;;R^"860.8:",100,10
|
---|
78 | ;;D^T+; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) W:$G(OCXTRACE) !,"%%%%",?20," Data equals Term" Q 1
|
---|
79 | ;;R^"860.8:",100,11
|
---|
80 | ;;D^T-; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) Q 1
|
---|
81 | ;;R^"860.8:",100,12
|
---|
82 | ;;D^T-; Q 0
|
---|
83 | ;;R^"860.8:",100,13
|
---|
84 | ;;D^T+; W:$G(OCXTRACE) !,"%%%%",?20," Data does not equal Term" Q 0
|
---|
85 | ;;R^"860.8:",100,14
|
---|
86 | ;;D^ ; ;
|
---|
87 | ;;EOR^
|
---|
88 | ;;KEY^860.8:^FILE DATA IN PATIENT ACTIVE DATA FILE
|
---|
89 | ;;R^"860.8:",.01,"E"
|
---|
90 | ;;D^FILE DATA IN PATIENT ACTIVE DATA FILE
|
---|
91 | ;;R^"860.8:",.02,"E"
|
---|
92 | ;;D^FILE
|
---|
93 | ;;R^"860.8:",1,1
|
---|
94 | ;;D^ ;FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function files data
|
---|
95 | ;;R^"860.8:",1,2
|
---|
96 | ;;D^ ; ; in the Order Check Patient Data File
|
---|
97 | ;;R^"860.8:",1,3
|
---|
98 | ;;D^ ; ;
|
---|
99 | ;;R^"860.8:",100,1
|
---|
100 | ;;D^ ;FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
|
---|
101 | ;;R^"860.8:",100,2
|
---|
102 | ;;D^ ; ;
|
---|
103 | ;;R^"860.8:",100,3
|
---|
104 | ;;D^T+; I $G(OCXTRACE) W !,"%%%%",?20," Execution trace DFN: ",DFN," OCXELE: ",+$G(OCXELE)," OCXDFL: ",$G(OCXDFL)
|
---|
105 | ;;R^"860.8:",100,4
|
---|
106 | ;;D^ ; N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
|
---|
107 | ;;R^"860.8:",100,5
|
---|
108 | ;;D^ ; S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
|
---|
109 | ;;R^"860.8:",100,6
|
---|
110 | ;;D^ ; ;
|
---|
111 | ;;R^"860.8:",100,7
|
---|
112 | ;;D^ ; Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
|
---|
113 | ;;R^"860.8:",100,8
|
---|
114 | ;;D^ ; ;
|
---|
115 | ;;R^"860.8:",100,9
|
---|
116 | ;;D^ ; S OCXDATA(DFN,OCXELE)=1
|
---|
117 | ;;R^"860.8:",100,10
|
---|
118 | ;;D^ ; F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
|
---|
119 | ;;R^"860.8:",100,11
|
---|
120 | ;;D^ ; .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
|
---|
121 | ;;R^"860.8:",100,12
|
---|
122 | ;;D^T+; .I $G(OCXTRACE) W !,"%%%%",?20," ",$P($G(^OCXS(860.4,+OCXDFI,0)),U,1)," = """,OCXVAL,""""
|
---|
123 | ;;R^"860.8:",100,13
|
---|
124 | ;;D^ ; ;
|
---|
125 | ;;R^"860.8:",100,14
|
---|
126 | ;;D^ ; M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
|
---|
127 | ;;R^"860.8:",100,15
|
---|
128 | ;;D^ ; ;
|
---|
129 | ;;R^"860.8:",100,16
|
---|
130 | ;;D^ ; Q 0
|
---|
131 | ;;R^"860.8:",100,17
|
---|
132 | ;;D^ ; ;
|
---|
133 | ;;EOR^
|
---|
134 | ;;KEY^860.8:^GENERATE STRING CHECKSUM
|
---|
135 | ;;R^"860.8:",.01,"E"
|
---|
136 | ;;D^GENERATE STRING CHECKSUM
|
---|
137 | ;;R^"860.8:",.02,"E"
|
---|
138 | ;;D^CKSUM
|
---|
139 | ;;R^"860.8:",100,1
|
---|
140 | ;;D^ ;CKSUM(STR) ;
|
---|
141 | ;;R^"860.8:",100,2
|
---|
142 | ;;D^ ; ;
|
---|
143 | ;;R^"860.8:",100,3
|
---|
144 | ;;D^ ; N CKSUM,PTR,ASC S CKSUM=0
|
---|
145 | ;;R^"860.8:",100,4
|
---|
146 | ;;D^ ; S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
---|
147 | ;;R^"860.8:",100,5
|
---|
148 | ;;D^ ; F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
|
---|
149 | ;;R^"860.8:",100,6
|
---|
150 | ;;D^ ; Q +CKSUM
|
---|
151 | ;;R^"860.8:",100,7
|
---|
152 | ;;D^ ; ;
|
---|
153 | ;;EOR^
|
---|
154 | ;;KEY^860.8:^GET DATA FROM THE ACTIVE DATA FILE
|
---|
155 | ;;R^"860.8:",.01,"E"
|
---|
156 | ;;D^GET DATA FROM THE ACTIVE DATA FILE
|
---|
157 | ;;R^"860.8:",.02,"E"
|
---|
158 | ;;D^GETDATA
|
---|
159 | ;;R^"860.8:",100,1
|
---|
160 | ;;D^ ;GETDATA(DFN,OCXL,OCXDFI) ; This Local Extrinsic Function returns runtime data
|
---|
161 | ;;R^"860.8:",100,2
|
---|
162 | ;;D^ ; ;
|
---|
163 | ;;R^"860.8:",100,3
|
---|
164 | ;;D^ ; N OCXE,VAL,PC S VAL=""
|
---|
165 | ;;R^"860.8:",100,4
|
---|
166 | ;;D^ ; 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)
|
---|
167 | ;;R^"860.8:",100,5
|
---|
168 | ;;D^ ; Q VAL
|
---|
169 | ;;R^"860.8:",100,6
|
---|
170 | ;;D^ ; ;
|
---|
171 | ;;EOR^
|
---|
172 | ;;KEY^860.8:^IN LIST OPERATOR
|
---|
173 | ;;R^"860.8:",.01,"E"
|
---|
174 | ;;D^IN LIST OPERATOR
|
---|
175 | ;;R^"860.8:",.02,"E"
|
---|
176 | ;;D^LIST
|
---|
177 | ;;R^"860.8:",100,1
|
---|
178 | ;;D^ ;LIST(DATA,LIST) ; IS THE DATA FIELD IN THE LIST
|
---|
179 | ;;R^"860.8:",100,2
|
---|
180 | ;;D^ ; ;
|
---|
181 | ;;R^"860.8:",100,3
|
---|
182 | ;;D^T+; W:$G(OCXTRACE) !,"%%%%",?20," $$LIST(""",DATA,""",""",LIST,""")"
|
---|
183 | ;;R^"860.8:",100,4
|
---|
184 | ;;D^ ; S:'($E(LIST,1)=",") LIST=","_LIST S:'($E(LIST,$L(LIST))=",") LIST=LIST_"," S DATA=","_DATA_","
|
---|
185 | ;;R^"860.8:",100,5
|
---|
186 | ;;D^ ; Q (LIST[DATA)
|
---|
187 | ;;R^"860.8:",100,6
|
---|
188 | ;;D^ ; ;
|
---|
189 | ;;EOR^
|
---|
190 | ;;KEY^860.8:^LOCAL TERM LOOKUP
|
---|
191 | ;;R^"860.8:",.01,"E"
|
---|
192 | ;;D^LOCAL TERM LOOKUP
|
---|
193 | ;;R^"860.8:",.02,"E"
|
---|
194 | ;;D^TERMLKUP
|
---|
195 | ;;R^"860.8:",1,1
|
---|
196 | ;;D^
|
---|
197 | ;;R^"860.8:",1,2
|
---|
198 | ;;D^ This function allows a local site to define to Order Checking
|
---|
199 | ;;R^"860.8:",1,3
|
---|
200 | ;;D^ a term specific to that site. (ie. Lab Test Name, Radiology
|
---|
201 | ;;R^"860.8:",1,4
|
---|
202 | ;;D^ procedure name, etc.)
|
---|
203 | ;;R^"860.8:",1,5
|
---|
204 | ;;D^
|
---|
205 | ;;R^"860.8:",100,1
|
---|
206 | ;;D^ ;TERMLKUP(OCXTERM,OCXFILE) ;
|
---|
207 | ;;R^"860.8:",100,2
|
---|
208 | ;;D^ ; ;
|
---|
209 | ;;R^"860.8:",100,3
|
---|
210 | ;;D^ ; Q
|
---|
211 | ;;R^"860.8:",100,4
|
---|
212 | ;;D^ ; ;
|
---|
213 | ;;EOR^
|
---|
214 | ;;KEY^860.8:^NEW RULE MESSAGE
|
---|
215 | ;;R^"860.8:",.01,"E"
|
---|
216 | ;;D^NEW RULE MESSAGE
|
---|
217 | ;;R^"860.8:",.02,"E"
|
---|
218 | ;;D^NEWRULE
|
---|
219 | ;;R^"860.8:",100,1
|
---|
220 | ;;D^ ;NEWRULE(OCXDFN,OCXORD,OCXRUL,OCXREL,OCXNOTF,OCXMESS) ; Has this rule already been triggered for this order number
|
---|
221 | ;;R^"860.8:",100,2
|
---|
222 | ;;D^ ; ;
|
---|
223 | ;;R^"860.8:",100,3
|
---|
224 | ;;D^L+; S OCXERR=$$TIMELOG("M","NEWRULE("_(+$G(OCXDFN))_","_(+$G(OCXORD))_","_(+$G(OCXRUL))_","_(+$G(OCXREL))_","_(+$G(OCXNOTF))_","_$G(OCXMESS)_")")
|
---|
225 | ;;R^"860.8:",100,4
|
---|
226 | ;;D^ ; ;
|
---|
227 | ;;R^"860.8:",100,5
|
---|
228 | ;;D^ ; Q:'$G(OCXDFN) 0 Q:'$G(OCXRUL) 0
|
---|
229 | ;;R^"860.8:",100,6
|
---|
230 | ;;D^ ; Q:'$G(OCXREL) 0 Q:'$G(OCXNOTF) 0 Q:'$L($G(OCXMESS)) 0
|
---|
231 | ;;R^"860.8:",100,7
|
---|
232 | ;;D^ ; S OCXORD=+$G(OCXORD),OCXDFN=+OCXDFN
|
---|
233 | ;;R^"860.8:",100,8
|
---|
234 | ;;D^ ; ;
|
---|
235 | ;;R^"860.8:",100,9
|
---|
236 | ;;D^ ; N OCXNDX,OCXDATA,OCXDFI,OCXELE,OCXGR,OCXTIME,OCXCKSUM,OCXTSP,OCXTSPL
|
---|
237 | ;;R^"860.8:",100,10
|
---|
238 | ;;D^ ; ;
|
---|
239 | ;;R^"860.8:",100,11
|
---|
240 | ;;D^ ; S OCXTIME=(+$H)
|
---|
241 | ;;R^"860.8:",100,12
|
---|
242 | ;;D^ ; S OCXCKSUM=$$CKSUM(OCXMESS)
|
---|
243 | ;;R^"860.8:",100,13
|
---|
244 | ;1;
|
---|
245 | ;
|
---|