source: WorldVistAEHR/trunk/r/FEE_BASIS-FB/FBAAFS.m@ 1111

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

initial load of WorldVistAEHR

File size: 6.0 KB
RevLine 
[613]1FBAAFS ;WCIOFO/dmk,SAB-OUTPATIENT FEE SCHEDULE ;5/27/2006
2 ;;3.5;FEE BASIS;**4,53,71,92,99**;JAN 30, 1995
3 ;
4LOOKUP ; Entry point for option to get fee schdule amount
5 ; without having to enter in a payment
6 ;
7 W !!
8 ;
9 ; ask date of service - required
10 S DIR(0)="D^::EX",DIR("A")="Enter date of service"
11 S DIR("B")=$$FMTE^XLFDT($S($G(FBDATE):FBDATE,1:DT))
12 D ^DIR K DIR I $D(DIRUT) G LOOKUPX
13 S FBDATE=+Y
14 I FBDATE<2990901 W !,"Note: Date is prior to VA implementation of RBRVS fee schedule (9/1/99).",!
15 ;
16 D CPTM^FBAALU(FBDATE) I 'FBGOT G LOOKUPX
17 S FBCPT=FBX
18 S FBMODLE=$$MODL^FBAAUTL4("FBMODA","E")
19 ;
20 ; ask vendor - optional
21 S DIR(0)="PO^161.2:EM",DIR("A")="Enter Fee Basis Vendor [optional]"
22 D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) G LOOKUPX
23 S FBVEN=$P(Y,U)
24 ;
25 ; ask zip - required
26 D ASKZIP(FBVEN,FBDATE) I FBZIP="" G LOOKUPX
27 ;
28 ; ask place of service OR facility
29 ;S DIR(0)="SA^0:NON-FACILITY;1:FACILITY",DIR("A")="Place of Service: "
30 ;S DIR("B")="NON-FACILITY"
31 ;D ^DIR K DIR I $D(DIRUT) G LOOKUPX
32 ;S FBFAC=Y
33 D POS^FBAACO1 I '$G(FBHCFA(30)) G LOOKUPX
34 S FBFAC=$$FAC(FBHCFA(30))
35 I FBFAC="" W $C(7),!,"Error: Can't determine if facility or non-facility setting" G LOOKUPX
36 ;
37 ; report schedule amount
38 S FBRSLT=$$GET^FBAAFS(FBCPT,FBMODLE,FBDATE,FBZIP,FBFAC)
39 I $P($G(FBRSLT),U)]"" D
40 . W !?5,"Amount to Pay: $ ",$P(FBRSLT,U)," from the "
41 . W:$P(FBRSLT,U,3)]"" $P(FBRSLT,U,3)," " ; year if returned
42 . W:$P(FBRSLT,U,2)]"" $$EXTERNAL^DILFD(162.03,45,"",$P(FBRSLT,U,2))
43 I $P($G(FBRSLT),U)']"" D
44 . W !?5,"Unable to determine a FEE schedule amount.",!
45 . I $D(FBERR) D DERR
46 ;
47 G LOOKUP
48 ;
49LOOKUPX ; exit for lookup
50 K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
51 K FBAACP,FBAAOUT,FBCPT,FBDATE,FBERR,FBFAC,FBGOT,FBMOD,FBMODLE,FBMODS
52 K FBRSLT,FBVEN,FBX,FBZIP
53 Q
54 ;
55GET(CPT,MODL,DOS,ZIP,FAC,TIME) ; call to calculate Fee Schedule amount
56 ; Input
57 ; CPT - CPT/HCPCS code, external value, required
58 ; MODL - list of optional CPT/HCPCS modifiers, external values
59 ; delimited by commas
60 ; DOS - date of service, fileman format, required
61 ; ZIP - zip code, 5 digit, required
62 ; FAC - facility flag, 0 or 1, required
63 ; indicates if procedure was performed in facility (1)
64 ; or non-facility (0)
65 ; TIME - anesthesia time (minutes), reserved for future use
66 ; Returns string
67 ; dollar amount^schedule used^schedule year (only when RBRVS)
68 ;
69 N FBAMT,FBERR,FBSCH,FBSCHYR
70 ; initialization
71 S (FBAMT,FBSCH,FBSCHYR)=""
72 K FBERR
73 S CPT=$G(CPT)
74 S DOS=$G(DOS)
75 S ZIP=$G(ZIP)
76 S FAC=$G(FAC)
77 S TIME=$G(TIME)
78 ;
79 ; validate input parameters
80 I CPT="" D ERR("Missing CPT")
81 I DOS'?7N D ERR("Invalid Date of Service")
82 ;
83 ; try RBRVS schedule
84 I '$D(FBERR) D
85 . S FBX=$$RBRVS^FBAAFSR(CPT,MODL,DOS,ZIP,FAC,TIME)
86 . S:$P(FBX,U)]"" FBAMT=$P(FBX,U),FBSCH="R",FBSCHYR=$P(FBX,U,2)
87 . K FBERR
88 ;
89 ; if not on RBRVS schedule try 75th percentile schedule
90 I '$D(FBERR),FBAMT']"" D
91 . S FBAMT=$$PRCTL^FBAAFSF(CPT,MODL,DOS)
92 . S:FBAMT]"" FBSCH="F",FBSCHYR=""
93 . K FBERR
94 ;
95 ; return result
96 K FBERR
97 Q $S(FBAMT]"":FBAMT_U_FBSCH_U_FBSCHYR,1:"")
98 ;
99ERR(MSG) ; add error message to array
100 S FBERR=$G(FBERR)+1
101 S FBERR(FBERR)=MSG
102 Q
103 ;
104DERR ; display error messages
105 N FBI
106 F FBI=0 F S FBI=$O(FBERR(FBI)) Q:'FBI W !,FBERR(FBI)
107 Q
108 ;
109ASKZIP(FBVEN,FBDOS) ;called from payment routines to ask user the
110 ;site of service zip code.
111 ; input
112 ; FBVEN - (optional) internal entry number of vendor (#161.2)
113 ; used to determine a default zip code
114 ; FBDOS - (optional) date of service
115 ; used to determine if GPCIs are available for the zip code
116 ; output
117 ; FBZIP - zip code, 5 digit
118 ; FBAAOUT if user '^' out without answering
119 N DIR,DUOUT,DIRUT,DTOUT,X,Y
120 N FBCY,FBGPCIY0
121ASKZIP1 ;
122 S FBZIP=""
123 S DIR(0)="162.03,42"
124 ; set default zip code if vendor available
125 I $G(FBVEN) D
126 . S X=$P($P($G(^FBAAV(FBVEN,0)),U,6),"-")
127 . I X]"" S DIR("B")=X
128 D ^DIR K DIR I $D(DIRUT) S FBAAOUT=1 Q
129 S FBZIP=Y
130 ;
131 ; if date after VA implementation then check for GPCIs
132 I $G(FBDOS)]"",FBDOS>2990900 D I Y D ASKZIP1
133 . S FBCY=$E(FBDOS,1,3)+1700
134 . ; if year after most recent RBRVS schedule then use prior year sched
135 . I FBCY>$$LASTCY^FBAAFSR() S FBCY=FBCY-1
136 . D ZIP^FBAAFSR(FBCY,FBZIP)
137 . S Y=0 I FBGPCIY0="" D
138 . . W $C(7),!,"Warning: ",FBCY," GPCIs are not on file for this zip code."
139 . . S DIR(0)="Y",DIR("A")="Do you want to enter a different zip code"
140 . . S DIR("B")="YES"
141 . . S DIR("?",1)="Geographic Practice Cost Index (GPCI) values are"
142 . . S DIR("?",2)="needed for calculation of the RBRVS physician fee"
143 . . S DIR("?",3)="schedule amount. There are not any GPCI values on"
144 . . S DIR("?",4)="file for the specified year and zip code."
145 . . S DIR("?")="Answer YES to enter a different zip code."
146 . . D ^DIR K DIR
147 Q
148 ;
149ASKTIME ;called to ask time in minutes if the service provided
150 ;is an anesthesia service (00100-01999)
151 ;return FBTIME equal to # of minutes or zero if '^'/timeout
152 ;return FBAAOUT if user does not answer
153 S FBTIME=0
154 S DIR(0)="162.03,43" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) S FBAAOUT=1 Q
155 S FBTIME=+Y
156 I '$G(FBTIME) D G ASKTIME
157 . W !,$C(7),"Time entry is required!",!
158 Q
159 ;
160ANES(CPT) ; call to determine if the CPT code has a major category
161 ;of anesthesia.
162 ; CPT = 5 digit CPT code (EXTERNAL)
163 ; returns 1 if CPT is an anesthesia code else return 0.
164 ;
165 S CPT=$G(CPT)
166 Q $S(+CPT>99&(+CPT<2000):1,1:0)
167 ;
168FAC(POS) ; call to determine if the place of service is a facility
169 ; Input
170 ; POS - place of service, internal, pointer to #353.1
171 ; Returns 0 or 1 or null
172 ; = 0 if place of service is non-facility setting
173 ; = 1 if place of service is facility setting
174 ; = null value if type of setting could not be determined
175 N CODE,RET
176 S (CODE,RET)=""
177 I $G(POS)]"" S CODE=$$GET1^DIQ(353.1,POS,.01)
178 ; list of codes considered as facility settings
179 S FCODE="^21^22^23^24^26^31^34^41^42^51^52^53^56^61^"
180 ; list of codes considered as non-facility settings
181 S NFCODE="^01^03^04^09^11^12^13^14^15^20^25^32^33^49^50^54^55^57^60^62^65^71^72^81^99^"
182 I FCODE[(U_CODE_U) S RET=1
183 I NFCODE[(U_CODE_U) S RET=0
184 Q RET
185 ;
186 ;FBAAFS
Note: See TracBrowser for help on using the repository browser.