[613] | 1 | IBCICME1 ;DSI/ESG - IBCI CLAIMSMANAGER ERROR REPORT <CONT> ;6-APR-2001
|
---|
| 2 | ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94
|
---|
| 3 | ;;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
| 4 | ;
|
---|
| 5 | BUILD ; Build the scratch global based on the selection and sort criteria
|
---|
| 6 | ;
|
---|
| 7 | NEW REF,MNEMONIC,RDT,IBIFN,CMDATA,IBDATA,CMSTATUS,BILLID,PATDATA
|
---|
| 8 | NEW NAME,SSN,BILLER,CODER,OIFLG,ASSIGNED,CHARGES,ERR,ERRCODES
|
---|
| 9 | NEW SORT1,SORT2,SORT3,SORT4,SORT5,RPTDATA,ERRIEN,LINENO
|
---|
| 10 | NEW COUNT,BILCOUNT,ERRCOUNT,INSNAME
|
---|
| 11 | ;
|
---|
| 12 | KILL ^TMP($J,IBCIRTN),^TMP($J,IBCIRTN_"-LIST-OF-BILLS")
|
---|
| 13 | KILL ^TMP($J,IBCIRTN_"-TOTALS")
|
---|
| 14 | ;
|
---|
| 15 | ; which array are we looping through? Find out here.
|
---|
| 16 | S REF="RPTSPECS(""SELECTED ERRCODES"")"
|
---|
| 17 | I RPTSPECS("ALL ERRCODES") S REF="^IBA(351.9,""AEC"")"
|
---|
| 18 | ;
|
---|
| 19 | S MNEMONIC="",(COUNT,BILCOUNT,ERRCOUNT)=0
|
---|
| 20 | F S MNEMONIC=$O(@REF@(MNEMONIC)) Q:MNEMONIC=""!$G(ZTSTOP) D
|
---|
| 21 | . S IBIFN=0
|
---|
| 22 | . F S IBIFN=$O(^IBA(351.9,"AEC",MNEMONIC,IBIFN)) Q:'IBIFN!$G(ZTSTOP) D
|
---|
| 23 | .. S COUNT=COUNT+1
|
---|
| 24 | .. I $D(ZTQUEUED),COUNT#100=0,$$S^%ZTLOAD() S ZTSTOP=1 Q
|
---|
| 25 | .. S CMDATA=$G(^IBA(351.9,IBIFN,0))
|
---|
| 26 | .. I CMDATA="" Q
|
---|
| 27 | .. S IBDATA=$G(^DGCR(399,IBIFN,0))
|
---|
| 28 | .. I IBDATA="" Q
|
---|
| 29 | .. ;
|
---|
| 30 | .. ; Get the date that the user selected and check it
|
---|
| 31 | .. S RDT=9999999
|
---|
| 32 | .. I RPTSPECS("DATYP")=1 S RDT=$P($P(IBDATA,U,3),".",1)
|
---|
| 33 | .. I RPTSPECS("DATYP")=2 S RDT=$P($P($G(^DGCR(399,IBIFN,"S")),U,1),".",1)
|
---|
| 34 | .. I RDT<RPTSPECS("BEGDATE") Q ; date too early
|
---|
| 35 | .. I RDT>RPTSPECS("ENDDATE") Q ; date too late
|
---|
| 36 | .. ;
|
---|
| 37 | .. ; If the user chose a specific ClaimsManager status to report
|
---|
| 38 | .. ; on, then make sure this bill has the status they want.
|
---|
| 39 | .. S CMSTATUS=$P(CMDATA,U,2)
|
---|
| 40 | .. I RPTSPECS("STATYP")=2,CMSTATUS'=RPTSPECS("IBCISTAT") Q
|
---|
| 41 | .. ;
|
---|
| 42 | .. ; If the user wants to see bills that are still open for editing
|
---|
| 43 | .. I RPTSPECS("STATYP")=3,'$F(".1.","."_$P(IBDATA,U,13)_".") Q ;DSI/DJW 3/21/02
|
---|
| 44 | .. ;
|
---|
| 45 | .. ; If the user wants to include a specific assigned to person,
|
---|
| 46 | .. ; then make sure the assigned to person is the one they want.
|
---|
| 47 | .. I RPTSPECS("ASNDUZ"),RPTSPECS("ASNDUZ")'=$P(CMDATA,U,12) Q
|
---|
| 48 | .. ;
|
---|
| 49 | .. ; At this point, we know we want to include this bill.
|
---|
| 50 | .. D GETDATA
|
---|
| 51 | .. I '$D(^TMP($J,IBCIRTN_"-LIST-OF-BILLS",IBIFN)) S ^TMP($J,IBCIRTN_"-LIST-OF-BILLS",IBIFN)="",BILCOUNT=BILCOUNT+1
|
---|
| 52 | .. ;
|
---|
| 53 | .. ; esg - 6/12/01
|
---|
| 54 | .. ; Determine what the value of SORT2 should be based on the user's
|
---|
| 55 | .. ; response to the Error Display Type question.
|
---|
| 56 | .. ;
|
---|
| 57 | .. I RPTSPECS("ERROR DISPLAY TYPE")=2 S SORT2=" "_MNEMONIC
|
---|
| 58 | .. S ^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)=RPTDATA
|
---|
| 59 | .. ;
|
---|
| 60 | .. ; continue looping to get the error level data and the totals
|
---|
| 61 | .. S ERRIEN=0
|
---|
| 62 | .. F S ERRIEN=$O(^IBA(351.9,"AEC",MNEMONIC,IBIFN,ERRIEN)) Q:'ERRIEN D
|
---|
| 63 | ... S ERRCOUNT=ERRCOUNT+1
|
---|
| 64 | ... S LINENO=$G(^IBA(351.9,IBIFN,1,ERRIEN,0))
|
---|
| 65 | ... S LINENO=$P($P(LINENO,U,2),"~",1)
|
---|
| 66 | ... S ^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN,ERRIEN)=LINENO_U_MNEMONIC
|
---|
| 67 | ... S ^TMP($J,IBCIRTN_"-TOTALS",MNEMONIC)=$G(^TMP($J,IBCIRTN_"-TOTALS",MNEMONIC))+1
|
---|
| 68 | ... Q
|
---|
| 69 | .. Q
|
---|
| 70 | . Q
|
---|
| 71 | S ^TMP($J,IBCIRTN_"-TOTALS")=BILCOUNT_U_ERRCOUNT
|
---|
| 72 | KILL ^TMP($J,IBCIRTN_"-LIST-OF-BILLS")
|
---|
| 73 | ;
|
---|
| 74 | BUILDX ;
|
---|
| 75 | Q
|
---|
| 76 | ;
|
---|
| 77 | ;
|
---|
| 78 | GETDATA ; Retrieve the data for this bill
|
---|
| 79 | S BILLID=$P(IBDATA,U,1) ; bill number
|
---|
| 80 | S PATDATA=$G(^DPT(+$P(IBDATA,U,2),0))
|
---|
| 81 | I PATDATA="" Q
|
---|
| 82 | S NAME=$P(PATDATA,U,1) ; patient name
|
---|
| 83 | I NAME="" S NAME="UNKNOWN"
|
---|
| 84 | S NAMESUB=$E(NAME,1,15)_+$P(IBDATA,U,2) ; name subscript
|
---|
| 85 | S SSN=$P(PATDATA,U,9) ; patient ssn
|
---|
| 86 | S BILLER=$P($$BILLER^IBCIUT5(IBIFN),U,2)
|
---|
| 87 | I BILLER="" S BILLER="UNKNOWN"
|
---|
| 88 | S CODER=$$CODER^IBCIUT5(IBIFN)
|
---|
| 89 | S OIFLG=$P(CODER,U,1) ; inpatient/outpatient flag
|
---|
| 90 | S CODER=$P(CODER,U,3)
|
---|
| 91 | I CODER="" S CODER="UNKNOWN"
|
---|
| 92 | S ASSIGNED=$P($G(^VA(200,+$P(CMDATA,U,12),0)),U,1) ; assigned to
|
---|
| 93 | I ASSIGNED="" S ASSIGNED="UNASSIGNED"
|
---|
| 94 | S ASNSUB=$E(ASSIGNED,1,12)_+$P(CMDATA,U,12) ; assigned to subscript
|
---|
| 95 | S CHARGES=+$P($G(^DGCR(399,IBIFN,"U1")),U,1) ; total charges
|
---|
| 96 | S (ERR,ERRCODES)=""
|
---|
| 97 | F S ERR=$O(^IBA(351.9,IBIFN,1,"B",ERR)) Q:ERR="" D
|
---|
| 98 | . I ERRCODES="" S ERRCODES=ERR
|
---|
| 99 | . E S ERRCODES=ERRCODES_","_ERR ; build the list of error codes
|
---|
| 100 | . Q
|
---|
| 101 | ;
|
---|
| 102 | ; set the sort variables and build the scratch global
|
---|
| 103 | S (SORT1,SORT2,SORT3,SORT4,SORT5)=1
|
---|
| 104 | I RPTSPECS("ASNSORT") S SORT3=" "_ASNSUB
|
---|
| 105 | I RPTSPECS("SORTBY")=1 S SORT4=" "_$P($$TD^IBCIUT5(IBIFN),U,1)
|
---|
| 106 | I RPTSPECS("SORTBY")=2 D
|
---|
| 107 | . S INSNAME=$P($G(^DIC(36,+$$FINDINS^IBCEF1(IBIFN),0)),U,1)
|
---|
| 108 | . I INSNAME="" S INSNAME="~~~ NO INSURANCE ~~~"
|
---|
| 109 | . S SORT4=" "_$E(INSNAME,1,25)
|
---|
| 110 | . Q
|
---|
| 111 | I RPTSPECS("SORTBY")=3 S SORT4=" "_NAMESUB
|
---|
| 112 | I RPTSPECS("SORTBY")=4 S SORT4=-CHARGES
|
---|
| 113 | I RPTSPECS("SORTBY")=5 S SORT4=" "_BILLID
|
---|
| 114 | ;
|
---|
| 115 | S RPTDATA=BILLID_U_SSN_U_$P(RDT,".",1)_U_BILLER_U_CODER_U_ASSIGNED_U_OIFLG_U_CHARGES_U_CMSTATUS_U_ERRCODES
|
---|
| 116 | ;
|
---|
| 117 | ; Build an array with the total number of bills in each status
|
---|
| 118 | ; This array will be used in the report print routines and it is
|
---|
| 119 | ; available in both the status report and the error report.
|
---|
| 120 | ; esg - 5/22/01
|
---|
| 121 | ;
|
---|
| 122 | ; bill count by status
|
---|
| 123 | S IBCISCNT(1,CMSTATUS)=$G(IBCISCNT(1,CMSTATUS))+1
|
---|
| 124 | S IBCISCNT(1)=$G(IBCISCNT(1))+1
|
---|
| 125 | ;
|
---|
| 126 | ; charges by status
|
---|
| 127 | S IBCISCNT(2,CMSTATUS)=$G(IBCISCNT(2,CMSTATUS))+CHARGES
|
---|
| 128 | S IBCISCNT(2)=$G(IBCISCNT(2))+CHARGES
|
---|
| 129 | ;
|
---|
| 130 | GETDATX ;
|
---|
| 131 | Q
|
---|
| 132 | ;
|
---|