Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HBHCRP25

HBHCRP25.m

Go to the documentation of this file.
HBHCRP25 ; LR VAMC(IRMS)/MJT-HBHC report on file 631, All active (admitted but not D/C) cases by date range, sorted by patient name, includes: patient name, last 4, date, address, city, ZIP code, phone, case manager & total ; Sep 03
 ;;1.0;HOSPITAL BASED HOME CARE;**21**;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^HBHCRP25",ZTDESC="HBPC Address Included Program Census Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
DQ ; De-queue
 U IO
 K ^TMP("HBHC",$J)
 S HBHCTOT=0,$P(HBHCY,"-",133)="",$P(HBHCZ,"=",133)="",HBHCHEAD="Address Included Program Census",HBHCCOLM=(132-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
 S HBHCHDR="W !,?20,""Last"",?29,""Admission"",?124,""Case"",!,""Patient Name"",?20,""Four"",?29,""Date"",?41,""Street Address"",?74,""City"",?94,""ZIP Code"",?108,""Phone"",?124,""Manager"""
 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) "AD" (admission date) cross-ref to build report
 S X1=HBHCBEG1,X2=-1 D C^%DTC S HBHCADDT=X
 F  S HBHCADDT=$O(^HBHC(631,"AD",HBHCADDT)) Q:(HBHCADDT="")!(HBHCADDT>HBHCEND1)  S HBHCDFN="" F  S HBHCDFN=$O(^HBHC(631,"AD",HBHCADDT,HBHCDFN)) Q:HBHCDFN=""  S HBHCNOD0=^HBHC(631,HBHCDFN,0) D:$P(HBHCNOD0,U,15)=1 PROCESS
 W:'$D(^TMP("HBHC",$J)) !!,"No data found for Date Range selected."
 I $D(^TMP("HBHC",$J)) D PRTLOOP W !!,HBHCZ,!,"Program Census Total: ",HBHCTOT,!,HBHCZ
 D END132^HBHCUTL1
EXIT ; Exit module
 D ^%ZISC
 K HBHCADDT,HBHCBEG1,HBHCBEG2,HBHCCASE,HBHCCOLM,HBHCCC,HBHCDAT,HBHCDATE,HBHCDFN,HBHCDISC,HBHCDPT,HBHCDPTA,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCHDR,HBHCHEAD,HBHCI,HBHCNAME,HBHCNOD0,HBHCNOD1,HBHCPAGE,HBHCPHON,HBHCSTOP,HBHCTDY,HBHCTMP
 K HBHCTOT,HBHCY,HBHCZ,HBHCZIP,X,X1,X2,Y,^TMP("HBHC",$J)
 Q
PROCESS ; Process record & build ^TMP("HBHC",$J) global
 Q:($P(HBHCNOD0,U,40)]"")&($P(HBHCNOD0,U,40)<HBHCEND1)
 S HBHCNOD1=$G(^HBHC(631,HBHCDFN,1)),HBHCCASE="" S:$P(HBHCNOD1,U,13)]"" HBHCCASE=$P(^VA(200,$P(^HBHC(631.4,$P(HBHCNOD1,U,13),0),U,2),0),U)
 S HBHCDPT=$P(HBHCNOD0,U),HBHCDPT0=^DPT(HBHCDPT,0),HBHCDPTA=$G(^DPT($P(HBHCNOD0,U),.11))
 S HBHCZIP=$S(($P(HBHCDPTA,U,12)]""):$E($P(HBHCDPTA,U,12),1,5)_$S($E($P(HBHCDPTA,U,12),6,9)]"":"-"_$E($P(HBHCDPTA,U,12),6,9),1:""),1:$E($P(HBHCDPTA,U,6),1,5)_$S($E($P(HBHCDPTA,U,6),6,9)]"":"-"_$E($P(HBHCDPTA,U,6),6,9),1:""))
 S HBHCPHON=$P($G(^DPT($P(HBHCNOD0,U),.13)),U)
 ; Remove alpha characters, (, ), -, & blanks from phone number
 S HBHCPHON=$TR(HBHCPHON,"("),HBHCPHON=$TR(HBHCPHON,")"),HBHCPHON=$TR(HBHCPHON,"-"),HBHCPHON=$TR(HBHCPHON," "),HBHCPHON=$TR(HBHCPHON,"ABCEDFGHIJKLMNOPQRSTUVWXYZ"),HBHCPHON=$TR(HBHCPHON,"abcdefghijklmnopqrstuvwxyz")
 S:$L(HBHCPHON>10) HBHCPHON=$E(HBHCPHON,1,10)
 S:HBHCPHON?7N HBHCPHON=$E(HBHCPHON,1,3)_"-"_$E(HBHCPHON,4,7) S:HBHCPHON?10N HBHCPHON="("_$E(HBHCPHON,1,3)_") "_$E(HBHCPHON,4,6)_"-"_$E(HBHCPHON,7,10)
 S ^TMP("HBHC",$J,$P(HBHCDPT0,U),$E(HBHCADDT,4,5)_"-"_$E(HBHCADDT,6,7)_"-"_$E(HBHCADDT,2,3))=$E($P(HBHCDPT0,U,9),6,9)_U_$P(HBHCDPTA,U)_U_$P(HBHCDPTA,U,2)_U_$P(HBHCDPTA,U,3)_U_$E($P(HBHCDPTA,U,4),1,15)_U_HBHCZIP_U_HBHCPHON_U_HBHCCASE
 Q
PRTLOOP ; Print loop
 S HBHCNAME="" F  S HBHCNAME=$O(^TMP("HBHC",$J,HBHCNAME)) Q:HBHCNAME=""  S HBHCADDT="" F  S HBHCADDT=$O(^TMP("HBHC",$J,HBHCNAME,HBHCADDT)) Q:HBHCADDT=""  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,HBHCADDT)
 W !,$E(HBHCNAME,1,17),?20,$P(HBHCTMP,U),?29,HBHCADDT,?41,$P(HBHCTMP,U,2),?74,$P(HBHCTMP,U,5),?94,$P(HBHCTMP,U,6),?108,$P(HBHCTMP,U,7),?124,$S(($L($P($P(HBHCTMP,U,8),","))>8):$E($P(HBHCTMP,U,8),1,8),1:$P($P(HBHCTMP,U,8),","))
 W:$P(HBHCTMP,U,3)]"" !?41,$P(HBHCTMP,U,3)
 W:$P(HBHCTMP,U,4)]"" !?41,$P(HBHCTMP,U,4)
 W !,HBHCY
 S HBHCTOT=HBHCTOT+1
 Q