source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRAPBR1.m@ 648

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

revised back to 6/30/08 version

File size: 7.7 KB
Line 
1LRAPBR1 ;DALOI/WTY/KLL;AP Browser Print Cont.;11/08/01
2 ;;5.2;LAB SERVICE;**259,317**;Sep 27, 1994
3 ;
4 ;
5ENTER ;from LRAPBR
6 N LRCNT,LRTMP,LRA1,LRADESC,LRLENG1,LRLENG2,LRFILE,LRAPMD
7 N LRFLD,LRV,LRV1,LRV2,LRB1,LRTEXT,LRSPCE,LRIENS,LRAPMR
8 Q:'$D(^LR(LRDFN,LRSS,LRI,0))
9 S:'LRTIU GROOT="^TMP(""LRAPBR"",$J,"
10 S:LRTIU GROOT="^TMP(""TIUP"",$J,"
11 D INP^VADPT S LRPRAC=+VAIN(2)
12 S:'LRPRAC LRPRAC(1)=""
13 I LRPRAC S X=LRPRAC D D^LRUA S LRPRAC(1)=X
14 S LRQ=0 D ^LRUA,HEADER
15 S LR("F")=1
16 D DASH
17 D:LRTIU GLENTRY("$TEXT",,1)
18 D GLENTRY("Submitted by: "_LRW(5),"",1)
19 D GLENTRY("Date obtained: "_LRTK,44)
20 D:LRA DASH
21MAIN ;
22 D SPEC
23 D MODCHK
24 D SUPBNNR
25 D DIAG
26 D DOC
27 D WPFLD
28 D SUPRPT
29 D SSJR
30 Q
31SPEC ;List specimens
32 D GLENTRY("Specimen (Received "_LRTK(1)_"):","",1)
33 S LRCNT=$P(^LR(LRDFN,LRSS,LRI,.1,0),U,4)
34 Q:'LRCNT
35 S LRFILE=+$$GET1^DID(LRSF,.012,"","SPECIFIER")
36 S LRIENS=LRI_","_LRDFN_","
37 S LRCT2=0
38 F LRB1=1:1 D Q:LRCT2=LRCNT
39 .D GETS^DIQ(LRFILE,LRB1_","_LRIENS,.01,"","LRTMP("_LRB1_")")
40 .I $D(LRTMP(LRB1)) S LRCT2=LRCT2+1
41 S LRA1=0 F S LRA1=$O(LRTMP(LRA1)) Q:'LRA1 D
42 .S LRTEXT=LRTMP(LRA1,LRFILE,LRA1_","_LRIENS,.01)
43 .D GLENTRY(LRTEXT,"",1)
44 Q
45MODCHK ;Display modified banner if required
46 S LRAPMR=$$GET1^DIQ(LRSF,LRIENS,.17,"I")
47 Q:'LRAPMR
48 S LRAPMD=$$GET1^DIQ(LRSF,LRIENS,.172,"I")
49 D GLENTRY("","",1)
50 S LRTEXT=""
51 F LRCNT=1:1:$S(LRAPMD:14,1:15) D
52 .S LRTEXT=LRTEXT_"*+"
53 S LRTEXT=LRTEXT_" MODIFIED "
54 S LRTEXT=LRTEXT_$S(LRAPMD:"DIAGNOSIS ",1:"REPORT ")
55 F LRCNT=1:1:$S(LRAPMD:14,1:15) D
56 .S LRTEXT=LRTEXT_"*+"
57 D GLENTRY(LRTEXT,"",1)
58 D GLENTRY("","",1)
59 Q
60SUPBNNR ;Display supplementary report header if one or more has been added
61 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) D
62 .S LRTEXT="*+* SUPPLEMENTARY REPORT HAS BEEN ADDED *+*"
63 .D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1)
64 .S LRTEXT="*+* REFER TO BOTTOM OF REPORT *+*"
65 .D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1)
66 .D GLENTRY("","",1)
67 Q
68DIAG ;
69 ;Display the Brief Clinical History, Preoperative Diagnosis,
70 ;Operative Findings, and Postoperative Diagnosis
71 S LRFILE=LRSF,LRCNT=0,LRIENS=LRI_","_LRDFN_","
72 F LRFLD=.013:.001:.016 D
73 .D:LRA DASH
74 .S LRCNT=LRCNT+1
75 .D GLENTRY($P($T(TEXT1+LRCNT),";",2),"",1)
76 .D WP
77 Q
78DOC ;
79 ;Pathologist information
80 D GLENTRY("","",1)
81 D GLENTRY("Surgeon/physician: "_LRMD,27,1)
82 D:LRA GLENTRY(LR("%1"),"",1)
83 D DASH
84 D HEADER2
85 D:LRA DASH
86 I LRRC="" D
87 .D GLENTRY("+*+* REPORT INCOMPLETE *+*+",20,1)
88 .D GLENTRY("","",1)
89 D GLENTRY("","",1)
90 I LRRMD'="" D
91 .S LRCNT=0 F LRA1="SP","CY","EM" D
92 ..S LRCNT=LRCNT+1
93 ..S LRTMP(LRA1)=$P($T(TEXT2+LRCNT),";",3)
94 .S LRTMP=LRTMP(LRSS)
95 .D GLENTRY(LRTMP_" "_LRRMD,31)
96 Q
97WPFLD ;
98 ;Display Frozen Section, Gross Description, Microscopic Description
99 ;and Surgical Path Diagnosis
100 F LRCNT=1:1:4 D
101 .S X=$T(FIELDS+LRCNT)
102 .S LRV=$P(X,";",2),LRV1=$P(X,";",3),LRV2=$P(X,";",4)
103 .I $P($G(^LR(LRDFN,LRSS,LRI,LRV,0)),U,4) D
104 ..D GLENTRY("","",1),GLENTRY(LR(69.2,LRV1),"",1)
105 ..S LRFILE=LRSF,LRIENS=LRI_","_LRDFN_",",LRFLD=LRV
106 ..I $P($G(^LR(LRDFN,LRSS,LRI,LRV2,0)),U,4) D
107 ...S LRFILE1=+$$GET1^DID(LRSF,LRV2,"","SPECIFIER")
108 ...D GLENTRY("*+* MODIFIED REPORT *+*",28,1)
109 ...D GLENTRY("(Last modified: ","",1)
110 ...S (LRA1,LRB1)=0
111 ...F S LRA1=$O(^LR(LRDFN,LRSS,LRI,LRV2,LRA1)) Q:'LRA1 S LRB1=LRA1
112 ...Q:'$D(^LR(LRDFN,LRSS,LRI,LRV2,LRB1,0))
113 ...S LRSR1=$$GET1^DIQ(LRFILE1,LRB1_","_LRIENS,.01)
114 ...S LRSR2=$$GET1^DIQ(LRFILE1,LRB1_","_LRIENS,.02)
115 ...S LRTEXT=LRSR1_" typed by "_LRSR2_")"
116 ...D GLENTRY(LRTEXT,BTAB)
117 ..D WP
118 Q
119SUPRPT ;Supplementary Report
120 I $P($G(^LR(LRDFN,LRSS,LRI,1.2,0)),U,4) D
121 .S LRFILE=+$$GET1^DID(LRSF,1.2,"","SPECIFIER")
122 .S LRIENS1=LRI_","_LRDFN_","
123 .D GLENTRY("","",1),GLENTRY("SUPPLEMENTARY REPORT(S):","",1)
124 .S LRV=0 F S LRV=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV)) Q:'LRV D
125 ..S LRIENS=LRV_","_LRIENS1
126 ..S LRSR1=$$GET1^DIQ(LRFILE,LRIENS,.01)
127 ..S LRSR2=+$$GET1^DIQ(LRFILE,LRIENS,.02)
128 ..D GLENTRY("Supplementary Report Date: "_LRSR1,3,1)
129 ..I $D(LR("R")),'LRSR2 D GLENTRY(" not verified",BTAB) Q
130 ..I $P($G(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,0)),U,4) D
131 ...S LRTEXT="*+* SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED *+*"
132 ...D GLENTRY($$CJ^XLFSTR(LRTEXT,IOM),"",1)
133 ...D GLENTRY("(Added/Last","",1)
134 ...S (LRA1,LRB1)=0
135 ...F S LRA1=$O(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,LRA1)) Q:'LRA1 D
136 ....S LRB1=LRA1
137 ...Q:'$D(^LR(LRDFN,LRSS,LRI,1.2,LRV,2,LRB1,0))
138 ...S LRA2=^(0),Y=+LRA2,LRA2A=$P(LRA2,"^",2),LRSGN=" Typed by ",LRDSC=" modified: "
139 ...I $P(LRA2,"^",3) S LRSGN=" Signed by ",LRDSC=" released: ",LRA2A=$P(LRA2,"^",3),Y=$P(LRA2,"^",4)
140 ...S LRA2A=$S($D(^VA(200,LRA2A,0)):$P(^(0),"^"),1:LRA2A)
141 ...D D^LRU
142 ...D GLENTRY(LRDSC_Y_LRSGN_LRA2A_")",BTAB)
143 ..S LRFLD=1 D WP
144 ..D GLENTRY("","",1)
145 Q
146SSJR ;Print special studies/journal references
147 D ^LRAPBR3
148 S LREFLG=1
149 Q
150WP ;Display word procesing fields
151 K LRTMP,^UTILITY($J,"W")
152 N X,DIWR,DIWL,LRINC
153 S X=$$GET1^DIQ(LRFILE,LRIENS,LRFLD,"","LRTMP",)
154 S DIWR=IOM-5,DIWL=5,DIWF=""
155 S X=+$$GET1^DID(LRFILE,LRFLD,"","SPECIFIER")
156 I $$GET1^DID(X,.01,"","SPECIFIER")["L" S DIWF="N"
157 S LRINC=0
158 F S LRINC=$O(LRTMP(LRINC)) Q:'LRINC S X=LRTMP(LRINC) D ^DIWP
159 S LRINC=0
160 F S LRINC=$O(^UTILITY($J,"W",DIWL,LRINC)) Q:'LRINC D
161 .D GLENTRY(^UTILITY($J,"W",DIWL,LRINC,0),DIWL,1)
162 K ^UTILITY($J,"W")
163 Q
164HEADER ;
165 D:LRTIU GLENTRY("$APHDR",,1)
166 D GLENTRY("","",1)
167 D DASH
168 D GLENTRY("MEDICAL RECORD |",5,1)
169 D GLENTRY(LRAA1,40)
170 D DASH
171HEADER2 ;
172 S LRADESC="Accession No. "_$S(LRQ(8)]"":LRQ(8)_LRW(1)_" "_LRAC,1:LRAC)
173 S LRLENG1=$L(LRQ(1)),LRLENG2=$L(LRADESC),LRSPCE=IOM-LRLENG2-14
174 S:LRLENG1>LRSPCE LRQ(1)=$E(LRQ(1),1,LRSPCE)
175 D GLENTRY("PATHOLOGY REPORT",30,1)
176 D GLENTRY("Laboratory: "_LRQ(1),"",1)
177 D GLENTRY(LRADESC,IOM-LRLENG2-1)
178 Q
179FOOTER ;Footer-called from ^LRAPBR
180 D:LRTIU GLENTRY("$FTR",,1)
181 D DASH
182 S LRTEXT=$S('$D(LR("W")):"",1:"See signed copy in chart")
183 D GLENTRY(LRTEXT,"",1)
184 S LRTEXT="("_$S($D(LREFLG):"End of report",1:"See next page")_")"
185 D GLENTRY(LRTEXT,57)
186 D GLENTRY(LRPMD,"",1),GLENTRY(LRW(9),52),GLENTRY("| Date "_LRRC,55)
187 D DASH
188 D GLENTRY(LRP,"",1)
189 S LRTEXT=$S('$D(LR("W")):"STANDARD FORM 515",1:"WORK COPY ONLY !!")
190 D GLENTRY(LRTEXT,50)
191 D GLENTRY("ID:"_SSN,"",1)
192 D GLENTRY("SEX:"_SEX,16),GLENTRY(" DOB:"_DOB,BTAB)
193 I AGE D
194 .S LRTEXT=$S($G(VADM(6))]"":" AGE AT DEATH: ",1:" AGE: ")_AGE
195 .D GLENTRY(LRTEXT,BTAB)
196 D GLENTRY(" LOC:"_LRLLOC,BTAB)
197 D GLENTRY("","",1)
198 D:$L(LRADM) GLENTRY("ADM:"_$P(LRADM,"@"),BTAB)
199 D:$L(LRADX) GLENTRY("DX:"_$E(LRADX,1,26),17)
200 D GLENTRY("PCP:",46)
201 D:$L(LRPRAC) GLENTRY($E(LRPRAC(1),1,28),51)
202 Q
203ESIGLN ;Write signature block name, title, and date of signature
204 D GLENTRY(,,1)
205 I $D(^VA(200,DUZ,0)) D
206 .S LRFILE=200,LRFLD=20.2,LRFLD2=20.3
207 .S X=$$GET1^DIQ(LRFILE,DUZ,LRFLD)
208 ;Compare DUZ to pathologist, if different, use proxy signature
209 S:LRSS="AU" LRPATH=$$GET1^DIQ(63,LRDFN,13.6,"I")
210 I LRSS'="AU" D
211 .S LRFL2=$S(LRSS="EM":63.02,LRSS="CY":63.09,LRSS="SP":63.08,1:0)
212 .S LRIENS=LRI_","_LRDFN_","
213 .S LRPATH=$$GET1^DIQ(LRFL2,LRIENS,.02,"I")
214 S LRPATH2=""
215 S:LRPATH'=DUZ LRPATH2=" FOR "_$$GET1^DIQ(LRFILE,LRPATH,LRFLD)
216 S LRTEXT="/es/ "_X_LRPATH2
217 ;S LRTEXT="/es/ "_X
218 D GLENTRY(LRTEXT,,1)
219 S X=$$GET1^DIQ(LRFILE,DUZ,LRFLD2)
220 S LRTEXT=X
221 D GLENTRY(LRTEXT,,1)
222 S Y=LRNTIME D DD^%DT
223 S LRTEXT="Signed "_Y
224 D GLENTRY(LRTEXT,,1)
225 Q
226DASH ;Display a line of dashes
227 D GLENTRY(LR("%"),"",1)
228 Q
229GLENTRY(LRPR1,LRPR2,LRPR3) ;Write to global
230 ;LRPR1 = Text to be written to global
231 ;LRPR2 = Tab position
232 ;LRPR3 = 1 means start a new line. Othewise, write an current line.
233 S LRPR1=$G(LRPR1)
234 S LRPR2=+$G(LRPR2)
235 S LRPR3=+$G(LRPR3)
236 D:LRPR3 NEWLN^LRAPUTL(LRPR1,LRPR2)
237 D:'LRPR3 GLBWRT^LRAPUTL(LRPR1,LRPR2)
238 Q
239TEXT1 ;Text for top of report
240 ;BRIEF CLINICAL HISTORY:
241 ;PREOPERATIVE DIAGNOSIS:
242 ;OPERATIVE FINDINGS:
243 ;POSTOPERATIVE DIAGNOSIS:
244TEXT2 ;Descriptive text based on section
245 ;SP;Pathology Resident:
246 ;CY;Screened by:
247 ;EM;Prepared by:
248FIELDS ;Field numbers for word processing fields
249 ;1.3;.13;6
250 ;1;.03;7
251 ;1.1;.04;4
252 ;1.4;.14;5
Note: See TracBrowser for help on using the repository browser.