source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LRAPDA.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 8.8 KB
Line 
1LRAPDA ;AVAMC/REG/WTY/KLL - ANATOMIC PATH DATA ENTRY;11/02/01
2 ;;5.2;LAB SERVICE;**72,73,91,121,248,259,295,317**;Sep 27, 1994
3 ;
4 ;Reference to ^%DT supported by IA #10003
5 ;Reference to ^DIE supported by IA #10018
6 ;Reference to ^VA(200 supported by IA #10060
7 ;Reference to EN^DDIOL supported by IA #10142
8 ;
9 W !?20,LRO(68)," (",LRABV,")",!
10 S:'$D(LRSOP) LRSOP=1 S:'$D(LRD(1)) LRD(1)="0"
11 S:'$D(^LRO(69.2,LRAA,2,0)) ^(0)="^69.23A^0^0"
12SEL K LR(1)
13 I $D(LR(2)) D G:%<1 END S:%=1 LR(1)=1
14 .W !!,"Enter Etiology, Function, Procedure & Disease "
15 .S %=2 D YN^LRU
16AK ;from LRAPD1
17 N CORRECT
18 S:'$D(LRSFLG) LRSFLG=""
19 W !!,"Data entry for ",LRH(0)," "
20 S %=1 D YN^LRU G:%<1 END
21 I %=2 D G:Y<1 END S LRAD=$E(Y,1,3)_"0000",LRH(0)=$E(Y,1,3)+1700
22 .S %DT="AE",%DT(0)="-N",%DT("A")="Enter YEAR: " D ^%DT K %DT
23 I '$O(^LRO(68,LRAA,1,LRAD,1,0)) D Q
24 .W $C(7),!!,"NO ",LRO(68)," ACCESSIONS IN FILE FOR ",LRH(0),!!
25W K X,Y,LR("CK")
26 R !!,"Select Accession Number/Pt name: ",LRAN:DTIME
27 G:LRAN=""!(LRAN[U) END
28 I LRAN["?" D G W
29 .W !!,"Enter the year ",LRH(0)," ",LRO(68)," accession number to be "
30 .W "updated"
31 .W !,"or locate the accession by entering the patient name."
32 I LRAN'?1N.N D PNAME G:LRAN<1 W D OE1^LR7OB63D,REST,OERR^LR7OB63D G W
33 D OE1^LR7OB63D,REST S:$D(DR(1))#2 DR=DR(1) D OERR^LR7OB63D G W
34REST ;
35 N LRXSTOP,LRX,LRX1
36 W " for ",LRH(0)
37 I '$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0)) D Q
38 .W $C(7),!!,"Accession # ",LRAN," for ",LRH(0)," not in ",LRO(68),!!
39 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),LRLLOC=$P(X,"^",7),LRDFN=+X
40 Q:'$D(^LR(LRDFN,0)) S X=^(0) D ^LRUP
41 W !,LRP," ID: ",SSN
42 S LRI=+$P($G(^LRO(68,LRAA,1,LRAD,1,LRAN,3)),"^",5)
43 I LRSS'="AU",'$D(^LR(LRDFN,LRSS,LRI,0)) D Q
44 .W $C(7),!,"Inverse date missing or incorrect in Accession Area file "
45 .W "for",!,LRO(68)," Year: ",$E(LRAD,2,3)," Accession: ",LRAN
46 I "SPCYEM"[LRSS,$O(^LR(LRDFN,LRSS,LRI,.1,0)) D
47 .W !,"Specimen(s):"
48 .S X=0 F S X=$O(^LR(LRDFN,LRSS,LRI,.1,X)) Q:'X D
49 ..W !,$P($G(^LR(LRDFN,LRSS,LRI,.1,X,0)),"^")
50 ;
51 ;Don't allow supp. report to be added to a released report if
52 ; modifications are being added via MM option
53 S LRXSTOP=0,(LRX,LRX1)=""
54 I LRSS'="AU",LRD(1)="S" D
55 .S LRX=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",11) ;release date/time
56 .S LRX1=$P($G(^LR(LRDFN,LRSS,LRI,0)),"^",15) ;orig rel date/time
57 I LRSS="AU",LRSOP="R" D
58 .S LRX=$P($G(^LR(LRDFN,"AU")),"^",15) ;release date/time
59 .S LRX1=$P($G(^LR(LRDFN,"AU")),"^",3) ;date report completed
60 I 'LRX,LRX1 D
61 .W $C(7),!!,"This "_$G(LRAA(1))_" report is currently being"
62 .W !,"modified; it must first be released before Supplementary"
63 .W !,"report can be added.",!
64 .S LRXSTOP=1
65 Q:LRXSTOP
66 ;
67DIE ;Edit
68 I LRSS="AU" D AUE Q
69 N LRRDT1,LRRDT2,LRIENS,LREL,LRQUIT,LRSNO,LRCPT,LRESCPT
70 S (LREL,LRESCPT,LRQUIT,LRSNO,LRCPT)=0,LRIENS=LRI_","_LRDFN_","
71 S LRRDT1=$$GET1^DIQ(LRSF,LRIENS,.11,"I")
72 S LRRDT2=$$GET1^DIQ(LRSF,LRIENS,.15,"I")
73 S:LRRDT1!LRRDT2 LREL=1
74 I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES()
75 I LRSOP="G",LREL D Q
76 .W $C(7),!!,"Report verified. Cannot edit with this option."
77 I LRSOP'="","ABM"[LRSOP,LREL D Q:LRQUIT
78 .;Allow SNOMED and CPT coding even after release.
79 .W $C(7),!!,"Report has been verified. "
80 .I 'LRESCPT,LRSOP'="B" D Q
81 ..W "Cannot edit with this option."
82 ..S LRQUIT=1
83 .W "Only "
84 .I LRESCPT W "CPT " W:LRSOP="B" "and "
85 .W:LRSOP="B" "SNOMED "
86 .W "coding permitted.",!
87 .I LRSOP="B" D
88 ..K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO"
89 ..D ^DIR W !
90 ..S LRSNO=+Y
91 .Q:'LRESCPT
92 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO"
93 .D ^DIR W !
94 .S LRCPT=+Y
95 .I "AM"[LRSOP,'LRCPT S LRQUIT=1 Q
96 .I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1
97RESET ;Reset DR string if altered by prior accession/patient
98 ;Reset DR to orig value in LRAPD1
99 I LRSOP'="","AMBS"[LRSOP,$G(LRD)'="" D @LRD
100 I LRSFLG="S",$G(LRD)'="" D @LRD ;For CY,EM Supp entry
101 S:LRSNO DR=10 ;Modify DR string if only SNOMED coding permitted
102 I 'LRSNO,LRCPT S DR="" ;Set DR string to null in only CPT coding
103 ;If adding supp rpt to released rpt, remove date rpt completed from DR
104 I LRRDT1,LRSOP="S"!(LRSFLG="S") S DR=".09///^S X=LRWHO;10"
105EDIT ;Call to ^DIE
106 W ! S LRA=^LR(LRDFN,LRSS,LRI,0),LRRC=$P(LRA,"^",10)
107 I LRCAPA,"SPCYEM"[LRSS D C^LRAPSWK
108 S DIE="^LR(LRDFN,LRSS,",DA=LRI,DA(1)=LRDFN
109 D CK^LRU Q:$D(LR("CK"))
110 I LRSS="SP",LRSOP="B",$O(^LR(LRDFN,LRSS,LRI,1.3,0)) D
111 .W $C(7),!!,"This accession has a FROZEN SECTION report."
112 .W !,"Be sure 'FROZEN SECTION' is entered as a SNOMED code in the "
113 .W "PROCEDURE field"
114 .W !,"for the appropriate organ or tissue.",!!
115 D ^DIE
116 D UPDATE^LRPXRM(LRDFN,LRSS,LRI)
117 D:LRSFLG="S"&('$D(Y)) ^LRAPDSR
118 D FRE^LRU
119 I LRSOP'="","ABM"[LRSOP D CPTCOD
120WKLD ;Capture Workload
121 I LRSOP="Z","CYSP"[LRSS,LRCAPA D S^LRAPR Q
122 I LRCAPA,"SPCYEM"[LRSS,LRD(1)'="","MBA"[LRD(1) D C1^LRAPSWK
123 I LRCAPA,"SPCYEM"[LRSS,LRSOP="G" D C1^LRAPSWK
124QUEUES ;Update Queues
125 S X=$P(^LR(LRDFN,LRSS,LRI,0),"^",4)
126 I X,$D(^VA(200,X,0)) S LR("TR")=$P(^(0),"^")
127 I "CYEMSP"[LRSS,$D(LR(6)),LRSOP="G" Q:$D(^LRO(69.2,LRAA,1,LRAN,0)) D Q
128 .L +^LRO(69.2,LRAA,1):5 I '$T D Q
129 ..S MSG(1)="The preliminary reports queue is in use by another person."
130 ..S MSG(1,"F")="!!"
131 ..S MSG(2)=" You will need to add this accession to the queue later."
132 ..D EN^DDIOL(.MSG) K MSG
133 .S ^LRO(69.2,LRAA,1,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0)
134 .S X=^LRO(69.2,LRAA,1,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
135 .L -^LRO(69.2,LRAA,1)
136 I "CYEMSP"[LRSS,$D(LR(7)),'$D(^LRO(69.2,LRAA,2,LRAN,0)),LRD(1)'="S" D
137 .L +^LRO(69.2,LRAA,2):5 I '$T D Q
138 ..S MSG(1)="The final reports queue is in use by another person. "
139 ..S MSG(1,"F")="!!"
140 ..S MSG(2)="You will need to add this accession to the queue later."
141 ..D EN^DDIOL(.MSG) K MSG
142 .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN_"^"_LRI_"^"_LRH(0)
143 .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
144 .L -^LRO(69.2,LRAA,2)
145 D:LRSOP="M"!(LRSOP="B") EN^LRSPGD
146 Q
147NM ;
148 I X'["@"!(X["@"&(Y(Z)="")) D Q
149 .W $C(7),!?4,"ENTER WHOLE NUMBERS ONLY",! K X
150 I Y(Z)'="" W $C(7),?40,"OK TO DELETE" S %=2 D YN^LRU I %'=1 K X Q
151 S Y(Z)="" Q
152 ;
153AUE ;Autopsy Data Entry
154 W !
155 N LREL,LRQUIT,LRSNO,LRESCPT,LRCPT
156 S (LREL,LRQUIT,LRSNO,LRCPT)=0
157 S LREL=+$$GET1^DIQ(63,LRDFN_",",14.7,"I")
158 I $T(ES^LRCAPES)'="" S LRESCPT=$$ES^LRCAPES()
159 ; Allow supp report to be added on verified AU
160 I LRSOP'="","AFIP"[LRSOP,LREL D Q:LRQUIT
161 .Q:LRESCPT&("AP"[LRSOP)
162 .W $C(7),!!,"Report verified. Cannot edit with this option!"
163 .S LRQUIT=1
164 I LRSOP'="","ABP"[LRSOP,LREL D Q:LRQUIT
165 .W $C(7),!!,"Report has been verified. "
166 .W "Only "
167 .I LRESCPT W "CPT " W:LRSOP="B" "and "
168 .W:LRSOP="B" "SNOMED "
169 .W "coding permitted.",!
170 .I LRSOP="B" D
171 ..K DIR S DIR(0)="Y",DIR("A")="Enter SNOMED coding",DIR("B")="NO"
172 ..D ^DIR W !
173 ..S LRSNO=+Y
174 .Q:'LRESCPT
175 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO"
176 .D ^DIR W !
177 .S LRCPT=+Y
178 .I "AP"[LRSOP,'LRCPT S LRQUIT=1 Q
179 .I LRSOP="B",'LRCPT,'LRSNO S LRQUIT=1
180AURESET ;Reset DR to orig value in LRAUDA
181 I LRSOP'="","AP"[LRSOP D @(LRSOP_"DR^LRAUDA")
182 I LRSOP="B" D BDR^LRAUDA
183 S:LRSNO DR=32 ;Modify DR string if only SNOMED coding permitted
184 I 'LRSNO,LRCPT S DR="" ;Set DR string to null inf only CPT coding
185 ; ;
186 ;Not all of the autopsy fields are within the AU subscript.
187 ;Therefore, we must lock the entire LRDFN.
188 L +^LR(LRDFN):5 I '$T D Q
189 .S MSG="This record is locked by another user. "
190 .S MSG=MSG_"Please wait and try again."
191 .D EN^DDIOL(MSG,"","!!") K MSG
192 I LRSFLG'="S" D
193 .S DIE="^LR(",DA=LRDFN
194 .D ^DIE
195 D:LRSFLG="S" ^LRAPDSR
196 D UPDATE^LRPXRM(LRDFN,"AU")
197 L -^LR(LRDFN)
198 D:"BAP"[LRSOP AU
199 D:LRSOP="R" R
200 I LRSOP'="","ABP"[LRSOP D CPTCOD
201 Q
202AU I '$D(^LRO(69.2,LRAA,2,LRAN,0)) D
203 .L +^LRO(69.2,LRAA,2):5 I '$T D Q
204 ..S MSG(1)="The final reports queue is in use by another person. "
205 ..S MSG(1,"F")="!!"
206 ..S MSG(2)="You will need to add this accession to the queue later."
207 ..D EN^DDIOL(.MSG) K MSG
208 .S ^LRO(69.2,LRAA,2,LRAN,0)=LRDFN
209 .S X=^LRO(69.2,LRAA,2,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
210 .L -^LRO(69.2,LRAA,2)
211 D AU^LRSPGD
212 Q
213R I '$D(^LRO(69.2,LRAA,3,LRAN,0)) D
214 .L +^LRO(69.2,LRAA,3):5 I '$T D Q
215 ..S MSG(1)="The interim reports queue is in use by another person. "
216 ..S MSG(1,"F")="!!"
217 ..S MSG(2)="You will need to add this accession to the queue later."
218 ..D EN^DDIOL(.MSG) K MSG
219 .S ^LRO(69.2,LRAA,3,LRAN,0)=LRDFN
220 .S X=^LRO(69.2,LRAA,3,0),^(0)=$P(X,"^",1,2)_"^"_LRAN_"^"_($P(X,"^",4)+1)
221 .L -^LRO(69.2,LRAA,3)
222 Q
223PNAME ;Patient Name Lookup
224 N LRPFLG ;LRPFLG tells LRUPS to limit accessions to
225 S X=LRAN,LRPFLG=1 ;the chosen year.
226 K LRAN,DIC,VADM,VAIN,VA
227 S DFN=-1,DIC(0)="EQM",(LRX,LRDPF)=""
228 D:'$D(LRLABKY) LABKEY^LRPARAM
229 D DPA1^LRDPA
230 I DFN=-1 S LRAN=-1 Q
231 D I^LRUPS
232 Q
233CPTCOD ;CPT Coding
234 N LRPRO
235 Q:$T(CPT^LRCAPES)=""
236 Q:LREL&('LRCPT)
237 I 'LREL D
238 .K DIR S DIR(0)="Y",DIR("A")="Enter CPT coding",DIR("B")="NO"
239 .D ^DIR W !
240 .S LRCPT=+Y
241 Q:'LRCPT
242 ;SET PROVIDER TO CURRENT USER, ALLOW UPDATES
243 S LRPRO=DUZ
244 D PROVIDR^LRAPUTL
245 Q:LRQUIT
246 D CPT^LRCAPES(LRAA,LRAD,LRAN,LRPRO)
247 Q
248END K LRSFLG
249 D:$T(CLEAN^LRCAPES)'="" CLEAN^LRCAPES
250 D V^LRU
251 Q
Note: See TracBrowser for help on using the repository browser.