Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBCICME1

IBCICME1.m

Go to the documentation of this file.
  1. IBCICME1 ;DSI/ESG - IBCI CLAIMSMANAGER ERROR REPORT <CONT> ;6-APR-2001
  1. ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. BUILD ; Build the scratch global based on the selection and sort criteria
  1. ;
  1. NEW REF,MNEMONIC,RDT,IBIFN,CMDATA,IBDATA,CMSTATUS,BILLID,PATDATA
  1. NEW NAME,SSN,BILLER,CODER,OIFLG,ASSIGNED,CHARGES,ERR,ERRCODES
  1. NEW SORT1,SORT2,SORT3,SORT4,SORT5,RPTDATA,ERRIEN,LINENO
  1. NEW COUNT,BILCOUNT,ERRCOUNT,INSNAME
  1. ;
  1. KILL ^TMP($J,IBCIRTN),^TMP($J,IBCIRTN_"-LIST-OF-BILLS")
  1. KILL ^TMP($J,IBCIRTN_"-TOTALS")
  1. ;
  1. ; which array are we looping through? Find out here.
  1. S REF="RPTSPECS(""SELECTED ERRCODES"")"
  1. I RPTSPECS("ALL ERRCODES") S REF="^IBA(351.9,""AEC"")"
  1. ;
  1. S MNEMONIC="",(COUNT,BILCOUNT,ERRCOUNT)=0
  1. F S MNEMONIC=$O(@REF@(MNEMONIC)) Q:MNEMONIC=""!$G(ZTSTOP) D
  1. . S IBIFN=0
  1. . F S IBIFN=$O(^IBA(351.9,"AEC",MNEMONIC,IBIFN)) Q:'IBIFN!$G(ZTSTOP) D
  1. .. S COUNT=COUNT+1
  1. .. I $D(ZTQUEUED),COUNT#100=0,$$S^%ZTLOAD() S ZTSTOP=1 Q
  1. .. S CMDATA=$G(^IBA(351.9,IBIFN,0))
  1. .. I CMDATA="" Q
  1. .. S IBDATA=$G(^DGCR(399,IBIFN,0))
  1. .. I IBDATA="" Q
  1. .. ;
  1. .. ; Get the date that the user selected and check it
  1. .. S RDT=9999999
  1. .. I RPTSPECS("DATYP")=1 S RDT=$P($P(IBDATA,U,3),".",1)
  1. .. I RPTSPECS("DATYP")=2 S RDT=$P($P($G(^DGCR(399,IBIFN,"S")),U,1),".",1)
  1. .. I RDT<RPTSPECS("BEGDATE") Q ; date too early
  1. .. I RDT>RPTSPECS("ENDDATE") Q ; date too late
  1. .. ;
  1. .. ; If the user chose a specific ClaimsManager status to report
  1. .. ; on, then make sure this bill has the status they want.
  1. .. S CMSTATUS=$P(CMDATA,U,2)
  1. .. I RPTSPECS("STATYP")=2,CMSTATUS'=RPTSPECS("IBCISTAT") Q
  1. .. ;
  1. .. ; If the user wants to see bills that are still open for editing
  1. .. I RPTSPECS("STATYP")=3,'$F(".1.","."_$P(IBDATA,U,13)_".") Q ;DSI/DJW 3/21/02
  1. .. ;
  1. .. ; If the user wants to include a specific assigned to person,
  1. .. ; then make sure the assigned to person is the one they want.
  1. .. I RPTSPECS("ASNDUZ"),RPTSPECS("ASNDUZ")'=$P(CMDATA,U,12) Q
  1. .. ;
  1. .. ; At this point, we know we want to include this bill.
  1. .. D GETDATA
  1. .. I '$D(^TMP($J,IBCIRTN_"-LIST-OF-BILLS",IBIFN)) S ^TMP($J,IBCIRTN_"-LIST-OF-BILLS",IBIFN)="",BILCOUNT=BILCOUNT+1
  1. .. ;
  1. .. ; esg - 6/12/01
  1. .. ; Determine what the value of SORT2 should be based on the user's
  1. .. ; response to the Error Display Type question.
  1. .. ;
  1. .. I RPTSPECS("ERROR DISPLAY TYPE")=2 S SORT2=" "_MNEMONIC
  1. .. S ^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)=RPTDATA
  1. .. ;
  1. .. ; continue looping to get the error level data and the totals
  1. .. S ERRIEN=0
  1. .. F S ERRIEN=$O(^IBA(351.9,"AEC",MNEMONIC,IBIFN,ERRIEN)) Q:'ERRIEN D
  1. ... S ERRCOUNT=ERRCOUNT+1
  1. ... S LINENO=$G(^IBA(351.9,IBIFN,1,ERRIEN,0))
  1. ... S LINENO=$P($P(LINENO,U,2),"~",1)
  1. ... S ^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN,ERRIEN)=LINENO_U_MNEMONIC
  1. ... S ^TMP($J,IBCIRTN_"-TOTALS",MNEMONIC)=$G(^TMP($J,IBCIRTN_"-TOTALS",MNEMONIC))+1
  1. ... Q
  1. .. Q
  1. . Q
  1. S ^TMP($J,IBCIRTN_"-TOTALS")=BILCOUNT_U_ERRCOUNT
  1. KILL ^TMP($J,IBCIRTN_"-LIST-OF-BILLS")
  1. ;
  1. BUILDX ;
  1. Q
  1. ;
  1. ;
  1. GETDATA ; Retrieve the data for this bill
  1. S BILLID=$P(IBDATA,U,1) ; bill number
  1. S PATDATA=$G(^DPT(+$P(IBDATA,U,2),0))
  1. I PATDATA="" Q
  1. S NAME=$P(PATDATA,U,1) ; patient name
  1. I NAME="" S NAME="UNKNOWN"
  1. S NAMESUB=$E(NAME,1,15)_+$P(IBDATA,U,2) ; name subscript
  1. S SSN=$P(PATDATA,U,9) ; patient ssn
  1. S BILLER=$P($$BILLER^IBCIUT5(IBIFN),U,2)
  1. I BILLER="" S BILLER="UNKNOWN"
  1. S CODER=$$CODER^IBCIUT5(IBIFN)
  1. S OIFLG=$P(CODER,U,1) ; inpatient/outpatient flag
  1. S CODER=$P(CODER,U,3)
  1. I CODER="" S CODER="UNKNOWN"
  1. S ASSIGNED=$P($G(^VA(200,+$P(CMDATA,U,12),0)),U,1) ; assigned to
  1. I ASSIGNED="" S ASSIGNED="UNASSIGNED"
  1. S ASNSUB=$E(ASSIGNED,1,12)_+$P(CMDATA,U,12) ; assigned to subscript
  1. S CHARGES=+$P($G(^DGCR(399,IBIFN,"U1")),U,1) ; total charges
  1. S (ERR,ERRCODES)=""
  1. F S ERR=$O(^IBA(351.9,IBIFN,1,"B",ERR)) Q:ERR="" D
  1. . I ERRCODES="" S ERRCODES=ERR
  1. . E S ERRCODES=ERRCODES_","_ERR ; build the list of error codes
  1. . Q
  1. ;
  1. ; set the sort variables and build the scratch global
  1. S (SORT1,SORT2,SORT3,SORT4,SORT5)=1
  1. I RPTSPECS("ASNSORT") S SORT3=" "_ASNSUB
  1. I RPTSPECS("SORTBY")=1 S SORT4=" "_$P($$TD^IBCIUT5(IBIFN),U,1)
  1. I RPTSPECS("SORTBY")=2 D
  1. . S INSNAME=$P($G(^DIC(36,+$$FINDINS^IBCEF1(IBIFN),0)),U,1)
  1. . I INSNAME="" S INSNAME="~~~ NO INSURANCE ~~~"
  1. . S SORT4=" "_$E(INSNAME,1,25)
  1. . Q
  1. I RPTSPECS("SORTBY")=3 S SORT4=" "_NAMESUB
  1. I RPTSPECS("SORTBY")=4 S SORT4=-CHARGES
  1. I RPTSPECS("SORTBY")=5 S SORT4=" "_BILLID
  1. ;
  1. S RPTDATA=BILLID_U_SSN_U_$P(RDT,".",1)_U_BILLER_U_CODER_U_ASSIGNED_U_OIFLG_U_CHARGES_U_CMSTATUS_U_ERRCODES
  1. ;
  1. ; Build an array with the total number of bills in each status
  1. ; This array will be used in the report print routines and it is
  1. ; available in both the status report and the error report.
  1. ; esg - 5/22/01
  1. ;
  1. ; bill count by status
  1. S IBCISCNT(1,CMSTATUS)=$G(IBCISCNT(1,CMSTATUS))+1
  1. S IBCISCNT(1)=$G(IBCISCNT(1))+1
  1. ;
  1. ; charges by status
  1. S IBCISCNT(2,CMSTATUS)=$G(IBCISCNT(2,CMSTATUS))+CHARGES
  1. S IBCISCNT(2)=$G(IBCISCNT(2))+CHARGES
  1. ;
  1. GETDATX ;
  1. Q
  1. ;