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

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

initial load of WorldVistAEHR

File size: 8.5 KB
Line 
1IBCICMEP ;DSI/JSR - ClaimsManager ERROR REPORT ;6-APR-2001
2 ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;; ** Program Description **
5 ; This routine has only 1 entry point EN.
6 ; This routine is invoked when ^IBCICME is run from the menu option.
7 ; ^IBCICME is and extraction routine which collects claims which
8 ; the user defined report extracted for reporting purposes.
9 ; This routine ^IBCICMEP is the print routine which permits the
10 ; user to print the report to the screen or to queue as a background
11 ; job which can be stopped at any time using TaskManager.
12 ; Variables
13 ; IBCIPXT = (0 or 1) halts job if report is stopped.
14 ; SORT1 = will always be a 1 (reserved for future use)
15 ; SORT2 = space concatenated with the Error Code Mnemonic or a 1
16 ; this is a flag type indicator. 1 indicates that the
17 ; report will print all errors for a bill
18 ; Sort2'=1 indicates that the report will print all Bills
19 ; for a ClaimsManager Error Code (JSR 6/12/01)
20 ; SORT3 = "1" or the Assigned to person name
21 ; SORT4 = a space concatenated with whatever data the user is
22 ; sorting by (terminal digit, Insurance company name,
23 ; patient last name, negative charge amount or bill #.
24 ; SORT5 = Sort5 will always be a 1 (reserved for future use
25 ; possible insurance group ID).
26 ; MAXCNT = Kernel determines the Max Lines per Page for each device
27 ; CRT = Determines if output is sent to screen.
28 ; RPTTYP = Identifies type of report being compiled.
29EN ; this is the only entry point
30 N ASSIGN,AUDIT,COMMEN,CRT,DATE,EFLAG,ERRSEQ,GROUPBY,I,IBCI1,IBCI10
31 N IBCI11,IBCI12,IBCI2,IBCI3,IBCI4,IBCI5,IBCI6,IBCI7,IBCI8,IBCI9,IBCIARR
32 N IBCIBEG,IBCID2,IBCIDATA,IBCIDT,IBCIEND,IBCIPGCT,IBCIARR,IBCIEMN
33 N IBCIQT,IBCIRUN,IBCISEQ,IBCITOT,IBCITXT,IBCIX,IBIFN,MAXCNT,PREV
34 N IBCIPXT,RPTTYP,SORT1,SORT2,SORT3,SORT4,SORT5,IBCIX,Y,Z,X,STOP,NAME
35 S ASSIGN=RPTSPECS("ASNSORT") ; PRIMARY SORT BY ASSIGN TO PERSON 1 YES 0 NO
36 S COMMEN=RPTSPECS("IBCICOMM") ; FLAG PRINT COMMENT 1 YES 0 NO
37 S GROUPBY=RPTSPECS("SORTBY") ;TYPE 2=INS LOGIC DIFF SORT4
38 S IBCIBEG=RPTSPECS("BEGDATE")
39 S DATE=RPTSPECS("DATYP")
40 S IBCIEND=RPTSPECS("ENDDATE")
41 S EFLAG=RPTSPECS("DISPLAY ERROR TEXT") ; 1 print error txt 0 don't
42 S (IBCIPXT,IBCIPGCT)=0 ; flags quit and header
43 S Z=($P($G(^IBA(351.91,0)),U,4))
44 F I=1:1:Z S (IBCIARR(I))=$P($G(^IBA(351.91,I,0)),U,2) ; CM status
45 S RPTTYP(1)="Terminal Digit"
46 S RPTTYP(2)="Insurance Company"
47 S RPTTYP(3)="Patient Last Name"
48 S RPTTYP(4)="Dollar Impact"
49 S RPTTYP(5)="Bill Number" ;JSR 6/12/2001
50 ;
51 I IOST["C" S MAXCNT=IOSL-4,CRT=1
52 E S MAXCNT=IOSL-6,CRT=0
53 I RPTSPECS("TYPE")="D" D PRINT ; Detailed Report ;DSI/DJW 3/21/02
54 I IBCIPXT=0 D PRINT2
55 I CRT,IBCIPGCT>0,'$D(ZTQUEUED),IBCIPXT=0 S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) S IBCIPXT=1 Q
56 G XIT
57 Q
58PRINT ; prints data extracted
59 I '$D(^TMP($J,IBCIRTN)) D HEADER W ?35,"N O D A T A F O U N D",!!
60 S SORT1="" F S SORT1=$O(^TMP($J,IBCIRTN,SORT1)) Q:SORT1=""!(IBCIPXT=1)!($G(ZTSTOP)) D
61 . S SORT2="" F S SORT2=$O(^TMP($J,IBCIRTN,SORT1,SORT2)) Q:SORT2=""!(IBCIPXT=1)!($G(ZTSTOP)) D
62 . . S SORT3="" F S SORT3=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3)) Q:SORT3=""!(IBCIPXT=1)!($G(ZTSTOP)) D
63 . . . I ASSIGN D HEADER
64 . . . S SORT4="" F S SORT4=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4)) Q:SORT4=""!(IBCIPXT=1)!($G(ZTSTOP)) D
65 . . . . S PREV=SORT4
66 . . . . I GROUPBY=2,IBCIPXT=0,IBCIPGCT>0 D HEAD2
67 . . . . S SORT5="" F S SORT5=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5)) Q:SORT5=""!(IBCIPXT=1)!($G(ZTSTOP)) D
68 . . . . . S NAME="" F S NAME=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME)) Q:NAME=""!(IBCIPXT=1)!($G(ZTSTOP)) D
69 . . . . . . S IBIFN="" F S IBIFN=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)) Q:IBIFN=""!(IBCIPXT=1)!($G(ZTSTOP)) D
70 . . . . . . . S IBCIEMN="" F S IBCIEMN=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN,IBCIEMN)) Q:IBCIEMN=""!(IBCIPXT=1)!($G(ZTSTOP)) D
71 . . . . . . . . D DATA
72 . . . . . . . . D LINE
73 . . . . . . . . I EFLAG D ERROR
74 . . . . . . . I COMMEN D COMM
75 Q
76PRINT2 ; print audit report
77 I RPTSPECS("TYPE")="D",('$D(^TMP($J,IBCIRTN))) Q
78 D HEADA
79 I IBCIPXT=1 Q
80 ; JSR 6/12/01 change to accommodate new request PRINT2+2 thru PRINT2+9
81 I '$D(^TMP($J,IBCIRTN)) W ?35,"N O D A T A F O U N D",! Q
82 S SORT1="" F S SORT1=$O(^TMP($J,IBCIRTN_"-TOTALS",SORT1)) Q:SORT1=""!(IBCIPXT=1)!($G(ZTSTOP)) D
83 . I $Y+1>MAXCNT D HEADER
84 . S AUDIT=^TMP($J,IBCIRTN_"-TOTALS",SORT1)
85 . W ?20,SORT1,?40,$J($FN(AUDIT,","),9),!
86 W !
87 S IBCITOT=$G(^TMP($J,IBCIRTN_"-TOTALS"))
88 ; JSR ===
89 W ?20,"Total # Claims",?40,$J($FN($P($G(IBCITOT),U,1),","),9),!
90 W ?20,"Total # Errors",?40,$J($FN($P($G(IBCITOT),U,2),","),9),!
91 Q
92HEADER ; header for main report
93 I CRT,IBCIPGCT>0,'$D(ZTQUEUED),IBCIPXT=0 S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) S IBCIPXT=1 Q
94 I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 Q
95 S IBCIPGCT=IBCIPGCT+1
96 W @IOF,!,"ClaimsManager Detailed Error Report sort by "_RPTTYP(GROUPBY)_" for "
97 W $E(IBCIBEG,4,5)_"/"_$E(IBCIBEG,6,7)_"/"_$E(IBCIBEG,2,3)_" thru "_$E(IBCIEND,4,5)_"/"_$E(IBCIEND,6,7)_"/"_$E(IBCIEND,2,3)
98 W ?100,"Page :"_IBCIPGCT,!
99 S Y=$$NOW^XLFDT X ^DD("DD") S IBCIRUN=Y
100 W "Detailed Report",?100,"Run Date: "_IBCIRUN,!!
101 I DATE=1 W ?1,"ERROR",?8,"BILL NO.",?18,"PATIENT NAME",?44,"PID",?50," EVENT",?60,"BILLER",?68,"CODER",?76,"ASSIGN",?84,"ERROR CODES",?102,"TYPE",?108,"CHARGES",?116,"CM STATUS"
102 E W ?1,"ERROR",?8,"BILL NO.",?18,"PATIENT NAME",?44,"PID",?50," ENTER",?60,"BILLER",?68,"CODER",?76,"ASSIGN",?84,"ERROR CODES",?102,"TYPE",?108,"CHARGES",?116,"CM STATUS"
103 N X S $P(X,"=",130)="" W !,X,!
104 Q
105HEAD2 ; only printed when insurance is a selected sort
106 Q:GROUPBY'=2
107 Q:IBCIPXT=1
108 I $Y+4>MAXCNT,IBCIPXT=0 D HEADER
109 I $Y=6,IBCIPXT=0 W ?2,"INSURANCE: "_SORT4,!
110 E W:IBCIPXT=0 !,?2,"INSURANCE: "_SORT4,!
111 Q
112HEADA ; only for audit header
113 I CRT,IBCIPGCT>0,'$D(ZTQUEUED),IBCIPXT=0 S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) S IBCIPXT=1 Q
114 I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 Q
115 S IBCIPGCT=IBCIPGCT+1
116 W @IOF,!,"ClaimsManager Audit Error Report for "
117 W $E(IBCIBEG,4,5)_"/"_$E(IBCIBEG,6,7)_"/"_$E(IBCIBEG,2,3)_" thru "_$E(IBCIEND,4,5)_"/"_$E(IBCIEND,6,7)_"/"_$E(IBCIEND,2,3)
118 W ?100,"Page :"_IBCIPGCT,!
119 I RPTSPECS("TYPE")="S" W "Summary Report"
120 E W "Detailed Report"
121 S Y=$$NOW^XLFDT X ^DD("DD") S IBCIRUN=Y
122 W ?100,"Run Date: "_IBCIRUN,!!
123 Q
124DATA ; formats line item data - note claims with same edit error mnemonic
125 ; may print mulitple times if the HFCA line item is an unique line
126 ; with the same error type. The report prints the error mnemonic and
127 ; the HCFA line # as it relates to IB.
128 S IBCIDATA=^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)
129 S IBCI1=$P(IBCIDATA,U,1) ; [1] External Bill#
130 S IBCI2=$P(IBCIDATA,U,2) ; [2] Patient SSN
131 S IBCI3=$P(IBCIDATA,U,3) ; ck logic [3] EventDate or Bill
132 S IBCIDT=$E(IBCI3,4,5)_"/"_$E(IBCI3,6,7)_"/"_$E(IBCI3,2,3)
133 S IBCI4=$P(IBCIDATA,U,4) ; [4] Biller name
134 S IBCI5=$P(IBCIDATA,U,5) ; [5] Coder name
135 S IBCI6=$P(IBCIDATA,U,6) ; [6] Assigned to person name
136 S IBCI7=$P(IBCIDATA,U,7) ;[7] inpatient/outpatient flag
137 S IBCI8=$P(IBCIDATA,U,8) ;[8] Charges
138 S IBCI9=$P(IBCIDATA,U,9) ;[9] ien of current ClaimsManager
139 S IBCI10=$P(IBCIDATA,U,10) ;[10] String of error code mne
140 S IBCID2=^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN,IBCIEMN)
141 S IBCI11=$P(IBCID2,U,1)
142 S IBCI12=$P(IBCID2,U,2) ; jsr 6/12/01
143 S IBCIX=(IBCIARR(IBCI9))
144 Q
145ERROR ; this is a unique error which CM reports
146 S ERRSEQ=0 F S ERRSEQ=$O(^IBA(351.9,IBIFN,1,IBCIEMN,1,ERRSEQ)) Q:'ERRSEQ!(IBCIPXT=1) D
147 . I $Y+2>MAXCNT D HEADER
148 . Q:IBCIPXT=1
149 . S IBCITXT=$G(^IBA(351.9,IBIFN,1,IBCIEMN,1,ERRSEQ,0))
150 . I ERRSEQ=1 W ?10,"CM Error Message: "
151 . I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
152 . W ?28,IBCITXT,!
153 W !
154 Q
155COMM ; print CM user comments these comments are keyed by the user
156 Q:'$D(^IBA(351.9,IBIFN,2,0))
157 I $Y+2>MAXCNT,IBCIPXT=0 D HEADER
158 Q:IBCIPXT=1
159 W ?10,$$CMTINFO^IBCIUT5(IBIFN),!
160 S IBCISEQ=0 F S IBCISEQ=$O(^IBA(351.9,IBIFN,2,IBCISEQ)) Q:'IBCISEQ!(IBCIPXT=1) D
161 . S IBCITXT=$G(^IBA(351.9,IBIFN,2,IBCISEQ,0))
162 . I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
163 . Q:IBCIPXT=1
164 . W ?28,IBCITXT,!
165 W !
166 Q
167LINE ; print report detail line
168 Q:IBCIPXT=1
169 I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
170 I IBCIPGCT=0,IBCIPXT=0 D HEADER D HEAD2
171 Q:IBCIPXT=1
172 W ?1,IBCI12_"*"_IBCI11,?8,IBCI1,?19,$E(NAME,1,23),?44,$E(IBCI2,6,9)
173 W ?50,IBCIDT,?60,$E(IBCI4,1,6),?68,$E(IBCI5,1,6),?76,$E(IBCI6,1,6)
174 W ?84,IBCI10,?102,IBCI7,?108,$J($FN(IBCI8,",",0),6),?116,IBCIX,!
175 Q
176XIT ; one exit point
177 Q
Note: See TracBrowser for help on using the repository browser.