source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LRVER4.m@ 1540

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

initial load of FOIAVistA 6/30/08 version

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