source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAURPT.m@ 1604

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

initial load of WorldVistAEHR

File size: 7.1 KB
Line 
1LRAURPT ;AVAMC/REG/WTY - AUTOPSY RPT ;9/22/00
2 ;;5.2;LAB SERVICE;**1,72,173,248,259**;Sep 27, 1994
3 ;
4 ;Reference to ^DD(63 supported by IA #10155
5 ;WTY;24-AUG-01;Added ICD to the print coding question
6 ;
7 N LRPTR,LREL
8 W !!,LRO(68)," Autopsy Protocols" D XR^LRU,EN2^LRUA S LRD("V")=""
9 G END:LRAPX=2,SGL:LRAPX=3,CH:LRAPX=4
10 L +^LRO(69.2,LRAA,2):5
11 I '$T D EN^DDIOL("Someone else is building a print queue for this Accession Area","","$C(7),!!") Q
12GETP ;Add a patient to the report queue
13 W ! S X="" D ^LRUPS G GETP:LRAN["?" I LRAN=-1 L -^LRO(69.2,LRAA,2) Q
14 G:$D(^LRO(69.2,LRAA,2,LRAN,0)) GETP
15 S FDAIEN(2)=LRAN
16 S FDA(2,69.23,"+2,"_+LRAA_",",.01)=LRDFN
17 D UPDATE^DIE("","FDA(2)","FDAIEN") K FDAIEN G GETP
18CH ;Check Queue
19 I '$O(^LRO(69.2,LRAA,2,0)) D Q
20 .W $C(7),!!,"No AUTOPSY PROTOCOLS currently on the print queue.",!!
21 ;Variable LR("DVD") is used to divide reports displayed in the browser
22 K LR("DVD")
23 S $P(LR("DVD"),"|",IOM)=""
24SPC ;Spacing
25 I LRAPX=4 D
26 .W !!,"The following two questions apply only to reports not stored in "
27 .W "TIU."
28 .W !,"If the report is stored in TIU it will be printed in its "
29 .W "original format.",!
30 R !,"(D)ouble or (S)ingle spacing of report(s): ",X:DTIME
31 Q:X=""!(X[U)
32 I $E(X)'="D"&($E(X)'="S") D G SPC
33 .W $C(7),!,"Enter 'S' for single or 'D' for double "
34 .W "spacing of reports"
35 S LRS=$S(X="D":"D",1:"")_"W"
36 W !!,"Print special studies, journal references, weights, and "
37 W "measures: "
38 S %=1 D YN^LRU Q:%<1 S:%=1 LRD=1
39 Q:LRAPX=3
40 W !!,"Save protocol list for reprinting "
41 S %=2 D YN^LRU S:%=1 LRSAV=1
42DEV ;Device Handling
43 S %ZIS="Q" D ^%ZIS
44 I POP W ! S LR("Q")=1 Q
45 I $D(IO("Q")) D Q
46 .S ZTDESC="Print AU Anat Path Reports"
47 .S ZTSAVE("LR*")="",ZTRTN="QUE^LRAURPT"
48 .D ^%ZTLOAD W:$D(ZTSK) !,"Request Queued, #",ZTSK W !
49 .K ZTSK,IO("Q") D HOME^%ZIS
50 .S LR("Q")=1
51QUE ;
52 U IO D L^LRU,S^LRU,EN^LRUA
53 N LRFFF
54 S LRQUIT=0,LR("Q")=+$G(LR("Q"))
55 ;LRSF515=1 means an SF515 is being generated.
56 S:'$D(LRSF515) LRSF515=0
57 S:'$D(LRFOC) LRFOC=0 ;Final office copy
58 S LRFFF=1 ;Flag used to determine whether to perform final form feed
59 I LRFOC S LRFFF=0 ;If final office copy, don't perform final form feed
60 S LR(.21)=+$G(^LRO(69.2,LRAA,.2)),(LRS(5),LRAURPT)=1
61PSGL ;Single Report
62 I $D(LRAP) D G LST
63 .S LRDFN=LRAP
64 .I +$G(LRPTR) D Q
65 ..D:$D(LR("AU1")) EN
66 ..Q:LR("Q")
67 ..D MAIN^LRAPTIUP(LRPTR,0)
68 ..S LRFFF=0 ;Don't do final form feed. It's done by LRAPTIUP.
69 ..I LRQUIT S LR("Q")=1 Q
70 ..K LRAP S LR("F")=1
71 ..I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
72 ..Q:LR("Q")
73 ..I 'LRFOC S LR("Q")=1 Q
74 ..S LRI="" D FOC^LRSPRPT
75 ..I LRQUIT S LR("Q")=1 Q
76 ..I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
77 .D EN
78 .K LRAP
79 .I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
80 .Q:LR("Q")
81 .I 'LRFOC S LR("Q")=1 Q
82 .W !
83 .W:IOST?1"P-".E @IOF
84 .S LRI="" D FOC^LRSPRPT
85 .I LRQUIT S LR("Q")=1 Q
86 .I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
87PQUE ;Print all on queue
88 S LRAN=0
89 F S LRAN=$O(^LRO(69.2,LRAA,2,LRAN)) Q:'LRAN!(LR("Q")) D
90 .S (LRQUIT,LRQ)=0
91 .I 'LRFOC S LRFFF=1
92 .K LR("F")
93 .S LRDFN=+^LRO(69.2,LRAA,2,LRAN,0)
94 .D RELEASE^LRAPUTL(.LREL,LRDFN,LRSS)
95 .I +$G(LREL(1)) D
96 ..D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS)
97 .I +$G(LRPTR) D Q
98 ..D MAIN^LRAPTIUP(LRPTR,0)
99 ..S LRFFF=0
100 ..W:IOST["BROWSER"&('LRFOC) !!,LR("DVD")
101 ..K LRPTR
102 ..I LRQUIT S LR("Q")=1 Q
103 ..S LR("F")=1
104 ..I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
105 ..Q:LR("Q")!('LRFOC)
106 ..D FOC^LRSPRPT
107 ..W:IOST["BROWSER" !!,LR("DVD")
108 ..I LRQUIT S LR("Q")=1 Q
109 ..I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
110 .W:IOST?1"C-".E @IOF
111 .D EN
112 .W:IOST?1"P-".E @IOF
113 .W:IOST["BROWSER"&('LRFOC) !!,LR("DVD")
114 .I 'LR("Q"),$D(LR("F")),IOST?1"C-".E D CONT
115 .Q:LR("Q")!('LRFOC)
116 .W !
117 .D FOC^LRSPRPT
118 .W:IOST["BROWSER" !!,LR("DVD")
119 .I LRQUIT S LR("Q")=1 Q
120 .I 'LR("Q"),$D(LR("F")),IOST?1"C".E D CONT
121 S LRFFF=0
122LST ;
123 K:'$D(LRSAV) ^LRO(69.2,LRAA,2) K LRAURPT
124 S:'$D(^LRO(69.2,LRAA,2,0)) ^(0)="^69.23A^0^0"
125 K LRSAV D K^LRU
126 D:'$D(LR("AU1")) DEVEND
127 Q
128W ;
129 W !,LR("%")
130 Q
131F D E
132 S A=0 F LRZ=0:1 S A=$O(^LR(LRDFN,LRV,A)) Q:'A!(LR("Q")) D
133 .D:$Y>(IOSL-12) FT,H Q:LR("Q")
134 .S X=^LR(LRDFN,LRV,A,0) D:X["|TOP|" TOP D ^DIWP
135 Q:LR("Q") D:LRZ ^DIWW Q
136E K ^UTILITY($J) S DIWR=IOM-5,DIWL=5,DIWF=LRS
137 Q
138EN ;
139 S LR("SPSM")=1 ;Set this flag to suppress SNOMED codes
140 S LRQ=0,X=^LR(LRDFN,0) D ^LRUP
141 I '$D(^LR(LRDFN,"AU")) L +^LRO(69.2,LRAA,2,LRAN):5 Q:'$T D Q
142 .S DIK="^LRO(69.2,LRAA,2,",DA=LRAN,DA(1)=0
143 .D ^DIK K DA,DIK
144 .L -^LRO(69.2,LRAA,2,LRAN)
145 S X=^LR(LRDFN,"AU"),LRAC=$P(X,"^",6),LRM(2)=$P(X,"^",7)
146 S LRM(1)=$P(X,"^",12),LRW(9)=$P(X,"^",13),LRM(3)=$P(X,"^",10)
147 S Y=$P(X,"^"),LRH(2)=$E(Y,2,3) D D^LRU
148 S LRH(1)=Y,Y=$P(X,"^",3) D D^LRU
149 S LRH(3)=Y,Y=$P(X,"^",17) D D^LRU S LRH(17)=Y
150 S LRLLOC=$P(X,"^",5),AGE=$P(X,"^",9)
151 S Y=$P(X,"^",8),C=$P(^DD(63,14.5,0),U,3)
152 D Y^DIQ S LRSVC=Y
153 S Y=$P(X,"^",11),C=$P(^DD(63,13.7,0),U,3)
154 D Y^DIQ S LRS(3)=Y
155 S DA=LRDFN D D^LRAUAW S Y=LR(63,12) D D^LRU S LRH=Y,X=LRM(1)
156 D:X D^LRUA S LRM(1)=X,X=LRM(2)
157 D:X D^LRUA S LRM(2)=X,X=LRM(3)
158 D:X D^LRUA S LRM(3)=X
159 Q:+$G(LRPTR)
160 D H Q:LR("Q") S LR("F")=1
161 W:LRH(1)="" !?20,"**** REPORT INCOMPLETE ****",!
162 W !!,LRAU(1),! S LRV=81 D F
163 D:$Y>(IOSL-12) FT,H Q:LR("Q") W !!,LR("%")
164 W !,LRAU(2),! S LRV=82 D F
165 I $O(^LR(LRDFN,84,0)),LR(.21) D FT,H Q:LR("Q")
166 S LRA=0 F S LRA=$O(^LR(LRDFN,84,LRA)) Q:'LRA!(LR("Q")) D
167 .S LRB=^LR(LRDFN,84,LRA,0) D:$Y>(IOSL-12) FT,H Q:LR("Q")
168 .W !!,"SUPPLEMENTARY REPORT DATE: "
169 .S Y=LRB D D^LRU W Y
170 .D:$P($G(^LR(LRDFN,84,LRA,2,0)),U,4) SUPA^LRAPAUSR
171 .D WRT
172 Q:LR("Q")
173 D:$G(LRD) ^LRAPT2
174 Q:LR("Q")
175 D FT
176 Q
177WRT D E S LRC=0
178 F LRZ=0:1 S LRC=$O(^LR(LRDFN,84,LRA,1,LRC)) Q:'LRC!(LR("Q")) D
179 .D:$Y>(IOSL-12) FT,H Q:LR("Q")
180 .S X=^LR(LRDFN,84,LRA,1,LRC,0) D:X["|TOP|" TOP D ^DIWP
181 Q:LR("Q") D:LRZ ^DIWW Q
182H ;
183 Q:LR("Q")
184 I $D(LR("F")),IOST?1"C".E D CONT Q:LR("Q")
185 S LRQ=LRQ+1
186 W:($D(LR("F"))) @IOF
187 W !! D W
188 W !?5,"CLINICAL RECORD |",?40,"AUTOPSY PROTOCOL",?73,"Pg ",LRQ
189 W !,LR("%")
190 W !,"Date died: ",LRH,?40,"| Autopsy date: ",LRH(1)
191 W !,"Resident: ",LRM(2),?40,"| ",$E(LRS(3),1,13)
192 W ?56,"Autopsy No. ",$S(LRQ(8)]"":LRQ(8)_LRH(2)_" "_LRAC,1:LRAC)
193 W !,LR("%")
194 Q
195FT ;Footer
196 Q:LR("Q")
197 I IOSL'>66 F Q:$Y>(IOSL-12) W !
198 D W W !
199 W:LRH(3)=""&(LRH(17)]"") ?55,"| Provisional Anatomic Dx"
200 W !,"Pathologist: ",LRM(3),?52,LRW(9),?55,"| Date "
201 W $E($S(LRH(3)]"":LRH(3),1:LRH(17)),1,12)
202 D W W !,LRQ(1),?IOM-17,"AUTOPSY PROTOCOL"
203 W !,"Patient: ",$E(LRP,1,30),?43,SSN,?56,"SEX:",SEX,?63,"DOB:",DOB
204 W !,$E(LRLLOC,1,22),?23,"Physician: ",$E(LRM(1),1,28)
205 W ?63,"AGE AT DEATH:",$J(AGE,3)
206 Q
207SGL ;Print single report entry point
208 K LRD("V") S X="" D ^LRUPS G:LRAN="?" SGL Q:LRAN=-1
209 D RELEASE^LRAPUTL(.LREL,LRDFN,LRSS)
210 I $D(LR("AU1")),'+$G(LREL(1)) D Q
211 .W $C(7),!!,"Report not verified." S LR("AU1")=2
212 I +$G(LREL(1)) D
213 .D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS)
214 I $D(LR("AU1"))!(+$G(LRPTR)) S LRS="W",LRD=1
215 E D SPC Q:X=""!(X[U)
216 D EN2^LRUA
217 S LRAP=LRDFN,LRSAV=1
218 G DEV
219DEVEND ;Close device
220 I IOST?1"P-".E W:LRFFF @IOF
221 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
222 Q
223CONT ;
224 K DIR S DIR(0)="E"
225 D ^DIR W !
226 S:$D(DTOUT)!(X[U) LR("Q")=1
227 Q
228END ;
229 W $C(7),!!,"OK to delete the AUTOPSY PROTOCOL list "
230 S %=2 D YN^LRU
231 I %=1 D Q
232 .K ^LRO(69.2,LRAA,2)
233 .S ^LRO(69.2,LRAA,2,0)="^69.23A^0^0"
234 .W $C(7),!,"LIST DELETED !",!
235 W !!,"OK, LET'S FORGET IT.",!
236 Q
237TOP ;
238 S Z=$P(X,"|TOP|",1)_$P(X,"|TOP|",2)
239 D FT,H S X=Z
240 Q
Note: See TracBrowser for help on using the repository browser.