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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHBHCRP25 3894 printed Nov 22, 2024@17:08:38 Page 2
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 ;;1.0;HOSPITAL BASED HOME CARE;**21**;NOV 01, 1993
+2 DO START^HBHCUTL
+3 if (HBHCBEG1=-1)!(HBHCEND1=-1)
GOTO EXIT
+4 SET %ZIS="Q"
SET HBHCCC=0
KILL IOP,ZTIO,ZTSAVE
DO ^%ZIS
if POP
GOTO EXIT
+5 IF $DATA(IO("Q"))
SET ZTRTN="DQ^HBHCRP25"
SET ZTDESC="HBPC Address Included Program Census Report"
SET ZTSAVE("HBHC*")=""
DO ^%ZTLOAD
GOTO EXIT
DQ ; De-queue
+1 USE IO
+2 KILL ^TMP("HBHC",$JOB)
+3 SET HBHCTOT=0
SET $PIECE(HBHCY,"-",133)=""
SET $PIECE(HBHCZ,"=",133)=""
SET HBHCHEAD="Address Included Program Census"
SET HBHCCOLM=(132-(30+$LENGTH(HBHCHEAD))\2)
if HBHCCOLM'>0
SET HBHCCOLM=1
+4 SET 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"""
+5 DO TODAY^HBHCUTL
if IO'=IO(0)!($DATA(IO("S")))
DO HDR132^HBHCUTL
+6 IF '$DATA(IO("S"))
IF (IO=IO(0))
SET HBHCCC=HBHCCC+1
DO HDR132^HBHCUTL
LOOP ; Loop thru ^HBHC(631) "AD" (admission date) cross-ref to build report
+1 SET X1=HBHCBEG1
SET X2=-1
DO C^%DTC
SET HBHCADDT=X
+2 FOR
SET HBHCADDT=$ORDER(^HBHC(631,"AD",HBHCADDT))
if (HBHCADDT="")!(HBHCADDT>HBHCEND1)
QUIT
SET HBHCDFN=""
FOR
SET HBHCDFN=$ORDER(^HBHC(631,"AD",HBHCADDT,HBHCDFN))
if HBHCDFN=""
QUIT
SET HBHCNOD0=^HBHC(631,HBHCDFN,0)
if $PIECE(HBHCNOD0,U,15)=1
DO PROCESS
+3 if '$DATA(^TMP("HBHC",$JOB))
WRITE !!,"No data found for Date Range selected."
+4 IF $DATA(^TMP("HBHC",$JOB))
DO PRTLOOP
WRITE !!,HBHCZ,!,"Program Census Total: ",HBHCTOT,!,HBHCZ
+5 DO END132^HBHCUTL1
EXIT ; Exit module
+1 DO ^%ZISC
+2 KILL 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
+3 KILL HBHCTOT,HBHCY,HBHCZ,HBHCZIP,X,X1,X2,Y,^TMP("HBHC",$JOB)
+4 QUIT
PROCESS ; Process record & build ^TMP("HBHC",$J) global
+1 if ($PIECE(HBHCNOD0,U,40)]"")&($PIECE(HBHCNOD0,U,40)<HBHCEND1)
QUIT
+2 SET HBHCNOD1=$GET(^HBHC(631,HBHCDFN,1))
SET HBHCCASE=""
if $PIECE(HBHCNOD1,U,13)]""
SET HBHCCASE=$PIECE(^VA(200,$PIECE(^HBHC(631.4,$PIECE(HBHCNOD1,U,13),0),U,2),0),U)
+3 SET HBHCDPT=$PIECE(HBHCNOD0,U)
SET HBHCDPT0=^DPT(HBHCDPT,0)
SET HBHCDPTA=$GET(^DPT($PIECE(HBHCNOD0,U),.11))
+4 SET HBHCZIP=$SELECT(($PIECE(HBHCDPTA,U,12)]""):$EXTRACT($PIECE(HBHCDPTA,U,12),1,5)_$SELECT($EXTRACT(...
... $PIECE(HBHCDPTA,U,12),6,9)]"":"-"_$EXTRACT($PIECE(HBHCDPTA,U,12),6,9),1:""),1:$EXTRACT($PIECE(HBHCDPTA,U,6),1,5)_$SELECT($EXTRACT($PIECE(HBHCDPTA,U,6),6,9)]"":"-"_$EXTRACT($PIECE(HBHCDPTA,U,6),6,9),1:""))
+5 SET HBHCPHON=$PIECE($GET(^DPT($PIECE(HBHCNOD0,U),.13)),U)
+6 ; Remove alpha characters, (, ), -, & blanks from phone number
+7 SET HBHCPHON=$TRANSLATE(HBHCPHON,"(")
SET HBHCPHON=$TRANSLATE(HBHCPHON,")")
SET HBHCPHON=$TRANSLATE(HBHCPHON,"-")
SET HBHCPHON=$TRANSLATE(HBHCPHON," ")
SET HBHCPHON=$TRANSLATE(HBHCPHON,"ABCEDFGHIJKLMNOPQRSTUVWXYZ")
SET HBHCPHON=$TRANSLATE(HBHCPHON,"abcdefghijklmnopqrstuvwxyz")
+8 if $LENGTH(HBHCPHON>10)
SET HBHCPHON=$EXTRACT(HBHCPHON,1,10)
+9 if HBHCPHON?7N
SET HBHCPHON=$EXTRACT(HBHCPHON,1,3)_"-"_$EXTRACT(HBHCPHON,4,7)
if HBHCPHON?10N
SET HBHCPHON="("_$EXTRACT(HBHCPHON,1,3)_") "_$EXTRACT(HBHCPHON,4,6)_"-"_$EXTRACT(HBHCPHON,7,10)
+10 SET ^TMP("HBHC",$JOB,$PIECE(HBHCDPT0,U),$EXTRACT(HBHCADDT,4,5)_"-"_$EXTRACT(HBHCADDT,6,7)_"-"_...
... $EXTRACT(HBHCADDT,2,3))=$EXTRACT($PIECE(HBHCDPT0,U,9),6,9)_U_$PIECE(HBHCDPTA,U)_U_$PIECE(HBHCDPTA,U,2)_U_$PIECE(HBHCDPTA,U,3)_U_$EXTRACT($PIECE(HBHCDPTA,U,4),1,15)_U_HBHCZIP_U_HBHCPHON_U_HBHCCASE
+11 QUIT
PRTLOOP ; Print loop
+1 SET HBHCNAME=""
FOR
SET HBHCNAME=$ORDER(^TMP("HBHC",$JOB,HBHCNAME))
if HBHCNAME=""
QUIT
SET HBHCADDT=""
FOR
SET HBHCADDT=$ORDER(^TMP("HBHC",$JOB,HBHCNAME,HBHCADDT))
if HBHCADDT=""
QUIT
DO PRINT
+2 QUIT
PRINT ; Print report
+1 IF ($DATA(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5)
WRITE @IOF
DO HDR132^HBHCUTL
+2 SET HBHCTMP=^TMP("HBHC",$JOB,HBHCNAME,HBHCADDT)
+3 WRITE !,$EXTRACT(HBHCNAME,1,17),?20,$PIECE(HBHCTMP,U),?29,HBHCADDT,?41,$PIECE(HBHCTMP,U,2),?74,$PIECE(HBHCTMP,U,5),?94,$PIECE(HBHCTMP,U,6),?108,$PIECE(HBHCTMP,U,7),?124,...
... $SELECT(($LENGTH($PIECE($PIECE(HBHCTMP,U,8),","))>8):$EXTRACT($PIECE(HBHCTMP,U,8),1,8),1:$PIECE($PIECE(HBHCTMP,U,8),","))
+4 if $PIECE(HBHCTMP,U,3)]""
WRITE !?41,$PIECE(HBHCTMP,U,3)
+5 if $PIECE(HBHCTMP,U,4)]""
WRITE !?41,$PIECE(HBHCTMP,U,4)
+6 WRITE !,HBHCY
+7 SET HBHCTOT=HBHCTOT+1
+8 QUIT