source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCE835.m@ 1154

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

revised back to 6/30/08 version

File size: 7.5 KB
RevLine 
[623]1IBCE835 ;ALB/TMP - 835 EDI EXPLANATION OF BENEFITS MSG PROCESSING ;19-JAN-99
2 ;;2.0;INTEGRATED BILLING;**137,135,155**;21-MAR-94
3 Q
4 ;
5 ; MESSAGE HEADER DATA STRING =
6 ; type of message^msg queue^msg #^bill #^^date/time
7 ;
8HDR(IBCLNO,IBD) ;Process header data
9 ; INPUT:
10 ; IBCLNO = claim #
11 ;
12 ; ^TMP("IBMSGH",$J,0) = header message text
13 ;
14 ; OUTPUT:
15 ; IBD array returned with processed data
16 ; "LINE" = The last line # populated in the message
17 ; "DATE" = Date/Time of EOB (Fileman format)
18 ; "MRA" = 1 if MRA, 0 if not
19 ; "X12" = 1 if X12, 0 if not
20 ;
21 ; ^TMP("IBMSG",$J,"CLAIM",claim #,0)=MESSAGE HEADER DATA STRING
22 ; ,"D",0,1)=header record raw data
23 ; ,"D1",1,0)=header record raw data
24 ; ,line #)=EOB message lines
25 ;
26 N CT,IB399,IBD0,IBBILL,LINE,L,X,Y,Z,%DT
27 S IBD0=$G(^TMP("IBMSGH",$J,0)),IBD("LINE")=0
28 Q:IBD0=""
29 S X=$P(IBD0,U,3),X=$E(X,5,8)_$E(X,1,4)_"@"_$P(IBD0,U,4)
30 I X S %DT="XTS" D ^%DT
31 S IBD("DATE")=$S(Y>0:Y,1:"")
32 S IBD("MRA")=$P(IBD0,U,5)
33 S IBD("X12")=($P(IBD0,U,2)="X")
34 S CT=0
35 ;
36 I $P(IBD0,U,6)'="" S CT=CT+1 S LINE(CT)=$G(LINE(CT))_"Payer Name: "_$P(IBD0,U,6)
37 ;
38 I CT D
39 . S (L,Z)=0
40 . F S Z=$O(LINE(Z)) Q:'Z S L=L+1,^TMP("IBMSG",$J,"CLAIM",IBCLNO,L)=LINE(Z)
41 . S IBD("LINE")=IBD("LINE")+CT
42 ;
43 S IB399=+$O(^DGCR(399,"B",$$GETCLM^IBCE277(IBCLNO),""),-1)
44 ;
45 S IBBILL=$$LAST364^IBCEF4(IB399)
46 ;
47 S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,0)="835EOB"_U_$G(IBD("MSG#"))_U_$G(IBD("SUBJ"))_U_IBBILL_U_U_IBD("DATE")
48 ;
49 S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,"D",0,1)="##RAW DATA: "_IBD0
50 S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,"D1",1,0)="##RAW DATA: "_IBD0
51 Q
52 ;
535(IBD) ; Process claim patient ID data
54 ; INPUT:
55 ; IBD must be passed by reference = entire message line
56 ;
57 ; OUTPUT:
58 ; IBD array
59 ; "LINE" = the last line # populated in the message
60 ;
61 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim pt id message lines
62 ; ,"D",5,msg seq #)=
63 ; ,"D1",msg seq #,5)=
64 ; claim pt id message raw data
65 ;
66 N IBBILL
67 S IBBILL=$$GETCLM^IBCE277($P(IBD,U,2))
68 ;
69 I '$D(^TMP("IBMSG",$J,"CLAIM",IBBILL)) D HDR(IBBILL,.IBD) ;Process header data if not already done for claim
70 ;
71 I $P(IBD,U,7)="Y"!($P(IBD,U,8)="Y") D ;New patient name or id reported
72 . ;
73 . ; Alert to EDI mail group that name or ID has changed
74 . N XQA,XQAMSG
75 . S XQA("G.IB EDI")=""
76 . S XQAMSG="EOB for bill # "_IBBILL_" indicates a new name or id exists for patient"
77 . D SETUP^XQALERT
78 . ;
79 . S IBD("LINE")=$G(IBD("LINE"))+1
80 . I $P(IBD,U,7)="Y" S ^TMP("IBMSG",$J,"CLAIM",IBBILL,IBD("LINE"))="New patient name: "_$P(IBD,U,3)_","_$P(IBD,U,4)_" "_$P(IBD,U,5)_" "
81 . I $P(IBD,U,8)="Y" S ^TMP("IBMSG",$J,"CLAIM",IBBILL,IBD("LINE"))=$G(^TMP("IBMSG",$J,"CLAIM",IBBILL,IBD("LINE")))_"New patient id: "_$P(IBD,U,6)
82 ;
83 I $P(IBD,U,9) D ;Statement dates
84 . S IBD("LINE")=$G(IBD("LINE"))+1
85 . S ^TMP("IBMSG",$J,"CLAIM",IBBILL,IBD("LINE"))="Statement Dates: "_$$DATE^IBCE277($P(IBD,U,9))_" - "_$$DATE^IBCE277($P(IBD,U,10))
86 ;
87 S ^TMP("IBMSG",$J,"CLAIM",IBBILL,"D",5,1)="##RAW DATA: "_IBD
88 S ^TMP("IBMSG",$J,"CLAIM",IBBILL,"D1",1,5)="##RAW DATA: "_IBD
89 Q
90 ;
9110(IBD) ; Process claim status data
92 ; INPUT:
93 ; IBD must be passed by reference = entire message line
94 ;
95 ; OUTPUT:
96 ; IBD array returned with processed data
97 ; "CLAIM" = The claim #
98 ; "LINE" = The last line # populated in the message
99 ;
100 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim status message lines
101 ; ,"D",10,msg seq #)=
102 ; ,"D1",msg seq #,10)=
103 ; claim status raw data
104 ;
105 N IBCLM,CT,LINE,L,Z,Z0,IBDATA,IBSTAT
106 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
107 Q:IBCLM=""
108 ;
109 I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
110 ;
111 S CT=0
112 F Z=3:1:6 I $P(IBD,U,Z)="Y" D Q ;Claim status
113 . S IBSTAT=(Z-2)
114 . S CT=CT+1,LINE(CT)="CLAIM STATUS: "_$P("PROCESSED^DENIED^PENDED^REVERSAL",U,IBSTAT)
115 I '$G(IBSTAT) D
116 . S CT=CT+1,LINE(CT)="CLAIM STATUS: "_$P(IBD,U,7)_" (OTHER)"
117 ;
118 I $P(IBD,U,8)'="" D ;Crossed over info
119 . S LINE(CT)=LINE(CT)_" Crossed over to: "_$P(IBD,U,9)_" "_$P(IBD,U,8)
120 ;
121 I CT D
122 . S L=$G(IBD("LINE")),Z=0
123 . F S Z=$O(LINE(Z)) Q:'Z S L=L+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,L)=LINE(Z)
124 . S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",10,1)="##RAW DATA: "_IBD
125 . S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,10)="##RAW DATA: "_IBD
126 . S IBD("LINE")=$G(IBD("LINE"))+CT
127 Q
128 ;
12915(IBD) ; Process claim status data
130 ; INPUT:
131 ; IBD must be passed by reference = entire message line
132 ;
133 ; OUTPUT:
134 ; IBD array
135 ; "LINE" = The last line # populated in the message
136 ;
137 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",15,msg seq #)=
138 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,15)=
139 ; claim status raw data
140 ;
141 N IBCLM,Z,Z0,IBDATA
142 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
143 Q:IBCLM=""
144 ;
145 I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
146 ;
147 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",15,1)="##RAW DATA: "_IBD
148 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,15)="##RAW DATA: "_IBD
149 Q
150 ;
15120(IBD) ; Process claim level adjustment data
152 ; Claim must have been referenced by a previous '05' level
153 ;
154 ; INPUT:
155 ; IBD must be passed by reference = entire message line
156 ;
157 ; OUTPUT:
158 ; IBD("LINE") = The last line # populated in the message
159 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line #)=claim level adjustment
160 ; ,"D",20,seq#)=
161 ; ,"D1",seq#,20)=
162 ; claim level adjust. raw data
163 ;
164 N IBCLM
165 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
166 Q:'$D(^TMP("IBMSG",$J,"CLAIM",IBCLM))
167 S IBD("LINE")=$G(IBD("LINE"))+1
168 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)
169 S IBD("LINE")=IBD("LINE")+1
170 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,IBD("LINE"))=" REASON: ("_$P(IBD,U,4)_") "_$P(IBD,U,7)
171 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",20,IBD("LINE"))="##RAW DATA: "_IBD
172 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",IBD("LINE"),20)="##RAW DATA: "_IBD
173 Q
174 ;
17537(IBD) ; Process claim level adjustment data for Inpatient MEDICARE
176 D 37^IBCE835A(.IBD)
177 Q
178 ;
17940(IBD) ; Process service line data
180 D 40^IBCE835A(.IBD)
181 Q
182 ;
18345(IBD) ; Process service line adjustment data
184 D 45^IBCE835A(.IBD)
185 Q
186 ;
18717(IBD) ; Process claim contact data segment
188 D XX(.IBD,17)
189 Q
190 ;
19130(IBD) ; Process MEDICARE inpatient adjudication data (part 1)
192 D XX(.IBD,30)
193 Q
194 ;
19535(IBD) ; Process MEDICARE inpatient adjudication data (part 2)
196 D XX(.IBD,35)
197 Q
198 ;
19941(IBD) ; Process service line data (part 2)
200 D XX(.IBD,41)
201 Q
202 ;
20342(IBD) ; Process service line data (part 3)
204 D XX(.IBD,42)
205 Q
206 ;
20799(IBD) ; Process trailer record for non-MRA EOB
208 D XX(.IBD,99)
209 Q
210 ;
211XX(IBD,IBID) ; Store non-displayed data nodes in TMP array
212 ;
213 ; INPUT:
214 ; IBD must be passed by reference = entire message line
215 ; IBID = record id for generic store
216 ;
217 ; OUTPUT:
218 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",IBID,msg seq #)=
219 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,IBID)=
220 ; claim status raw data
221 ; IBD("LINE") = The last line # populated in the message
222 ;
223 N IBCLM
224 S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
225 ;
226 S IBD("LINE")=$G(IBD("LINE"))+1
227 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",IBID,IBD("LINE"))="##RAW DATA: "_IBD
228 S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",IBD("LINE"),IBID)="##RAW DATA: "_IBD
229 ;
230 Q
231 ;
Note: See TracBrowser for help on using the repository browser.