source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRSPRPT.m@ 623

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

initial load of WorldVistAEHR

File size: 9.2 KB
Line 
1LRSPRPT ;AVAMC/REG/WTY/KLL - CY/EM/SP PATIENT RPT ;08/22/01
2 ;;5.2;LAB SERVICE;**1,72,248,259,317**;Sep 27, 1994
3 ;
4 W !!?20,LRO(68)," FINAL PATIENT REPORTS"
5 K LRSAV,LRAP,LRS(99)
6 D EN2^LRUA
7 G END^LRSPRPT1:LRAPX=2,SGL:LRAPX=3,CH:LRAPX=4
8GETP ;
9 D EN1^LRUPS Q:LRAN=-1
10 G:$D(^LRO(69.2,LRAA,2,LRAN,0)) GETP
11 L +^LRO(69.2,LRAA,2):5 I '$T D G GETP
12 .S MSG(1)="The final reports queue is in use by another person. "
13 .S MSG(1,"F")="!!"
14 .S MSG(2)="You will need to add this accession to the queue later."
15 .D EN^DDIOL(.MSG) K MSG
16 S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN_"^"_LRI
17 S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
18 L -^LRO(69.2,LRAA,2)
19 G GETP
20CH ;
21 S LRAPX(1)=2 D EN^LRSPRPT2 Q:%<1
22 W !!,"Save final report list for reprinting "
23 S %=2 D YN^LRU S:%=1 LRSAV=1
24 ;Variable LR("DVD") is used to divide reports displayed in the browser
25 K LR("DVD")
26 S $P(LR("DVD"),"|",IOM)=""
27DEV ;from LRAPMOD
28 W !
29 S %ZIS="Q" D ^%ZIS
30 I POP W ! D END Q
31 I $D(IO("Q")) D Q
32 .S ZTDESC="ANAT PATH FINAL REPORT"
33 .S ZTSAVE("LR*")="",ZTRTN="QUE^LRSPRPT"
34 .D ^%ZTLOAD W:$D(ZTSK) !,"Request Queued, #",ZTSK W !
35 .K ZTSK,IO("Q") D HOME^%ZIS
36QUE ;
37 U IO
38 N LRFFF
39 ;LRSF515=1 means that this is generating an SF515
40 S:'$D(LRSF515) LRSF515=0
41 S:'$D(LRFOC) LRFOC=0
42 S:'$D(LRQUIT) LRQUIT=0
43 S LRFFF=1 ;Flag used to determine whether to perform final form feed
44 I LRFOC S LRFFF=0 ;If final office copy, don't perform final form feed
45 S LR(.21)=+$G(^LRO(69.2,LRAA,.2)),LR("DIWF")="W"
46 S LRA=$S($D(^LRO(69.2,LRAA,0)):$P(^(0),U,9),1:1) S:LRA="" LRA=1
47 D L^LRU,S^LRU,L1^LRU,SET^LRUA
48PSGL ;Single Report
49 I $D(LRAP) D G LST
50 .S LRDFN=$P(LRAP,"^"),LRI=$P(LRAP,"^",2)
51 .I +$G(LRPTR) D Q
52 ..D MAIN^LRAPTIUP(LRPTR,0)
53 ..S LRFFF=0 ;Don't do final form feed. It's done by LRAPTIUP.
54 ..I LRQUIT S LR("Q")=1 Q
55 ..K LRAP S LR("F")=1
56 ..I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
57 ..Q:LR("Q")
58 ..I 'LRFOC S LR("Q")=1 Q
59 ..D FOC
60 ..I LRQUIT S LR("Q")=1 Q
61 ..I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
62 .W:IOST?1"C-".E @IOF
63 .D EN
64 .K LRAP
65 .I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
66 .Q:LR("Q")
67 .I 'LRFOC S LR("Q")=1 Q
68 .W !
69 .W:IOST?1"P-".E @IOF
70 .D FOC
71 .I LRQUIT S LR("Q")=1 Q
72 .I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
73PQUE ;Report from queue
74 S LRAN=0
75 F S LRAN=$O(^LRO(69.2,LRAA,2,LRAN)) Q:'LRAN!(LR("Q")) D
76 .S LRQUIT=0
77 .I 'LRFOC S LRFFF=1
78 .K LR("F")
79 .S X=^LRO(69.2,LRAA,2,LRAN,0),LRDFN=+X,LRI=$P(X,"^",2)
80 .D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS,LRI)
81 .I +$G(LRPTR) D Q
82 ..D MAIN^LRAPTIUP(LRPTR,0)
83 ..S LRFFF=0
84 ..W:IOST["BROWSER"&('LRFOC) !!,LR("DVD")
85 ..K LRPTR
86 ..I LRQUIT S LR("Q")=1 Q
87 ..S LR("F")=1
88 ..I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
89 ..Q:LR("Q")!('LRFOC)
90 ..D FOC
91 ..W:IOST["BROWSER" !!,LR("DVD")
92 ..I LRQUIT S LR("Q")=1 Q
93 ..I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
94 .W:IOST?1"C-".E @IOF
95 .D EN
96 .W:IOST?1"P-".E @IOF
97 .W:IOST["BROWSER"&('LRFOC) !!,LR("DVD")
98 .I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
99 .Q:LR("Q")
100 .Q:'LRFOC
101 .W !
102 .D FOC
103 .W:IOST["BROWSER" !!,LR("DVD")
104 .I LRQUIT S LR("Q")=1 Q
105 .I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
106 S LRFFF=0
107LST ;
108 K LRRMD,LRPMD,LRAP
109 K:'$D(LRSAV) ^LRO(69.2,LRAA,2)
110 S ^LRO(69.2,LRAA,2,0)="^69.23A^^0"
111 K LRSAV,LRV,LRW,LRZ
112 I IOST?1"P-".E W:LRFFF @IOF
113 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
114 K %,DIR,DTOUT,DUOUT,DIRUT,X,Y
115 D END
116 Q
117W ;
118 W !,LR("%")
119 Q
120F ;
121 D E
122 S A=0 F LRZ=0:1 S A=$O(^LR(LRDFN,LRSS,LRI,LRV,A)) Q:'A!(LR("Q")) D
123 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
124 .S X=^LR(LRDFN,LRSS,LRI,LRV,A,0) D:X["|TOP|" TOP D ^DIWP
125 Q:LR("Q") D:LRZ ^DIWW
126 Q
127E ;
128 K ^UTILITY($J)
129 S DIWR=IOM-5,DIWL=5,DIWF=LR("DIWF")
130 Q
131 ;
132EN ;from LRSPT
133 ;KLL-Suppress printing of SNOMED codes, except on Preliminary prints
134 S LR("SPSM")=$S($G(LRPRE):0,1:1)
135 S LR(.21)=+$G(^LRO(69.2,+$G(LRAA),.2))
136 K LRO Q:'$D(^LR(LRDFN,LRSS,LRI,0))
137 S LRQ=0
138 D ^LRUA
139 D INP^VADPT S LRPRAC=+VAIN(2)
140 S:'LRPRAC LRPRAC(1)=""
141 I LRPRAC S X=LRPRAC D D^LRUA S LRPRAC(1)=X
142 D ^LRAPF Q:LR("Q")
143 S LR("F")=1 W !,"Submitted by: ",LRW(5),?44,"Date obtained: ",LRTK
144 D:LRA W
145 W !,"Specimen (Received ",LRTK(1),"):" S LRV=.1 D A Q:LR("Q")
146 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),"^",4) D
147 .W !?14,"*+* SUPPLEMENTARY REPORT HAS BEEN ADDED *+*"
148 .W !?19,"*+* REFER TO BOTTOM OF REPORT *+*",!
149 D:LRA W W !,"Brief Clinical History:" S LRV=.2 D F Q:LR("Q")
150 D:LRA W W !,"Preoperative Diagnosis:" S LRV=.3 D F Q:LR("Q")
151 D:LRA W W !,"Operative Findings:" S LRV=.4 D F Q:LR("Q")
152 D:LRA W W !,"Postoperative Diagnosis:" S LRV=.5 D F Q:LR("Q")
153 W !?27,"Surgeon/physician: ",LRMD W:LRA !,LR("%1")
154 D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
155 D P^LRAPF
156 D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
157 D:LRA W
158 W:LRRC="" !?20,"+*+* REPORT INCOMPLETE *+*+",!
159 D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
160 W ! W:LRRMD]"" ?31,$S(LRSS="SP":"Pathology Resident: ",LRSS="CY":"Screened by: ",LRSS="EM":"Prepared by: ",1:" "),LRRMD
161 I $O(^LR(LRDFN,LRSS,LRI,1.3,0)) D Q:LR("Q")
162 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
163 .W !,LR(69.2,.13)
164 .I $P($G(^LR(LRDFN,LRSS,LRI,6,0)),U,4) S LR(0)=6 D ^LRSPRPTM
165 S LRV=1.3 D F Q:LR("Q")
166 I $O(^LR(LRDFN,LRSS,LRI,1,0)) D Q:LR("Q")
167 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
168 .W !,LR(69.2,.03)
169 .I $P($G(^LR(LRDFN,LRSS,LRI,7,0)),U,4) S LR(0)=7 D ^LRSPRPTM
170 S LRV=1 D F Q:LR("Q")
171 I $O(^LR(LRDFN,LRSS,LRI,1.1,0)) D Q:LR("Q")
172 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
173 .W !,LR(69.2,.04)
174 .I $P($G(^LR(LRDFN,LRSS,LRI,4,0)),"^",4) S LR(0)=4 D ^LRSPRPTM
175 S LRV=1.1 D F Q:LR("Q")
176 I $O(^LR(LRDFN,LRSS,LRI,1.4,0)) D Q:LR("Q")
177 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
178 .W !,LR(69.2,.14)
179 .I $P($G(^LR(LRDFN,LRSS,LRI,5,0)),U,4) S LR(0)=5 D ^LRSPRPTM
180 S LRV=1.4 D F Q:LR("Q")
181 ;Supplementary Report
182 I $O(^LR(LRDFN,LRSS,LRI,1.2,0)) D:LR(.21) F^LRAPF,^LRAPF Q:LR("Q") D
183 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
184 .W !,"Supplementary Report:"
185 .S LRV=0 F S LRV=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV)) Q:'LRV!(LR("Q")) D
186 ..S X=^LR(LRDFN,LRSS,LRI,1.2,LRV,0) D S
187 D ^LRSPRPT1 Q:LR("Q")
188 Q:+$G(LRPRE) ;Don't set the final flag and print the footer if prelim
189 S LRO=1 D F^LRAPF
190 Q
191S ;
192 S Y=+X,X=$P(X,U,2) D D^LRU
193 W !?3,"Date: ",Y
194 I $D(LR("R")),'X W " not verified" Q
195 D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
196 D:$P($G(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,0)),U,4) SUPA
197 D E S B=0
198 F LRZ=0:1 S B=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,1,B)) Q:'B!(LR("Q")) D
199 .D:$Y>(IOSL-14) F^LRAPF,^LRAPF Q:LR("Q")
200 .S DIWF="W"
201 .S X=^LR(LRDFN,LRSS,LRI,1.2,LRV,1,B,0) D ^DIWP Q:LR("Q")
202 Q:LR("Q")
203 D:LRZ ^DIWW
204 Q
205SGL ;Print Single Report
206 N LRPTR
207 S LRAPX(1)=""
208 D EN1^LRUPS Q:LRAN=-1
209 I '$P(^LR(LRDFN,LRSS,LRI,0),"^",11) D G SGL
210 .W $C(7)," Sorry, report not verified.",!
211 D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS,LRI)
212 S LRAP=LRDFN_"^"_LRI,LRSAV=1
213 D EN2^LRUA
214 G DEV
215A ;
216 S A=0 F S A=$O(^LR(LRDFN,LRSS,LRI,LRV,A)) Q:'A!(LR("Q")) D
217 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
218 .W !,$P(^LR(LRDFN,LRSS,LRI,LRV,A,0),"^")
219 Q
220TOP ;
221 S Z=$P(X,"|TOP|",1)_$P(X,"|TOP|",2) D F^LRAPF,^LRAPF S X=Z
222 Q
223SUPA ;Print supplementary report audit information
224 W !?14,"*+* SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED *+*"
225 W !,"(Added/Last modified: "
226 S (A,B)=0 F S A=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,A)) Q:'A!(LR("Q")) D
227 .S B=A
228 Q:LR("Q")
229 Q:'$D(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,B,0))
230 S A=^(0),Y=+A,LRSGN=" typed by ",A=$P(A,"^",2)
231 I $P(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,B,0),"^",3) D
232 .S A=^(0),LRSGN=" signed by ",A2=$P(A,"^",3),Y=$P(A,"^",4)
233 .S A=A2
234 S A=$S($D(^VA(200,A,0)):$P(^(0),"^"),1:A)
235 ;If supp rpt is released, display 'signed by' instead of 'typed by'
236 D D^LRU W Y,LRSGN,A,")"
237 ;If RELEASE SUPP REPORT MODIFIED set to 1, display "NOT VERIFIED"
238 I $P(^LR(LRDFN,LRSS,LRI,1.2,LRV,0),"^",3) W !,?25,"**-* NOT VERIFIED *-**"
239 D:$D(LRQ(9)) SUPM
240 Q
241SUPM ;Print previous versions of supplementary reports
242 ;This is used by menu option 'Print path modifications [LRAPMOD]'
243 ;
244 S A=0 F S A=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,A)) Q:'A!(LR("Q")) D
245 .S LRT=^LR(LRDFN,LRSS,LRI,1.2,LRV,2,A,0)
246 .D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
247 .S Y=+LRT,Y2=" modified: ",X=$P(LRT,"^",2),LRSGN=" typed by "
248 .;If supp rpt is released, display 'signed by' instead of 'typed by'
249 .I $P(LRT,"^",3) S LRSGN=" signed by ",X=$P(LRT,"^",3),Y=$P(LRT,"^",4),Y2=" released: "
250 .S X=$S($D(^VA(200,X,0)):$P(^(0),"^"),1:X)
251 .D D^LRU W !,"Date ",Y2,Y,LRSGN,X
252 .K ^UTILITY($J)
253 .S DIWR=IOM-5,DIWL=5,DIWF="W"
254 .S B=0
255 .F LRZ=0:1 S B=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,A,1,B)) Q:'B!(LR("Q")) D
256 ..S LRT=^LR(LRDFN,LRSS,LRI,1.2,LRV,2,A,1,B,0)
257 ..D:$Y>(IOSL-13) F^LRAPF,^LRAPF Q:LR("Q")
258 ..S X=LRT D ^DIWP
259 .Q:LR("Q") D:LRZ ^DIWW
260 Q:LR("Q")
261 W !?13,"==========Text below appears on final report=========="
262 Q
263CONT ;
264 K DIR S DIR(0)="E"
265 D ^DIR W !
266 S:$D(DTOUT)!(X[U) LR("Q")=1
267 Q
268FOC ;Print final office copy page (SNOMEDS)
269 N LRADC,LRCTR
270 I '$D(LRAP) D
271 .D:LRSS'="AU" ^LRUA
272 .I LRSS="AU" S X=^LR(LRDFN,0) D ^LRUP
273 I LRSS="AU" D
274 .S LRADC=$E($P(^LR(LRDFN,LRSS),"^"),1,3)_"0000"
275 .S:+$G(LRDPF)=2 LRDEM("DTH")=$P(VADM(6),"^",2)
276 .;Get DATE DIED from Referral File for Referral Patients
277 .S:+$G(LRDPF)'=2 LRDEM("DTH")=$$GET1^DIQ(67,DFN_",",.351)
278 .S LRDEM("AUDT")=$$GET1^DIQ(63,LRDFN_",",11)
279 .S LRDEM("AUTYP")=$$GET1^DIQ(63,LRDFN_",",13.7)
280 .S LRDEM("PRO")=$$GET1^DIQ(63,LRDFN_",",13.5)
281 I LRSS'="AU" D
282 .S LRADC=$E($P(^LR(LRDFN,LRSS,LRI,0),"^"),1,3)_"0000"
283 .S LRDEM("PRO")=LRMD
284 S LRDEM("PNM")=LRP,LRDEM("SSN")=SSN
285 S LRDEM("SEX")=SEX,LRDEM("AGE")=AGE,LRDEM("DOB")=DOB
286 D INIT^LRAPSNMD(LRDFN,LRSS,$G(LRI),LRSF,LRAA,LRAN,LRADC,.LRDEM,0)
287 Q
288END ;
289 D V^LRU
290 K LRSF515
291 Q
Note: See TracBrowser for help on using the repository browser.