IBCEMQC ;ALB/ESG - MRA EOB CRITERIA FOR AUTO-AUTHORIZE ; 11/1/06 10:34am
;;2.0;INTEGRATED BILLING;**155,323,302,350,359,447,718**;21-MAR-94;Build 73
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
Q ; must be called at proper entry point
;
CRIT(IBEOB) ; Function to determine if EOB entry meets the criteria for
; auto-authorization and secondary claim submission
;
; Input: IBEOB - internal entry number for an entry in 361.1
;
; Output: This function returns a pieced string
; [1] 0 or 1, EOB meets criteria
; [2] error message if the first piece is 0
;
NEW IBM,IBM3,IBM5,IBIFN,PCE,REMC,Z,OK,REASON,STOP,IBPTRESP
;
S OK=0,REASON="Unknown",IBEOB=+$G(IBEOB)
;
S IBM=$G(^IBM(361.1,IBEOB,0)) I IBM="" S REASON="No EOB Data Found" G CRITX
I $D(^IBM(361.1,IBEOB,"ERR")) S REASON="Filing Errors" G CRITX
I $P(IBM,U,13)'=1 S REASON="Claim Status is "_$$GET1^DIQ(361.1,IBEOB_",",.13)_". It must be PROCESSED." G CRITX
;
I $P(IBM,U,4)'=1 S REASON="The EOB Type is not Medicare MRA" G CRITX
;
; If any other MRA's on file for this bill failed the auto-generation
; check, then this MRA must also fail the check
S IBIFN=+IBM,Z=0,STOP=0
F S Z=$O(^IBM(361.1,"B",IBIFN,Z)) Q:'Z D Q:STOP
. I Z=IBEOB Q ; check different EOB records if they exist
. I $P($G(^IBM(361.1,Z,0)),U,4)'=1 Q ; must be an MRA
. I $P($G(^IBM(361.1,Z,30)),U,1)="" Q ; no problems recorded
. S REASON="Another MRA for this bill (ien="_Z_") failed the auto-generation criteria check."
. S STOP=1
. Q
I STOP G CRITX
;
; If this EOB is a split EOB, then don't allow it
; WCJ;IB*2.0*718;added check for incomplete MRA so treat like a split
;I $$SPLIT^IBCEMU1(IBEOB) S REASON="Claim level remark code MA15 received. Multiple MRA's" G CRITX
I $$SPLIT^IBCEMU1(IBEOB) S REASON="Claim level remark code MA15 received or incomplete MRA detected. Multiple MRA's" G CRITX
;
; Call the function that checks the claim level and/or line level
; adjustments for this EOB
I '$$CAS(IBEOB,"B",.REASON) G CRITX ; "B" for both
;
; Make sure the patient responsibility amount for this MRA is greater than $0
S IBPTRESP=$P($G(^IBM(361.1,IBEOB,1)),U,2) ; Pt Resp Amt 1.02 field
I $$FT^IBCEF(IBIFN)=3 S IBPTRESP=$$PTRESPI^IBCECOB1(IBEOB)
; IB*2.0*447 PR for supplemental plans can be different
S:$$MSEDT^IBCEMU4(IBIFN)'="" IBPTRESP=$$MSPRE^IBCEMU4(IBIFN)
I IBPTRESP'>0 S REASON="Patient responsibility dollar amount is less than or equal to $0" G CRITX
;
; Check the parameter values last of all
I '$P($G(^IBE(350.9,1,8)),U,11) S REASON="Automatic MRA Processing parameter is turned off. File 350.9, Field 8.11." G CRITX
I '$P($G(^IBE(350.9,1,8)),U,12) S REASON="Allow MRA Processing parameter is turned off. File 350.9, Field 8.12." G CRITX
;
; At this point, we're OK
S OK=1,REASON=""
;
CRITX ;
Q OK_U_REASON
;
;
CAS(IBEOB,ADJFLAG,REASON) ; This function determines if the EOB
; adjustment group codes and reason codes from file 361.1 (either
; claim level or line level or both) meet the criteria for auto-
; authorization and secondary claim submission.
;
; Input Parameters
; IBEOB - ien of entry in file 361.1
; ADJFLAG - adjustment flag
; "C" - look at claim level adjustments only
; "L" - look at line level adjustments only
; "B" - look at both claim and line level adjustments
; Output Parameter
; REASON - error message describing why it failed
;
; Function Value is either 0 or 1, indicating if it passed the criteria
;
NEW EOBADJ,OK,OKCOMBO,PATRESP,STOP,LNIEN
;
S IBEOB=+$G(IBEOB)
S ADJFLAG=$G(ADJFLAG,"B") ; default is "B" if not passed in
D BUILD ; build the array of OK group/reason combinations
S PATRESP=0 ; patient responsibility flag (default false)
S STOP=0 ; Stop flag
S OK=0 ; OK flag (function value)
S REASON="" ; error reason text
;
; claim level adjustments
I $F(".C.B.","."_ADJFLAG_".") D
. KILL EOBADJ
. M EOBADJ=^IBM(361.1,IBEOB,10)
. D ADJCHK
. Q
;
; Get out if the claim level adjustments failed
I STOP G CASX
;
; line level adjustments
I $F(".L.B.","."_ADJFLAG_".") D
. S LNIEN=0
. F S LNIEN=$O(^IBM(361.1,IBEOB,15,LNIEN)) Q:'LNIEN D Q:STOP
.. KILL EOBADJ
.. M EOBADJ=^IBM(361.1,IBEOB,15,LNIEN,1)
.. D ADJCHK
.. Q
. Q
;
; Get out if the line level adjustments failed
I STOP G CASX
;
; Get out if there was no patient responsibility adjustments found
I 'PATRESP S REASON="No Patient Responsibility Adjustments found" G CASX
;
; At this point, we're OK
S OK=1,REASON=""
CASX ;
Q OK
;
;
ADJCHK ; This procedure checks the adjustments for this EOB. The group codes
; and reason codes are in the EOBADJ array structures from file 361.1.
;
; Variables STOP and REASON will be returned on an error
; Variable PATRESP will be returned if a valid PR adjustment found
;
NEW ADJIEN,GROUP,RSNIEN,RSNCODE
S ADJIEN=0
F S ADJIEN=$O(EOBADJ(ADJIEN)) Q:'ADJIEN D Q:STOP
. S GROUP=$P($G(EOBADJ(ADJIEN,0)),U,1)
. I GROUP="LQ" Q ; line level remark code kludge: 42 rec [3]
. I GROUP="" S GROUP="<Undefined>"
. I '$D(OKCOMBO(GROUP)) S STOP=1,REASON="Unacceptable Claim Adjustment Group Code: "_GROUP Q
. S RSNIEN=0
. F S RSNIEN=$O(EOBADJ(ADJIEN,1,RSNIEN)) Q:'RSNIEN D Q:STOP
.. S RSNCODE=$P($G(EOBADJ(ADJIEN,1,RSNIEN,0)),U,1)
.. ;
.. ; Ignore some special adjustment data that is filed with the MRA
.. I GROUP="PR",RSNCODE="AAA" Q ; Allowed Amount: 41 rec [3]
.. I GROUP="OA",RSNCODE="AB3" Q ; Covered Amount: 15 rec [3]
.. ;
.. I RSNCODE="" S RSNCODE="<Undefined>"
.. I '$D(OKCOMBO(GROUP,RSNCODE)) S STOP=1,REASON="Unacceptable Reason Code ("_RSNCODE_") for Claim Adjustment Group Code ("_GROUP_")" Q
.. ;
.. ; Set the flag if the group is PR
.. I GROUP="PR" S PATRESP=1
.. Q
. Q
ADJCHKX ;
Q
;
;
BUILD ; This procedure builds the OKCOMBO array which identifies which
; combinations of group codes and reason codes are acceptable
;
NEW LN,LINE,GROUP,RSNLST,R,RSN
KILL OKCOMBO
F LN=1:1 D Q:$P(LINE,";",4)=""&$D(OKCOMBO)
. S LINE=$T(OKCOMBO+LN)
. S GROUP=$P(LINE,";",3) Q:GROUP=""
. S RSNLST=$P(LINE,";",4) Q:RSNLST=""
. F R=1:1:$L(RSNLST,",") D
.. S RSN=$P(RSNLST,",",R) Q:RSN=""
.. S OKCOMBO(GROUP,RSN)=""
.. Q
. Q
BUILDX ;
Q
;
;
OKCOMBO ; This section lists OK combinations of adjustment category group codes
; and associated reason codes.
; The format is as follows - semi-colon delimiter
; [3] Adjustment category (group code)
; [4] List of acceptable reason codes - comma delimiter
;
; PR-AAA is created by VistA for the Allowed Amount
; OA-AB3 is created by VistA for the Covered Amount
; LQ-zzz is created by VistA for the Line Level remark
;
;;CO;A2,B6,42,45,172,94,194
;;PR;1,2,66,122,AAA
;;OA;AB3
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCEMQC 7055 printed Dec 13, 2024@02:10:56 Page 2
IBCEMQC ;ALB/ESG - MRA EOB CRITERIA FOR AUTO-AUTHORIZE ; 11/1/06 10:34am
+1 ;;2.0;INTEGRATED BILLING;**155,323,302,350,359,447,718**;21-MAR-94;Build 73
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
+4 ; must be called at proper entry point
QUIT
+5 ;
CRIT(IBEOB) ; Function to determine if EOB entry meets the criteria for
+1 ; auto-authorization and secondary claim submission
+2 ;
+3 ; Input: IBEOB - internal entry number for an entry in 361.1
+4 ;
+5 ; Output: This function returns a pieced string
+6 ; [1] 0 or 1, EOB meets criteria
+7 ; [2] error message if the first piece is 0
+8 ;
+9 NEW IBM,IBM3,IBM5,IBIFN,PCE,REMC,Z,OK,REASON,STOP,IBPTRESP
+10 ;
+11 SET OK=0
SET REASON="Unknown"
SET IBEOB=+$GET(IBEOB)
+12 ;
+13 SET IBM=$GET(^IBM(361.1,IBEOB,0))
IF IBM=""
SET REASON="No EOB Data Found"
GOTO CRITX
+14 IF $DATA(^IBM(361.1,IBEOB,"ERR"))
SET REASON="Filing Errors"
GOTO CRITX
+15 IF $PIECE(IBM,U,13)'=1
SET REASON="Claim Status is "_$$GET1^DIQ(361.1,IBEOB_",",.13)_". It must be PROCESSED."
GOTO CRITX
+16 ;
+17 IF $PIECE(IBM,U,4)'=1
SET REASON="The EOB Type is not Medicare MRA"
GOTO CRITX
+18 ;
+19 ; If any other MRA's on file for this bill failed the auto-generation
+20 ; check, then this MRA must also fail the check
+21 SET IBIFN=+IBM
SET Z=0
SET STOP=0
+22 FOR
SET Z=$ORDER(^IBM(361.1,"B",IBIFN,Z))
if 'Z
QUIT
Begin DoDot:1
+23 ; check different EOB records if they exist
IF Z=IBEOB
QUIT
+24 ; must be an MRA
IF $PIECE($GET(^IBM(361.1,Z,0)),U,4)'=1
QUIT
+25 ; no problems recorded
IF $PIECE($GET(^IBM(361.1,Z,30)),U,1)=""
QUIT
+26 SET REASON="Another MRA for this bill (ien="_Z_") failed the auto-generation criteria check."
+27 SET STOP=1
+28 QUIT
End DoDot:1
if STOP
QUIT
+29 IF STOP
GOTO CRITX
+30 ;
+31 ; If this EOB is a split EOB, then don't allow it
+32 ; WCJ;IB*2.0*718;added check for incomplete MRA so treat like a split
+33 ;I $$SPLIT^IBCEMU1(IBEOB) S REASON="Claim level remark code MA15 received. Multiple MRA's" G CRITX
+34 IF $$SPLIT^IBCEMU1(IBEOB)
SET REASON="Claim level remark code MA15 received or incomplete MRA detected. Multiple MRA's"
GOTO CRITX
+35 ;
+36 ; Call the function that checks the claim level and/or line level
+37 ; adjustments for this EOB
+38 ; "B" for both
IF '$$CAS(IBEOB,"B",.REASON)
GOTO CRITX
+39 ;
+40 ; Make sure the patient responsibility amount for this MRA is greater than $0
+41 ; Pt Resp Amt 1.02 field
SET IBPTRESP=$PIECE($GET(^IBM(361.1,IBEOB,1)),U,2)
+42 IF $$FT^IBCEF(IBIFN)=3
SET IBPTRESP=$$PTRESPI^IBCECOB1(IBEOB)
+43 ; IB*2.0*447 PR for supplemental plans can be different
+44 if $$MSEDT^IBCEMU4(IBIFN)'=""
SET IBPTRESP=$$MSPRE^IBCEMU4(IBIFN)
+45 IF IBPTRESP'>0
SET REASON="Patient responsibility dollar amount is less than or equal to $0"
GOTO CRITX
+46 ;
+47 ; Check the parameter values last of all
+48 IF '$PIECE($GET(^IBE(350.9,1,8)),U,11)
SET REASON="Automatic MRA Processing parameter is turned off. File 350.9, Field 8.11."
GOTO CRITX
+49 IF '$PIECE($GET(^IBE(350.9,1,8)),U,12)
SET REASON="Allow MRA Processing parameter is turned off. File 350.9, Field 8.12."
GOTO CRITX
+50 ;
+51 ; At this point, we're OK
+52 SET OK=1
SET REASON=""
+53 ;
CRITX ;
+1 QUIT OK_U_REASON
+2 ;
+3 ;
CAS(IBEOB,ADJFLAG,REASON) ; This function determines if the EOB
+1 ; adjustment group codes and reason codes from file 361.1 (either
+2 ; claim level or line level or both) meet the criteria for auto-
+3 ; authorization and secondary claim submission.
+4 ;
+5 ; Input Parameters
+6 ; IBEOB - ien of entry in file 361.1
+7 ; ADJFLAG - adjustment flag
+8 ; "C" - look at claim level adjustments only
+9 ; "L" - look at line level adjustments only
+10 ; "B" - look at both claim and line level adjustments
+11 ; Output Parameter
+12 ; REASON - error message describing why it failed
+13 ;
+14 ; Function Value is either 0 or 1, indicating if it passed the criteria
+15 ;
+16 NEW EOBADJ,OK,OKCOMBO,PATRESP,STOP,LNIEN
+17 ;
+18 SET IBEOB=+$GET(IBEOB)
+19 ; default is "B" if not passed in
SET ADJFLAG=$GET(ADJFLAG,"B")
+20 ; build the array of OK group/reason combinations
DO BUILD
+21 ; patient responsibility flag (default false)
SET PATRESP=0
+22 ; Stop flag
SET STOP=0
+23 ; OK flag (function value)
SET OK=0
+24 ; error reason text
SET REASON=""
+25 ;
+26 ; claim level adjustments
+27 IF $FIND(".C.B.","."_ADJFLAG_".")
Begin DoDot:1
+28 KILL EOBADJ
+29 MERGE EOBADJ=^IBM(361.1,IBEOB,10)
+30 DO ADJCHK
+31 QUIT
End DoDot:1
+32 ;
+33 ; Get out if the claim level adjustments failed
+34 IF STOP
GOTO CASX
+35 ;
+36 ; line level adjustments
+37 IF $FIND(".L.B.","."_ADJFLAG_".")
Begin DoDot:1
+38 SET LNIEN=0
+39 FOR
SET LNIEN=$ORDER(^IBM(361.1,IBEOB,15,LNIEN))
if 'LNIEN
QUIT
Begin DoDot:2
+40 KILL EOBADJ
+41 MERGE EOBADJ=^IBM(361.1,IBEOB,15,LNIEN,1)
+42 DO ADJCHK
+43 QUIT
End DoDot:2
if STOP
QUIT
+44 QUIT
End DoDot:1
+45 ;
+46 ; Get out if the line level adjustments failed
+47 IF STOP
GOTO CASX
+48 ;
+49 ; Get out if there was no patient responsibility adjustments found
+50 IF 'PATRESP
SET REASON="No Patient Responsibility Adjustments found"
GOTO CASX
+51 ;
+52 ; At this point, we're OK
+53 SET OK=1
SET REASON=""
CASX ;
+1 QUIT OK
+2 ;
+3 ;
ADJCHK ; This procedure checks the adjustments for this EOB. The group codes
+1 ; and reason codes are in the EOBADJ array structures from file 361.1.
+2 ;
+3 ; Variables STOP and REASON will be returned on an error
+4 ; Variable PATRESP will be returned if a valid PR adjustment found
+5 ;
+6 NEW ADJIEN,GROUP,RSNIEN,RSNCODE
+7 SET ADJIEN=0
+8 FOR
SET ADJIEN=$ORDER(EOBADJ(ADJIEN))
if 'ADJIEN
QUIT
Begin DoDot:1
+9 SET GROUP=$PIECE($GET(EOBADJ(ADJIEN,0)),U,1)
+10 ; line level remark code kludge: 42 rec [3]
IF GROUP="LQ"
QUIT
+11 IF GROUP=""
SET GROUP="<Undefined>"
+12 IF '$DATA(OKCOMBO(GROUP))
SET STOP=1
SET REASON="Unacceptable Claim Adjustment Group Code: "_GROUP
QUIT
+13 SET RSNIEN=0
+14 FOR
SET RSNIEN=$ORDER(EOBADJ(ADJIEN,1,RSNIEN))
if 'RSNIEN
QUIT
Begin DoDot:2
+15 SET RSNCODE=$PIECE($GET(EOBADJ(ADJIEN,1,RSNIEN,0)),U,1)
+16 ;
+17 ; Ignore some special adjustment data that is filed with the MRA
+18 ; Allowed Amount: 41 rec [3]
IF GROUP="PR"
IF RSNCODE="AAA"
QUIT
+19 ; Covered Amount: 15 rec [3]
IF GROUP="OA"
IF RSNCODE="AB3"
QUIT
+20 ;
+21 IF RSNCODE=""
SET RSNCODE="<Undefined>"
+22 IF '$DATA(OKCOMBO(GROUP,RSNCODE))
SET STOP=1
SET REASON="Unacceptable Reason Code ("_RSNCODE_") for Claim Adjustment Group Code ("_GROUP_")"
QUIT
+23 ;
+24 ; Set the flag if the group is PR
+25 IF GROUP="PR"
SET PATRESP=1
+26 QUIT
End DoDot:2
if STOP
QUIT
+27 QUIT
End DoDot:1
if STOP
QUIT
ADJCHKX ;
+1 QUIT
+2 ;
+3 ;
BUILD ; This procedure builds the OKCOMBO array which identifies which
+1 ; combinations of group codes and reason codes are acceptable
+2 ;
+3 NEW LN,LINE,GROUP,RSNLST,R,RSN
+4 KILL OKCOMBO
+5 FOR LN=1:1
Begin DoDot:1
+6 SET LINE=$TEXT(OKCOMBO+LN)
+7 SET GROUP=$PIECE(LINE,";",3)
if GROUP=""
QUIT
+8 SET RSNLST=$PIECE(LINE,";",4)
if RSNLST=""
QUIT
+9 FOR R=1:1:$LENGTH(RSNLST,",")
Begin DoDot:2
+10 SET RSN=$PIECE(RSNLST,",",R)
if RSN=""
QUIT
+11 SET OKCOMBO(GROUP,RSN)=""
+12 QUIT
End DoDot:2
+13 QUIT
End DoDot:1
if $PIECE(LINE,";",4)=""&$DATA(OKCOMBO)
QUIT
BUILDX ;
+1 QUIT
+2 ;
+3 ;
OKCOMBO ; This section lists OK combinations of adjustment category group codes
+1 ; and associated reason codes.
+2 ; The format is as follows - semi-colon delimiter
+3 ; [3] Adjustment category (group code)
+4 ; [4] List of acceptable reason codes - comma delimiter
+5 ;
+6 ; PR-AAA is created by VistA for the Allowed Amount
+7 ; OA-AB3 is created by VistA for the Covered Amount
+8 ; LQ-zzz is created by VistA for the Line Level remark
+9 ;
+10 ;;CO;A2,B6,42,45,172,94,194
+11 ;;PR;1,2,66,122,AAA
+12 ;;OA;AB3
+13 ;