source: WorldVistAEHR/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDFOSG2.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: 5.6 KB
Line 
1IBDFOSG2 ;ALB/TMP - ENCOUNTERS WITH BILLING DATA CONT. - SEP 11, 1995
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
3TOT2 ; #2a,b
4 N IBDHD,IBBY,IBFLDS
5 I '$D(DT) D DT^DICRW
6 S (IBFLDS,IBBY)="OPT AMT BILLED & # GEN"
7 S IBDHD="(#2a,2b) OUTPT DOLLARS BILLED, # OF OUTPT BILLS GENERATED"
8 D PRT("2a,b",IBFLDS,IBBY,IBDHD)
9 K IOP,DQTIME
10 Q
11 ;
12TOT3 ; #3a,b
13 N IBDHD,IBBY,IBFLDS
14 I '$D(DT) D DT^DICRW
15 S (IBFLDS,IBBY)="OPT NUM BILLS GEN < 65"
16 S IBDHD="(#3a) # OF OUTPT BILLS FOR PATIENTS < 65 YEARS OF AGE DATE: "
17 D PRT("3a",IBFLDS,IBBY,IBDHD)
18 ;
19 I '$D(IOP) W !,"#3b" D SELDEV Q:'$D(IOP)!('$D(DQTIME))
20 S (IBFLDS,IBBY)="OPT NUM BILLS GEN 65 & UP"
21 S IBDHD="(#3b) # OF OUTPT BILLS FOR PATIENTS AGE 65 AND OVER"
22 D PRT("3b",IBFLDS,IBBY,IBDHD)
23 K IOP,DQTIME
24 Q
25 ;
26TOT4 ; #4
27 N IBDHD,IBBY,IBFLDS
28 I '$D(DT) D DT^DICRW
29 S (IBFLDS,IBBY)="OPT # BILLS GEN < 30 DYS"
30 S IBDHD="(#4) # BILLS GENERATED < 30 DAYS FROM DT OF SERVICE"
31 D PRT(4,IBFLDS,IBBY,IBDHD)
32 K IOP,DQTIME
33 Q
34 ;
35TOT7 ; #7
36 N IBDHD,IBBY,IBFLDS
37 I '$D(DT) D DT^DICRW
38 S (IBFLDS,IBBY)="CPT CODE - MNTH OPT BILLS"
39 S IBDHD="(#7) TOTAL # CPT CODES ON OUTPATIENT BILLS FOR A MONTH"
40 D PRT(7,IBFLDS,IBBY,IBDHD)
41 K IOP,DQTIME
42 Q
43 ;
44TOT10 ; #10a,b
45 N IBDHD,IBBY,IBFLDS
46 I '$D(DT) D DT^DICRW
47 S (IBFLDS,IBBY)="LAG ENC DT TO CREAT & PRT"
48 S IBDHD="(#10a,10b) AVG LAG FROM ENC DATE TO CREATE AND PRINT DATES"
49 D PRT(10,IBFLDS,IBBY,IBDHD)
50 K IOP,DQTIME
51 Q
52 ;
53TOT11 ; #11
54 N DTRNG,DTRNG1
55 I '$D(DT) D DT^DICRW
56 D END
57 W !,"#11"
58 W !!,"Scanned Encounter Forms with Outpatient Bills Generated."
59 ;I $D(^DG(43,1,"GL")) S IBDFMUL=$P(^DG(43,1,"GL"),"^",2)
60 ;I $D(IBDFMUL),IBDFMUL D DIVISION^VAUTOMA I Y=-1 G END
61 ;I 'IBDFMUL S IBDFDV=$O(^DG(40.8,0))
62 S (VAUTD,IBDFMUL)=1
63 ;
64 W !!,"You will need a 132 column printer for this report!",!
65 D SELDEV I '$D(IOP)!('$D(DQTIME)) G END
66 ;
67 D DTRNG ;,SELMONTH
68 S IBZ=$G(DTRNG1($E(Y,1,5)_"01"))
69 I IBZ,$D(DTRNG(IBZ)) S IBBDT=$P(DTRNG(IBZ),U),IBEDT=$P(DTRNG(IBZ),U,2) D PRT11
70 S DIR(0)="SB^A:ALL 24 MONTHS;S:SELECTED MONTH ONLY",DIR("A")="INCLUDE ALL MONTHS OR A SELECTED MONTH",DIR("B")="A" D ^DIR K DIR
71 G:$D(DIRUT) TOT11Q
72 I Y="A" D G TOT11Q
73 .F IBZ=1:1:24 D PRT11
74 D SELMONTH
75 S IBZ=$G(DTRNG1($E(Y,1,5)_"01")) I IBZ D PRT11
76 ;
77TOT11Q G END
78 ;
79PRT11 ;
80 I IBZ,$D(DTRNG(IBZ)) S IBBDT=$P(DTRNG(IBZ),U),IBEDT=$P(DTRNG(IBZ),U,2)
81 S DIPA("DTFR")=IBBDT
82 W !,"#11 MONTH: "_$$DT()
83 S IBDFL="CLN",VAUTC=1
84 S IBDFDAT=$$HTE^XLFDT($H)
85 S IBDFBEG=IBBDT,IBDFEND=IBEDT
86 S ZTDTH=$TR(DQTIME,"@",".")
87 S ZTRTN="DQ^IBDFOSG",ZTSAVE("IB*")="",ZTSAVE("VAU*")="",ZTSAVE("VAD*")="",ZTDESC="Scanned Encntr Forms Totals" D ^%ZTLOAD
88 W !,$S($D(ZTSK):"Request Queued Task="_ZTSK,1:"Request Canceled")
89 Q
90 ;
91END D END^IBDFOSG
92 K DQTIME,IOP
93 Q
94 ;
95PRT(IBTOT,IBFLDS,IBBY,IBDHD,DIOBEG,DIOEND) ; Prt rpt
96 N IBZ,DTRNG,DTRNG1,DIPA,Y,X
97 W !,"#",IBTOT
98 D:'$D(IOP) SELDEV G:'$D(IOP)!('$D(DQTIME)) PRTQ
99 D DTRNG
100 S DIR(0)="SB^A:ALL 24 MONTHS;S:SELECTED MONTH ONLY",DIR("A")="INCLUDE ALL MONTHS OR A SELECTED MONTH",DIR("B")="A" D ^DIR K DIR
101 G:$D(DIRUT) PRTQ
102 I Y="A" D G PRTQ
103 .F IBZ=1:1:24 D PRT1
104 D SELMONTH
105 S IBZ=$G(DTRNG1($E(Y,1,5)_"01")) I IBZ D PRT1
106PRTQ Q
107 ;
108PRT1 I $G(IBTOT)=10 S DIOBEG="D BEG10^IBDFOSG2",DIOEND="D END10^IBDFOSG2"
109 S DIPA("DTTO")=$P(DTRNG(IBZ),U,2),DIPA("DTFR")=$P(DTRNG(IBZ),U),FLDS="[EFDP "_IBFLDS_"]",BY="[EFDP "_IBBY_"]"
110 S FR="3,"_DIPA("DTFR"),TO="4,"_DIPA("DTTO"),L=0,DHD=IBDHD_" MONTH: "_$$DT(),DIC="^DGCR(399,",DIS(0)="I $O(^DGCR(399,D0,""OP"",0))'="""""
111 W !,"TOTALS FOR #"_IBTOT_" ("_$$DT()_")"
112 D EN1^DIP
113 Q
114 ;
115BEG10 ; DIOBEG
116 S ^TMP($J,"EFDPTOT",1)=0,^(2)=0,^TMP($J,"EFDPTOT",3)=0,^(4)=0
117 Q
118 ;
119END10 ; DIOEND
120 W !!,"(10a) AVERAGE # DAYS LAG FROM ENCOUNTER TO BILL CREATE: ",$J($S(^TMP($J,"EFDPTOT",2):^TMP($J,"EFDPTOT",1)/^TMP($J,"EFDPTOT",2),1:0),10,2)
121 W !,"(10b) AVERAGE # DAYS LAG FROM ENCOUNTER TO BILL PRINT : ",$J($S(^TMP($J,"EFDPTOT",4):^TMP($J,"EFDPTOT",3)/^TMP($J,"EFDPTOT",4),1:0),10,2)
122 K ^TMP($J,"EFDPTOT")
123 Q
124 ;
125LAG ; Set up lag time accumulators-from computed fld
126 N X1,X2,Z,Z0,Z1
127 S (Z,X)=0,Z0=+$G(^DGCR(399,D0,"S")),Z1=+$P($G(^("S")),U,12)
128 F S Z=$O(^DGCR(399,D0,"OP",Z)) S:'Z X=0 Q:'Z D ;loop thru opt visits
129 .S X1=Z0,X2=+$G(^DGCR(399,D0,"OP",Z,0)) I X2,X1 D ^%DTC S ^TMP($J,"EFDPTOT",1)=$G(^TMP($J,"EFDPTOT",1))+X,^TMP($J,"EFDPTOT",2)=$G(^TMP($J,"EFDPTOT",2))+1 ;elapsed time and count - encounter to bill create
130 .S X1=Z1,X2=+$G(^DGCR(399,D0,"OP",Z,0)) I X2,X1 D ^%DTC S ^TMP($J,"EFDPTOT",3)=$G(^TMP($J,"EFDPTOT",3))+X,^TMP($J,"EFDPTOT",4)=$G(^TMP($J,"EFDPTOT",4))+1 ;elapsed tm,ct (encntr-bill 1st prt)
131 Q
132 ;
133GEN30 ; Was printed within 30 days of any visit on bill
134 N X1,X2,Z,Z0
135 S (Z,X)=0,Z0=+$P($G(^DGCR(399,D0,"S")),U,12) Q:'Z0
136 F S Z=$O(^DGCR(399,D0,"OP",Z)) S:'Z X=0 Q:'Z D Q:X ;loop thru opt visits
137 .S X1=Z0,X2=+$G(^DGCR(399,D0,"OP",Z,0)) I X2,X1 D ^%DTC S X=$S(X<30:1,1:0)
138 Q
139 ;
140DTRNG ;
141 N Z,Z0,X1,X2,X
142 ;S Z=2931001 F Z0=1:1:23 D
143 S Z=2940401 F Z0=1:1:24 D
144 .S X2=-1,Z1=$E(Z,1,5)+1_"01" S:$E(Z1,4,5)=13 Z1=Z1+8800
145 .S X1=Z1 D C^%DTC S DTRNG(Z0)=Z_U_X,DTRNG1(Z)=Z0,Z=Z1
146 Q
147 ;
148SELDEV ; Device/queue tm (IOP,DQTIME returned)
149 K IOP,DQTIME
150 S %ZIS("A")="Select device the output will be queued to: ",%ZIS="NQ",%ZIS("B")=""
151 D ^%ZIS K %ZIS
152 I IO=IO(0) W !,$C(7),"CANNOT BE YOUR HOME DEVICE" G SELDEV
153 I POP D HOME^%ZIS G SELDEVQ
154 S IOP="Q;"_IO
155 S %DT("A")="Select date/time to queue these reports to run: ",%DT="AEXRF",%DT("B")="NOW",%DT(0)="NOW" D ^%DT K %DT
156 I Y>0 S DQTIME=$TR(Y,".","@") I $L($P(Y,"@",2))<4 S DQTIME=DQTIME_$E("0000",1,4-$L($P(DQTIME,"@",2)))
157SELDEVQ Q
158 ;
159DT() ; Display date format
160 S Y=$E(DIPA("DTFR"),1,5)_"00"
161 D DD^%DT
162 Q Y
163 ;
164SELMONTH ;
165 F S %DT="AEPN",%DT(0)=-2960300,%DT("A")="SELECT MONTH: " D ^%DT K %DT Q:X="^"!($D(DTOUT))!($D(DTRNG1($E(Y,1,5)_"01"))) W !,$C(7),"Must choose a month from 4/94 thru 3/96"
166 Q
167 ;
Note: See TracBrowser for help on using the repository browser.