40 lines
2.7 KiB
Mathematica
40 lines
2.7 KiB
Mathematica
HBHCRP16 ; LR VAMC(IRMS)/MJT-HBHC report on file 631, Admit/Reject Action field=Reject for date range, sorted by name, includes: patient name, Last Four, & evaluation date ; 12/21/05 3:30pm
|
|
;;1.0;HOSPITAL BASED HOME CARE;**6,22**;NOV 01, 1993;Build 2
|
|
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^HBHCRP16",ZTDESC="HBPC Rejections from Program Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
|
|
DQ ; De-queue
|
|
U IO
|
|
K ^TMP("HBHC",$J)
|
|
S $P(HBHCY,"-",133)="",$P(HBHCZ,"=",133)="",HBHCHEAD="Rejections from Program",HBHCHDR="W !,""Patient Name"",?37,""Last Four"",?55,""Date"",?70,""Reject/Withdraw Reason""",HBHCCOLM=(132-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
|
|
D TODAY^HBHCUTL D:IO'=IO(0)!($D(IO("S"))) HDR132^HBHCUTL
|
|
I '$D(IO("S")),(IO=IO(0)) S HBHCCC=HBHCCC+1 D HDR132^HBHCUTL
|
|
LOOP ; Loop thru ^HBHC(631,"AI") evaluation date cross-ref to build report, rejects will only contain evaluation date data until HBHC/PCE patch installed
|
|
S X1=HBHCBEG1,X2=-1 D C^%DTC S (HBHCDAT,HBHCDATE)=X
|
|
F S HBHCDATE=$O(^HBHC(631,"AI",HBHCDATE)) Q:(HBHCDATE="")!(HBHCDATE>HBHCEND1) S HBHCDFN="" F S HBHCDFN=$O(^HBHC(631,"AI",HBHCDATE,HBHCDFN)) Q:HBHCDFN="" D PROCESS
|
|
; Loop thru ^HBHC(631,"AD") Date cross-ref to build report, after HBHC/PCE patch installed, only Date (formerly Admission Date) will contain data
|
|
S HBHCDATE=HBHCDAT F S HBHCDATE=$O(^HBHC(631,"AD",HBHCDATE)) Q:(HBHCDATE="")!(HBHCDATE>HBHCEND1) S HBHCDFN="" F S HBHCDFN=$O(^HBHC(631,"AD",HBHCDATE,HBHCDFN)) Q:HBHCDFN="" D PROCESS
|
|
I $D(^TMP("HBHC",$J)) D PRTLOOP W !!,HBHCZ,!,"Program Rejections Total: ",HBHCTOT,!,HBHCZ
|
|
D END132^HBHCUTL1
|
|
EXIT ; Exit module
|
|
D ^%ZISC
|
|
K HBHCBEG1,HBHCBEG2,HBHCCC,HBHCCOLM,HBHCDAT,HBHCDATE,HBHCDFN,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCHDR,HBHCHEAD,HBHCNAME,HBHCNOD0,HBHCPAGE,HBHCREJ,HBHCTDY,HBHCTMP,HBHCTOT,HBHCY,HBHCZ,X,X1,X2,Y,^TMP("HBHC",$J)
|
|
Q
|
|
PROCESS ; Process record & build ^TMP("HBHC",$J) global
|
|
S HBHCNOD0=^HBHC(631,HBHCDFN,0)
|
|
; Q:Admit/Reject Action field=Admit or is null
|
|
Q:($P(HBHCNOD0,U,15)=1)!($P(HBHCNOD0,U,15)="")
|
|
S HBHCDPT0=^DPT($P(HBHCNOD0,U),0),HBHCREJ=$S($P(HBHCNOD0,U,16)]"":$P(^HBHC(631.1,$P(HBHCNOD0,U,16),0),U,2),1:"")
|
|
S ^TMP("HBHC",$J,$P(HBHCDPT0,U),HBHCDATE)=$E($P(HBHCDPT0,U,9),6,9)_U_HBHCREJ
|
|
Q
|
|
PRTLOOP ; Print loop
|
|
S HBHCTOT=0
|
|
S HBHCNAME="" F S HBHCNAME=$O(^TMP("HBHC",$J,HBHCNAME)) Q:HBHCNAME="" S HBHCDATE="" F S HBHCDATE=$O(^TMP("HBHC",$J,HBHCNAME,HBHCDATE)) Q:HBHCDATE="" D PRINT
|
|
Q
|
|
PRINT ; Print report
|
|
I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDR132^HBHCUTL
|
|
S HBHCTMP=^TMP("HBHC",$J,HBHCNAME,HBHCDATE),HBHCTOT=HBHCTOT+1
|
|
W !,HBHCNAME,?37,$P(HBHCTMP,U),?55,$E(HBHCDATE,4,5)_"-"_$E(HBHCDATE,6,7)_"-"_$E(HBHCDATE,2,3),?70,$P(HBHCTMP,U,2),!,HBHCY
|
|
Q
|