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

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

initial load of WorldVistAEHR

File size: 6.4 KB
Line 
1IBCEMQC ;ALB/ESG - MRA EOB CRITERIA FOR AUTO-AUTHORIZE ; 11/1/06 10:34am
2 ;;2.0;INTEGRATED BILLING;**155,323,302,350,359**;21-MAR-94;Build 9
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 Q ; must be called at proper entry point
6 ;
7CRIT(IBEOB) ; Function to determine if EOB entry meets the criteria for
8 ; auto-authorization and secondary claim submission
9 ;
10 ; Input: IBEOB - internal entry number for an entry in 361.1
11 ;
12 ; Output: This function returns a pieced string
13 ; [1] 0 or 1, EOB meets criteria
14 ; [2] error message if the first piece is 0
15 ;
16 NEW IBM,IBM3,IBM5,IBIFN,PCE,REMC,Z,OK,REASON,STOP,IBPTRESP
17 ;
18 S OK=0,REASON="Unknown",IBEOB=+$G(IBEOB)
19 ;
20 S IBM=$G(^IBM(361.1,IBEOB,0)) I IBM="" S REASON="No EOB Data Found" G CRITX
21 I $D(^IBM(361.1,IBEOB,"ERR")) S REASON="Filing Errors" G CRITX
22 I $P(IBM,U,13)'=1 S REASON="Claim Status is "_$$GET1^DIQ(361.1,IBEOB_",",.13)_". It must be PROCESSED." G CRITX
23 ;
24 I $P(IBM,U,4)'=1 S REASON="The EOB Type is not Medicare MRA" G CRITX
25 ;
26 ; If any other MRA's on file for this bill failed the auto-generation
27 ; check, then this MRA must also fail the check
28 S IBIFN=+IBM,Z=0,STOP=0
29 F S Z=$O(^IBM(361.1,"B",IBIFN,Z)) Q:'Z D Q:STOP
30 . I Z=IBEOB Q ; check different EOB records if they exist
31 . I $P($G(^IBM(361.1,Z,0)),U,4)'=1 Q ; must be an MRA
32 . I $P($G(^IBM(361.1,Z,30)),U,1)="" Q ; no problems recorded
33 . S REASON="Another MRA for this bill (ien="_Z_") failed the auto-generation criteria check."
34 . S STOP=1
35 . Q
36 I STOP G CRITX
37 ;
38 ; If this EOB is a split EOB, then don't allow it
39 I $$SPLIT^IBCEMU1(IBEOB) S REASON="Claim level remark code MA15 received. Multiple MRA's" G CRITX
40 ;
41 ; Call the function that checks the claim level and/or line level
42 ; adjustments for this EOB
43 I '$$CAS(IBEOB,"B",.REASON) G CRITX ; "B" for both
44 ;
45 ; Make sure the patient responsibility amount for this MRA is greater than $0
46 S IBPTRESP=$P($G(^IBM(361.1,IBEOB,1)),U,2) ; Pt Resp Amt 1.02 field
47 I $$FT^IBCEF(IBIFN)=3 S IBPTRESP=$$PTRESPI^IBCECOB1(IBEOB)
48 I IBPTRESP'>0 S REASON="Patient responsibility dollar amount is less than or equal to $0" G CRITX
49 ;
50 ; Check the parameter values last of all
51 I '$P($G(^IBE(350.9,1,8)),U,11) S REASON="Automatic MRA Processing parameter is turned off. File 350.9, Field 8.11." G CRITX
52 I '$P($G(^IBE(350.9,1,8)),U,12) S REASON="Allow MRA Processing parameter is turned off. File 350.9, Field 8.12." G CRITX
53 ;
54 ; At this point, we're OK
55 S OK=1,REASON=""
56 ;
57CRITX ;
58 Q OK_U_REASON
59 ;
60 ;
61CAS(IBEOB,ADJFLAG,REASON) ; This function determines if the EOB
62 ; adjustment group codes and reason codes from file 361.1 (either
63 ; claim level or line level or both) meet the criteria for auto-
64 ; authorization and secondary claim submission.
65 ;
66 ; Input Parameters
67 ; IBEOB - ien of entry in file 361.1
68 ; ADJFLAG - adjustment flag
69 ; "C" - look at claim level adjustments only
70 ; "L" - look at line level adjustments only
71 ; "B" - look at both claim and line level adjustments
72 ; Output Parameter
73 ; REASON - error message describing why it failed
74 ;
75 ; Function Value is either 0 or 1, indicating if it passed the criteria
76 ;
77 NEW EOBADJ,OK,OKCOMBO,PATRESP,STOP,LNIEN
78 ;
79 S IBEOB=+$G(IBEOB)
80 S ADJFLAG=$G(ADJFLAG,"B") ; default is "B" if not passed in
81 D BUILD ; build the array of OK group/reason combinations
82 S PATRESP=0 ; patient responsibility flag (default false)
83 S STOP=0 ; Stop flag
84 S OK=0 ; OK flag (function value)
85 S REASON="" ; error reason text
86 ;
87 ; claim level adjustments
88 I $F(".C.B.","."_ADJFLAG_".") D
89 . KILL EOBADJ
90 . M EOBADJ=^IBM(361.1,IBEOB,10)
91 . D ADJCHK
92 . Q
93 ;
94 ; Get out if the claim level adjustments failed
95 I STOP G CASX
96 ;
97 ; line level adjustments
98 I $F(".L.B.","."_ADJFLAG_".") D
99 . S LNIEN=0
100 . F S LNIEN=$O(^IBM(361.1,IBEOB,15,LNIEN)) Q:'LNIEN D Q:STOP
101 .. KILL EOBADJ
102 .. M EOBADJ=^IBM(361.1,IBEOB,15,LNIEN,1)
103 .. D ADJCHK
104 .. Q
105 . Q
106 ;
107 ; Get out if the line level adjustments failed
108 I STOP G CASX
109 ;
110 ; Get out if there was no patient responsibility adjustments found
111 I 'PATRESP S REASON="No Patient Responsibility Adjustments found" G CASX
112 ;
113 ; At this point, we're OK
114 S OK=1,REASON=""
115CASX ;
116 Q OK
117 ;
118 ;
119ADJCHK ; This procedure checks the adjustments for this EOB. The group codes
120 ; and reason codes are in the EOBADJ array structures from file 361.1.
121 ;
122 ; Variables STOP and REASON will be returned on an error
123 ; Variable PATRESP will be returned if a valid PR adjustment found
124 ;
125 NEW ADJIEN,GROUP,RSNIEN,RSNCODE
126 S ADJIEN=0
127 F S ADJIEN=$O(EOBADJ(ADJIEN)) Q:'ADJIEN D Q:STOP
128 . S GROUP=$P($G(EOBADJ(ADJIEN,0)),U,1)
129 . I GROUP="LQ" Q ; line level remark code kludge: 42 rec [3]
130 . I GROUP="" S GROUP="<Undefined>"
131 . I '$D(OKCOMBO(GROUP)) S STOP=1,REASON="Unacceptable Claim Adjustment Group Code: "_GROUP Q
132 . S RSNIEN=0
133 . F S RSNIEN=$O(EOBADJ(ADJIEN,1,RSNIEN)) Q:'RSNIEN D Q:STOP
134 .. S RSNCODE=$P($G(EOBADJ(ADJIEN,1,RSNIEN,0)),U,1)
135 .. ;
136 .. ; Ignore some special adjustment data that is filed with the MRA
137 .. I GROUP="PR",RSNCODE="AAA" Q ; Allowed Amount: 41 rec [3]
138 .. I GROUP="OA",RSNCODE="AB3" Q ; Covered Amount: 15 rec [3]
139 .. ;
140 .. I RSNCODE="" S RSNCODE="<Undefined>"
141 .. I '$D(OKCOMBO(GROUP,RSNCODE)) S STOP=1,REASON="Unacceptable Reason Code ("_RSNCODE_") for Claim Adjustment Group Code ("_GROUP_")" Q
142 .. ;
143 .. ; Set the flag if the group is PR
144 .. I GROUP="PR" S PATRESP=1
145 .. Q
146 . Q
147ADJCHKX ;
148 Q
149 ;
150 ;
151BUILD ; This procedure builds the OKCOMBO array which identifies which
152 ; combinations of group codes and reason codes are acceptable
153 ;
154 NEW LN,LINE,GROUP,RSNLST,R,RSN
155 KILL OKCOMBO
156 F LN=1:1 D Q:$P(LINE,";",4)=""&$D(OKCOMBO)
157 . S LINE=$T(OKCOMBO+LN)
158 . S GROUP=$P(LINE,";",3) Q:GROUP=""
159 . S RSNLST=$P(LINE,";",4) Q:RSNLST=""
160 . F R=1:1:$L(RSNLST,",") D
161 .. S RSN=$P(RSNLST,",",R) Q:RSN=""
162 .. S OKCOMBO(GROUP,RSN)=""
163 .. Q
164 . Q
165BUILDX ;
166 Q
167 ;
168 ;
169OKCOMBO ; This section lists OK combinations of adjustment category group codes
170 ; and associated reason codes.
171 ; The format is as follows - semi-colon delimiter
172 ; [3] Adjustment category (group code)
173 ; [4] List of acceptable reason codes - comma delimiter
174 ;
175 ; PR-AAA is created by VistA for the Allowed Amount
176 ; OA-AB3 is created by VistA for the Covered Amount
177 ; LQ-zzz is created by VistA for the Line Level remark
178 ;
179 ;;CO;A2,B6,42,45,172,94,194
180 ;;PR;1,2,66,122,AAA
181 ;;OA;AB3
182 ;
Note: See TracBrowser for help on using the repository browser.