| [613] | 1 | IBCEMRAX ;ALB/DSM - MEDICARE REMITTANCE ADVICE DETAIL-PART A Cont'd ;25-APR-2003 | 
|---|
|  | 2 | ;;2.0;INTEGRATED BILLING;**155**;21-MAR-94 | 
|---|
|  | 3 | ;;Per VHA Directive 10-93-142, this routine should not be modified. | 
|---|
|  | 4 | ; | 
|---|
|  | 5 | Q | 
|---|
|  | 6 | ; | 
|---|
|  | 7 | DEV(IBIFN) ; Prompt the user for a device | 
|---|
|  | 8 | ; Input: IBIFN= ien# of Claim file | 
|---|
|  | 9 | ; | 
|---|
|  | 10 | N %ZIS,ZTRTN,ZTSAVE,ZTDESC,POP,MRACNT | 
|---|
|  | 11 | I '$G(IBIFN) Q  ;DEV | 
|---|
|  | 12 | W !!,"This report displays Medicare-equivalent Remittance Advice Detail." | 
|---|
|  | 13 | S MRACNT=$$MRACNT^IBCEMU1(IBIFN) | 
|---|
|  | 14 | I MRACNT>1 W !,"*** Multiple MRAs on File for this claim.  ",MRACNT," MRAs will be printed. ***" | 
|---|
|  | 15 | W !,"You will need a 132 column printer for this report",! | 
|---|
|  | 16 | ; | 
|---|
|  | 17 | S %ZIS="QM" D ^%ZIS I POP S IBQUIT=1 Q | 
|---|
|  | 18 | ; handle queuing report next | 
|---|
|  | 19 | I $D(IO("Q")) D  S IBQUIT=1 Q | 
|---|
|  | 20 | . S ZTRTN="PROC^IBCEMRAA"   ; background re-entry point | 
|---|
|  | 21 | . S ZTDESC="Medicare-equivalent Remittance Advice Detail Print" | 
|---|
|  | 22 | . S ZTSAVE("IB*")="" | 
|---|
|  | 23 | . D ^%ZTLOAD | 
|---|
|  | 24 | . W !!,$S($D(ZTSK):"Your task number "_ZTSK_" has been queued.",1:"Unable to queue this job.") | 
|---|
|  | 25 | . K ZTSK,IO("Q") D HOME^%ZIS | 
|---|
|  | 26 | U IO    ; Output device | 
|---|
|  | 27 | Q  ;DEV | 
|---|
|  | 28 | ; | 
|---|
|  | 29 | SRVHDR ; Print Srvice Level Header | 
|---|
|  | 30 | ; ROW 23 - | 
|---|
|  | 31 | ; Service (Line) Level Adjustments Data | 
|---|
|  | 32 | W !!! I '$G(INPAT) W "SERV DATE"  ;print only on outpatient claims | 
|---|
|  | 33 | W ?12,"PT",?15,"PROC",?21,"MODS",?30,"REV",?35,"APC",?43,"UNITS",?50,"TOT CHARGES" | 
|---|
|  | 34 | W ?67,"DEDUCT",?80,"COINS",?90,"ALLOWED",?102,"PAYMENT",?111,"GRP-RC",?123,"ADJ AMT" | 
|---|
|  | 35 | Q  ;SRVHDR | 
|---|
|  | 36 | ; | 
|---|
|  | 37 | SRVDATA ; Get Service Level Data of EOB file (#361.1 Level 15) | 
|---|
|  | 38 | ; | 
|---|
|  | 39 | N LNLVL,RLVL,GLVL,RLVLD,GLVLD,SRVDED,GRPCD,RSNCD,SRVCOIN,I,MOD,SRMKS,LNLVLD | 
|---|
|  | 40 | N PRCD,REVCD,UNIT,SRVDT,PRCTYP,ALWD,PAID,SRVDED,GLVL,RCNT,OPRCD,TOTL,LNORD,LNCNT | 
|---|
|  | 41 | ; Use array LNORD to sort Service Lines in order of Referenced Line # | 
|---|
|  | 42 | S LNLVL=0,LNCNT=1000 | 
|---|
|  | 43 | F  S LNLVL=$O(^IBM(361.1,IEN,15,LNLVL)) Q:'LNLVL  S LNORD=$P(^(LNLVL,0),U,12) D  ; | 
|---|
|  | 44 | . I LNORD S LNORD(LNORD)=LNLVL Q | 
|---|
|  | 45 | . S LNORD(LNCNT)=LNLVL,LNCNT=LNCNT+1 | 
|---|
|  | 46 | ; | 
|---|
|  | 47 | S LNORD=0 | 
|---|
|  | 48 | F  S LNORD=$O(LNORD(LNORD)) Q:'LNORD  S LNLVL=LNORD(LNORD) D  I IBQUIT Q | 
|---|
|  | 49 | . S LNLVLD=$G(^IBM(361.1,IEN,15,LNLVL,0)) I LNLVLD="" Q | 
|---|
|  | 50 | . I ($Y+4)>IOSL D  I IBQUIT Q | 
|---|
|  | 51 | . . D PAUSE I IBQUIT Q | 
|---|
|  | 52 | . . W @IOF D CLMHDR^IBCEMRAA | 
|---|
|  | 53 | . . D SRVHDR | 
|---|
|  | 54 | . ; | 
|---|
|  | 55 | . K MOD,RCNT,TOTL S RCNT=0 | 
|---|
|  | 56 | . ; Procedure Code, Revenue Code, Units, From Service Date, Procedure Type | 
|---|
|  | 57 | . S PRCD=$P(LNLVLD,U,4),REVCD=$P(LNLVLD,U,10),UNIT=$P(LNLVLD,U,11),SRVDT=$P(LNLVLD,U,16) | 
|---|
|  | 58 | . S PRCTYP=$P(LNLVLD,U,18) I PRCTYP="NU" S PRCTYP="" ;don't display NU for Proc Type | 
|---|
|  | 59 | . ; Resolve Revenue Code Pointer | 
|---|
|  | 60 | . I REVCD'="" S REVCD=$P($G(^DGCR(399.2,REVCD,0)),U) | 
|---|
|  | 61 | . ; Allowed, Payment, Original Procedure Code | 
|---|
|  | 62 | . S ALWD=$P(LNLVLD,U,13),PAID=$P(LNLVLD,U,3),OPRCD=$P(LNLVLD,U,15) | 
|---|
|  | 63 | . ; Handle Multiple Paid Modifiers from the Service Line Level (may have 4 mod's, could only fit 3) | 
|---|
|  | 64 | . M MOD=^IBM(361.1,IEN,15,LNLVL,2) S MOD="" F I=1:1:3 Q:'$D(MOD(I))  S MOD=MOD_$S(MOD="":"",1:",")_MOD(I,0) | 
|---|
|  | 65 | . ; Get Total Charge by matching 837 Extract Records with Bill's Original Line# on the current Service Line (LNLVLD) | 
|---|
|  | 66 | . S TOTL=$P($G(IBZDATA($P(LNLVLD,U,12))),U,5) | 
|---|
|  | 67 | . ; Service Line Level Remarks Codes | 
|---|
|  | 68 | . S SRMKS=$G(^IBM(361.1,IEN,15,LNLVL,3)) | 
|---|
|  | 69 | . ; Row 24  - print Service date only on Outpatient claims (skip on Inpatients) | 
|---|
|  | 70 | . W ! I '$G(INPAT) W $$FMTE^XLFDT(SRVDT,5) | 
|---|
|  | 71 | . W ?12,PRCTYP,?15,PRCD,?21,MOD,?30,REVCD,?41,$J(UNIT,7),?49,$J($G(TOTL),12,2) | 
|---|
|  | 72 | . ; | 
|---|
|  | 73 | . ; Get Service Level Group Code/Reason Code Data | 
|---|
|  | 74 | . ; RLVLD=reason_code^amount^quantity^reason text | 
|---|
|  | 75 | . S (SRVDED,GLVL,RCNT,SRVCOIN)=0 K RSNCD | 
|---|
|  | 76 | . F  S GLVL=$O(^IBM(361.1,IEN,15,LNLVL,1,GLVL)) Q:'GLVL  S GLVLD=^(GLVL,0) D  ; | 
|---|
|  | 77 | . . S GRPCD=$P(GLVLD,U),RLVL=0 | 
|---|
|  | 78 | . . F  S RLVL=$O(^IBM(361.1,IEN,15,LNLVL,1,GLVL,1,RLVL)) Q:'RLVL  S RLVLD=^(RLVL,0),RSNCD=$P(RLVLD,U) D  ; | 
|---|
|  | 79 | . . . I GRPCD="PR",RSNCD="AAA" Q   ;exception | 
|---|
|  | 80 | . . . I GRPCD="OA",RSNCD="AB3" Q   ;exception | 
|---|
|  | 81 | . . . I GRPCD="LQ" Q               ;exception | 
|---|
|  | 82 | . . . I GRPCD="PR",RSNCD=1!(RSNCD=66) S SRVDED=SRVDED+$P(RLVLD,U,2) Q  ;deductible | 
|---|
|  | 83 | . . . I GRPCD="PR",RSNCD=2 S SRVCOIN=$P(RLVLD,U,2) Q  ;coinsurance | 
|---|
|  | 84 | . . . S RCNT=RCNT+1,RSNCD(RCNT)=GRPCD_"-"_RSNCD_U_$P(RLVLD,U,2) | 
|---|
|  | 85 | . ; Print Service Level Group Code/Reason Code Data | 
|---|
|  | 86 | . ; Service Level deductible, Coinsurance, Allowed, Paid Amount | 
|---|
|  | 87 | . W ?62,$J(SRVDED,11,2),?74,$J(SRVCOIN,11,2),?86,$J(ALWD,11,2),?98,$J(PAID,11,2) | 
|---|
|  | 88 | . ; Print Group Code-Reason Code, Adjustment Amount | 
|---|
|  | 89 | . F I=1:1:RCNT W:I>1 ! W ?111,$P(RSNCD(I),U),?118,$J($P(RSNCD(I),U,2),12,2) | 
|---|
|  | 90 | . ; Row 25 | 
|---|
|  | 91 | . I OPRCD="",(SRMKS="") Q | 
|---|
|  | 92 | . W ! I OPRCD'="" W ?15,"(",$E(OPRCD,1,4),")" | 
|---|
|  | 93 | . I SRMKS'="" W ?26,"REM:",?30,$P(SRMKS,U) | 
|---|
|  | 94 | ; | 
|---|
|  | 95 | Q  ;SRVDATA | 
|---|
|  | 96 | ; | 
|---|
|  | 97 | PAUSE ; Pause at the bottom of screen. This section is called | 
|---|
|  | 98 | ; from different points of the MRA report. | 
|---|
|  | 99 | ; | 
|---|
|  | 100 | I $E(IOST,1,2)'["C-" Q  ;if not terminal, don't pause | 
|---|
|  | 101 | N DIR,DIROUT,DIRUT,DTOUT,DUOUT | 
|---|
|  | 102 | S DIR(0)="E" D ^DIR | 
|---|
|  | 103 | I $D(DIRUT)!($D(DUOUT)) S IBQUIT=1 Q | 
|---|
|  | 104 | Q  ;PAUSE | 
|---|
|  | 105 | ; | 
|---|
|  | 106 | DSCLMR ; | 
|---|
|  | 107 | N LINE | 
|---|
|  | 108 | S $P(LINE,"-",122)="" | 
|---|
|  | 109 | W !!,LINE | 
|---|
|  | 110 | W !,"This is a printed representation of a remittance advice, developed through a joint effort between the Centers for Medicare and" | 
|---|
|  | 111 | W !,"Medicaid Services and the Department of Veterans Affairs, for a claim for services or supplies furnished to a Medicare-eligible" | 
|---|
|  | 112 | W !,"veteran through a facility of the Department of Veterans Affairs.  The remittance advice shows the amount that Medicare would have" | 
|---|
|  | 113 | W !,"paid had the claim been payable by Medicare, as well as the coinsurance and deductible amounts that would have applied." | 
|---|
|  | 114 | W !,"The claim is not payable under the Medicare program, and no Medicare payment was issued." | 
|---|
|  | 115 | W ! | 
|---|
|  | 116 | Q  ;DSCLMR | 
|---|
|  | 117 | ; | 
|---|
|  | 118 | LINELVL ; This section is called when printing Institutional Reports | 
|---|
|  | 119 | ; The values of Coinsurance, Contractual Adjustment, Noncovered Charges | 
|---|
|  | 120 | ; and Deductible are calculated from the Service Line level and not | 
|---|
|  | 121 | ; from the Claim level. | 
|---|
|  | 122 | ; | 
|---|
|  | 123 | ; RLVLD=reason_code^amount^quantity^reason text | 
|---|
|  | 124 | ; IBCOINS,IBCTADJ,NCVRCHRG,CLMADJ are set to zero in the calling section CLMDATA | 
|---|
|  | 125 | ; | 
|---|
|  | 126 | N LNLVL,LNLVLD,GLVL,GLVLD,RLVL,RLVLD,GRPCD,RSNCD | 
|---|
|  | 127 | S LNLVL=0 | 
|---|
|  | 128 | F  S LNLVL=$O(^IBM(361.1,IEN,15,LNLVL)) Q:'LNLVL  S LNLVLD=^(LNLVL,0) D  ; | 
|---|
|  | 129 | . S GLVL=0 F  S GLVL=$O(^IBM(361.1,IEN,15,LNLVL,1,GLVL)) Q:'GLVL  S GLVLD=^(GLVL,0) D  ; | 
|---|
|  | 130 | . . S GRPCD=$P(GLVLD,U),RLVL=0 | 
|---|
|  | 131 | . . F  S RLVL=$O(^IBM(361.1,IEN,15,LNLVL,1,GLVL,1,RLVL)) Q:'RLVL  S RLVLD=^(RLVL,0),RSNCD=$P(RLVLD,U) D  ; | 
|---|
|  | 132 | . . . I GRPCD="PR",RSNCD="AAA" Q   ;exception | 
|---|
|  | 133 | . . . I GRPCD="OA",RSNCD="AB3" Q   ;exception | 
|---|
|  | 134 | . . . I GRPCD="LQ" Q               ;exception | 
|---|
|  | 135 | . . . ; set Claim Adjustment only if none were found at the claim level (don't check for group code) | 
|---|
|  | 136 | . . . I RCLMADJ[(","_RSNCD_",") S CLMADJ=CLMADJ+$P(RLVLD,U,2) | 
|---|
|  | 137 | . . . ; Coinsurance | 
|---|
|  | 138 | . . . I GRPCD="PR",RCOINS[(","_RSNCD_",") S IBCOINS=IBCOINS+$P(RLVLD,U,2) Q | 
|---|
|  | 139 | . . . ; Deductible | 
|---|
|  | 140 | . . . I GRPCD="PR" I RCDED[(","_RSNCD_",") S IBDED=IBDED+$P(RLVLD,U,2) Q | 
|---|
|  | 141 | . . . I GRPCD="CO" D  ; | 
|---|
|  | 142 | . . . . ; Contractual Adjustment | 
|---|
|  | 143 | . . . . I RCTADJ[(","_RSNCD_",") S IBCTADJ=IBCTADJ+$P(RLVLD,U,2) | 
|---|
|  | 144 | . . . . ; Noncovered Charges | 
|---|
|  | 145 | . . . . I RCNCVR'[(","_RSNCD_",") S NCVRCHRG=NCVRCHRG+$P(RLVLD,U,2) | 
|---|
|  | 146 | Q  ;LINELVL | 
|---|
|  | 147 | ; | 
|---|