| 1 | IBCRHBRV ;ALB/ARH - RATES: UPLOAD (RC) VERSION FUNCTIONS ; 14-FEB-01
 | 
|---|
| 2 |  ;;2.0;INTEGRATED BILLING;**148,169,245,270,285,298,325,334,355,360,365,382,390**;21-MAR-94;Build 2
 | 
|---|
| 3 |  ;;Per VHA Directive 2004-038, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  ; RC functions related to Version.  Update VLIST with new versions.  Update FTYPE if new types of files.
 | 
|---|
| 6 |  ;
 | 
|---|
| 7 | SELVERS() ; get version to upload from user
 | 
|---|
| 8 |  N DIR,DIRUT,DTOUT,DUOUT,IBVLIST,IBQUIT,IBVERS,IBI,IBJ,IBX,X,Y
 | 
|---|
| 9 |  ;
 | 
|---|
| 10 |  S IBVLIST=$$VERSTR(),IBQUIT=0,IBVERS=0
 | 
|---|
| 11 |  ;
 | 
|---|
| 12 |  W !!,"Select the version of Reasonable Charges to upload."
 | 
|---|
| 13 |  S DIR("?",1)="Enter the code from the list corresponding to the version of Reasonable Charges"
 | 
|---|
| 14 |  S DIR("?",2)="to upload.  There are no version 1.3, 2.2, or 2.10 (ten) RC charges." S DIR("?",3)=" "
 | 
|---|
| 15 |  S DIR("?",4)="Versions: "_IBVLIST S DIR("?",5)=" " S DIR("?")="Enter version number to upload."
 | 
|---|
| 16 |  ;
 | 
|---|
| 17 |  F IBI=1:1 D  I +IBQUIT Q
 | 
|---|
| 18 |  . W !!,?5,"Select one of the following:",!
 | 
|---|
| 19 |  . F IBJ=1:1 S IBX=$P(IBVLIST,",",IBJ) Q:'IBX  W !,?10,IBX,?20,"Reasonable Charges version ",IBX
 | 
|---|
| 20 |  . ;
 | 
|---|
| 21 |  . W ! S DIR("A")="Enter Version" S DIR(0)="FO^1:5" D ^DIR I $D(DIRUT) S IBQUIT=1
 | 
|---|
| 22 |  . I Y>0,(","_IBVLIST_",")[(","_Y_",") S IBVERS=Y,IBQUIT=1 W "  Reasonable Charges version ",IBVERS
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  Q IBVERS
 | 
|---|
| 25 |  ;
 | 
|---|
| 26 | VERSION() ; return currently loaded version of RC files (1, 1.1, ...)
 | 
|---|
| 27 |  N IBX S IBX=$G(^XTMP("IBCR RC SITE","VERSION"))
 | 
|---|
| 28 |  Q IBX
 | 
|---|
| 29 |  ;
 | 
|---|
| 30 | VERSDT(VERS) ; return Effective Date of a version of RC files, either version passed in or currently loaded version
 | 
|---|
| 31 |  N IBI,LINE,IBX S IBX="" S VERS=+$G(VERS) I 'VERS S VERS=$$VERSION
 | 
|---|
| 32 |  I +VERS F IBI=1:1 S LINE=$P($T(VLIST+IBI),";;",2,99) Q:'LINE  I VERS=+LINE S IBX=$P(LINE,U,3)
 | 
|---|
| 33 |  Q IBX
 | 
|---|
| 34 |  ;
 | 
|---|
| 35 | VERSEDT(VERS) ; return Inactive Date of a version of RC files, either version passed in or currently loaded version
 | 
|---|
| 36 |  N IBI,LINE,IBX S IBX="" S VERS=+$G(VERS) I 'VERS S VERS=$$VERSION
 | 
|---|
| 37 |  I +VERS F IBI=1:1 S LINE=$P($T(VLIST+IBI),";;",2,99) Q:'LINE  I VERS=+LINE S IBX=$P(LINE,U,4)
 | 
|---|
| 38 |  Q IBX
 | 
|---|
| 39 |  ;
 | 
|---|
| 40 | VERSALL() ; return all RC versions and corresponding effective date 'VERS;EFFDT^VERS;EFFDT^...'
 | 
|---|
| 41 |  N IBI,LINE,IBX,IBC S IBX="",IBC=""
 | 
|---|
| 42 |  F IBI=1:1 S LINE=$P($T(VLIST+IBI),";;",2,99) Q:'LINE  S IBX=IBX_IBC_+LINE_";"_$P(LINE,U,3),IBC=U
 | 
|---|
| 43 |  Q IBX
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 | VERSEND() ; return all RC versions and corresponding inactive date 'VERS;INACTIVE DT^VERS;INACTIVE DT^...'
 | 
|---|
| 46 |  N IBI,LINE,IBX,IBC S IBX="",IBC=""
 | 
|---|
| 47 |  F IBI=1:1 S LINE=$P($T(VLIST+IBI),";;",2,99) Q:'LINE  I $P(LINE,U,4) S IBX=IBX_IBC_+LINE_";"_$P(LINE,U,4),IBC=U
 | 
|---|
| 48 |  Q IBX
 | 
|---|
| 49 |  ;
 | 
|---|
| 50 | VERSITE(SITE) ; returns the list of versions loaded for a particular site
 | 
|---|
| 51 |  ; *** uses 99201 in the RC PHYSICIAN set to check which versions/dates are loaded
 | 
|---|
| 52 |  ; *** so 99201 must have a pro charge in all versions, if not it must be replaced with an item that does
 | 
|---|
| 53 |  N IBCS,IBXRF,IBITM,IBVERS,IBCSFN,IBI,IBV,IBX,IBY,IBC
 | 
|---|
| 54 |  S IBVERS=$$VERSALL,IBITM=99201
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 |  I $G(SITE)'="" S IBCS="RC-PHYSICIAN" F  S IBCS=$O(^IBE(363.1,"B",IBCS)) Q:IBCS'["RC-PHYSICIAN"  D
 | 
|---|
| 57 |  . S IBV=$L(IBCS," ") I $P(IBCS," ",IBV)'=SITE Q
 | 
|---|
| 58 |  . S IBCSFN=$O(^IBE(363.1,"B",IBCS,0)) Q:'IBCSFN  S IBXRF="AIVDTS"_IBCSFN
 | 
|---|
| 59 |  . F IBI=1:1 S IBV=$P(IBVERS,U,IBI) Q:'IBV  I $O(^IBA(363.2,IBXRF,IBITM,-$P(IBV,";",2),0)) S IBY(+IBV)=""
 | 
|---|
| 60 |  ;
 | 
|---|
| 61 |  S (IBX,IBC)="" F IBI=1:1 S IBV=+$P(IBVERS,U,IBI) Q:'IBV  I $D(IBY(IBV)) S IBX=IBX_IBC_IBV S IBC=","
 | 
|---|
| 62 |  ;
 | 
|---|
| 63 |  Q IBX
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 | MSGSITE(SITE) ; display a message indicating which versions are loaded for a site
 | 
|---|
| 66 |  N IBVERS Q:'$G(SITE)
 | 
|---|
| 67 |  S IBVERS=$$VERSITE(SITE)
 | 
|---|
| 68 |  I 'IBVERS W !!,?12,"There appear to be no RC charges already loaded for "_SITE_"."
 | 
|---|
| 69 |  I +IBVERS W !!,?12,"RC versions "_IBVERS_" appear to be already loaded for "_SITE_"."
 | 
|---|
| 70 |  Q
 | 
|---|
| 71 |  ;
 | 
|---|
| 72 | MSGVERS(SITE) ; check if versions are being loaded in the correct order, should be loaded in date order
 | 
|---|
| 73 |  ;   - if loading a version that has already been loaded for the site
 | 
|---|
| 74 |  ;   - if loading a version when any future versions have already been loaded for the site
 | 
|---|
| 75 |  ;   - if loading a version when the last version has not yet been loaded for the site
 | 
|---|
| 76 |  ; *** uses 99201 in the RC PHYSICIAN set to check which versions/dates are loaded
 | 
|---|
| 77 |  ; *** so 99201 must have a pro charge in all versions, if not it must be replaced with an item that does
 | 
|---|
| 78 |  N IBVERS,IBVDTC,IBVERSIN,IBVERSC,IBVERSO,IBI,VERSTR Q:'$G(SITE)
 | 
|---|
| 79 |  ;
 | 
|---|
| 80 |  S IBVERS=$$VERSION Q:'IBVERS  S IBVDTC=$$VERSDT,IBVERSIN=","_$$VERSITE(SITE)_",",IBVERSC=","_IBVERS_","
 | 
|---|
| 81 |  ;
 | 
|---|
| 82 |  ; check if loading a version that has already been loaded
 | 
|---|
| 83 |  I IBVERSIN[IBVERSC D
 | 
|---|
| 84 |  . W !!,?5,"*** It appears version RC v",IBVERS," has already been loaded for this site ***"
 | 
|---|
| 85 |  ;
 | 
|---|
| 86 |  ; check if loading a version when any future versions have already been loaded
 | 
|---|
| 87 |  S VERSTR=","_$$VERSTR()_",",VERSTR=$P(VERSTR,IBVERSC,2) ; all versions after current version
 | 
|---|
| 88 |  F IBI=1:1 S IBVERSO=$P(VERSTR,",",IBI) Q:'IBVERSO  I IBVERSIN[(","_IBVERSO_",")  D
 | 
|---|
| 89 |  . W !!,?5,">>> Currently trying to load RC v"_IBVERS_" but RC v"_IBVERSO_" appears to be already",!,?9,"loaded for this site.  The versions should be loaded in date order."
 | 
|---|
| 90 |  ;
 | 
|---|
| 91 |  ; check if loading a version when the last version has not yet been loaded
 | 
|---|
| 92 |  S VERSTR=","_$$VERSTR(1)_",",VERSTR=$P(VERSTR,IBVERSC,2) ; all versions before current version, reverse order
 | 
|---|
| 93 |  S IBVERSO=$P(VERSTR,",",1) I +IBVERSO,IBVERSIN'[(","_IBVERSO_",") D
 | 
|---|
| 94 |  . W !!,?5,"*** Currently trying to load RC v"_IBVERS_" but RC v"_IBVERSO_" does not appear to be",!,?9,"loaded for this site.  The versions should be loaded in date order."
 | 
|---|
| 95 |  . W !!,?5,">>> Continue only if there will never be a need to bill events before ",!,?9,$$FMTE^XLFDT(IBVDTC,2)," for this site.  If RC v"_IBVERSO_" will be needed for this site then",!,?9,"load it first."
 | 
|---|
| 96 |  ;
 | 
|---|
| 97 |  Q
 | 
|---|
| 98 |  ;
 | 
|---|
| 99 | VERSTR(RVRS) ; returns string containing list of all Reasonable Charges versions with charges, separated by ","
 | 
|---|
| 100 |  ; RVRS - if set, returns the list of versions in reverse order
 | 
|---|
| 101 |  N IBI,LINE,IBS,IBR,IBC,IBX  S (IBS,IBR,IBC,IBX)=""
 | 
|---|
| 102 |  F IBI=1:1 S LINE=$P($T(VLIST+IBI),";;",2,99) Q:'LINE  S IBS=IBS_IBC_+LINE,IBR=+LINE_IBC_IBR S IBC=","
 | 
|---|
| 103 |  S IBX=IBS I +$G(RVRS) S IBX=IBR
 | 
|---|
| 104 |  Q IBX
 | 
|---|
| 105 |  ;
 | 
|---|
| 106 |  ;
 | 
|---|
| 107 |  ;
 | 
|---|
| 108 |  ;
 | 
|---|
| 109 |  ;
 | 
|---|
| 110 |  ;
 | 
|---|
| 111 |  ;
 | 
|---|
| 112 |  ; File Names:  'IBRCyymmx.TXT'   w/ yymm - year month of version release (except v1)
 | 
|---|
| 113 |  ;              'IBRCyymm', file version identifier prefix, from VLIST text version description
 | 
|---|
| 114 |  ;              x=A-I/F, single character file identifier, from FTYPE text file description
 | 
|---|
| 115 |  ;
 | 
|---|
| 116 | FILES(IBFILES,VERS) ; returns array of source Host Files and data for version requested, pass IBFILES by reference
 | 
|---|
| 117 |  N IBI,LINE,IBTYPE,IBFILE,IBNAME,IBDESC S VERS=+$G(VERS) I 'VERS S VERS=1
 | 
|---|
| 118 |  ;
 | 
|---|
| 119 |  ; get requested versions data
 | 
|---|
| 120 |  F IBI=1:1 S LINE=$P($T(VLIST+IBI),";;",2,99) Q:'LINE  I VERS=+LINE S IBTYPE=$P(LINE,U,2),IBFILE=$P(LINE,U,5) Q
 | 
|---|
| 121 |  ;
 | 
|---|
| 122 |  ; get requested versions files
 | 
|---|
| 123 |  I +$G(IBTYPE) F IBI=1:1 S LINE=$P($T(@("FT"_IBTYPE)+IBI),";;",2,99) Q:LINE=""  D
 | 
|---|
| 124 |  . S IBNAME=IBFILE_$P(LINE,":",1)_".TXT",IBDESC="RC v"_+VERS_" "_$P(LINE,":",2,99)
 | 
|---|
| 125 |  . S IBFILES(IBNAME)=IBDESC
 | 
|---|
| 126 |  Q
 | 
|---|
| 127 |  ;
 | 
|---|
| 128 |  ;
 | 
|---|
| 129 |  ; versions and their critical data, add new versions here
 | 
|---|
| 130 | VLIST ; version ^ file type/version ^ effective date ^ inactive date ^ file prefix
 | 
|---|
| 131 |  ;;1.0^1^2990901^3001101^IBRCV
 | 
|---|
| 132 |  ;;1.1^1^3001102^3010507^IBRC0011
 | 
|---|
| 133 |  ;;1.2^1^3010508^3030428^IBRC0105
 | 
|---|
| 134 |  ;;1.4^1^3030429^3031218^IBRC0304
 | 
|---|
| 135 |  ;;2.0^2^3031219^3040414^IBRC0312
 | 
|---|
| 136 |  ;;2.1^2^3040415^3041231^IBRC0404
 | 
|---|
| 137 |  ;;2.3^2^3050101^3050410^IBRC0501
 | 
|---|
| 138 |  ;;2.4^2^3050411^3050930^IBRC0504
 | 
|---|
| 139 |  ;;2.5^2^3051001^3051231^IBRC0510
 | 
|---|
| 140 |  ;;2.6^2^3060101^3060824^IBRC0601
 | 
|---|
| 141 |  ;;2.7^2^3060825^3060930^IBRC0608
 | 
|---|
| 142 |  ;;2.8^2^3061001^3061231^IBRC0610
 | 
|---|
| 143 |  ;;2.9^2^3070101^3070930^IBRC0701
 | 
|---|
| 144 |  ;;2.11^2^3071001^3071231^IBRC0710
 | 
|---|
| 145 |  ;;3.1^2^3080101^^IBRC0801
 | 
|---|
| 146 |  ;;
 | 
|---|
| 147 |  ; 
 | 
|---|
| 148 |  ; 
 | 
|---|
| 149 |  ; 
 | 
|---|
| 150 |  ; 
 | 
|---|
| 151 |  ; 
 | 
|---|
| 152 |  ; 
 | 
|---|
| 153 |  ; 
 | 
|---|
| 154 | FTYPE ; file type/versions and relevant data
 | 
|---|
| 155 |  ; file identifer is used with XTMP subscript 'IBCR RC ' and routine label to parse file
 | 
|---|
| 156 |  ; file identifier : file name/description ^ file identifier ^ number of columns (for v2+)
 | 
|---|
| 157 |  ;
 | 
|---|
| 158 | FT1 ; Reasonable Charge File Type 1 files
 | 
|---|
| 159 |  ;;A:Inpatient Facility Charges^A
 | 
|---|
| 160 |  ;;B:Inpatient Facility Area Factors^B
 | 
|---|
| 161 |  ;;C:Outpatient Facility Charges^C
 | 
|---|
| 162 |  ;;D:Outpatient Facility Area Factors^D
 | 
|---|
| 163 |  ;;E:Physician Charges E^E
 | 
|---|
| 164 |  ;;F:Physician Charges F^F
 | 
|---|
| 165 |  ;;G:Physician Charges G^G
 | 
|---|
| 166 |  ;;H:Physician Area Factors^H
 | 
|---|
| 167 |  ;;I:Physician Unit Area Factors^I
 | 
|---|
| 168 |  ;;
 | 
|---|
| 169 |  ;
 | 
|---|
| 170 | FT2 ; Reasonable Charges File Type 2 files
 | 
|---|
| 171 |  ;;A:Inpatient Facility Charges^A^10
 | 
|---|
| 172 |  ;;B:Outpatient Facility Charges^B^14
 | 
|---|
| 173 |  ;;C:Professional Charges^C^23
 | 
|---|
| 174 |  ;;D:Service Category Codes^D^4
 | 
|---|
| 175 |  ;;E:Area Factors^E^41
 | 
|---|
| 176 |  ;;F:VA Sites and Zip Codes^F^4
 | 
|---|
| 177 |  ;;
 | 
|---|