source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCRHBS3.m@ 1036

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1IBCRHBS3 ;ALB/ARH - RATES: UPLOAD HOST FILES (RC 2+) PARSE ; 10-OCT-03
2 ;;2.0;INTEGRATED BILLING;**245**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; IBFILE, IBFLINE, COLUMNS required and VERS expected on entry
6 ; Parse lines from the Host Files and place them in XTMP.
7 ; Direct copy of fields, number of fields and placement not changed, but cleaned up (spaces, $, commas removed)
8 ;
9A ; Inpatient Facility DRG Charges: process a single line, parse out into individual fields and store in XTMP
10 ;
11 N LINE,IBI,IBPIECE,IBITYPE,IBCODE,IBXTMP,IBXIFN S IBXTMP="IBCR RC A" I ('$G(COLUMNS))!($G(IBFLINE)="") Q
12 ;
13 S LINE="" F IBI=1:1:COLUMNS S IBPIECE=$$P(IBFLINE,IBI),IBPIECE=$$STRIP(IBPIECE) S LINE=LINE_IBPIECE_U
14 ;
15 S IBITYPE=$P(LINE,U,2) I IBITYPE'="DRG",IBITYPE'="SNF" Q
16 S IBCODE=$P(LINE,U,1) I IBCODE'?3N Q
17 ;
18 S IBXIFN=$$SET(IBFILE,IBXTMP,LINE)
19 ;
20 Q
21 ;
22B ; Outpatient Facility CPT Charges: process a single line, parse out into individual fields and store in XTMP
23 ;
24 N LINE,IBI,IBPIECE,IBITYPE,IBCODE,IBXTMP,IBXIFN S IBXTMP="IBCR RC B" I ('$G(COLUMNS))!($G(IBFLINE)="") Q
25 ;
26 S LINE="" F IBI=1:1:COLUMNS S IBPIECE=$$P(IBFLINE,IBI),IBPIECE=$$STRIP(IBPIECE) S LINE=LINE_IBPIECE_U
27 ;
28 S IBITYPE=$P(LINE,U,2) I IBITYPE'="CPT",IBITYPE'="HCPCS",IBITYPE'="PHOSP" Q
29 S IBCODE=$P(LINE,U,1) I IBCODE'?5UN Q
30 ;
31 S IBXIFN=$$SET(IBFILE,IBXTMP,LINE,IBCODE)
32 ;
33 Q
34 ;
35C ; Physician CPT Charges: process a single line, parse out into individual fields and store in XTMP
36 ;
37 N LINE,IBI,IBPIECE,IBITYPE,IBCODE,IBXTMP,IBXIFN S IBXTMP="IBCR RC C" I ('$G(COLUMNS))!($G(IBFLINE)="") Q
38 ;
39 S LINE="" F IBI=1:1:COLUMNS S IBPIECE=$$P(IBFLINE,IBI),IBPIECE=$$STRIP(IBPIECE) S LINE=LINE_IBPIECE_U
40 ;
41 S IBITYPE=$P(LINE,U,2) I IBITYPE'="CPT",IBITYPE'="HCPCS" Q
42 S IBCODE=$P(LINE,U,1) I IBCODE'?5UN Q
43 ;
44 S IBXIFN=$$SET(IBFILE,IBXTMP,LINE,IBCODE)
45 ;
46 Q
47 ;
48D ; Service Category Codes: process a single line, parse out into individual fields and store in XTMP
49 ;
50 N LINE,IBI,IBPIECE,IBCODE,IBXTMP,IBXIFN S IBXTMP="IBCR RC D" I ('$G(COLUMNS))!($G(IBFLINE)="") Q
51 ;
52 S LINE="" F IBI=1:1:COLUMNS S IBPIECE=$$P(IBFLINE,IBI),IBPIECE=$$STRIP(IBPIECE) S LINE=LINE_IBPIECE_U
53 ;
54 S IBCODE=$P(LINE,U,1) I 'IBCODE Q
55 ;
56 S IBXIFN=$$SET(IBFILE,IBXTMP,LINE,IBCODE)
57 ;
58 Q
59 ;
60E ; Area Factors: process a single line, parse out into individual fields and store in XTMP
61 ;
62 N LINE,IBI,IBPIECE,IBZIP,IBXTMP,IBXIFN S IBXTMP="IBCR RC E" I ('$G(COLUMNS))!($G(IBFLINE)="") Q
63 ;
64 S LINE="" F IBI=1:1:COLUMNS S IBPIECE=$$P(IBFLINE,IBI),IBPIECE=$$STRIP(IBPIECE) S LINE=LINE_IBPIECE_U
65 ;
66 S IBZIP=$P(LINE,U,1) I IBZIP'?3N Q
67 ;
68 S IBXIFN=$$SET(IBFILE,IBXTMP,LINE,IBZIP) D SETSITE(IBZIP)
69 ;
70 Q
71 ;
72F ; Zip Codes and Sites: process a single line, parse out into individual fields and store in XTMP
73 ;
74 N LINE,IBSITE,IBZIP,IBNM,IBSTYPE,IBXTMP,IBXIFN S IBXTMP="IBCR RC F" I ('$G(COLUMNS))!($G(IBFLINE)="") Q
75 ;
76 S IBSITE=$$P(IBFLINE,1),IBSITE=$$STRIP(IBSITE) I IBSITE'?3N0.2UN Q ; division number
77 S IBNM=$$P(IBFLINE,2) ; facility name
78 S IBZIP=$$P(IBFLINE,3),IBZIP=$$STRIP(IBZIP) I IBZIP'?3N Q ; 3-digit zip code
79 S IBSTYPE=$$P(IBFLINE,4),IBSTYPE=$$STRIP(IBSTYPE) I 'IBSTYPE Q ; facility type
80 ;
81 S LINE=IBSITE_U_IBNM_U_IBZIP_U_IBSTYPE
82 ;
83 S IBXIFN=$$SET(IBFILE,IBXTMP,LINE,IBZIP) D SETSITE(IBZIP,IBSITE,IBNM,IBSTYPE)
84 ;
85 Q
86 ;
87 ;
88 ;
89SETHDR(IBFILE,IBXRF1) ; set up header for XTMP file
90 ;
91 N IBX S IBX=IBFILE_" RC v"_$G(VERS)_" Host File Upload, "_$P($$HTE^XLFDT($H,2),":",1,2)_" by "_$P($G(^VA(200,+$G(DUZ),0)),U,1)
92 S ^XTMP(IBXRF1,0)=$$FMADD^XLFDT(DT,2)_U_DT_U_IBX_U_0_U_0
93 I IBXRF1="IBCR RC SITE" S ^XTMP(IBXRF1,"VERSION")=$G(VERS),^XTMP(IBXRF1,"VERSION INACTIVE")=$$VERSEDT^IBCRHBRV($G(VERS))
94 Q
95 ;
96SET(IBFILE,IBXRF1,LINE,ACROSS) ; set data parsed from host file to XTMP
97 N IBX,IBK
98 S IBX=$G(^XTMP(IBXRF1,0)) I IBX="" D SETHDR(IBFILE,IBXRF1)
99 S IBK=+$P(IBX,U,5)+1,$P(^XTMP(IBXRF1,0),U,5)=IBK
100 S ^XTMP(IBXRF1,IBK)=LINE
101 ;
102 I $G(ACROSS)'="" S ^XTMP(IBXRF1,"A",ACROSS,IBK)=""
103 Q IBK
104 ;
105 ;
106SETSITE(ZIP,SITE,NAME,TYPE) ; set up site entries and cross references
107 ; the Area Factor File (E) has entries not associated with a VA site, Site/Zip file (F) only has valid VA sites
108 ; therefore there are many zip codes (E) with no assigned division but that must be available for selection
109 ; these unassigned zip codes are passed in with only Zip defined,
110 ; a temporary Division Number '9yyXy' and Name 'ZIP Code ZZZ' is created, Type is blank to be set by user
111 ; if the zip is '000' then these are the Nation wide charges and the corresponding Division Number/Name is used
112 N IBXRF1,LINE,IBXIFN
113 ;
114 I ZIP="000" S SITE="999",NAME="NATIONWIDE AVERAGE",TYPE=""
115 I $G(SITE)="" S SITE="9"_$E(ZIP,1,2)_"X"_$E(ZIP,3),NAME="ZIP Code "_ZIP,TYPE=""
116 I $O(^XTMP("IBCR RC SITE","C",SITE_" ",0)) W !!,"Site Error: Dupicate Site Numbers: ",SITE
117 ;
118 S IBXRF1="IBCR RC SITE"
119 S LINE=SITE_U_NAME_U_ZIP_U_TYPE
120 ;
121 S IBXIFN=$$SET(IBXRF1,IBXRF1,LINE)
122 ;
123 I $G(NAME)'="" S ^XTMP(IBXRF1,"B",NAME,IBXIFN)=""
124 I $G(ZIP)'="" S ZIP="ZC "_ZIP S ^XTMP(IBXRF1,"B",ZIP,IBXIFN)=""
125 I $G(SITE)'="" S SITE=SITE_" " S ^XTMP(IBXRF1,"B",SITE,IBXIFN)="",^XTMP(IBXRF1,"C",SITE,IBXIFN)=""
126 ;
127 Q
128 ;
129 ;
130STRIP(IBVAL) ; strip blanks, $, and commas
131 N IBI,IBY,IBX S IBY=""
132 F IBI=1:1:200 S IBX=$E(IBVAL,IBI) Q:IBX="" I IBX'=" ",IBX'=",",IBX'="$" S IBY=IBY_IBX
133 Q IBY
134 ;
135 ;
136P(LINE,P) ; parse the line and return the piece requested (replaces $P since may be two dilimiters)
137 ; the pieces are delimited by a comma, any piece that includes a comma within the text is surrounded by quotes
138 N I,U1,U2,PC S U1=",",U2="""",PC=""
139 ;
140 F I=1:1:P D
141 . I $E(LINE)=U2 S LINE=$E(LINE,2,9999),PC=$P(LINE,U2,1),LINE=$P(LINE,U2_U1,2,9999) Q
142 . ;
143 . S PC=$P(LINE,U1,1),LINE=$P(LINE,U1,2,9999)
144 ;
145 Q PC
Note: See TracBrowser for help on using the repository browser.