source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LR7OSAP2.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 7.2 KB
Line 
1LR7OSAP2 ;ISL/RAB/WTY/KLL -Silent Routine for autopsy report;3/28/2002
2 ;;5.2;LAB SERVICE;**230,256,259,317**;Sep 27, 1994
3 ;
4 ;Reference to ^DD(63 supported by IA #999
5 ;
6EN(LRDFN) ;
7 N CCNT,GIOM,XPOS,LR,LRSS,X,I,LRAU,LRS,VERIFIED,LRTEXT,LRPTR,X2
8 S XPOS=0,(LRS(5),LR("M"),CCNT)=1,LRSS="AU",GIOM=80
9 D EN^LRUA,^LRAPU
10 S X=$S($D(^LRO(69.2,+Y,0)):^(0),1:""),LRAU(3)=$P(X,"^",3),LRAU(4)=$P(X,"^",4)
11 D LINE,LN
12 S ^TMP("LRH",$J,"AUTOPSY")=GCNT,^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(28,CCNT,"---- AUTOPSY ----")
13 S VERIFIED=$P($G(^LR(LRDFN,"AU")),U,15)
14 I 'VERIFIED D Q
15 . D LN
16 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Report not verified.")
17 D TIUCHK^LRAPUTL(.LRPTR,LRDFN,LRSS)
18 I +$G(LRPTR) D Q
19 .D MAIN^LR7OSAP3(LRPTR)
20 D ZZ,LINE
21 I $D(^LR(LRDFN,84)) D
22 .D LN
23 .S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED"
24 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*+* "_LRTEXT_" *+*")
25 .D LN
26 .S LRTEXT="REFER TO BOTTOM OF REPORT"
27 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(19,CCNT,"*+* "_LRTEXT_" *+*")
28 .D LN
29 I $D(^LR(LRDFN,81)) D
30 . D LN
31 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,LRAU(3))
32 . D F(81)
33 I $D(^LR(LRDFN,82)) D
34 . D LN
35 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,LRAU(4))
36 . D F(82)
37 I $O(^LR(LRDFN,84,0)) D
38 . S I=0 F S I=$O(^LR(LRDFN,84,I)) Q:'I S X=^(I,0) D
39 .. ;Don't print supp date and text if supp has not been released
40 .. S X1=$P(X,"^",1),X2=$P(X,"^",2)
41 .. Q:'X2
42 .. D LINE,LN
43 .. S LRTEXT="SUPPLEMENTARY REPORT DATE: "_$$FMTE^XLFDT(X1,"1P")
44 .. S ^TMP("LRC",$J,GCNT,0)=LRTEXT
45 .. I $O(^LR(LRDFN,84,I,2,0)) D MODSR
46 .. D WRAP^LR7OSAP1("^LR("_LRDFN_",84,"_I_",1)",79)
47 Q:'$D(^LR(LRDFN,"AW"))&('$D(^("AY")))&('$D(^("AWI")))
48 D WT
49 D LRAPT3
50 ;Removed code that prints SNOMED codes per LR*5.2*259
51 Q
52MODSR ;Modified Autopsy Supplementary Report Audit Info
53 N LRTEXT,LRSP1,LRSP2,LRFILE,LRIENS,LRR1,LRR2
54 S LRFILE=63.3242
55 D LN
56 S LRTEXT="SUPPLEMENTARY REPORT HAS BEEN ADDED/MODIFIED"
57 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(14,CCNT,"*** "_LRTEXT_" ***")
58 D LN
59 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"(Added/Last modified: ")
60 S LRIENS=I_","_LRDFN_","
61 S LRSP1=0
62 F S LRSP1=$O(^LR(LRDFN,84,I,2,LRSP1)) Q:'LRSP1 D
63 .S LRSP2=LRSP1
64 Q:'$D(^LR(LRDFN,84,I,2,LRSP2,0))
65 S LRS2=^(0),Y=+LRS2,LRS2A=$P(LRS2,"^",2),LRSGN=" typed by "
66 ;If supp rpt is released, display 'signed by' instead of 'typed by'
67 I $P(LRS2,"^",3) S Y=$P(LRS2,"^",4),LRS2A=$P(LRS2,"^",3),LRSGN=" signed by "
68 S LRS2A=$S($D(^VA(200,LRS2A,0)):$P(^(0),"^"),1:LRS2A)
69 D D^LRU
70 S LRR1=Y,LRR2=LRS2A
71 S ^(0)=^TMP("LRC",$J,GCNT,0)_LRR1_LRSGN_LRR2_")"
72 ;If RELEASED SUPP REPORT MODIFIED set to 1, display "NOT VERIFIED"
73 I $P(^LR(LRDFN,84,I,0),"^",3) D
74 .D LN
75 .S LRTEXT="NOT VERIFIED"
76 .S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(25,CCNT,"**-* "_LRTEXT_" *-**")
77 Q
78LN ;Increment the counter
79 S GCNT=GCNT+1,CCNT=1
80 Q
81LINE ;Fill in the global with bank lines
82 N X
83 D LN
84 S X="",$P(X," ",GIOM)="",^TMP("LRC",$J,GCNT,0)=X
85 Q
86F(NODE) ;;
87 D WRAP^LR7OSAP1("^LR("_LRDFN_","_NODE_")",79)
88 Q
89D ;
90 N LRB,M,X
91 S LRB=0
92 F S LRB=$O(^LR(LRDFN,"AY",I,1,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.4,+X,0),"^"))
93 S LRB=0
94 F S LRB=$O(^LR(LRDFN,"AY",I,3,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.3,+X,0),"^"))
95 S LRB=0
96 F S LRB=$O(^LR(LRDFN,"AY",I,4,LRB)) Q:'LRB S X=^(LRB,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.5,+X,0),"^"))
97 S M=0
98 F S M=$O(^LR(LRDFN,"AY",I,2,M)) Q:'M S X=^(M,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(5,CCNT,$P(^LAB(61.1,+X,0),"^")) D E
99 Q
100E ;
101 N E
102 S E=0
103 F S E=$O(^LR(LRDFN,"AY",I,2,M,1,E)) Q:'E S X=^(E,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(7,CCNT,$P(^LAB(61.2,+X,0),"^"))
104 Q
105HD ;
106 D LINE
107 D LN
108 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Organ/tissue:")_$$S^LR7OS(33,CCNT,"SNOMED CODING")
109 Q
110WT ;
111 N B,X,OUT
112 I '$D(^LR(LRDFN,"AW")) D
113 . D LINE,LN
114 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(20,CCNT,"No organ weights entered.")
115 . D LINE
116 I $D(^LR(LRDFN,"AW")) S X=^("AW") D
117 . S B(9)=$P(X,"^",9),B(1)=$P(X,"^",11,99)
118 . D LINE,LN
119 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Rt--Lung--Lt Liver Spleen RT--Kidney--Lt Brain Body Wt(lb) Ht(in)")
120 I $D(B) D
121 . D LN
122 . S OUT=$$S^LR7OS(XPOS,CCNT,$J($P(X,"^",3),4))_$$S^LR7OS(9,CCNT,$J($P(X,"^",4),4))_$$S^LR7OS(15,CCNT,$J($P(X,"^",5),5))_$$S^LR7OS(22,CCNT,$J($P(X,"^",6),5))_$$S^LR7OS(29,CCNT,$J($P(X,"^",7),4))_$$S^LR7OS(39,CCNT,$J($P(X,"^",8),4))
123 . S OUT=OUT_$$S^LR7OS(45,CCNT,$J($P(X,"^",10),4))_$$S^LR7OS(55,CCNT,$P(X,"^",2))_$$S^LR7OS(68,CCNT,$P(X,"^"))
124 . S ^TMP("LRC",$J,GCNT,0)=OUT
125 D LINE,LN
126 S ^TMP("LRC",$J,GCNT,0)=""
127 I $D(B) S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Heart(gm)")
128 I $D(^LR(LRDFN,"AV")) S X=^("AV"),B(2)=$P(X,"^",7,99),^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(12,CCNT,"TV(cm) PV(cm) MV(cm) AV(cm) RV(cm) LV(cm)")
129 D LN
130 S ^TMP("LRC",$J,GCNT,0)=""
131 I $D(B(9)) S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$J(B(9),5))
132 I $D(B(2)) D
133 . S OUT=$$S^LR7OS(12,CCNT,$J($P(X,"^"),4))_$$S^LR7OS(20,CCNT,$J($P(X,"^",2),4))_$$S^LR7OS(28,CCNT,$J($P(X,"^",3),4))_$$S^LR7OS(36,CCNT,$J($P(X,"^",4),4))_$$S^LR7OS(44,CCNT,$J($P(X,"^",5),4))_$$S^LR7OS(52,CCNT,$J($P(X,"^",6),4))
134 . S ^(0)=^TMP("LRC",$J,GCNT,0)_OUT
135 . D LINE,LN
136 . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,"Cavities(ml): Rt--Pleural--Lt Pericardial Peritoneal")
137 . D LN
138 . S OUT=$$S^LR7OS(14,CCNT,$J($P(B(2),"^",2),4))_$$S^LR7OS(25,CCNT,$J($P(B(2),"^"),4))_$$S^LR7OS(33,CCNT,$J($P(B(2),"^",3),4))_$$S^LR7OS(45,CCNT,$J($P(B(2),"^",4),4))
139 . S ^TMP("LRC",$J,GCNT,0)=OUT
140 I $D(B(1)) F B=1:1:8 D
141 . I $P(B(1),"^",B) D
142 .. S X="25."_B
143 .. D LN
144 .. S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$P(^DD(63,X,0),"^")_": "_$P(B(1),"^",B))
145 I $D(^LR(LRDFN,"AWI")) S Y=^("AWI") F B=1:1:5 I $P(Y,"^",B) D LN S X=$S(B=1:25.9,1:25.9_(B-1)),^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,$P(^DD(63,X,0),"^")_": "_$P(Y,"^",B))
146 Q
147ZZ ;;
148 D LN
149 N OUT,X,LRLLOC,DA,A,B,C,LR,Y
150 S OUT=$$S^LR7OS(XPOS,CCNT,"Acc #")_$$S^LR7OS(9,CCNT,"Date/time Died")_$$S^LR7OS(27,CCNT,"Age")_$$S^LR7OS(33,CCNT,"AUTOPSY DATA")_$$S^LR7OS(53,CCNT,"Date/time of Autopsy"),^TMP("LRC",$J,GCNT,0)=OUT
151 S X=^LR(LRDFN,"AU"),LRLLOC=$P(X,"^",8),DA=LRDFN
152 D D^LRAUAW
153 S Y=LR(63,12)
154 D D^LRU,LN
155 S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(XPOS,CCNT,($P(X,"^",6)_" "_Y))_$$S^LR7OS(26,CCNT,$J($P(X,"^",9),3))_$$S^LR7OS(33,CCNT,PNM)
156 S Y=+X
157 D D^LRU
158 I Y'[1700 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(53,CCNT,Y)
159 D LN
160 S ^TMP("LRC",$J,GCNT,0)=""
161 F X(1)=7,10 D
162 . S Y=$P(X,"^",X(1)),Y=$S(Y="":Y,$D(^VA(200,Y,0)):$P(^(0),"^"),1:Y)
163 . I Y]"" S ^TMP("LRC",$J,GCNT,0)=^TMP("LRC",$J,GCNT,0)_$S(X(1)=7:$$S^LR7OS(1,CCNT,"Resident: ")_Y,1:$$S^LR7OS(38,CCNT,"Senior: ")_Y)
164 Q
165LRAPT3 ;COPIED FROM ^LRAPT3
166 ;;
167 N A,C,X,T,F
168 S (F,A)=0
169 F S A=$O(^LR(LRDFN,"AY",A)) Q:'A D
170 .I $D(^LR(LRDFN,"AY",A,0)) S T=+^(0) D
171 ..S T(1)=$P($G(^LAB(61,T,0)),"^")
172 ..S C=0 F S C=$O(^LR(LRDFN,"AY",A,5,C)) Q:'C D
173 ...S X=^LR(LRDFN,"AY",A,5,C,0) D SP(X) S F=1
174 ;Removed code that prints ICD codes per LR*5.2*259
175 Q
176SP(NODE) ;
177 N Y,E,X,A1,B
178 S Y=$P(NODE,"^",2),E=$P(NODE,"^",3),X=$P(NODE,"^")_":",A1=$P($P(LRAU("S"),X,2),";",1)
179 D D^LRU
180 S T(2)=Y
181 I 'F D LINE,LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,T(1))
182 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,A1_" "_E_" Date: "_T(2))
183 D WRAP^LR7OSAP1("^LR("_LRDFN_",""AY"","_A_",5,"_C_",1)",80)
184 Q
185OUT ;Show output
186 Q:'$D(^TMP("LRC",$J))
187 N I
188 S I=0
189 F S I=$O(^TMP("LRC",$J,I)) Q:'I W !,^(I,0)
190 Q
Note: See TracBrowser for help on using the repository browser.