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

IBCRHBC3.m

Go to the documentation of this file.
  1. IBCRHBC3 ;ALB/ARH - RATES: UPLOAD HOST FILES (CMAC 2005+) ; 10-MAY-2005
  1. ;;2.0;INTEGRATED BILLING;**307,329**;21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ; ROUTINE SPECIFIC FOR FORMAT OF YEAR 2005+ CMAC FILES
  1. ;
  1. CMAC(IBPATH,IBFILE,IBNAME,IBMODP,IBMODT) ; upload CMAC file from a VMS file into ^XTMP
  1. N X,Y,IBI,IBXRF,IBDONE,IBXRF1,IBXRF2,IBFLINE,IBINACT,IBMOD,IBCHG
  1. N IBLOC,IBCPT,IBNFP,IBFP,IBNFNP,IBFNP,IBEFDT,IBTRDT,IBPPC,IBPTC,IBNPPC,IBNPTC
  1. ;
  1. D SETUP(IBFILE,IBNAME)
  1. ;
  1. S IBXRF=IBNAME_IBFILE,IBLOC="",IBDONE=""
  1. ;
  1. D OPEN^%ZISH("CMAC UPLOAD",IBPATH,IBFILE,"R") I POP W !!,"**** Unable to open ",IBPATH,IBFILE,! G CMACQ
  1. ;
  1. U IO(0) W !!,"Loading ",IBFILE," into ^XTMP "
  1. ;
  1. S IBI=0 F S IBI=IBI+1 U IO R IBFLINE:5 Q:$$ENDF D PARSE,STORE I '(IBI#100) U IO(0) W "."
  1. ;
  1. D CLOSE^%ZISH("CMAC UPLOAD")
  1. ;
  1. S IBDONE=(IBI-1)_U_IBXRF
  1. ;
  1. CMACQ Q IBDONE
  1. ;
  1. ENDF() N IBX S IBX=1 I $T,IBFLINE'="" S IBX=0
  1. I $$STATUS^%ZISH S IBX=1
  1. I 'IBX,'$$LNFORM(IBFLINE) D
  1. . U IO(0)
  1. . W !!,"**** Error while reading file: line not expected format (98 numeric characters):"
  1. . W !!,"Line Length=",$L(IBFLINE)," characters" W:IBFLINE="" ?40,"Line read is null"
  1. . W !,"LINE='",IBFLINE,"'",!!,"Upload Aborted!"
  1. . S IBX=1 H 7 U IO
  1. I IBI=1,IBFLINE="" U IO(0) W !!,"First line of file has no data, can not continue!" S IBX=1 H 7 U IO
  1. Q IBX
  1. ;
  1. LNFORM(LINE) ; check an individual line of the file for proper format (length=98 characters)
  1. N IBX S IBX=0,LINE=$G(LINE) I (LINE?98N)!(LINE?3N5AN90N) S IBX=1
  1. Q IBX
  1. ;
  1. PARSE ; process a single line from a CMAC file: parse out into individual fields and store the line in XTMP
  1. ;
  1. S IBLOC=$E(IBFLINE,1,3) ; locality
  1. S IBCPT=$E(IBFLINE,4,8) ; CPT procedure
  1. S IBNFP=$E(IBFLINE,9,16) ; category 2 Non-Facility Physician charge
  1. S IBFP=$E(IBFLINE,17,24) ; category 1 Facility Physician charge
  1. S IBNFNP=$E(IBFLINE,25,32) ; category 4 Non-Facility Non-Physician charge
  1. S IBFNP=$E(IBFLINE,33,40) ; category 3 Facility Non-Physician charge
  1. S IBEFDT=$E(IBFLINE,41,48) ; effective date
  1. S IBTRDT=$E(IBFLINE,57,64) ; termination date
  1. S IBPPC=$E(IBFLINE,65,72) ; Physician professional component
  1. S IBPTC=$E(IBFLINE,73,80) ; Physician technical component
  1. S IBNPPC=$E(IBFLINE,81,88) ; Non-Physician professional component
  1. S IBNPTC=$E(IBFLINE,89,96) ; Non-Physician technical component
  1. Q
  1. ;
  1. STORE ;
  1. S IBXRF1=IBXRF_" "_IBLOC
  1. ;
  1. S IBMOD="",IBEFDT=$$DATE(IBEFDT),IBINACT="" I IBTRDT'=99999999,+IBTRDT S IBINACT=$$DATE(IBTRDT)
  1. ;
  1. I +IBFP S IBCHG=$$CGF(IBFP),IBMOD="" S IBXRF2="FAC/PHYS CAT 1" D SET
  1. I +IBFNP S IBCHG=$$CGF(IBFNP),IBMOD="" S IBXRF2="FAC/NONPHYS CAT 3" D SET
  1. ;
  1. I +IBNFP S IBCHG=$$CGF(IBNFP),IBMOD="" S IBXRF2="NONFAC/PHYS CAT 2" D SET
  1. I +IBNFNP S IBCHG=$$CGF(IBNFNP),IBMOD="" S IBXRF2="NONFAC/NONPHYS CAT 4" D SET
  1. ;
  1. I +IBMODP,+IBPPC S IBCHG=$$CGF(IBPPC),IBMOD=IBMODP S IBXRF2="FAC/PHYS PC" D SET S IBXRF2="NON"_IBXRF2 D SET
  1. I +IBMODT,+IBPTC S IBCHG=$$CGF(IBPTC),IBMOD=IBMODT S IBXRF2="FAC/PHYS TC" D SET S IBXRF2="NON"_IBXRF2 D SET
  1. ;
  1. I +IBMODP,+IBNPPC S IBCHG=$$CGF(IBNPPC),IBMOD=IBMODP S IBXRF2="FAC/NONPHYS PC" D SET S IBXRF2="NON"_IBXRF2 D SET
  1. I +IBMODT,+IBNPTC S IBCHG=$$CGF(IBNPTC),IBMOD=IBMODT S IBXRF2="FAC/NONPHYS TC" D SET S IBXRF2="NON"_IBXRF2 D SET
  1. ;
  1. Q
  1. ;
  1. CGF(AMT) ; return charge string from file line in dollar format
  1. Q +($E(AMT,1,6)_"."_$E(AMT,7,8))
  1. ;
  1. SET ;
  1. N IBX S IBX=$G(^XTMP(IBXRF1,0)) I IBX="" D SETHDR
  1. S $P(^XTMP(IBXRF1,0),U,4)=+$P(IBX,U,4)+1
  1. S $P(^XTMP(IBXRF1,IBXRF2),U,1)=+$G(^XTMP(IBXRF1,IBXRF2))+1
  1. S ^XTMP(IBXRF1,IBXRF2,IBI)=IBCPT_U_IBEFDT_U_IBINACT_U_+IBCHG_U_IBMOD
  1. Q
  1. ;
  1. SETHDR ;
  1. N IBX S IBX="IB upload of Host file "_IBFILE_", on "_$$HTE^XLFDT($H,2)_" by "_$P($G(^VA(200,+$G(DUZ),0)),U,1)
  1. S ^XTMP(IBXRF1,0)=$$FMADD^XLFDT(DT,2)_U_DT_U_IBX
  1. ;
  1. S ^XTMP(IBXRF1,IBXRF2)=0_U_2_U_$G(IBCS)
  1. Q
  1. ;
  1. ;
  1. DATE(DATE) ; return yymmdd in FM format
  1. N IBX S IBX="" I $G(DATE)?8N S IBX=$S($E(DATE,1,2)<20:"2",1:"3")_$E(DATE,3,8)
  1. Q IBX
  1. ;
  1. ;
  1. LNDT(LINE) ; return the date of an individual line, in FM format
  1. N IBX S IBX=$E($G(LINE),41,48) S IBX=$$DATE(IBX)
  1. Q IBX
  1. ;
  1. ;
  1. ;
  1. SETUP(IBFILE,IBNAME) ; set up Charge Sets, Billing Regions, Rate Schedule links for new charges
  1. ; if new region entered, asks user for divisions
  1. N IBLOC,IBXRF1,IBXRF2,IBEVENT,IBCT,IBBS,IBRV,IBRG,IBCS
  1. ;
  1. S IBLOC=$P($P($G(IBFILE),"CMAC",2),".",1),IBXRF1=$G(IBNAME)_IBFILE_" "_IBLOC
  1. S IBEVENT="PROCEDURE",IBCT="PROF",IBBS="OUTPATIENT VISIT",IBRV=510
  1. ;
  1. ;
  1. ; Find/Create Billing Region
  1. S IBRG=$$RG^IBCRHU2("CMAC "_IBLOC,,IBLOC)
  1. ;
  1. ;
  1. ; Category 1 Facility Physician Charges
  1. S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" FAC/PHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
  1. D RSBR^IBCRHU2(IBCS,1,$G(IBGLBEFF))
  1. F IBXRF2="FAC/PHYS CAT 1","FAC/PHYS PC","FAC/PHYS TC" D SETHDR
  1. ;
  1. ;
  1. ; Category 3 Facility Non-Physician Charges
  1. S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" FAC/NONPHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
  1. D RSBR^IBCRHU2(IBCS,0,$G(IBGLBEFF))
  1. F IBXRF2="FAC/NONPHYS CAT 3","FAC/NONPHYS PC","FAC/NONPHYS TC" D SETHDR
  1. ;
  1. ;
  1. ; Category 2 Non-Facility Physician Charges
  1. S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" NONFAC/PHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
  1. D RSBR^IBCRHU2(IBCS,0,$G(IBGLBEFF))
  1. F IBXRF2="NONFAC/PHYS CAT 2","NONFAC/PHYS PC","NONFAC/PHYS TC" D SETHDR
  1. ;
  1. ;
  1. ; Category 4 Non-Facility Non-Physician Charges
  1. S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" NONFAC/NONPHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
  1. D RSBR^IBCRHU2(IBCS,0,$G(IBGLBEFF))
  1. F IBXRF2="NONFAC/NONPHYS CAT 4","NONFAC/NONPHYS PC","NONFAC/NONPHYS TC" D SETHDR
  1. ;
  1. ;
  1. ; get divisions added to new Billing Region
  1. I +$P(IBRG,U,3) D GETDIV^IBCRHU2(+IBRG)
  1. Q