source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORY21105.m@ 1297

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

initial load of WorldVistAEHR

File size: 7.1 KB
Line 
1ORY21105 ;SLC/RJS,CLA - OCX PACKAGE RULE TRANSPORT ROUTINE (Delete after Install of OR*3*211) ;APR 5,2005 at 08:07
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**211**;Dec 17,1997
3 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
4 ;
5S ;
6 ;
7 D DOT^ORY211ES
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 ^ORY21106
15 ;
16 Q
17 ;
18DATA ;
19 ;
20 ;;R^"860.8:",100,5
21 ;;D^ ; N OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXCYR
22 ;;R^"860.8:",100,6
23 ;;D^ ; S (OCXYR,OCXLPYR,OCXMON,OCXDAY,OCXHR,OCXMIN,OCXSEC,OCXAP)=""
24 ;;R^"860.8:",100,7
25 ;;D^ ; S OCXSEC=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
26 ;;R^"860.8:",100,8
27 ;;D^ ; S OCXMIN=$E(OCXDT#60+100,2,3),OCXDT=OCXDT\60
28 ;;R^"860.8:",100,9
29 ;;D^ ; S OCXHR=$E(OCXDT#24+100,2,3),OCXDT=OCXDT\24
30 ;;R^"860.8:",100,10
31 ;;D^ ; S OCXCYR=($H\1461)*4+1841+(($H#1461)\365)
32 ;;R^"860.8:",100,11
33 ;;D^ ; S OCXYR=(OCXDT\1461)*4+1841,OCXDT=OCXDT#1461
34 ;;R^"860.8:",100,12
35 ;;D^ ; S OCXLPYR=(OCXDT\365),OCXDT=OCXDT-(OCXLPYR*365),OCXYR=OCXYR+OCXLPYR
36 ;;R^"860.8:",100,13
37 ;;D^ ; S OCXCNT="031^059^090^120^151^181^212^243^273^304^334^365"
38 ;;R^"860.8:",100,14
39 ;;D^ ; S:(OCXLPYR=3) OCXCNT="031^060^091^121^152^182^213^244^274^305^335^366"
40 ;;R^"860.8:",100,15
41 ;;D^ ; F OCXMON=1:1:12 Q:(OCXDT<$P(OCXCNT,U,OCXMON))
42 ;;R^"860.8:",100,16
43 ;;D^ ; S OCXDAY=OCXDT-$P(OCXCNT,U,OCXMON-1)+1
44 ;;R^"860.8:",100,17
45 ;;D^ ; I OCXF S OCXMON=$P("January^February^March^April^May^June^July^August^September^October^November^December",U,OCXMON)
46 ;;R^"860.8:",100,18
47 ;;D^ ; E S OCXMON=$E(OCXMON+100,2,3)
48 ;;R^"860.8:",100,19
49 ;;D^ ; S OCXAP=$S('OCXHR:"Midnight",(OCXHR=12):"Noon",(OCXHR<12):"AM",1:"PM")
50 ;;R^"860.8:",100,20
51 ;;D^ ; I OCXF S OCXHR=OCXHR#12 S:'OCXHR OCXHR=12
52 ;;R^"860.8:",100,21
53 ;;D^ ; Q:'OCXF $E(OCXMON+100,2,3)_"/"_$E(OCXDAY+100,2,3)_$S((OCXCYR=OCXYR):" "_OCXHR_":"_OCXMIN,1:"/"_$E(OCXYR,3,4))
54 ;;R^"860.8:",100,22
55 ;;D^ ; Q:(OCXHR+OCXMIN+OCXSEC) OCXMON_" "_OCXDAY_","_OCXYR_" at "_OCXHR_":"_OCXMIN_"."_OCXSEC_" "_OCXAP
56 ;;R^"860.8:",100,23
57 ;;D^ ; Q OCXMON_" "_OCXDAY_","_OCXYR
58 ;;R^"860.8:",100,24
59 ;;D^ ; ;
60 ;;EOR^
61 ;;KEY^860.8:^DETERMINE IF RENAL LAB RESULTS ARE ABNORMAL HIGH OR LOW
62 ;;R^"860.8:",.01,"E"
63 ;;D^DETERMINE IF RENAL LAB RESULTS ARE ABNORMAL HIGH OR LOW
64 ;;R^"860.8:",.02,"E"
65 ;;D^ABREN
66 ;;R^"860.8:",100,1
67 ;;D^ ;ABREN(DFN) ;
68 ;;R^"860.8:",100,2
69 ;;D^ ; ;
70 ;;R^"860.8:",100,3
71 ;;D^ ; N OCXFLAG,OCXVAL,OCXLIST,OCXTEST,UNAV,OCXTLIST,OCXTERM,OCXSLIST,OCXSPEC
72 ;;R^"860.8:",100,4
73 ;;D^ ; S (OCXLIST,OCXTLIST)="",UNAV="0^<Unavailable>"
74 ;;R^"860.8:",100,5
75 ;;D^ ; S OCXSLIST="" Q:'$$TERMLKUP("SERUM SPECIMEN",.OCXSLIST) UNAV
76 ;;R^"860.8:",100,6
77 ;;D^ ; F OCXTERM="SERUM CREATININE","SERUM UREA NITROGEN" D Q:($L(OCXLIST)>130)
78 ;;R^"860.8:",100,7
79 ;;D^ ; .Q:'$$TERMLKUP(OCXTERM,.OCXTLIST)
80 ;;R^"860.8:",100,8
81 ;;D^ ; .S OCXTEST=0 F S OCXTEST=$O(OCXTLIST(OCXTEST)) Q:'OCXTEST D Q:($L(OCXLIST)>130)
82 ;;R^"860.8:",100,9
83 ;;D^ ; ..S OCXSPEC=0 F S OCXSPEC=$O(OCXSLIST(OCXSPEC)) Q:'OCXSPEC D Q:($L(OCXLIST)>130)
84 ;;R^"860.8:",100,10
85 ;;D^ ; ...S OCXVAL=$$LOCL^ORQQLR1(DFN,OCXTEST,OCXSPEC),OCXFLAG=$P(OCXVAL,U,5)
86 ;;R^"860.8:",100,11
87 ;;D^ ; ...I $L(OCXVAL),((OCXFLAG["H")!(OCXFLAG["L")) D
88 ;;R^"860.8:",100,12
89 ;;D^ ; ....N OCXY S OCXY=""
90 ;;R^"860.8:",100,13
91 ;;D^ ; ....S OCXY=$P(OCXVAL,U,2)_": "_$P(OCXVAL,U,3)_" "_$P(OCXVAL,U,4)
92 ;;R^"860.8:",100,14
93 ;;D^ ; ....S OCXY=OCXY_" "_$S($L(OCXFLAG):"["_OCXFLAG_"]",1:"")
94 ;;R^"860.8:",100,15
95 ;;D^ ; ....S OCXY=OCXY_" "_$$FMTE^XLFDT($P(OCXVAL,U,7),"2P")
96 ;;R^"860.8:",100,16
97 ;;D^ ; ....S:$L(OCXLIST) OCXLIST=OCXLIST_" " S OCXLIST=OCXLIST_OCXY
98 ;;R^"860.8:",100,17
99 ;;D^ ; Q:'$L(OCXLIST) UNAV Q 1_U_OCXLIST
100 ;;R^"860.8:",100,18
101 ;;D^ ; ;
102 ;;EOR^
103 ;;KEY^860.8:^ELAPSED ORDER CHECK TIME LOGGER
104 ;;R^"860.8:",.01,"E"
105 ;;D^ELAPSED ORDER CHECK TIME LOGGER
106 ;;R^"860.8:",.02,"E"
107 ;;D^TIMELOG
108 ;;R^"860.8:",100,1
109 ;;D^ ;TIMELOG(OCXMODE,OCXCALL) ; Log an entry in the Elapsed time log.
110 ;;R^"860.8:",100,2
111 ;;D^ ; ;
112 ;;R^"860.8:",100,3
113 ;;D^ ; ;
114 ;;R^"860.8:",100,4
115 ;;D^ ; Q 0
116 ;;R^"860.8:",100,5
117 ;;D^ ; ;
118 ;;EOR^
119 ;;KEY^860.8:^EQUALS TERM OPERATOR
120 ;;R^"860.8:",.01,"E"
121 ;;D^EQUALS TERM OPERATOR
122 ;;R^"860.8:",.02,"E"
123 ;;D^EQTERM
124 ;;R^"860.8:",100,1
125 ;;D^ ;EQTERM(DATA,TERM) ;
126 ;;R^"860.8:",100,2
127 ;;D^ ; ;
128 ;;R^"860.8:",100,3
129 ;;D^T+; I $G(OCXTRACE) W !,"%%%%",?20," Execution trace DATA: ",$G(DATA)," TERM: ",$G(TERM)
130 ;;R^"860.8:",100,4
131 ;;D^ ; N OCXF,OCXL
132 ;;R^"860.8:",100,5
133 ;;D^ ; ;
134 ;;R^"860.8:",100,6
135 ;;D^ ; S OCXL="",OCXF=$$TERMLKUP(TERM,.OCXL)
136 ;;R^"860.8:",100,7
137 ;;D^T-; Q:'OCXF 0
138 ;;R^"860.8:",100,8
139 ;;D^T+; I 'OCXF W:$G(OCXTRACE) !,"%%%%",?20," Term '",TERM,"' not in Order Check National Term File" Q 0
140 ;;R^"860.8:",100,9
141 ;;D^T+; I '$O(OCXL(0)) W:$G(OCXTRACE) !,"%%%%",?20," There are no local terms listed for the National Term '",TERM,"'." Q 0
142 ;;R^"860.8:",100,10
143 ;;D^T+; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) W:$G(OCXTRACE) !,"%%%%",?20," Data equals Term" Q 1
144 ;;R^"860.8:",100,11
145 ;;D^T-; I ($D(OCXL(DATA))!$D(OCXL("B",DATA))) Q 1
146 ;;R^"860.8:",100,12
147 ;;D^T-; Q 0
148 ;;R^"860.8:",100,13
149 ;;D^T+; W:$G(OCXTRACE) !,"%%%%",?20," Data does not equal Term" Q 0
150 ;;R^"860.8:",100,14
151 ;;D^ ; ;
152 ;;EOR^
153 ;;KEY^860.8:^FILE DATA IN PATIENT ACTIVE DATA FILE
154 ;;R^"860.8:",.01,"E"
155 ;;D^FILE DATA IN PATIENT ACTIVE DATA FILE
156 ;;R^"860.8:",.02,"E"
157 ;;D^FILE
158 ;;R^"860.8:",1,1
159 ;;D^ ;FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function files data
160 ;;R^"860.8:",1,2
161 ;;D^ ; ; in the Order Check Patient Data File
162 ;;R^"860.8:",1,3
163 ;;D^ ; ;
164 ;;R^"860.8:",100,1
165 ;;D^ ;FILE(DFN,OCXELE,OCXDFL) ; This Local Extrinsic Function logs a validated event/element.
166 ;;R^"860.8:",100,2
167 ;;D^ ; ;
168 ;;R^"860.8:",100,3
169 ;;D^T+; I $G(OCXTRACE) W !,"%%%%",?20," Execution trace DFN: ",DFN," OCXELE: ",+$G(OCXELE)," OCXDFL: ",$G(OCXDFL)
170 ;;R^"860.8:",100,4
171 ;;D^ ; N OCXTIMN,OCXTIML,OCXTIMT1,OCXTIMT2,OCXDATA,OCXPC,OCXPC,OCXVAL,OCXSUB,OCXDFI
172 ;;R^"860.8:",100,5
173 ;;D^ ; S DFN=+$G(DFN),OCXELE=+$G(OCXELE)
174 ;;R^"860.8:",100,6
175 ;;D^ ; ;
176 ;;R^"860.8:",100,7
177 ;;D^ ; Q:'DFN 1 Q:'OCXELE 1 K OCXDATA
178 ;;R^"860.8:",100,8
179 ;;D^ ; ;
180 ;;R^"860.8:",100,9
181 ;;D^ ; S OCXDATA(DFN,OCXELE)=1
182 ;;R^"860.8:",100,10
183 ;;D^ ; F OCXPC=1:1:$L(OCXDFL,",") S OCXDFI=$P(OCXDFL,",",OCXPC) I OCXDFI D
184 ;;R^"860.8:",100,11
185 ;;D^ ; .S OCXVAL=$G(OCXDF(+OCXDFI)),OCXDATA(DFN,OCXELE,+OCXDFI)=OCXVAL
186 ;;R^"860.8:",100,12
187 ;;D^T+; .I $G(OCXTRACE) W !,"%%%%",?20," ",$P($G(^OCXS(860.4,+OCXDFI,0)),U,1)," = """,OCXVAL,""""
188 ;;R^"860.8:",100,13
189 ;;D^ ; ;
190 ;;R^"860.8:",100,14
191 ;;D^ ; M ^TMP("OCXCHK",$J,DFN)=OCXDATA(DFN)
192 ;;R^"860.8:",100,15
193 ;;D^ ; ;
194 ;;R^"860.8:",100,16
195 ;;D^ ; Q 0
196 ;;R^"860.8:",100,17
197 ;;D^ ; ;
198 ;;EOR^
199 ;;KEY^860.8:^GENERATE STRING CHECKSUM
200 ;;R^"860.8:",.01,"E"
201 ;;D^GENERATE STRING CHECKSUM
202 ;;R^"860.8:",.02,"E"
203 ;;D^CKSUM
204 ;;R^"860.8:",100,1
205 ;;D^ ;CKSUM(STR) ;
206 ;;R^"860.8:",100,2
207 ;;D^ ; ;
208 ;;R^"860.8:",100,3
209 ;;D^ ; N CKSUM,PTR,ASC S CKSUM=0
210 ;;R^"860.8:",100,4
211 ;;D^ ; S STR=$TR(STR,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
212 ;;R^"860.8:",100,5
213 ;;D^ ; F PTR=$L(STR):-1:1 S ASC=$A(STR,PTR)-42 I (ASC>0),(ASC<51) S CKSUM=CKSUM*2+ASC
214 ;1;
215 ;
Note: See TracBrowser for help on using the repository browser.