source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBTOUR1.m@ 868

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

initial load of FOIAVistA 6/30/08 version

File size: 4.8 KB
Line 
1IBTOUR1 ;ALB/AAS - CLAIMS TRACKING UR/ACTIVITY REPORT ; 27-OCT-93
2 ;;Version 2.0 ; INTEGRATED BILLING ;**56**; 21-MAR-94
3 ;
4% ;
5 ; ibcnt(1) = total count of admissions
6 ; ibcnt(1,1) = total count of admissions to nhcu
7 ; ibcnt(1,2) = total count of admissions to domiciliary
8 ; ibcnt(2) = total count of insured admissions
9 ; ibcnt(3,0) = total count of billable admissions
10 ; ibcnt(3,n) = count of non-billable admissions by reason (n)
11 ; ibcnt(4) = count of admissions requiring reviews
12 ; ibcnt(5) = admissions with pre-cert and follow-up
13 ; ibcnt(6) = no pre-cert but active monitoring required
14 ; ibcnt(7) = new closed cases = discharged, or no next rev. date, or ur not required
15 ; ibcnt(7,0) = new cases closed, billable
16 ; ibcnt(7,1) = new cases closed, not billable
17 ; ibcnt(8) = new cases open (not closed)
18 ;
19 ; ibcnt(9) = previous case (find in REV), adm prior to begin date
20 ; ibcnt(9,0) = cases closed billable
21 ; ibcnt(9,1) = cases closed non-billable
22 ; ibcnt(9,2) = previous cases still open
23 ;
24 ; ^tmp($j,"ibtour", $s(pt. name/specialty/review date) ,pt. name,sort3,ibtrc)=^ibt(ibtrc,0)
25 ; ^tmp($j,"ibtour1",specialty)=days approved, days denied, $approved, $denied)
26 ;
27BLD ; -- build data
28 ;initialize summary array
29 F I=1:1:11 S IBCNT(I)=0 I I=7!(I=9) F J=0:1:2 S IBCNT(I,J)=0
30 F I=40:1:52 S IBCNT(I)=0 I I=45 F J=1:1:3 S IBCNT(I,J)=0
31 ;
32 D ADM
33 D:IBSORT'="H" IREV^IBTOUR2,ISUB
34 D:IBSORT'="I" HREV^IBTOUR2,HSUB^IBTOUR5
35 Q
36 ;
37ADM ; -- count admission
38 D CHK^IBTOSUM2 I $G(ZTSTOP) Q
39 S IBDT=IBBDT-.000000001
40 F S IBDT=$O(^DGPM("AMV1",IBDT)) Q:'IBDT!(IBDT>(IBEDT+.24)) D
41 .S DFN=0 F S DFN=$O(^DGPM("AMV1",IBDT,DFN)) Q:'DFN D
42 ..S DGPM=0 F S DGPM=$O(^DGPM("AMV1",IBDT,DFN,DGPM)) Q:'DGPM D
43 ...S IBCNT(1)=IBCNT(1)+1 ; count of admissions
44 ...I $P($G(^DIC(42,+$P(^DGPM(DGPM,0),"^",6),0)),"^",3)="NH" S IBCNT(1,1)=$G(IBCNT(1,1))+1 ; count nhcu admissions
45 ...I $P($G(^DIC(42,+$P(^DGPM(DGPM,0),"^",6),0)),"^",3)="D" S IBCNT(1,2)=$G(IBCNT(1,2))+1 ; count domiciliary admissions
46 ...S IBTRN=$O(^IBT(356,"AD",DGPM,0))
47 ...Q:'IBTRN
48 ...S IBTRND=$G(^IBT(356,+IBTRN,0))
49 ...Q:'$P(IBTRND,"^",20)
50 ...S X=$P($G(^IBT(356,+IBTRN,1)),"^",7) I X>3 S IBCNT(4)=IBCNT(4)+1,^TMP($J,"IBTOUR0",IBTRN)=IBTRN ;reviews required
51 ...I X="",$P(IBTRND,"^",24),'$P(IBTRND,"^",19) S IBCNT(4)=IBCNT(4)+1,^TMP($J,"IBTOUR0",IBTRN)=IBTRN
52 ...;
53 ...S IBINS=$$INSURED^IBCNS1(DFN,IBDT) I IBINS S IBCNT(2)=IBCNT(2)+1 ; count of insured admissions
54 ...I IBINS S IBCNT(3,+$P(IBTRND,"^",19))=$G(IBCNT(3,+$P(IBTRND,"^",19)))+1 ;count of NOT Billable by reason billable
55 Q
56 ;
57ISUB ; -- count subtotals for cases reviewed
58 N IBTRN,IBCLOS,DGPM,IBTPREV
59 S IBTRN="" F S IBTRN=$O(^TMP($J,"IBTOUR0",IBTRN)) Q:'IBTRN D
60 .S IBTRND=$G(^IBT(356,+IBTRN,0))
61 .Q:'$P(IBTRND,"^",20) ;inactive case
62 .Q:$P(IBTRND,"^",8) ;rx fill, don't count
63 .S DGPM=$P($G(^IBT(356,+IBTRN,0)),"^",5)
64 .S IBCLOS=$$CLOSED(DGPM,IBTRN)
65 .S IBTPREV=0 I $P($G(^IBT(356,+IBTRN,0)),"^",6)<IBBDT S IBTPREV=1
66 .I $P(IBTRND,"^",4) S IBCNT(10)=IBCNT(10)+1
67 .D CASE
68 .Q
69 Q
70 ;
71CASE ; -- figure out case summary
72 N I,J,IBPRE,IBFOL
73 I IBTPREV D PREV
74 S (IBFOL,IBPRE)=0
75 I $O(^IBT(356.2,"APRE",IBTRN))'="" S IBPRE=1 ; is precert number
76 S IBPCODE=$O(^IBE(356.11,"ACODE",10,0)) ; precert tracking type
77 S IBCCODE=$O(^IBE(356.11,"ACODE",30,0)) ; cont. stay tracking type
78 ;
79 I 'IBPRE S IBTRC=$O(^IBT(356.2,"ATRTP",IBTRN,IBPCODE,0)) I IBTRC,$P($G(^IBT(356.2,+IBTRC,0)),"^",19)=10 S IBPRE=1
80 ;
81 S IBX=$P($G(^IBT(356,+IBTRN,1)),"^",7) I 'IBX D
82 .I $O(^IBT(356.2,"ATRTP",IBTRN,IBCCODE,0)) S IBFOL=1
83 .I IBPRE,IBFOL S IBCNT(5)=IBCNT(5)+1 ; adm with precert and follow up
84 .I 'IBPRE,IBFOL S IBCNT(6)=IBCNT(6)+1 ; adm w/o precert but cont. monitor
85 I IBX>4 S IBCNT(5)=IBCNT(5)+1
86 I IBX=4 S IBCNT(6)=IBCNT(6)=1
87 ;
88 I IBCLOS S IBCNT(7,$S($P(IBTRND,"^",19):1,1:0))=IBCNT(7,$S($P(IBTRND,"^",19):1,1:0))+1,IBCNT(7)=IBCNT(7)+1
89 ;
90 I 'IBTPREV S IBX=$P($G(^IBT(356,+IBTRN,1)),"^",7) I IBX,IBX<4 S IBCNT(4)=IBCNT(4)+1 ; new case rev not required, but done.
91 ;
92 I 'IBCLOS,'IBTPREV S IBCNT(8)=IBCNT(8)+1 ;new cases still open
93 I '$P(IBTRND,"^",5),$P(^IBE(356.6,+$P(IBTRND,"^",18),0),"^",8)=5 S IBCNT(11)=IBCNT(11)+1
94CASEQ Q
95 ;
96CLOSED(DGPM,IBTRN) ; -- is case closed
97 N IBI,IBJ,IBCLOSE
98 S IBCLOSE=0
99 I $P($G(^DGPM(+DGPM,0)),"^",17) S IBCLOSE=1 G CLOSEDQ ; - discharged
100 I '$P($G(^IBT(356,+IBTRN,0)),"^",24) S IBCLOSE=1 G CLOSEDQ ; ur no longer required
101 ;
102 ; -- see if any reviews are still pending
103 S IBCLOSE=1,IBI=0 F S IBI=$O(^IBT(356.2,"C",+IBTRN,IBI)) Q:'IBI I $P(^IBT(356.2,IBI,0),"^",24)>IBEDT S IBCLOSE=0 Q
104 ;
105CLOSEDQ Q IBCLOSE
106 ;
107PREV ; -- previous case
108 Q:'$G(IBTPREV)
109 I $P(IBTRND,"^",4)!($P(IBTRND,"^",8))!($P(IBTRND,"^",9)) Q ; only count previous admissions
110 S IBCNT(9)=IBCNT(9)+1 ; number of previous cases
111 I 'IBCLOS S IBCNT(9,2)=IBCNT(9,2)+1 ; still open
112 I IBCLOS S IBCNT(9,$S($P(IBTRND,"^",19):1,1:0))=IBCNT(9,$S($P(IBTRND,"^",19):1,1:0))+1 ;closed and billable or not
113 Q
Note: See TracBrowser for help on using the repository browser.