source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCE835.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.8 KB
Line 
1IBCE835 ;ALB/TMP - 835 EDI EXPLANATION OF BENEFITS MSG PROCESSING ;19-JAN-99
2 ;;2.0;INTEGRATED BILLING;**137,135,155,377**;21-MAR-94;Build 23
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 Q
6 ;
7 ; MESSAGE HEADER DATA STRING =
8 ; type of message^msg queue^msg #^bill #^^date/time
9 ;
10HDR(IBCLNO,IBD) ;Process header data
11 ; INPUT:
12 ; IBCLNO = claim #
13 ;
14 ; ^TMP("IBMSGH",$J,0) = header message text
15 ;
16 ; OUTPUT:
17 ; IBD array returned with processed data
18 ; "LINE" = The last line # populated in the message
19 ; "DATE" = Date/Time of EOB (Fileman format)
20 ; "MRA" = 1 if MRA, 0 if not
21 ; "X12" = 1 if X12, 0 if not
22 ;
23 ; ^TMP("IBMSG",$J,"CLAIM",claim #,0)=MESSAGE HEADER DATA STRING
24 ; ,"D",0,1)=header record raw data
25 ; ,"D1",1,0)=header record raw data
26 ; ,line #)=EOB message lines
27 ;
28 N CT,IB399,IBD0,IBBILL,LINE,L,X,Y,Z,%DT
29 S IBD0=$G(^TMP("IBMSGH",$J,0)),IBD("LINE")=0
30 Q:IBD0=""
31 S X=$P(IBD0,U,3),X=$E(X,5,8)_$E(X,1,4)_"@"_$P(IBD0,U,4)
32 I X S %DT="XTS" D ^%DT
33 S IBD("DATE")=$S(Y>0:Y,1:"")
34 S IBD("MRA")=$P(IBD0,U,5)
35 S IBD("X12")=($P(IBD0,U,2)="X")
36 S CT=0
37 ;
38 I $P(IBD0,U,6)'="" S CT=CT+1 S LINE(CT)=$G(LINE(CT))_"Payer Name: "_$P(IBD0,U,6)
39 ;
40 I CT D
41 . S (L,Z)=0
42 . F S Z=$O(LINE(Z)) Q:'Z S L=L+1,^TMP("IBMSG",$J,"CLAIM",IBCLNO,L)=LINE(Z)
43 . S IBD("LINE")=IBD("LINE")+CT
44 ;
45 S IB399=+$O(^DGCR(399,"B",$$GETCLM^IBCE277(IBCLNO),""),-1)
46 ;
47 S IBBILL=$$LAST364^IBCEF4(IB399)
48 ;
49 S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,0)="835EOB"_U_$G(IBD("MSG#"))_U_$G(IBD("SUBJ"))_U_IBBILL_U_U_IBD("DATE")
50 ;
51 S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,"D",0,1)="##RAW DATA: "_IBD0
52 S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,"D1",1,0)="##RAW DATA: "_IBD0
53 Q
54 ;
555(IBD) ; Process claim patient ID data
56 ; INPUT:
57 ; IBD must be passed by reference = entire message line
58 ;
59 ; OUTPUT:
60 ; IBD array
61 ; "LINE" = the last line # populated in the message
62 ;
63 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim pt id message lines
64 ; ,"D",5,msg seq #)=
65 ; ,"D1",msg seq #,5)=
66 ; claim pt id message raw data
67 ;
68 N IBBILL
69 S IBBILL=$$GETCLM^IBCE277($P(IBD,U,2))
70 ;
71 I '$D(^TMP("IBMSG",$J,"CLAIM",IBBILL)) D HDR(IBBILL,.IBD) ;Process header data if not already done for claim
72 ;
73 I $P(IBD,U,9) D ;Statement dates
74 . S IBD("LINE")=$G(IBD("LINE"))+1
75 . S ^TMP("IBMSG",$J,"CLAIM",IBBILL,IBD("LINE"))="Statement Dates: "_$$DATE^IBCE277($P(IBD,U,9))_" - "_$$DATE^IBCE277($P(IBD,U,10))
76 ;
77 S ^TMP("IBMSG",$J,"CLAIM",IBBILL,"D",5,1)="##RAW DATA: "_IBD
78 S ^TMP("IBMSG",$J,"CLAIM",IBBILL,"D1",1,5)="##RAW DATA: "_IBD
79 Q
80 ;
816(IBD) ; Process 06 record type for corrected name and/or ID# - IB*2*377 - 1/14/08
82 NEW IBCLM,Z
83 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
84 Q:IBCLM=""
85 I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
86 ;
87 S Z=$G(IBD("LINE"))
88 I $P(IBD,U,3)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient Last Name: "_$P(IBD,U,3)
89 I $P(IBD,U,4)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient First Name: "_$P(IBD,U,4)
90 I $P(IBD,U,5)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient Middle Name: "_$P(IBD,U,5)
91 I $P(IBD,U,6)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient ID#: "_$P(IBD,U,6)
92 S IBD("LINE")=Z
93 ;
94 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",6,1)="##RAW DATA: "_IBD
95 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,6)="##RAW DATA: "_IBD
96 Q
97 ;
9810(IBD) ; Process claim status data
99 ; INPUT:
100 ; IBD must be passed by reference = entire message line
101 ;
102 ; OUTPUT:
103 ; IBD array returned with processed data
104 ; "CLAIM" = The claim #
105 ; "LINE" = The last line # populated in the message
106 ;
107 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim status message lines
108 ; ,"D",10,msg seq #)=
109 ; ,"D1",msg seq #,10)=
110 ; claim status raw data
111 ;
112 N IBCLM,CT,LINE,L,Z,Z0,IBDATA,IBSTAT
113 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
114 Q:IBCLM=""
115 ;
116 I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
117 ;
118 S CT=0
119 F Z=3:1:6 I $P(IBD,U,Z)="Y" D Q ;Claim status
120 . S IBSTAT=(Z-2)
121 . S CT=CT+1,LINE(CT)="CLAIM STATUS: "_$P("PROCESSED^DENIED^PENDED^REVERSAL",U,IBSTAT)
122 I '$G(IBSTAT) D
123 . S CT=CT+1,LINE(CT)="CLAIM STATUS: "_$P(IBD,U,7)_" (OTHER)"
124 ;
125 I $P(IBD,U,8)'="" D ;Crossed over info
126 . S LINE(CT)=LINE(CT)_" Crossed over to: "_$P(IBD,U,9)_" "_$P(IBD,U,8)
127 ;
128 I CT D
129 . S L=$G(IBD("LINE")),Z=0
130 . F S Z=$O(LINE(Z)) Q:'Z S L=L+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,L)=LINE(Z)
131 . S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",10,1)="##RAW DATA: "_IBD
132 . S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,10)="##RAW DATA: "_IBD
133 . S IBD("LINE")=$G(IBD("LINE"))+CT
134 Q
135 ;
13615(IBD) ; Process claim status data
137 ; INPUT:
138 ; IBD must be passed by reference = entire message line
139 ;
140 ; OUTPUT:
141 ; IBD array
142 ; "LINE" = The last line # populated in the message
143 ;
144 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",15,msg seq #)=
145 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,15)=
146 ; claim status raw data
147 ;
148 N IBCLM,Z,Z0,IBDATA
149 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
150 Q:IBCLM=""
151 ;
152 I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
153 ;
154 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",15,1)="##RAW DATA: "_IBD
155 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,15)="##RAW DATA: "_IBD
156 Q
157 ;
15820(IBD) ; Process claim level adjustment data
159 ; Claim must have been referenced by a previous '05' level
160 ;
161 ; INPUT:
162 ; IBD must be passed by reference = entire message line
163 ;
164 ; OUTPUT:
165 ; IBD("LINE") = The last line # populated in the message
166 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line #)=claim level adjustment
167 ; ,"D",20,seq#)=
168 ; ,"D1",seq#,20)=
169 ; claim level adjust. raw data
170 ;
171 N IBCLM
172 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
173 Q:'$D(^TMP("IBMSG",$J,"CLAIM",IBCLM))
174 S IBD("LINE")=$G(IBD("LINE"))+1
175 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,IBD("LINE"))="ADJUSTMENT GROUP: "_$P(IBD,U,3)_" QTY: "_+$P(IBD,U,6)_", AMT: "_($P(IBD,U,5)/100)
176 S IBD("LINE")=IBD("LINE")+1
177 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,IBD("LINE"))=" REASON: ("_$P(IBD,U,4)_") "_$P(IBD,U,7)
178 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",20,IBD("LINE"))="##RAW DATA: "_IBD
179 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",IBD("LINE"),20)="##RAW DATA: "_IBD
180 Q
181 ;
18237(IBD) ; Process claim level adjustment data for Inpatient MEDICARE
183 D 37^IBCE835A(.IBD)
184 Q
185 ;
18640(IBD) ; Process service line data
187 D 40^IBCE835A(.IBD)
188 Q
189 ;
19045(IBD) ; Process service line adjustment data
191 D 45^IBCE835A(.IBD)
192 Q
193 ;
19417(IBD) ; Process claim contact data segment
195 D XX(.IBD,17)
196 Q
197 ;
19830(IBD) ; Process MEDICARE inpatient adjudication data (part 1)
199 D XX(.IBD,30)
200 Q
201 ;
20235(IBD) ; Process MEDICARE inpatient adjudication data (part 2)
203 D XX(.IBD,35)
204 Q
205 ;
20641(IBD) ; Process service line data (part 2)
207 D XX(.IBD,41)
208 Q
209 ;
21042(IBD) ; Process service line data (part 3)
211 D XX(.IBD,42)
212 Q
213 ;
21499(IBD) ; Process trailer record for non-MRA EOB
215 D XX(.IBD,99)
216 Q
217 ;
218XX(IBD,IBID) ; Store non-displayed data nodes in TMP array
219 ;
220 ; INPUT:
221 ; IBD must be passed by reference = entire message line
222 ; IBID = record id for generic store
223 ;
224 ; OUTPUT:
225 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",IBID,msg seq #)=
226 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,IBID)=
227 ; claim status raw data
228 ; IBD("LINE") = The last line # populated in the message
229 ;
230 N IBCLM
231 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
232 ;
233 S IBD("LINE")=$G(IBD("LINE"))+1
234 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",IBID,IBD("LINE"))="##RAW DATA: "_IBD
235 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",IBD("LINE"),IBID)="##RAW DATA: "_IBD
236 ;
237 Q
238 ;
Note: See TracBrowser for help on using the repository browser.