IBCE835 ;ALB/TMP/PJH - 835 EDI EXPLANATION OF BENEFITS MSG PROCESSING ; 7/15/10 4:40pm
;;2.0;INTEGRATED BILLING;**137,135,155,377,431,718**;21-MAR-94;Build 73
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
;
; MESSAGE HEADER DATA STRING =
; type of message^msg queue^msg #^bill #^^date/time
;
HDR(IBCLNO,IBD) ;Process header data
; INPUT:
; IBCLNO = claim #
;
; ^TMP("IBMSGH",$J,0) = header message text
;
; OUTPUT:
; IBD array returned with processed data
; "LINE" = The last line # populated in the message
; "DATE" = Date/Time of EOB (Fileman format)
; "MRA" = 1 if MRA, 0 if not
; "X12" = 1 if X12, 0 if not
;
; ^TMP("IBMSG",$J,"CLAIM",claim #,0)=MESSAGE HEADER DATA STRING
; ,"D",0,1)=header record raw data
; ,"D1",1,0)=header record raw data
; ,line #)=EOB message lines
;
N CT,IB399,IBD0,IBBILL,LINE,L,X,Y,Z,%DT
S IBD0=$G(^TMP("IBMSGH",$J,0)),IBD("LINE")=0
Q:IBD0=""
S X=$P(IBD0,U,3),X=$E(X,5,8)_$E(X,1,4)_"@"_$P(IBD0,U,4)
I X S %DT="XTS" D ^%DT
S IBD("DATE")=$S(Y>0:Y,1:"")
S IBD("MRA")=$P(IBD0,U,5)
S IBD("X12")=($P(IBD0,U,2)="X")
S CT=0
;
I $P(IBD0,U,6)'="" S CT=CT+1 S LINE(CT)=$G(LINE(CT))_"Payer Name: "_$P(IBD0,U,6)
;
I CT D
. S (L,Z)=0
. F S Z=$O(LINE(Z)) Q:'Z S L=L+1,^TMP("IBMSG",$J,"CLAIM",IBCLNO,L)=LINE(Z)
. S IBD("LINE")=IBD("LINE")+CT
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file - changed IBCLNO to $P(IBCLNO,"#")
S IB399=+$O(^DGCR(399,"B",$$GETCLM^IBCE277($P(IBCLNO,"#")),""),-1)
;
S IBBILL=$$LAST364^IBCEF4(IB399)
;
S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,0)="835EOB"_U_$G(IBD("MSG#"))_U_$G(IBD("SUBJ"))_U_IBBILL_U_U_IBD("DATE")
;
S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,"D",0,1)="##RAW DATA: "_IBD0
S ^TMP("IBMSG",$J,"CLAIM",IBCLNO,"D1",1,0)="##RAW DATA: "_IBD0
Q
;
5(IBD) ; Process claim patient ID data
; INPUT:
; IBD must be passed by reference = entire message line
;
; OUTPUT:
; IBD array
; "LINE" = the last line # populated in the message
;
; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim pt id message lines
; ,"D",5,msg seq #)=
; ,"D1",msg seq #,5)=
; claim pt id message raw data
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
N IBBILL,IBHCT
S IBBILL=$$GETCLM^IBCE277($P(IBD,U,2))
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
S IBHCT=$$CHCT(IBBILL),IBBILL=IBBILL_"#"_IBHCT
;
I '$D(^TMP("IBMSG",$J,"CLAIM",IBBILL)) D HDR(IBBILL,.IBD) ;Process header data if not already done for claim
;
I $P(IBD,U,9) D ;Statement dates
. S IBD("LINE")=$G(IBD("LINE"))+1
. S ^TMP("IBMSG",$J,"CLAIM",IBBILL,IBD("LINE"))="Statement Dates: "_$$DATE^IBCE277($P(IBD,U,9))_" - "_$$DATE^IBCE277($P(IBD,U,10))
;
S ^TMP("IBMSG",$J,"CLAIM",IBBILL,"D",5,1)="##RAW DATA: "_IBD
S ^TMP("IBMSG",$J,"CLAIM",IBBILL,"D1",1,5)="##RAW DATA: "_IBD
Q
;
6(IBD) ; Process 06 record type for corrected name and/or ID# - IB*2*377 - 1/14/08
NEW IBCLM,Z,IBHCT
S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
Q:IBCLM=""
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
S IBHCT=$$GETHCT(IBCLM) I IBHCT=0 S IBHCT=$$CHCT(IBCLM)
S IBCLM=IBCLM_"#"_IBHCT
;
I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
;
S Z=$G(IBD("LINE"))
I $P(IBD,U,3)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient Last Name: "_$P(IBD,U,3)
I $P(IBD,U,4)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient First Name: "_$P(IBD,U,4)
I $P(IBD,U,5)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient Middle Name: "_$P(IBD,U,5)
I $P(IBD,U,6)'="" S Z=Z+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,Z)="Corrected Patient ID#: "_$P(IBD,U,6)
S IBD("LINE")=Z
;
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",6,1)="##RAW DATA: "_IBD
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,6)="##RAW DATA: "_IBD
Q
;
10(IBD) ; Process claim status data
; INPUT:
; IBD must be passed by reference = entire message line
;
; OUTPUT:
; IBD array returned with processed data
; "CLAIM" = The claim #
; "LINE" = The last line # populated in the message
;
; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim status message lines
; ,"D",10,msg seq #)=
; ,"D1",msg seq #,10)=
; claim status raw data
;
N IBCLM,CT,LINE,L,Z,Z0,IBDATA,IBSTAT,IBHCT
S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
Q:IBCLM=""
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
S IBHCT=$$GETHCT(IBCLM) I IBHCT=0 S IBHCT=$$CHCT(IBCLM)
S IBCLM=IBCLM_"#"_IBHCT
;
I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
;
S CT=0
F Z=3:1:6 I $P(IBD,U,Z)="Y" D Q ;Claim status
. S IBSTAT=(Z-2)
. S CT=CT+1,LINE(CT)="CLAIM STATUS: "_$P("PROCESSED^DENIED^PENDED^REVERSAL",U,IBSTAT)
I '$G(IBSTAT) D
. S CT=CT+1,LINE(CT)="CLAIM STATUS: "_$P(IBD,U,7)_" (OTHER)"
;
I $P(IBD,U,8)'="" D ;Crossed over info
. S CT=CT+1,LINE(CT)="Crossed over to: "_$P(IBD,U,9)_" "_$P(IBD,U,8)
;
I CT D
. S L=$G(IBD("LINE")),Z=0
. F S Z=$O(LINE(Z)) Q:'Z S L=L+1,^TMP("IBMSG",$J,"CLAIM",IBCLM,L)=LINE(Z)
. S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",10,1)="##RAW DATA: "_IBD
. S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,10)="##RAW DATA: "_IBD
. S IBD("LINE")=$G(IBD("LINE"))+CT
Q
;
15(IBD) ; Process claim status data
; INPUT:
; IBD must be passed by reference = entire message line
;
; OUTPUT:
; IBD array
; "LINE" = The last line # populated in the message
;
; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",15,msg seq #)=
; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,15)=
; claim status raw data
;
N IBCLM,Z,Z0,IBDATA,IBHCT
S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
Q:IBCLM=""
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
S IBHCT=$$GETHCT(IBCLM) I IBHCT=0 S IBHCT=$$CHCT(IBCLM)
S IBCLM=IBCLM_"#"_IBHCT
;
I '$D(^TMP("IBMSG",$J,"CLAIM",IBCLM)) D HDR(IBCLM,.IBD) ;Process header data if not already done for claim
;
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",15,1)="##RAW DATA: "_IBD
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",1,15)="##RAW DATA: "_IBD
Q
;
20(IBD) ; Process claim level adjustment data
; Claim must have been referenced by a previous '05' level
;
; INPUT:
; IBD must be passed by reference = entire message line
;
; OUTPUT:
; IBD("LINE") = The last line # populated in the message
; ^TMP("IBMSG",$J,"CLAIM",claim #,line #)=claim level adjustment
; ,"D",20,seq#)=
; ,"D1",seq#,20)=
; claim level adjust. raw data
;
N IBCLM,IBHCT
S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
S IBHCT=$$GETHCT(IBCLM) I IBHCT=0 S IBHCT=$$CHCT(IBCLM)
S IBCLM=IBCLM_"#"_IBHCT
;
Q:'$D(^TMP("IBMSG",$J,"CLAIM",IBCLM))
S IBD("LINE")=$G(IBD("LINE"))+1
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)
S IBD("LINE")=IBD("LINE")+1
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,IBD("LINE"))=" REASON: ("_$P(IBD,U,4)_") "_$P(IBD,U,7)
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",20,IBD("LINE"))="##RAW DATA: "_IBD
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",IBD("LINE"),20)="##RAW DATA: "_IBD
Q
;
37(IBD) ; Process claim level adjustment data for Inpatient MEDICARE
D 37^IBCE835A(.IBD)
Q
;
40(IBD) ; Process service line data
D 40^IBCE835A(.IBD)
Q
;
45(IBD) ; Process service line adjustment data
D 45^IBCE835A(.IBD)
Q
;
11(IBD) ; Process claim status rendering provider data segment
D XX(.IBD,11)
Q
;
12(IBD) ; Process claim status corrected priority payer data segment
D XX(.IBD,12)
Q
;
13(IBD) ; Process claim status other subscriber data segment
D XX(.IBD,13)
Q
;
17(IBD) ; Process claim contact data segment
D XX(.IBD,17)
Q
;
30(IBD) ; Process MEDICARE inpatient adjudication data (part 1)
D XX(.IBD,30)
Q
;
35(IBD) ; Process MEDICARE inpatient adjudication data (part 2)
D XX(.IBD,35)
Q
;
41(IBD) ; Process service line data (part 2)
D XX(.IBD,41)
Q
;
42(IBD) ; Process service line data (part 3)
D XX(.IBD,42)
Q
;
46(IBD) ; Process Adjustment Policy Reference segment
D 46^IBCE835A(.IBD)
Q
;
99(IBD) ; Process trailer record for non-MRA EOB
D XX(.IBD,99)
Q
;
XX(IBD,IBID) ; Store non-displayed data nodes in TMP array
;
; INPUT:
; IBD must be passed by reference = entire message line
; IBID = record id for generic store
;
; OUTPUT:
; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",IBID,msg seq #)=
; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,IBID)=
; claim status raw data
; IBD("LINE") = The last line # populated in the message
;
N IBCLM
S IBCLM=$$GETCLM^IBCE277($P(IBD,U,2))
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
S IBHCT=$$GETHCT(IBCLM)
S IBCLM=IBCLM_"#"_IBHCT
;
S IBD("LINE")=$G(IBD("LINE"))+1
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D",IBID,IBD("LINE"))="##RAW DATA: "_IBD
S ^TMP("IBMSG",$J,"CLAIM",IBCLM,"D1",IBD("LINE"),IBID)="##RAW DATA: "_IBD
;
Q
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
GETHCT(IBCLNO) ;
Q +$G(^TMP("IBMSG",$J,"CLAIM",IBCLNO))
;
;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
CHCT(IBCLNO) ;
N IBHCT
S IBHCT=$G(^TMP("IBMSG",$J,"CLAIM",IBCLNO))+1,^(IBCLNO)=IBHCT
Q IBHCT
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCE835 10096 printed Dec 13, 2024@02:09:23 Page 2
IBCE835 ;ALB/TMP/PJH - 835 EDI EXPLANATION OF BENEFITS MSG PROCESSING ; 7/15/10 4:40pm
+1 ;;2.0;INTEGRATED BILLING;**137,135,155,377,431,718**;21-MAR-94;Build 73
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
+6 ; MESSAGE HEADER DATA STRING =
+7 ; type of message^msg queue^msg #^bill #^^date/time
+8 ;
HDR(IBCLNO,IBD) ;Process header data
+1 ; INPUT:
+2 ; IBCLNO = claim #
+3 ;
+4 ; ^TMP("IBMSGH",$J,0) = header message text
+5 ;
+6 ; OUTPUT:
+7 ; IBD array returned with processed data
+8 ; "LINE" = The last line # populated in the message
+9 ; "DATE" = Date/Time of EOB (Fileman format)
+10 ; "MRA" = 1 if MRA, 0 if not
+11 ; "X12" = 1 if X12, 0 if not
+12 ;
+13 ; ^TMP("IBMSG",$J,"CLAIM",claim #,0)=MESSAGE HEADER DATA STRING
+14 ; ,"D",0,1)=header record raw data
+15 ; ,"D1",1,0)=header record raw data
+16 ; ,line #)=EOB message lines
+17 ;
+18 NEW CT,IB399,IBD0,IBBILL,LINE,L,X,Y,Z,%DT
+19 SET IBD0=$GET(^TMP("IBMSGH",$JOB,0))
SET IBD("LINE")=0
+20 if IBD0=""
QUIT
+21 SET X=$PIECE(IBD0,U,3)
SET X=$EXTRACT(X,5,8)_$EXTRACT(X,1,4)_"@"_$PIECE(IBD0,U,4)
+22 IF X
SET %DT="XTS"
DO ^%DT
+23 SET IBD("DATE")=$SELECT(Y>0:Y,1:"")
+24 SET IBD("MRA")=$PIECE(IBD0,U,5)
+25 SET IBD("X12")=($PIECE(IBD0,U,2)="X")
+26 SET CT=0
+27 ;
+28 IF $PIECE(IBD0,U,6)'=""
SET CT=CT+1
SET LINE(CT)=$GET(LINE(CT))_"Payer Name: "_$PIECE(IBD0,U,6)
+29 ;
+30 IF CT
Begin DoDot:1
+31 SET (L,Z)=0
+32 FOR
SET Z=$ORDER(LINE(Z))
if 'Z
QUIT
SET L=L+1
SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLNO,L)=LINE(Z)
+33 SET IBD("LINE")=IBD("LINE")+CT
End DoDot:1
+34 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file - changed IBCLNO to $P(IBCLNO,"#")
+35 SET IB399=+$ORDER(^DGCR(399,"B",$$GETCLM^IBCE277($PIECE(IBCLNO,"#")),""),-1)
+36 ;
+37 SET IBBILL=$$LAST364^IBCEF4(IB399)
+38 ;
+39 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLNO,0)="835EOB"_U_$GET(IBD("MSG#"))_U_$GET(IBD("SUBJ"))_U_IBBILL_U_U_IBD("DATE")
+40 ;
+41 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLNO,"D",0,1)="##RAW DATA: "_IBD0
+42 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLNO,"D1",1,0)="##RAW DATA: "_IBD0
+43 QUIT
+44 ;
5(IBD) ; Process claim patient ID data
+1 ; INPUT:
+2 ; IBD must be passed by reference = entire message line
+3 ;
+4 ; OUTPUT:
+5 ; IBD array
+6 ; "LINE" = the last line # populated in the message
+7 ;
+8 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim pt id message lines
+9 ; ,"D",5,msg seq #)=
+10 ; ,"D1",msg seq #,5)=
+11 ; claim pt id message raw data
+12 ;
+13 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+14 NEW IBBILL,IBHCT
+15 SET IBBILL=$$GETCLM^IBCE277($PIECE(IBD,U,2))
+16 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+17 SET IBHCT=$$CHCT(IBBILL)
SET IBBILL=IBBILL_"#"_IBHCT
+18 ;
+19 ;Process header data if not already done for claim
IF '$DATA(^TMP("IBMSG",$JOB,"CLAIM",IBBILL))
DO HDR(IBBILL,.IBD)
+20 ;
+21 ;Statement dates
IF $PIECE(IBD,U,9)
Begin DoDot:1
+22 SET IBD("LINE")=$GET(IBD("LINE"))+1
+23 SET ^TMP("IBMSG",$JOB,"CLAIM",IBBILL,IBD("LINE"))="Statement Dates: "_$$DATE^IBCE277($PIECE(IBD,U,9))_" - "_$$DATE^IBCE277($PIECE(IBD,U,10))
End DoDot:1
+24 ;
+25 SET ^TMP("IBMSG",$JOB,"CLAIM",IBBILL,"D",5,1)="##RAW DATA: "_IBD
+26 SET ^TMP("IBMSG",$JOB,"CLAIM",IBBILL,"D1",1,5)="##RAW DATA: "_IBD
+27 QUIT
+28 ;
6(IBD) ; Process 06 record type for corrected name and/or ID# - IB*2*377 - 1/14/08
+1 NEW IBCLM,Z,IBHCT
+2 SET IBCLM=$$GETCLM^IBCE277($PIECE(IBD,U,2))
+3 if IBCLM=""
QUIT
+4 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+5 SET IBHCT=$$GETHCT(IBCLM)
IF IBHCT=0
SET IBHCT=$$CHCT(IBCLM)
+6 SET IBCLM=IBCLM_"#"_IBHCT
+7 ;
+8 ;Process header data if not already done for claim
IF '$DATA(^TMP("IBMSG",$JOB,"CLAIM",IBCLM))
DO HDR(IBCLM,.IBD)
+9 ;
+10 SET Z=$GET(IBD("LINE"))
+11 IF $PIECE(IBD,U,3)'=""
SET Z=Z+1
SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,Z)="Corrected Patient Last Name: "_$PIECE(IBD,U,3)
+12 IF $PIECE(IBD,U,4)'=""
SET Z=Z+1
SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,Z)="Corrected Patient First Name: "_$PIECE(IBD,U,4)
+13 IF $PIECE(IBD,U,5)'=""
SET Z=Z+1
SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,Z)="Corrected Patient Middle Name: "_$PIECE(IBD,U,5)
+14 IF $PIECE(IBD,U,6)'=""
SET Z=Z+1
SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,Z)="Corrected Patient ID#: "_$PIECE(IBD,U,6)
+15 SET IBD("LINE")=Z
+16 ;
+17 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D",6,1)="##RAW DATA: "_IBD
+18 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D1",1,6)="##RAW DATA: "_IBD
+19 QUIT
+20 ;
10(IBD) ; Process claim status data
+1 ; INPUT:
+2 ; IBD must be passed by reference = entire message line
+3 ;
+4 ; OUTPUT:
+5 ; IBD array returned with processed data
+6 ; "CLAIM" = The claim #
+7 ; "LINE" = The last line # populated in the message
+8 ;
+9 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line#)=claim status message lines
+10 ; ,"D",10,msg seq #)=
+11 ; ,"D1",msg seq #,10)=
+12 ; claim status raw data
+13 ;
+14 NEW IBCLM,CT,LINE,L,Z,Z0,IBDATA,IBSTAT,IBHCT
+15 SET IBCLM=$$GETCLM^IBCE277($PIECE(IBD,U,2))
+16 if IBCLM=""
QUIT
+17 ;
+18 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+19 SET IBHCT=$$GETHCT(IBCLM)
IF IBHCT=0
SET IBHCT=$$CHCT(IBCLM)
+20 SET IBCLM=IBCLM_"#"_IBHCT
+21 ;
+22 ;Process header data if not already done for claim
IF '$DATA(^TMP("IBMSG",$JOB,"CLAIM",IBCLM))
DO HDR(IBCLM,.IBD)
+23 ;
+24 SET CT=0
+25 ;Claim status
FOR Z=3:1:6
IF $PIECE(IBD,U,Z)="Y"
Begin DoDot:1
+26 SET IBSTAT=(Z-2)
+27 SET CT=CT+1
SET LINE(CT)="CLAIM STATUS: "_$PIECE("PROCESSED^DENIED^PENDED^REVERSAL",U,IBSTAT)
End DoDot:1
QUIT
+28 IF '$GET(IBSTAT)
Begin DoDot:1
+29 SET CT=CT+1
SET LINE(CT)="CLAIM STATUS: "_$PIECE(IBD,U,7)_" (OTHER)"
End DoDot:1
+30 ;
+31 ;Crossed over info
IF $PIECE(IBD,U,8)'=""
Begin DoDot:1
+32 SET CT=CT+1
SET LINE(CT)="Crossed over to: "_$PIECE(IBD,U,9)_" "_$PIECE(IBD,U,8)
End DoDot:1
+33 ;
+34 IF CT
Begin DoDot:1
+35 SET L=$GET(IBD("LINE"))
SET Z=0
+36 FOR
SET Z=$ORDER(LINE(Z))
if 'Z
QUIT
SET L=L+1
SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,L)=LINE(Z)
+37 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D",10,1)="##RAW DATA: "_IBD
+38 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D1",1,10)="##RAW DATA: "_IBD
+39 SET IBD("LINE")=$GET(IBD("LINE"))+CT
End DoDot:1
+40 QUIT
+41 ;
15(IBD) ; Process claim status data
+1 ; INPUT:
+2 ; IBD must be passed by reference = entire message line
+3 ;
+4 ; OUTPUT:
+5 ; IBD array
+6 ; "LINE" = The last line # populated in the message
+7 ;
+8 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",15,msg seq #)=
+9 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,15)=
+10 ; claim status raw data
+11 ;
+12 NEW IBCLM,Z,Z0,IBDATA,IBHCT
+13 SET IBCLM=$$GETCLM^IBCE277($PIECE(IBD,U,2))
+14 if IBCLM=""
QUIT
+15 ;
+16 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+17 SET IBHCT=$$GETHCT(IBCLM)
IF IBHCT=0
SET IBHCT=$$CHCT(IBCLM)
+18 SET IBCLM=IBCLM_"#"_IBHCT
+19 ;
+20 ;Process header data if not already done for claim
IF '$DATA(^TMP("IBMSG",$JOB,"CLAIM",IBCLM))
DO HDR(IBCLM,.IBD)
+21 ;
+22 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D",15,1)="##RAW DATA: "_IBD
+23 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D1",1,15)="##RAW DATA: "_IBD
+24 QUIT
+25 ;
20(IBD) ; Process claim level adjustment data
+1 ; Claim must have been referenced by a previous '05' level
+2 ;
+3 ; INPUT:
+4 ; IBD must be passed by reference = entire message line
+5 ;
+6 ; OUTPUT:
+7 ; IBD("LINE") = The last line # populated in the message
+8 ; ^TMP("IBMSG",$J,"CLAIM",claim #,line #)=claim level adjustment
+9 ; ,"D",20,seq#)=
+10 ; ,"D1",seq#,20)=
+11 ; claim level adjust. raw data
+12 ;
+13 NEW IBCLM,IBHCT
+14 SET IBCLM=$$GETCLM^IBCE277($PIECE(IBD,U,2))
+15 ;
+16 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+17 SET IBHCT=$$GETHCT(IBCLM)
IF IBHCT=0
SET IBHCT=$$CHCT(IBCLM)
+18 SET IBCLM=IBCLM_"#"_IBHCT
+19 ;
+20 if '$DATA(^TMP("IBMSG",$JOB,"CLAIM",IBCLM))
QUIT
+21 SET IBD("LINE")=$GET(IBD("LINE"))+1
+22 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,IBD("LINE"))="ADJUSTMENT GROUP: "_$PIECE(IBD,U,3)_" QTY: "_+$PIECE(IBD,U,6)_", AMT: "_($PIECE(IBD,U,5)/100)
+23 SET IBD("LINE")=IBD("LINE")+1
+24 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,IBD("LINE"))=" REASON: ("_$PIECE(IBD,U,4)_") "_$PIECE(IBD,U,7)
+25 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D",20,IBD("LINE"))="##RAW DATA: "_IBD
+26 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D1",IBD("LINE"),20)="##RAW DATA: "_IBD
+27 QUIT
+28 ;
37(IBD) ; Process claim level adjustment data for Inpatient MEDICARE
+1 DO 37^IBCE835A(.IBD)
+2 QUIT
+3 ;
40(IBD) ; Process service line data
+1 DO 40^IBCE835A(.IBD)
+2 QUIT
+3 ;
45(IBD) ; Process service line adjustment data
+1 DO 45^IBCE835A(.IBD)
+2 QUIT
+3 ;
11(IBD) ; Process claim status rendering provider data segment
+1 DO XX(.IBD,11)
+2 QUIT
+3 ;
12(IBD) ; Process claim status corrected priority payer data segment
+1 DO XX(.IBD,12)
+2 QUIT
+3 ;
13(IBD) ; Process claim status other subscriber data segment
+1 DO XX(.IBD,13)
+2 QUIT
+3 ;
17(IBD) ; Process claim contact data segment
+1 DO XX(.IBD,17)
+2 QUIT
+3 ;
30(IBD) ; Process MEDICARE inpatient adjudication data (part 1)
+1 DO XX(.IBD,30)
+2 QUIT
+3 ;
35(IBD) ; Process MEDICARE inpatient adjudication data (part 2)
+1 DO XX(.IBD,35)
+2 QUIT
+3 ;
41(IBD) ; Process service line data (part 2)
+1 DO XX(.IBD,41)
+2 QUIT
+3 ;
42(IBD) ; Process service line data (part 3)
+1 DO XX(.IBD,42)
+2 QUIT
+3 ;
46(IBD) ; Process Adjustment Policy Reference segment
+1 DO 46^IBCE835A(.IBD)
+2 QUIT
+3 ;
99(IBD) ; Process trailer record for non-MRA EOB
+1 DO XX(.IBD,99)
+2 QUIT
+3 ;
XX(IBD,IBID) ; Store non-displayed data nodes in TMP array
+1 ;
+2 ; INPUT:
+3 ; IBD must be passed by reference = entire message line
+4 ; IBID = record id for generic store
+5 ;
+6 ; OUTPUT:
+7 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D",IBID,msg seq #)=
+8 ; ^TMP("IBMSG",$J,"CLAIM",claim #,"D1",msg seq #,IBID)=
+9 ; claim status raw data
+10 ; IBD("LINE") = The last line # populated in the message
+11 ;
+12 NEW IBCLM
+13 SET IBCLM=$$GETCLM^IBCE277($PIECE(IBD,U,2))
+14 ;
+15 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
+16 SET IBHCT=$$GETHCT(IBCLM)
+17 SET IBCLM=IBCLM_"#"_IBHCT
+18 ;
+19 SET IBD("LINE")=$GET(IBD("LINE"))+1
+20 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D",IBID,IBD("LINE"))="##RAW DATA: "_IBD
+21 SET ^TMP("IBMSG",$JOB,"CLAIM",IBCLM,"D1",IBD("LINE"),IBID)="##RAW DATA: "_IBD
+22 ;
+23 QUIT
+24 ;
+25 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
GETHCT(IBCLNO) ;
+1 QUIT +$GET(^TMP("IBMSG",$JOB,"CLAIM",IBCLNO))
+2 ;
+3 ;;IB*2.0*718;JWS;EBILL-924;handle split MRAs in the same file received from FSC
CHCT(IBCLNO) ;
+1 NEW IBHCT
+2 SET IBHCT=$GET(^TMP("IBMSG",$JOB,"CLAIM",IBCLNO))+1
SET ^(IBCLNO)=IBHCT
+3 QUIT IBHCT
+4 ;