source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRVER4.m@ 1005

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

initial load of WorldVistAEHR

File size: 8.9 KB
Line 
1LRVER4 ;DALOI/CJS/DALOI/FHS - LAB ROUTINE DATA VERIFICATION ; 7/28/05 3:08pm
2 ;;5.2;LAB SERVICE;**14,42,112,121,140,171,153,188,279,283,286**;Sep 27, 1994
3 ;
4 N LRAMEND,LRRFLAG
5 ;
6LOOP ;
7 S LRLCT=0
8 I '$D(LRGVP) D
9 . S:$D(LRWRDS) LRWRD=LRWRDS
10 . W !!,PNM," SSN: ",SSN," " S LRLCT=LRLCT+1
11 . I LRDPF=2 W " LOC: ",$S(LRWRD'="":LRWRD,1:$S($L($P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,7)):$P(^(0),U,7),1:"??"))
12 ; VOE Fix for an error ;RED; 7/28/05
13 I $G(SEX)="" S SEX=""
14 W !,"Pat Info: ",$P($G(^LR(LRDFN,.091)),U)
15 W ?34," Sex: ",$S(SEX="M":"MALE",SEX="F":"FEMALE",1:SEX)
16 W ?48," Age: ",$$CALCAGE^LRRPU(DOB,LRCDT)," as of ",$$FMTE^XLFDT(LRCDT,"1D")
17 S LRPRAC=$P(^LRO(68,LRAA,1,LRAD,1,LRAN,0),U,8)
18 I LRPRAC>0,LRPRAC=+LRPRAC D GETS^DIQ(200,LRPRAC_",",".01;.132;.137;.138","E","LRPRAC(LRPRAC)","LRERR")
19 W !,"Provider: "
20 S LRLCT=LRLCT+2
21 I LRPRAC'="",'$D(LRPRAC(LRPRAC,200)) W LRPRAC
22 I LRPRAC,$D(LRPRAC(LRPRAC,200)) D
23 . W LRPRAC(LRPRAC,200,LRPRAC_",",.01,"E"),?40," Voice pager: ",LRPRAC(LRPRAC,200,LRPRAC_",",.137,"E")
24 . W !," Phone: ",LRPRAC(LRPRAC,200,LRPRAC_",",.132,"E"),?38," Digital pager: ",LRPRAC(LRPRAC,200,LRPRAC_",",.138,"E")
25 . S LRLCT=LRLCT+1
26 ;
27 N PRAC,PR
28 D PRAC^LR7OMERG(LRAA,LRAD,LRAN,.PRAC)
29 I $O(PRAC(0)) D
30 . S PR=0
31 . F S PR=$O(PRAC(PR)) Q:PR<1 I $D(^VA(200,PR,0)) W !?14,$P(^(0),"^") S LRLCT=LRLCT+1
32 W ! S LRLCT=LRLCT+1
33 S LRNX=0,LRVRM=2,T=""
34 I $P(^LR(LRDFN,LRSS,LRIDT,0),U,7)'="" D
35 . W !,"VOLUME: ",$P(^(0),U,7)
36 . S LRLCT=LRLCT+1
37 S LRACC=$P(Z1,U,6)
38 W !,"ACCESSION:",?30,$P(Z2,U,6),?44," ",LRACC
39 W !,?30,LRDAT(2) W ?44," ",LRDAT
40 S LRLCT=LRLCT+2
41 I $D(LRALERT),LRALERT<($P(LRPARAM,U,20)+1) D
42 . W !?15 W:$E(IOST,1,2)="C-" @LRVIDO
43 . W "Test ordered "_$P($G(^LAB(62.05,+LRALERT,0)),U)
44 . W:$E(IOST,1,2)="C-" @LRVIDOF,$C(7)
45 . S LRLCT=LRLCT+1
46 ;
47 I '$O(LRORD(0)) W !!?7,$C(7),"This is not a verifiable test/accession ",! Q
48V I $D(LRGVP) D V20 Q
49 G EDIT:($O(^LR(LRDFN,LRSS,LRIDT,1))=""!('LRVF&$D(LRPER)))&'$D(LRNUF)
50 K LRNUF
51 D V20,ND G V37:LRVF&'$D(X)#2,EDIT:LREDIT
52 S LRTEC=$S($D(^LRO(68,LRAA,1,LRAD,2)):$P(^(2),U),1:$S($D(LRUSI):LRUSI,1:"")),LREDIT=0
53V36 ;
54 Q:$D(LRGVP)
55 K DIR
56 S DIR(0)="SAO^E:Edit;C:Comments;W:Workload"
57 S DIR("A")="SELECT ('E' to Edit, 'C' for Comments, 'W' Workload): "
58 D ^DIR
59 I $D(DIRUT) S X="^" G V37
60 S X=Y
61 S:$E(X)="E" LREDIT=1,X=""
62 K LRNC
63 I $E(X)="C" S LRNC=1 D COM K LRNC G V36
64 I $E(X)="W" D G LOOP
65 . I $P(LRPARAM,U,14),$P($G(^LRO(68,LRAA,0)),U,16) D STD^LRCAPV,EN^LRCAPV S LREND=0 Q
66 . W !?10," Workload is not activated."
67 S X=$S(X="@":"",X="":LRTEC,1:X),LRTEC=X
68 S:'$D(^LRO(68,LRAA,1,LRAD,2)) ^(2)="" S ^(2)=X_U_$P(^(2),U,2,99)
69 G EDIT:LREDIT
70V37 Q ;LEAVE LRVER4, BACK TO LRVER3
71 ;
72 ;
73V20 ;
74 I $G(LRCHG) D V21,DCOM^LRVERA Q
75 S LRNX=$O(LRORD(LRNX)) G V35:LRNX<1 D SUBS
76 G:'$G(LRTS) V20
77 I '$D(LRSB(LRSB)),'$D(^LR(LRDFN,LRSS,LRIDT,LRSB)) G V20
78 D V25^LRVER5
79 ;
80 D:$D(LRGVP) PG Q:$D(LRGVP)&($D(DTOUT)!$D(DUOUT))
81 ;
82 W !,$P(^LAB(60,+LRTS,0),U)
83 S X1=""
84 I $D(^LR(LRDFN,LRSS,+LRLDT,LRSB)) D
85 . S X1=$P(^(LRSB),U),X=X1
86 . I $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET" D
87 . . S X=$$EXTERNAL^DILFD(63.04,LRSB,"",X1)
88 . . I X="" S X=X1
89 . W:X'="" ?30,@LRFP
90 S (X,LRFLG)=""
91 I $D(LRSB(LRSB)) D
92 . N LRX
93 . K LRNOVER(LRSB)
94 . S (LRDL,LRX,X)=$P(LRSB(LRSB),U)
95 . S LREDIT=0,LRFLG=$P(LRSB(LRSB),U,2)
96 . I $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET" D
97 . . S X=$$EXTERNAL^DILFD(63.04,LRSB,"",LRX)
98 . . I X="" S X=LRX
99 . W ?44," ",@LRFP," ",LRFLG,?56," ",$P($P(LRSB(LRSB),U,5),"!",7) ;$P(LRNG,U,7)
100 . S X=LRX
101 . I X=""!(X="canc")!(X="comment")!(X="pending") Q
102 . S Y=0
103 . I LRDEL'="" S LRQ=1 X LRDEL K LRQ
104 . W " "
105 . I '$D(LRQ),$E(LRFLG,2)="*" D DISPFLG^LRVER4
106 ;
107 S:$P(X,U)="" $P(LRSB(LRSB),U)=""
108 I $P(X,U)'="" D
109 . N I,LRX,LRY
110 . S $P(LRSB(LRSB),U)=X,$P(LRSB(LRSB),U,2)=LRFLG
111 . S LRX=$$TMPSB^LRVER1(LRSB),LRY=$P(LRSB(LRSB),U,3)
112 . F I=1:1:$L(LRX,"!") I $P(LRY,"!",I)="" S $P(LRY,"!",I)=$P(LRX,"!",I)
113 . S $P(LRSB(LRSB),U,3)=LRY
114 . I $P($P(LRSB(LRSB),U,3),"!")="" D RONLT^LRVER3
115 . D
116 . . I $P(LRSB(LRSB),U,4)!($P(LRSB(LRSB),U)="pending") Q
117 . . I '$D(LRSA(LRSB))#2 S $P(LRSB(LRSB),U,4)=$S($G(LRDUZ):LRDUZ,1:$G(DUZ)),$P(LRSB(LRSB),U,9)=$S($G(LRDUZ(2)):LRDUZ(2),$G(DUZ(2)):DUZ(2),1:"") Q
118 . . I $P(LRSB(LRSB),U)=$P(LRSA(LRSB),U) S:$P(LRSA(LRSB),U,4) $P(LRSB(LRSB),U,4)=$P(LRSA(LRSB),U,4) S $P(LRSA(LRSB),U,3)=$P(LRSB(LRSB),U,3) Q
119 . . S:'$P(LRSB(LRSB),U,4) $P(LRSB(LRSB),U,4)=$S($G(LRDUZ):LRDUZ,1:$G(DUZ)),$P(LRSB(LRSB),U,9)=$S($G(LRDUZ(2)):LRDUZ(2),$G(DUZ(2)):DUZ(2),1:"")
120 . S $P(LRSB(LRSB),U,5)=$TR(LRNGS,U,"!")
121 I '$D(LRNUF) S LRLCT=LRLCT+1 S:$X>80 LRLCT=LRLCT+1 D:LRLCT>22 WT G:$G(Y)'="^" V20
122 ;
123V35 ;
124 D LRCFL:LRCFL]""
125 D DCOM^LRVERA K LRNUF
126 Q
127 ;
128 ;
129LRCFL ;
130 S LREXEC=LRCFL D ^LREXEC:LRCFL[""
131 D:LRLCT>22 WT
132 Q
133 ;
134 ;
135EDIT ;
136 K LROUT
137 D ^LRVER5 S LRVRM=2 G:$G(LRCHG) LOOP G LRCFL:$D(LROUT)!$D(LRPER)
138 G LOOP
139 ;
140 ;
141RANGE ;
142 N LRI,LRFIND
143 S Y=X
144 I X=""!(X="canc")!(X="comment")!(X="pending") Q
145 W " "
146 F LRI=1:1:$L(X) S LRFIND=$E(X,LRI) Q:LRFIND?1(1N,1A,1".",1"-",1"<",1">")
147 S X=$E(X,LRI,999)
148 ;
149 ; User has indicated specific normality to set - used when entering
150 ; reference lab results and all the info to calculate is not available.
151 I $G(LRRFLAG(LRSB)) S LRFLG=$P("L^L*^H^H*","^",LRRFLAG(LRSB))
152 ;
153 E D RANGECHK
154 I '$D(LRQ),$E(LRFLG,2)="*" D DISPFLG^LRVER4
155RQ S X=Y
156 Q
157 ;
158 ;
159RANGECHK ; Check result against reference ranges and set flag
160 ;
161 ;
162 ; Check for numeric abnormal results
163 I X?.1"-".N.1".".N D Q
164 . I LRNG4'="",LRNG4?.1"-".N.1".".N,X<LRNG4 S LRFLG="L*" Q
165 . I LRNG5'="",LRNG5?.1"-".N.1".".N,X>LRNG5 S LRFLG="H*" Q
166 . I LRNG2'="",LRNG2?.1"-".N.1".".N,X<LRNG2 S LRFLG="L" Q
167 . I LRNG3'="",LRNG3?.1"-".N.1".".N,X>LRNG3 S LRFLG="H" Q
168 ;
169 ; Check for <> abnormal results
170 ; "<" results checked against low values
171 ; ">" results checked against high values
172 I X?1(1"<",1">").N.1".".N D Q
173 . N LRX
174 . S LRX=$E(X,2,$L(X))
175 . I $E(X)="<" D Q
176 . . I LRNG4'="",LRNG4?.N.1".".N,LRX<LRNG4 S LRFLG="L*" Q
177 . . I LRNG4'="",LRNG4?.N.1".".N,LRX=LRNG4 S LRFLG="L*" Q
178 . . I LRNG2'="",LRNG2?.N.1".".N,LRX<LRNG2 S LRFLG="L" Q
179 . . I LRNG2'="",LRNG2?.N.1".".N,LRX=LRNG2 S LRFLG="L" Q
180 . I $E(X)=">" D Q
181 . . I LRNG5'="",LRNG5?.N.1".".N,LRX>LRNG5 S LRFLG="H*" Q
182 . . I LRNG5'="",LRNG5?.N.1".".N,LRX=LRNG5 S LRFLG="H*" Q
183 . . I LRNG3'="",LRNG3?.N.1".".N,LRX>LRNG3 S LRFLG="H" Q
184 . . I LRNG3'="",LRNG3?.N.1".".N,LRX=LRNG3 S LRFLG="H" Q
185 ;
186 ; Check for ranges, i.e. 0-5, 6-10.
187 ; Compare first value to abnormal value
188 I X?1.N1"-"1.N D Q
189 . I LRNG4'="",LRNG4?.N.1".".N,+X<LRNG4 S LRFLG="L*" Q
190 . I LRNG5'="",LRNG5?.N.1".".N,+X>LRNG5 S LRFLG="H*" Q
191 . I LRNG2'="",LRNG2?.N.1".".N,+X<LRNG2 S LRFLG="L" Q
192 . I LRNG3'="",LRNG3?.N.1".".N,+X>LRNG3 S LRFLG="H" Q
193 ;
194 Q
195 ;
196 ;
197DISPFLG ; Display critical flags
198 ;
199 I $E(IOST,1,2)="C-" W $C(7),@LRVIDO
200 W "CRITICAL ",$S($E(LRFLG,1)="L":"LOW",$E(LRFLG,1)="H":"HIGH",1:""),"!!"
201 I $E(IOST,1,2)="C-" W @LRVIDOF,$C(7),$C(7)
202 Q
203 ;
204 ;
205SUBS ;
206 S LRSB=LRORD(LRNX),LRTS=$S($D(^TMP("LR",$J,"TMP",LRSB)):^(LRSB),1:0)
207 Q
208 ;
209 ;
210ND ;
211 K X,DIR
212 Q:'LRVF
213 I '$P($G(LRLABKY),U) D Q
214 . W !,"You're not authorized to edit verified data."
215 . S LREDIT=0
216 S DIR(0)="FO"
217 S DIR("A")="If you need to change something, enter your initials"
218 S DIR("?")="To change verified results, enter your initials."
219 D ^DIR
220 S X=Y K DIR
221 I $$UP^XLFSTR(X)'=$$UP^XLFSTR(LRUSI) S LREDIT=0 K X QUIT
222 I $D(X)#2,'$G(LRCHG) W ! D S LRCHG=1
223 . K LRSA S LRSA=1
224 . F S LRSA=$O(^LR(LRDFN,"CH",LRIDT,LRSA)) Q:'LRSA S LRSA(LRSA)=^(LRSA)
225 Q
226 ;
227 ;
228WT S LRLCT=0 Q:$D(LRGVP)
229 W !,"PRESS ANY KEY TO CONTINUE, '^' TO STOP " R Y:DTIME S:'$T Y="^"
230 Q
231 ;
232 ;
233COM ;from LRVER5
234 Q:$D(LRGVP)
235 K DR
236 S DIE="^LR("_LRDFN_",""CH"",",DA=LRIDT,DA(1)=LRDFN,DR=.99
237 D ^DIE,COM1:$D(LRNC)
238 L +^LR(LRDFN,LRSS,LRIDT):5
239 I $O(^LR(LRDFN,"CH",LRIDT,1,0))="" K ^LR(LRDFN,"CH",LRIDT,1)
240 L -^LR(LRDFN,LRSS,LRIDT)
241 Q
242 ;
243 ;
244VOL ;
245 W !,"VOLUME: ",$P(^LR(LRDFN,LRSS,LRIDT,0),U,7),"//" R X:DTIME
246 G VOL:X["?" S:X'=""&(X'[U) ^(0)=$P(^(0),U,1,6)_U_X_U_$P(^(0),U,8,10)
247 G COM
248 ;
249 ;
250COM1 ;
251 N LRX Q:'$P(^LR(LRDFN,LRSS,LRIDT,0),U,3)
252 D XREF^LRVER3A
253 S LRX=0 F S LRX=$O(^TMP("LR",$J,"TMP",LRX)) Q:LRX<1 S ^LRO(68,"AC",LRDFN,LRIDT,LRX)=""
254 I $L($P(^LR(LRDFN,LRSS,LRIDT,0),U,9)),$E($P(^(0),U,9))'="-" S $P(^(0),U,9)="-"_$P(^(0),U,9)
255 Q
256 ;
257 ;
258PG Q:$Y<(IOSL+5)
259 I $E(IOST,1,2)'="C-" W @IOF Q
260 D PG^LRGVP
261 Q
262 ;
263V21 ;
264 N Y,LREND
265 S LRSB=1,LRLCT=1
266 F S LRSB=+$O(LRSB(LRSB)) Q:'LRSB!($G(LREND)) D
267 . N LRX
268 . S LRTS=$O(^LAB(60,"C","CH;"_LRSB_";1",0)) Q:'LRTS
269 . D V25^LRVER5
270 . W !,$P(^LAB(60,LRTS,0),U) S X1=""
271 . I $D(^LR(LRDFN,LRSS,+LRLDT,LRSB)) D
272 . . S X1=$P(^(LRSB),U),(LRDL,X)=X1
273 . . I $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET" D
274 . . . S X=$$EXTERNAL^DILFD(63.04,LRSB,"",X1)
275 . . . I X="" S X=X1
276 . . W:X'="" ?30,@LRFP
277 . S (LRDL,LRX,X)=$P(LRSB(LRSB),U)
278 . S LREDIT=0,LRFLG=$P(LRSB(LRSB),U,2)
279 . I $$GET1^DID(63.04,LRSB,"","TYPE","","LRERR")="SET" D
280 . . S X=$$EXTERNAL^DILFD(63.04,LRSB,"",LRX)
281 . . I X="" S X=LRX
282 . W ?44," ",@LRFP," ",LRFLG,?56," ",$P(LRNG,U,7)
283 . S X=LRX
284 . I X=""!(X="canc")!(X="comment")!(X="pending") Q
285 . S Y=0
286 . I LRDEL'="" S LRQ=1 X LRDEL K LRQ
287 . W " "
288 . I '$D(LRQ),$E(LRFLG,2)="*" D DISPFLG^LRVER4
289 . I '$D(LRNUF) S LRLCT=LRLCT+1 S:$X>80 LRLCT=LRLCT+1 D:LRLCT>15 WT S:$E($G(Y))="^" LREND=1
290 Q
Note: See TracBrowser for help on using the repository browser.