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

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

initial load of WorldVistAEHR

File size: 7.2 KB
RevLine 
[613]1IBCNERP4 ;DAOU/BHS - IBCNE USER INTERFACE IIV PAYER REPORT ;03-JUN-2002
2 ;;2.0;INTEGRATED BILLING;**184,271,300**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; IIV - Insurance Identification and Verification Interface
6 ;
7 ; Input parameter: N/A
8 ; Other relevant variables:
9 ; IBCNERTN = "IBCNERP4" (current routine name for queueing the
10 ; COMPILE process)
11 ; IBCNESPC("BEGDT") = start date for date range
12 ; IBCNESPC("ENDDT") = end date for date range
13 ; IBCNESPC("PYR") = payer ien for report, if = "", then include all
14 ; IBCNESPC("SORT") = 1 - Payer name OR 2 - Total Inqs (PAYER)
15 ; IBCNESPC("DTL") = 1 - YES OR 0 - NO Include Rejection Detail in
16 ; report output - rejections broken down by code
17 ;
18 ; Enter only from EN tag
19 ;
20 ; Added tag DATA as split out from program IBCNERP5 for size restrictions
21 QUIT
22 ;
23 ; Entry point
24EN ;
25 ; Initialize variables
26 NEW STOP,IBCNERTN,POP,IBCNESPC
27 ;
28 S STOP=0
29 S IBCNERTN="IBCNERP4"
30 W @IOF
31 W !,"IIV Payer Report",!
32 W !,"Insurance identification and verification inquiries are created daily."
33 W !,"Select a date range in which inquiries were created by the eIIV extracts."
34 ;
35 ; Prompts for Payer Report
36 ; Date Range parameters
37P10 D DTRANGE I STOP G EXIT
38 ; Payer Selection parameter
39P20 D PYRSEL^IBCNERP1 I STOP G:$$STOP^IBCNERP1 EXIT G P10
40 ; Include Rejection Detail in Payer report
41P30 D REJDTL I STOP G:$$STOP^IBCNERP1 EXIT G P20
42 ; Sort by parameter - Payer or Total Inquiries
43P40 D SORT I STOP G:$$STOP^IBCNERP1 EXIT G P30
44 ; Select the output device
45P100 D DEVICE^IBCNERP1(IBCNERTN,.IBCNESPC) I STOP G:$$STOP^IBCNERP1 EXIT G P40
46 ;
47EXIT ; Quit this routine
48 QUIT
49 ;
50 ;
51SORT ; Prompt to allow users to sort the report
52 ; by Payer(default) OR Total Inquiries, then Payer
53 ; Initialize variables
54 NEW DIR,X,Y,DIRUT
55 ;
56 S DIR(0)="S^1:Payer Name;2:Total Inquiries"
57 S DIR("A")=" Select the primary sort field"
58 S DIR("B")=1
59 S DIR("?",1)=" 1 - Payer Name is the only sort. (Default)"
60 S DIR("?",2)=" 2 - Total Inquiries is the primary sort, Payer Name is"
61 S DIR("?")=" the secondary sort."
62 D ^DIR K DIR
63 I $D(DIRUT) S STOP=1 G SORTX
64 S IBCNESPC("SORT")=Y
65 ;
66SORTX ; SORT exit point
67 QUIT
68 ;
69 ;
70REJDTL ; Prompt to allow users to include the Rejection Detail in the report
71 ; Initialize variables
72 NEW DIR,X,Y,DIRUT
73 ;
74 S DIR(0)="Y"
75 S DIR("A")=" Include Rejection Detail"
76 S DIR("B")="NO"
77 S DIR("?",1)=" N - No, exclude Rejection Detail totals from report. (Default)"
78 S DIR("?")=" Y - Yes, include Rejection Detail totals in report."
79 D ^DIR K DIR
80 I $D(DIRUT) S STOP=1 G REJDTLX
81 S IBCNESPC("DTL")=Y
82 ;
83REJDTLX ; REJDTL exit point
84 QUIT
85 ;
86 ;
87DTRANGE ; Determine the start and end dates for the date range parameter
88 ; Initialize variables
89 NEW X,Y,DIRUT
90 ;
91 W !
92 ;
93 S DIR(0)="D^::EX"
94 S DIR("A")="Start DATE"
95 S DIR("?",1)=" Please enter a valid date for which an IIV Inquiry"
96 S DIR("?")=" would have been created."
97 D ^DIR K DIR
98 I $D(DIRUT) S STOP=1 G DTRANGX
99 S IBCNESPC("BEGDT")=Y
100 ; End date
101DTRANG1 S DIR(0)="D^::EX"
102 S DIR("A")=" End DATE"
103 S DIR("?",1)=" Please enter a valid date for which an IIV Inquiry"
104 S DIR("?",2)=" would have been created. This date must not precede"
105 S DIR("?")=" the Start Date."
106 D ^DIR K DIR
107 I $D(DIRUT) S STOP=1 G DTRANGX
108 I Y<IBCNESPC("BEGDT") D G DTRANG1
109 . W !," End Date must not precede the Start Date."
110 . W !," Please reenter."
111 S IBCNESPC("ENDDT")=Y
112 ;
113DTRANGX ; DTRANGE exit point
114 QUIT
115 ;
116 ;
117 ; called from IBCNERP5
118 ; Loop through the IIV Response File (#365)
119 ; By DATE/TIME RECEIVED & PAYER & PATIENT Cross-Reference ("AE")
120 ;
121DATA N RDATA,RDATA1,TQDATA,IBCNEDT,IBCNEPTR,IBCNEPAT,RPYRIEN,RPYNM,PYRIEN,IBPNM,ERRCON
122 N IBPIEN,PC,ERR,ERRTXT,PYRNM,APIEN,IBCNEPTD,TQIEN
123 S IBCNEDT=$O(^IBCN(365,"AD",IBCNEDT1),-1)
124 F S IBCNEDT=$O(^IBCN(365,"AD",IBCNEDT)) Q:IBCNEDT=""!($P(IBCNEDT,".",1)>IBCNEDT2) D Q:$G(ZTSTOP)
125 . I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 QUIT
126 . S IBCNEPAT=0
127 . F S IBCNEPAT=$O(^IBCN(365,"AD",IBCNEDT,IBCNEPAT)) Q:'IBCNEPAT D Q:$G(ZTSTOP)
128 .. S IBCNEPTD=0
129 .. F S IBCNEPTD=$O(^IBCN(365,"AD",IBCNEDT,IBCNEPAT,IBCNEPTD)) Q:'IBCNEPTD D Q:$G(ZTSTOP)
130 ... S IBCNEPTR=0
131 ... F S IBCNEPTR=$O(^IBCN(365,"AD",IBCNEDT,IBCNEPAT,IBCNEPTD,IBCNEPTR)) Q:'IBCNEPTR D Q:$G(ZTSTOP)
132 .... ; Get data from Resp File
133 .... S RDATA=$G(^IBCN(365,IBCNEPTR,0))
134 .... I RDATA="" Q
135 .... ; ONLY select Transmission status 3
136 .... I $P($G(RDATA),U,6)'=3 Q
137 .... ; Determine Payer name from Payer File (#365.12)
138 .... S RPYRIEN=$P($G(RDATA),U,3)
139 .... I 'RPYRIEN Q
140 .... ; Check payer filter
141 .... I IBCNEPY'="",RPYRIEN'=IBCNEPY Q
142 .... S RPYNM=$P($G(^IBE(365.12,RPYRIEN,0)),U)
143 .... I RPYNM="" Q
144 .... ; link to TQ file
145 .... S TQIEN=$P($G(RDATA),U,5)
146 .... I TQIEN="" Q
147 .... ; Get data from TQ file (365.1)
148 .... S TQDATA=$G(^IBCN(365.1,TQIEN,0))
149 .... I TQDATA="" Q
150 .... ; Get TQ Payer from (365.1) File
151 .... S PYRIEN=$P($G(TQDATA),U,3)
152 .... S PYRNM=$P($G(^IBE(365.12,PYRIEN,0)),U)
153 .... ; Cancelled (7) - Payer deactivated
154 .... I $P($G(TQDATA),U,4)=7 Q
155 .... ; Determine Deactivation DTM for eIIV application
156 .... I RPYNM'="~NO PAYER" D
157 ..... S APIEN=$$PYRAPP^IBCNEUT5("IIV",RPYRIEN)
158 ..... I APIEN,$P($G(^IBE(365.12,RPYRIEN,1,APIEN,0)),U,11) S $P(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*"),U,11)=$P($G(^IBE(365.12,RPYRIEN,1,APIEN,0)),U,12)
159 .... ; Determine Deactivation DTM for eIIV application
160 .... I PYRNM'="~NO PAYER",PYRIEN'=RPYRIEN D
161 ..... S APIEN=$$PYRAPP^IBCNEUT5("IIV",PYRIEN)
162 ..... I APIEN,$P($G(^IBE(365.12,PYRIEN,1,APIEN,0)),U,11) S $P(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*"),U,11)=$P($G(^IBE(365.12,PYRIEN,1,APIEN,0)),U,12)
163 .... ; Get error text
164 .... S ERRTXT=$G(^IBCN(365,IBCNEPTR,4))
165 .... ; Now get the data from Response file for the report
166 .... S RDATA1=$G(^IBCN(365,IBCNEPTR,1)),ERRCON=$P($G(RDATA1),U,14)
167 .... ; Increment for non-error (GOOD) response and quit
168 .... I ERRCON="",ERRTXT="" D Q
169 ..... S $P(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*"),U,6)=$P($G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*")),U,6)+1
170 ..... ; if TQ payer was ~NO PAYER then also increment ~NO PAYER good count
171 ..... I IBCNEPY="",(RPYRIEN'=PYRIEN),(PYRNM="~NO PAYER") S $P(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*"),U,6)=$P($G(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*")),U,6)+1
172 .... ; Rejection is defined as having a value in the Error Condition field or Error Text field
173 .... ; Increment for error response
174 .... S $P(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*"),U,7)=$P($G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*")),U,7)+1
175 .... ; if TQ payer was ~NO PAYER then also increment ~NO PAYER error count
176 .... I IBCNEPY="",(RPYRIEN'=PYRIEN),(PYRNM="~NO PAYER") S $P(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*"),U,7)=$P($G(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*")),U,7)+1
177 .... ; Store rejection detail only if user requested it
178 .... I 'IBCNEDTL Q
179 .... I ERRCON S ^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",ERRCON)=$G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",ERRCON))+1
180 .... I 'ERRCON,ERRTXT'="" S ^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",0_U_ERRTXT)=$G(^TMP($J,IBCNERTN,RPYNM,RPYRIEN,"*",0_U_ERRTXT))+1
181 .... I IBCNEPY="",(RPYRIEN'=PYRIEN),(PYRNM="~NO PAYER") D
182 .... . I ERRCON S ^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*",ERRCON)=$G(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*",ERRCON))+1
183 .... . I 'ERRCON,ERRTXT'="" S ^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*",0_U_ERRTXT)=$G(^TMP($J,IBCNERTN,PYRNM,PYRIEN,"*",0_U_ERRTXT))+1
184 Q
Note: See TracBrowser for help on using the repository browser.