source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCRHBC3.m@ 1203

Last change on this file since 1203 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.5 KB
Line 
1IBCRHBC3 ;ALB/ARH - RATES: UPLOAD HOST FILES (CMAC 2005+) ; 10-MAY-2005
2 ;;2.0;INTEGRATED BILLING;**307,329**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; ROUTINE SPECIFIC FOR FORMAT OF YEAR 2005+ CMAC FILES
6 ;
7CMAC(IBPATH,IBFILE,IBNAME,IBMODP,IBMODT) ; upload CMAC file from a VMS file into ^XTMP
8 N X,Y,IBI,IBXRF,IBDONE,IBXRF1,IBXRF2,IBFLINE,IBINACT,IBMOD,IBCHG
9 N IBLOC,IBCPT,IBNFP,IBFP,IBNFNP,IBFNP,IBEFDT,IBTRDT,IBPPC,IBPTC,IBNPPC,IBNPTC
10 ;
11 D SETUP(IBFILE,IBNAME)
12 ;
13 S IBXRF=IBNAME_IBFILE,IBLOC="",IBDONE=""
14 ;
15 D OPEN^%ZISH("CMAC UPLOAD",IBPATH,IBFILE,"R") I POP W !!,"**** Unable to open ",IBPATH,IBFILE,! G CMACQ
16 ;
17 U IO(0) W !!,"Loading ",IBFILE," into ^XTMP "
18 ;
19 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 "."
20 ;
21 D CLOSE^%ZISH("CMAC UPLOAD")
22 ;
23 S IBDONE=(IBI-1)_U_IBXRF
24 ;
25CMACQ Q IBDONE
26 ;
27ENDF() N IBX S IBX=1 I $T,IBFLINE'="" S IBX=0
28 I $$STATUS^%ZISH S IBX=1
29 I 'IBX,'$$LNFORM(IBFLINE) D
30 . U IO(0)
31 . W !!,"**** Error while reading file: line not expected format (98 numeric characters):"
32 . W !!,"Line Length=",$L(IBFLINE)," characters" W:IBFLINE="" ?40,"Line read is null"
33 . W !,"LINE='",IBFLINE,"'",!!,"Upload Aborted!"
34 . S IBX=1 H 7 U IO
35 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
36 Q IBX
37 ;
38LNFORM(LINE) ; check an individual line of the file for proper format (length=98 characters)
39 N IBX S IBX=0,LINE=$G(LINE) I (LINE?98N)!(LINE?3N5AN90N) S IBX=1
40 Q IBX
41 ;
42PARSE ; process a single line from a CMAC file: parse out into individual fields and store the line in XTMP
43 ;
44 S IBLOC=$E(IBFLINE,1,3) ; locality
45 S IBCPT=$E(IBFLINE,4,8) ; CPT procedure
46 S IBNFP=$E(IBFLINE,9,16) ; category 2 Non-Facility Physician charge
47 S IBFP=$E(IBFLINE,17,24) ; category 1 Facility Physician charge
48 S IBNFNP=$E(IBFLINE,25,32) ; category 4 Non-Facility Non-Physician charge
49 S IBFNP=$E(IBFLINE,33,40) ; category 3 Facility Non-Physician charge
50 S IBEFDT=$E(IBFLINE,41,48) ; effective date
51 S IBTRDT=$E(IBFLINE,57,64) ; termination date
52 S IBPPC=$E(IBFLINE,65,72) ; Physician professional component
53 S IBPTC=$E(IBFLINE,73,80) ; Physician technical component
54 S IBNPPC=$E(IBFLINE,81,88) ; Non-Physician professional component
55 S IBNPTC=$E(IBFLINE,89,96) ; Non-Physician technical component
56 Q
57 ;
58STORE ;
59 S IBXRF1=IBXRF_" "_IBLOC
60 ;
61 S IBMOD="",IBEFDT=$$DATE(IBEFDT),IBINACT="" I IBTRDT'=99999999,+IBTRDT S IBINACT=$$DATE(IBTRDT)
62 ;
63 I +IBFP S IBCHG=$$CGF(IBFP),IBMOD="" S IBXRF2="FAC/PHYS CAT 1" D SET
64 I +IBFNP S IBCHG=$$CGF(IBFNP),IBMOD="" S IBXRF2="FAC/NONPHYS CAT 3" D SET
65 ;
66 I +IBNFP S IBCHG=$$CGF(IBNFP),IBMOD="" S IBXRF2="NONFAC/PHYS CAT 2" D SET
67 I +IBNFNP S IBCHG=$$CGF(IBNFNP),IBMOD="" S IBXRF2="NONFAC/NONPHYS CAT 4" D SET
68 ;
69 I +IBMODP,+IBPPC S IBCHG=$$CGF(IBPPC),IBMOD=IBMODP S IBXRF2="FAC/PHYS PC" D SET S IBXRF2="NON"_IBXRF2 D SET
70 I +IBMODT,+IBPTC S IBCHG=$$CGF(IBPTC),IBMOD=IBMODT S IBXRF2="FAC/PHYS TC" D SET S IBXRF2="NON"_IBXRF2 D SET
71 ;
72 I +IBMODP,+IBNPPC S IBCHG=$$CGF(IBNPPC),IBMOD=IBMODP S IBXRF2="FAC/NONPHYS PC" D SET S IBXRF2="NON"_IBXRF2 D SET
73 I +IBMODT,+IBNPTC S IBCHG=$$CGF(IBNPTC),IBMOD=IBMODT S IBXRF2="FAC/NONPHYS TC" D SET S IBXRF2="NON"_IBXRF2 D SET
74 ;
75 Q
76 ;
77CGF(AMT) ; return charge string from file line in dollar format
78 Q +($E(AMT,1,6)_"."_$E(AMT,7,8))
79 ;
80SET ;
81 N IBX S IBX=$G(^XTMP(IBXRF1,0)) I IBX="" D SETHDR
82 S $P(^XTMP(IBXRF1,0),U,4)=+$P(IBX,U,4)+1
83 S $P(^XTMP(IBXRF1,IBXRF2),U,1)=+$G(^XTMP(IBXRF1,IBXRF2))+1
84 S ^XTMP(IBXRF1,IBXRF2,IBI)=IBCPT_U_IBEFDT_U_IBINACT_U_+IBCHG_U_IBMOD
85 Q
86 ;
87SETHDR ;
88 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)
89 S ^XTMP(IBXRF1,0)=$$FMADD^XLFDT(DT,2)_U_DT_U_IBX
90 ;
91 S ^XTMP(IBXRF1,IBXRF2)=0_U_2_U_$G(IBCS)
92 Q
93 ;
94 ;
95DATE(DATE) ; return yymmdd in FM format
96 N IBX S IBX="" I $G(DATE)?8N S IBX=$S($E(DATE,1,2)<20:"2",1:"3")_$E(DATE,3,8)
97 Q IBX
98 ;
99 ;
100LNDT(LINE) ; return the date of an individual line, in FM format
101 N IBX S IBX=$E($G(LINE),41,48) S IBX=$$DATE(IBX)
102 Q IBX
103 ;
104 ;
105 ;
106SETUP(IBFILE,IBNAME) ; set up Charge Sets, Billing Regions, Rate Schedule links for new charges
107 ; if new region entered, asks user for divisions
108 N IBLOC,IBXRF1,IBXRF2,IBEVENT,IBCT,IBBS,IBRV,IBRG,IBCS
109 ;
110 S IBLOC=$P($P($G(IBFILE),"CMAC",2),".",1),IBXRF1=$G(IBNAME)_IBFILE_" "_IBLOC
111 S IBEVENT="PROCEDURE",IBCT="PROF",IBBS="OUTPATIENT VISIT",IBRV=510
112 ;
113 ;
114 ; Find/Create Billing Region
115 S IBRG=$$RG^IBCRHU2("CMAC "_IBLOC,,IBLOC)
116 ;
117 ;
118 ; Category 1 Facility Physician Charges
119 S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" FAC/PHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
120 D RSBR^IBCRHU2(IBCS,1,$G(IBGLBEFF))
121 F IBXRF2="FAC/PHYS CAT 1","FAC/PHYS PC","FAC/PHYS TC" D SETHDR
122 ;
123 ;
124 ; Category 3 Facility Non-Physician Charges
125 S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" FAC/NONPHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
126 D RSBR^IBCRHU2(IBCS,0,$G(IBGLBEFF))
127 F IBXRF2="FAC/NONPHYS CAT 3","FAC/NONPHYS PC","FAC/NONPHYS TC" D SETHDR
128 ;
129 ;
130 ; Category 2 Non-Facility Physician Charges
131 S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" NONFAC/PHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
132 D RSBR^IBCRHU2(IBCS,0,$G(IBGLBEFF))
133 F IBXRF2="NONFAC/PHYS CAT 2","NONFAC/PHYS PC","NONFAC/PHYS TC" D SETHDR
134 ;
135 ;
136 ; Category 4 Non-Facility Non-Physician Charges
137 S IBCS=$$CS^IBCRHU2("CMAC "_IBLOC_" NONFAC/NONPHYS","CMAC",IBEVENT,$P(IBRG,U,2),IBCT,IBRV,IBBS)
138 D RSBR^IBCRHU2(IBCS,0,$G(IBGLBEFF))
139 F IBXRF2="NONFAC/NONPHYS CAT 4","NONFAC/NONPHYS PC","NONFAC/NONPHYS TC" D SETHDR
140 ;
141 ;
142 ; get divisions added to new Billing Region
143 I +$P(IBRG,U,3) D GETDIV^IBCRHU2(+IBRG)
144 Q
Note: See TracBrowser for help on using the repository browser.