source: WorldVistAEHR/trunk/r/HOSPITAL_BASED_HOME_CARE-HBH/HBHCRP16.m@ 1042

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

initial load of WorldVistAEHR

File size: 2.7 KB
Line 
1HBHCRP16 ; 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
2 ;;1.0;HOSPITAL BASED HOME CARE;**6,22**;NOV 01, 1993;Build 2
3 D START^HBHCUTL
4 G:(HBHCBEG1=-1)!(HBHCEND1=-1) EXIT
5 S %ZIS="Q",HBHCCC=0 K IOP,ZTIO,ZTSAVE D ^%ZIS G:POP EXIT
6 I $D(IO("Q")) S ZTRTN="DQ^HBHCRP16",ZTDESC="HBPC Rejections from Program Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
7DQ ; De-queue
8 U IO
9 K ^TMP("HBHC",$J)
10 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
11 D TODAY^HBHCUTL D:IO'=IO(0)!($D(IO("S"))) HDR132^HBHCUTL
12 I '$D(IO("S")),(IO=IO(0)) S HBHCCC=HBHCCC+1 D HDR132^HBHCUTL
13LOOP ; Loop thru ^HBHC(631,"AI") evaluation date cross-ref to build report, rejects will only contain evaluation date data until HBHC/PCE patch installed
14 S X1=HBHCBEG1,X2=-1 D C^%DTC S (HBHCDAT,HBHCDATE)=X
15 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
16 ; Loop thru ^HBHC(631,"AD") Date cross-ref to build report, after HBHC/PCE patch installed, only Date (formerly Admission Date) will contain data
17 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
18 I $D(^TMP("HBHC",$J)) D PRTLOOP W !!,HBHCZ,!,"Program Rejections Total: ",HBHCTOT,!,HBHCZ
19 D END132^HBHCUTL1
20EXIT ; Exit module
21 D ^%ZISC
22 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)
23 Q
24PROCESS ; Process record & build ^TMP("HBHC",$J) global
25 S HBHCNOD0=^HBHC(631,HBHCDFN,0)
26 ; Q:Admit/Reject Action field=Admit or is null
27 Q:($P(HBHCNOD0,U,15)=1)!($P(HBHCNOD0,U,15)="")
28 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:"")
29 S ^TMP("HBHC",$J,$P(HBHCDPT0,U),HBHCDATE)=$E($P(HBHCDPT0,U,9),6,9)_U_HBHCREJ
30 Q
31PRTLOOP ; Print loop
32 S HBHCTOT=0
33 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
34 Q
35PRINT ; Print report
36 I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDR132^HBHCUTL
37 S HBHCTMP=^TMP("HBHC",$J,HBHCNAME,HBHCDATE),HBHCTOT=HBHCTOT+1
38 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
39 Q
Note: See TracBrowser for help on using the repository browser.