source: FOIAVistA/trunk/r/SURGERY-SR/SROADX1.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: 9.1 KB
Line 
1SROADX1 ;BIR/RJS - CONTINUED FROM SROADX ASSOCIATED DIAGNOSIS FOR CODER AND VERIFY SCREENS ;09/12/05 12:01pm
2 ;;3.0;Surgery;**119,150**;24 Jun 93
3OTHADX ;Display ASDX for OTHER PROCS
4 K SRTMP,SRASSD,SROICD
5 S SRPADX=0,SROCNTR=1
6 F SRI=1:1 S SRPADX=$O(^SRF(SRTN,13,OTH,"OADX",SRPADX)) Q:'SRPADX D
7 .S SRASSD=^SRF(SRTN,13,OTH,"OADX",SRPADX,0)
8 .D AASDX
9 .S SRTMP(SRI)=SROICD,SROCNTR=SROCNTR+1
10 S SROCNTR=0
11 D ADXDISP
12 I '$O(^SRF(SRTN,13,OTH,"OADX",0)) W !,?5,SRMSG,!
13 D PASSDIAG
14 D ASSDIAG
15 Q
16ASDX N SRI,SRFIRST,SRICD9,SRPRIN,SRPADX,SRASSD ;Display ASDX for PRIN Procs
17 K SRTMP
18 S SRI=0,SRFIRST=1
19 F S SRI=$O(^SRF(SRTN,"OPMOD",SRI)) Q:'SRI S SRM=$P(^SRF(SRTN,"OPMOD",SRI,0),U)
20 S SRPADX=0,SROCNTR=2
21 F SRI=1:1 S SRPADX=$O(^SRF(SRTN,"PADX",SRPADX)) Q:'SRPADX D
22 .S SRASSD=^SRF(SRTN,"PADX",SRPADX,0)
23 .D AASDX
24 .S SRTMP(SRI)=SROICD,SROCNTR=SROCNTR+1
25 D ADXDISP
26 I '$O(^SRF(SRTN,"PADX",0)) W !,?5,SRMSG
27 D PASSDIAG
28 D ASSDIAG
29 Q
30AASDX S SROICD=""
31 S:SRASSD SRICD9=$P($G(^SRF(SRTN,15,SRASSD,0)),U,3)
32 S:'SRASSD SRICD9=$P($G(^SRF(SRTN,34)),U,2)
33 S:SRICD9 SROICD=$$ICDSTR
34 I 'SRICD9 D
35 .S:SRASSD SROICD=$P($G(^SRF(SRTN,15,SRASSD,0)),U)
36 .S:'SRASSD SROICD=$P($G(^SRF(SRTN,34)),U,1)
37 Q
38PASSDIAG N ADCNT,SRICD9,SRFLG,SRCNTR,SRASSD ;List PRIN DX to assoc.
39 K SRADX,SRDIRX,SRADIAG
40 S SRICD9=$P($G(^SRF(SRTN,34)),U,2)
41 I SRICD9'="" S SRDIRX(1)=$$ICDSTR,SRADX(1)=$P(^ICD9(SRICD9,0),U,1),SRADIAG(1)=0
42 I SRICD9="" S SRDIRX(1)=$P($G(^SRF(SRTN,34)),U,1),SRADIAG(1)=0
43 Q
44ASSDIAG N SRDCNT,SRADCNT,SRQ ;DXs for assoc.
45 S (ADCNT,SRASSD)=0,SRCNT=2
46 F S ADCNT=$O(^SRF(SRTN,15,ADCNT)) Q:ADCNT="" D
47 .S SRICD9=$P(^SRF(SRTN,15,ADCNT,0),U,3)
48 .S:SRICD9'="" SRDIRX(SRCNT)=$$ICDSTR,SRADX(SRCNT)=$P(^ICD9(SRICD9,0),U,1)
49 .S:SRICD9="" SRDIRX(SRCNT)=$P(^SRF(SRTN,15,ADCNT,0),U,1)
50 .S SRADIAG(SRCNT)=ADCNT,SRCNT=SRCNT+1
51 S SRDX2="LO^:0"
52 I (ADCNT<$$SRDIAGS) D
53 .S:(SRCNT>2) SRDIRX(SRCNT)="ALL"
54 .S:$D(SRDIRX) SRDX2="LO^:"_SRCNT
55 .S:$$SRDIAGS=1 SRDX2="LO^:"_(SRCNT-1)
56 Q
57SRDIAGS() N SRDIAGS,SRDGCNT
58 S (SRDIAGS,SRDGCNT)=0
59 S:($P($G(^SRF(SRTN,34)),U)'="")!($P($G(^SRF(SRTN,34)),U,2)) SRDIAGS=1
60 F I=1:1 S SRDGCNT=$O(^SRF(SRTN,15,SRDGCNT)) Q:SRDGCNT="" S SRDIAGS=SRDIAGS+1
61 Q SRDIAGS
62ICDSTR() N SRICDSTR
63 S SRICDSTR=$P($$ICDDX^ICDCODE(SRICD9,SRSDATE),U,2)_"-"_$P($$ICDDX^ICDCODE(SRICD9,SRSDATE),U,4)
64 Q SRICDSTR
65PASSDS() N SRPADX,SRASSDS,SRPX
66 S SRASSDS="",SRPADX=0
67 F SRI=1:1 S SRPADX=$O(^SRF(SRTN,"PADX",SRPADX)) Q:'SRPADX D
68 .S SRPX=^SRF(SRTN,"PADX",SRPADX,0)
69 .S SRPX=SRPX+1
70 .S SRASSDS=$S($L(SRASSDS)<1:SRPX,1:SRASSDS_","_SRPX)
71 Q SRASSDS
72OASSDS() N SRPADX,SRASSDS,SRPX
73 S SRASSDS="",SRPADX=0
74 F SRI=1:1 S SRPADX=$O(^SRF(SRTN,13,D0,"OADX",SRPADX)) Q:'SRPADX D
75 .S SRPX=^SRF(SRTN,13,D0,"OADX",SRPADX,0)
76 .S SRPX=SRPX+1
77 .S SRASSDS=$S($L(SRASSDS)<1:SRPX,1:SRASSDS_","_SRPX)
78 Q SRASSDS
79SRODIR N SRFLG,SRCNT,SRCNTR
80 S DIR("A",1)=""
81 S (SRFLG,SRCNT)=1,SRCNTR=2,ADCNT=""
82 F S ADCNT=$O(SRDIRX(ADCNT)) Q:'ADCNT D
83 .S:'$D(DIR("A",SRCNTR)) DIR("A",SRCNTR)=""
84 .S DIR("A",SRCNTR)=DIR("A",SRCNTR)_SRCNT_". "_SRDIRX(ADCNT),SRCNT=SRCNT+1,SRCNTR=SRCNTR+1,SRFLG=1
85 S DIR("A",SRCNTR+2)=SRODIR("A",1),DIR("A")=SRODIR("A"),DIR("A",SRCNTR+1)=""
86 Q
87COTHBLD N SRCNT,OTH,X,CPT,CPT1,SRDA K SRSEL
88 S OTH=0,SRCNT=1
89 F S OTH=$O(^SRF(SRTN,13,OTH)) Q:'OTH D
90 .S OTHER=$P(^SRF(SRTN,13,OTH,0),U)
91 .S X=$P($G(^SRF(SRTN,13,OTH,2)),U),CPT="NOT ENTERED",CPT1=""
92 .I X S CPT1=X,Y=$$CPT^ICPTCOD(X),SRCPT=$P(Y,U,2),SRSHT=$P(Y,U,3),Y=SRCPT,SRDA=OTH D SSOTH^SROCPT S SRCPT=Y,CPT=SRCPT_" "_SRSHT
93 .S SRSEL(SRCNT)=OTH_U_OTHER_"^CPT Code: "_CPT_U_CPT1
94 .S SRCNT=SRCNT+1
95 Q
96OTHADXD N SRCOMMA,SROADX,SRICD9,SROADX1,SROODX,SRASSD,SRSUB ;OTHER PROCS ADXs
97 I '$O(^SRF(SRTN,13,OTH,"OADX",0)) W !,?5,SRMSG Q
98 S SRSUB=1
99 D OTHADX
100 Q
101PADXD N SRCOMMA,SRPADX,SRICD9,SRPDX,SRPDX1,SROPRIN,SRSUB
102 S SRPADX=0,SROCNTR=2,SRSUB=1
103 D ADXCHK^SROADX2
104 I '$O(^SRF(SRTN,"PADX",0)),(($P($G(^SRF(SRTN,34)),U)'="")!($P($G(^SRF(SRTN,34)),U,2))),(($P($G(^SRF(SRTN,"OP")),U)'="")!($P($G(^SRF(SRTN,"OP")),U,2))) D
105 .S SRASSD=0,SRFDA="130.275",SRIENU="+1"_","_SRTN_",",SRIENF=0_","_SRTN_"," D UPDATE,FILE
106 D ASDX
107 Q
108ADXDISP N SROCNTR ;ADXS for PROC
109 W !,?5,"Assoc. DX: "
110 S (SROCNTR,SRDXCNT)=0
111 F I=1:1 S SROCNTR=$O(SRTMP(SROCNTR)) Q:'SROCNTR D
112 .I $D(SRSUB) D
113 ..W:'(I#2) ?48
114 ..W:I#2 ?16
115 ..W I,". ",$E(SRTMP(SROCNTR),1,25)
116 ..I '(I#2),($O(SRTMP(SROCNTR))) W !
117 .W:'$D(SRSUB) !,?8,I,". ",SRTMP(SROCNTR)
118 S SRDXCNT=I
119 S SRDX1="LO^:"_SRDXCNT
120 S:SRDXCNT>0 SRDX1="LO^:"_SRDXCNT
121 Q
122OTHCPTD N SRM,SRI,SRFIRST ;PROCS/Codes/Mods.
123 S SRFIRST=0
124 W !,?3,"Other Procedures:",!!,OTHCNT,"."
125 D COTHBLD
126 W ?3,$P(SRSEL(SRDA),U,2),!,?2,"Other ",$P(SRSEL(SRDA),U,3)
127 S OTH=$P(SRSEL(SRDA),U) K SRDES S CPT1=$P(SRSEL(SRDA),U,4),X=$$CPTD^ICPTCOD(CPT1,"SRDES") I $O(SRDES(0)) F I=1:1:X W !,?4,SRDES(I)
128 W !,?3,"Modifiers: "
129 S SRI=0
130 F S SRI=$O(^SRF(SRTN,13,OTH,"MOD",SRI)) Q:'SRI D
131 .S SRM=$P(^SRF(SRTN,13,OTH,"MOD",SRI,0),U)
132 .W:SRFIRST !,?14
133 .W $P($$MOD^ICPTMOD(SRM,"I"),"^",2),"-",$P($$MOD^ICPTMOD(SRM,"I"),"^",3)
134 .S SRFIRST=1
135 Q
136CPTDISP S X=$P(^SRF(SRTN,"OP"),U,2) I X D W !
137 .S SRY=$$CPT^ICPTCOD(X),Y=$P(SRY,U,2),(SROCPT2,Z)=$P(SRY,U,3)
138 S:'$D(Y) Y="NOT ENTERED",Z=""
139 W " CPT Code: "_Y_" ",Z,!," Description:" D ^SROCPT W ! F I=1:1:80 W "-"
140 W !,?3,"Principal CPT Code: "_Y_" ",!,?3,"Description:",Z,!,?3,"Modifiers: "
141 S SRMOD=0
142 F S SRMOD=$O(^SRF(SRTN,"OPMOD",SRMOD)) Q:'SRMOD D
143 .S SRMO=$P(^SRF(SRTN,"OPMOD",SRMOD,0),U)
144 .W:$G(SRFIRST) !,?14
145 .W $P($$MOD^ICPTMOD(SRMO,"I"),"^",2),"-",$P($$MOD^ICPTMOD(SRMO,"I"),"^",3)
146 .S SRFIRST=1
147 Q
148PADDALL Q:$E($G(IOST))'="C"!($G(DIK)'="")
149 D KPADX^SROADX2(DA)
150 N DIE,DR,DA,PADX,SRY,SRY1,SRICD9,SRCNTRN,SRIENU,SRIENF,SRASSD
151 S SRY(0)=Y(0),SRFDA="130.275",SRIENU="+1"_","_SRTN_","
152 S SRICD9=$P($G(^SRF(SRTN,34)),U,2),SRCNTR=1,SRIENF=SRCNTR_","_SRTN_",",SRASSD=0
153 K SRY1 D UPDATE,FILE
154 S PADX=0
155 F S PADX=$O(^SRF(SRTN,15,PADX)) Q:'PADX S SRASSD=PADX,SRICD9=$P(^SRF(SRTN,15,SRASSD,0),U,3),SRCNTR=SRCNTR+1,SRIENF=SRCNTR_","_SRTN_"," K SRY1 D UPDATE,FILE
156 S Y(0)=SRY(0)
157 Q
158PADD1 ;PRIN ADX
159 N SRY,SRY0,SRY1,SRY2,SRC,REC,DIE,DA,DR,SRASSD
160 S SRY(0)=Y(0)
161 D KPADX^SROADX2(SRTN)
162 S SRCNTR=0,SRASSD=SRADIAG($P(SRY(0),",",1)),SRFDA="130.275",SRIENU="+1"_","_SRTN_",",SRIENF=SRCNTR_","_SRTN_"," D UPDATE,FILE
163 S SRY(0)=$E(SRY(0),2,$L(SRY(0)))
164 F SRY2=1:1:$P(SRDX2,":",2) D
165 .S SRY0=$P(SRY(0),",",SRY2)
166 .Q:SRY0<1
167 .S SRCNTR=$P(^SRF(SRTN,"PADX",0),U,3)+1,SRASSD=SRADIAG(SRY0),SRFDA="130.275",SRIENU="+1"_","_SRTN_",",SRIENF=SRCNTR_","_SRTN_"," D UPDATE,FILE
168 S Y(0)=SRY(0)
169 Q
170UPDATE ;
171 S SRY1(SRFDA,SRIENU,".01")=SRASSD
172 D UPDATE^DIE("","SRY1")
173 Q
174FILE ;
175 S SRY1(SRFDA,SRIENF,".01")=SRASSD
176 D FILE^DIE("","SRY1")
177 K SRY1
178 Q
179PDELALL W !,"Are you sure you want to DELETE ALL Associated Diagnoses ? (Y/N) "
180 S SRY(0)=Y(0)
181 S %=2 D YN^DICN
182 I %=1 Q:$E($G(IOST))'="C"!($G(DIK)'="") D KPADX^SROADX2(DA)
183 S Y(0)=SRY(0)
184 Q
185PDEL1 N SRC,SRY,SRY1,SRY2,REC,SRICD9,SRASSD ;DEL 1 PRIN ADX
186 S (SRY,SRY0)=0
187 F S SRY=$O(^SRF(SRTN,"PADX",SRY)) Q:'SRY S SRY0=SRY0+1,REC(SRY0)=SRY
188 S SRY(0)=Y(0),SRFDA="130.275"
189 F SRY2=1:1:SRDXCNT D
190 .S SRY0=$P(SRY(0),",",SRY2)
191 .Q:'SRY0
192 .Q:'$D(REC(SRY0))
193 .I SRY0=1,$P(^SRF(SRTN,"PADX",0),U,4)>1 K SRC S SRC(1)="PLEASE DELETE ALL DIAGNOSIS BEFORE THE PRINCIPAL",SRC(1,"F")="!!?5" D SRCWRT K SRC Q
194 .S SRIENF=REC(SRY0)_","_SRTN_",",SRASSD="@"
195 .W !,"Are you sure you want to DELETE ",SRTMP(SRY0)," ? (Y/N) "
196 .S %=2 D YN^DICN
197 .I %=1 D FILE
198 S Y(0)=SRY(0)
199 Q
200ODEL1 N SRY,SRY0,SRY1,SRY2,SRASSD ;DEL 1 OTH ADX
201 S (SRY,SRY0)=0
202 F S SRY=$O(^SRF(SRTN,13,OTH,"OADX",SRY)) Q:'SRY S SRY0=SRY0+1,REC(SRY0)=SRY
203 S SRY(0)=Y(0),SRFDA="130.165"
204 F SRY2=1:1:SRDXCNT D
205 .S SRY0=$P(SRY(0),",",SRY2)
206 .Q:'SRY0
207 .S SRIENF=REC(SRY0)_","_OTH_","_SRTN_",",SRASSD="@"
208 .W !,"Are you sure you want to DELETE ",SRTMP(SRY0)," ? (Y/N) "
209 .Q:SRTMP(SRY0)=""
210 .S %=2 D YN^DICN
211 .I %=1 D FILE
212 S Y(0)=SRY(0)
213 Q
214OADDALL Q:$E($G(IOST))'="C"!($G(DIK)'="") D KOADX^SROADX2(SRTN,OTH) ;Associate all Diagnosis to OTHER Procedure
215 N SRICD9,PADX,SRFDA,SRIENU,SRIENF,SRY,SRY1
216 S SRY(0)=Y(0),SRFDA="130.165",SRIENU="+1"_","_OTH_","_SRTN_","
217 S PADX=0
218 F S PADX=$O(SRADIAG(PADX)) Q:'PADX S SRASSD=SRADIAG(PADX),SRIENF=PADX_","_OTH_","_SRTN_"," K SRY1 D UPDATE,FILE
219 S Y(0)=SRY(0)
220 Q
221OADD1 N SRY,SRY0,SRY1,SRY2,SRCNTR,SRASSD ;Associate 1 Diagnosis to OTHER Procedure
222 S SRY(0)=Y(0),SRCNTR=0
223 S:$D(^SRF(SRTN,13,OTH,"OADX")) SRCNTR=$P(^SRF(SRTN,13,OTH,"OADX",0),U,3)+1
224 D KOADX^SROADX2(SRTN,OTH)
225 S:'$D(^SRF(SRTN,13,OTH,"OADX")) SRCNTR=1
226 S SRFDA="130.165",SRIENU="+1"_","_OTH_","_SRTN_","
227 I SRDIRX(+Y)="ALL" D
228 .S SRY0=0
229 .F S SRY0=$O(SRADIAG(SRY0)) Q:'SRY0 D
230 ..I '$D(^SRF(SRTN,13,OTH,"OADX","B",SRADIAG(SRY0))) D
231 ..S SRASSD=SRADIAG(SRY0),SRIENF=SRCNTR_","_OTH_","_SRTN_"," K SRY1 D UPDATE,FILE
232 ..S SRCNTR=SRCNTR+1
233 I SRDIRX(+Y)'="ALL" D
234 .F SRY2=1:1:$P(SRDX2,":",2) D
235 ..S SRY0=$P(SRY(0),",",SRY2)
236 ..Q:'SRY0
237 ..S SRASSD=SRADIAG(SRY0),SRIENF=SRCNTR_","_OTH_","_SRTN_"," K SRY1 D UPDATE,FILE
238 ..S SRCNTR=SRCNTR+1
239 S Y(0)=SRY(0)
240 Q
241SRCMSG S SRDX=X
242 S SRC(1)="The Diagnosis/Procedure Code Association may no longer be correct,",SRC(1,"F")="!!?5"
243 S SRC(2)="please confirm or update the values in the Diagnosis Association Field",SRC(2,"F")="!?5"
244 Q
245SRCWRT D EN^DDIOL(.SRC)
246 D CONT
247 Q:$G(DTOUT)
248 S:$D(SRDX) X=SRDX
249 S SRFLG=1
250 Q
251CONT N DIR
252 S DIR(0)="FO^"
253 S DIR("A")="Press RETURN to continue "
254 D ^DIR
255 Q
256ADXKILL K ADCNT,SRCOMMA,SRDXCNT,SROCNTR,SROCPT2,SROFLG,SRTMP,SRICD9,SRDIAGS
257 K SRASDX,SRMSG,SRADX,SRPADX,SRODIR,REC,SRDIRX,SROANS
258 Q
Note: See TracBrowser for help on using the repository browser.