43 lines
2.5 KiB
Mathematica
43 lines
2.5 KiB
Mathematica
HBHCRP20 ; LR VAMC(IRMS)/MJT-HBHC report on file 632, unique patients by date range summary ; Apr 2000
|
|
;;1.0;HOSPITAL BASED HOME CARE;**8,10,16**;NOV 01, 1993
|
|
D START^HBHCUTL
|
|
G:(HBHCBEG1=-1)!(HBHCEND1=-1) EXIT
|
|
S %ZIS="Q",HBHCCC=0 K IOP,ZTIO,ZTSAVE D ^%ZIS G:POP EXIT
|
|
I $D(IO("Q")) S ZTRTN="DQ^HBHCRP20",ZTDESC="HBPC Unique Patients by Date Range Summary Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
|
|
DQ ; De-queue
|
|
U IO
|
|
K ^TMP("HBHC",$J)
|
|
S $P(HBHCY,"-",81)="",HBHCHEAD="Unique Patients by Date Range Summary",(HBHCCNT,HBHCCNT1)=0
|
|
S HBHCCOLM=(80-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
|
|
D TODAY^HBHCUTL D:IO'=IO(0)!($D(IO("S"))) HDRRANGE^HBHCUTL
|
|
I '$D(IO("S")),(IO=IO(0)) S HBHCCC=HBHCCC+1 D HDRRANGE^HBHCUTL
|
|
LOOP ; Loop thru ^HBHC(632) "C" (appointment date) cross-ref to build report
|
|
S X1=HBHCBEG1,X2=-1 D C^%DTC S HBHCAPDT=X_.9999
|
|
F S HBHCAPDT=$O(^HBHC(632,"C",HBHCAPDT)) Q:(HBHCAPDT="")!(HBHCAPDT>HBHCEND1) S HBHCDFN="" F S HBHCDFN=$O(^HBHC(632,"C",HBHCAPDT,HBHCDFN)) Q:HBHCDFN="" S HBHCNOD0=^HBHC(632,HBHCDFN,0) D:$P(HBHCNOD0,U,7)="" PROCESS
|
|
D CNTLOOP
|
|
W !!,"Total Patients with Single Appointment Only:",?46,$J(HBHCCNT1,4)
|
|
W !,"Total Patients with Multiple Appointments:",?46,$J(HBHCCNT,4)
|
|
W !!,"Total Unique Patients: ",$J((HBHCCNT+HBHCCNT1),5)
|
|
D ENDRPT^HBHCUTL1
|
|
EXIT ; Exit module
|
|
D ^%ZISC
|
|
K HBHCAPDT,HBHCBEG1,HBHCBEG2,HBHCCC,HBHCCNT,HBHCCNT1,HBHCCOLM,HBHCDFN,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCHEAD,HBHCNAME,HBHCNOD0,HBHCPAGE,HBHCSSN,HBHCTDY,HBHCY,HBHCZ,X,X1,X2,Y,^TMP("HBHC",$J)
|
|
Q
|
|
PROCESS ; Process record & build ^TMP("HBHC",$J) global
|
|
S HBHCDPT0=^DPT($P(HBHCNOD0,U),0)
|
|
D:$D(^TMP("HBHC",$J,$P(HBHCDPT0,U),$E($P(HBHCDPT0,U,9),1,3)_"-"_$E($P(HBHCDPT0,U,9),4,5)_"-"_$E($P(HBHCDPT0,U,9),6,9))) SET
|
|
S:'$D(^TMP("HBHC",$J,$P(HBHCDPT0,U),$E($P(HBHCDPT0,U,9),1,3)_"-"_$E($P(HBHCDPT0,U,9),4,5)_"-"_$E($P(HBHCDPT0,U,9),6,9))) ^TMP("HBHC",$J,$P(HBHCDPT0,U),$E($P(HBHCDPT0,U,9),1,3)_"-"_$E($P(HBHCDPT0,U,9),4,5)_"-"_$E($P(HBHCDPT0,U,9),6,9))=HBHCAPDT
|
|
Q
|
|
SET ; Set ^TMP("HBHC",$J
|
|
S ^TMP("HBHC",$J,$P(HBHCDPT0,U),$E($P(HBHCDPT0,U,9),1,3)_"-"_$E($P(HBHCDPT0,U,9),4,5)_"-"_$E($P(HBHCDPT0,U,9),6,9))=HBHCAPDT_U_"*"
|
|
Q
|
|
CNTLOOP ; Count loop
|
|
S HBHCNAME="" F S HBHCNAME=$O(^TMP("HBHC",$J,HBHCNAME)) Q:HBHCNAME="" S HBHCSSN="" F S HBHCSSN=$O(^TMP("HBHC",$J,HBHCNAME,HBHCSSN)) Q:HBHCSSN="" D COUNT
|
|
Q
|
|
COUNT ; Count
|
|
; patients with multiple visits
|
|
S:$P(^TMP("HBHC",$J,HBHCNAME,HBHCSSN),U,2)]"" HBHCCNT=HBHCCNT+1
|
|
; patients with only 1 visit
|
|
S:$P(^TMP("HBHC",$J,HBHCNAME,HBHCSSN),U,2)="" HBHCCNT1=HBHCCNT1+1
|
|
Q
|