HBHCRP18 ;LR VAMC(IRMS)/MJT - HBHC rpt, file 631, All active (admitted but not D/C) cases by date range, sorted by patient name, includes: name, Last Four, adm date, primary diagnosis @ adm (code & text), & total ;12/21/05 3:31pm
;;1.0;HOSPITAL BASED HOME CARE;**6,22,24,25**;NOV 01, 1993;Build 45
;
; This routine references the following supported ICRs:
; 5747 $$CODEC^ICDEX
; 5747 $$VSTD^ICDEX
;
;******************************************************************************
;******************************************************************************
; --- ROUTINE MODIFICATION LOG ---
;
;PKG/PATCH DATE DEVELOPER MODIFICATION
;----------- ---------- ----------- ----------------------------------------
;HBH*1.0*25 FEB 2012 K GUPTA Support for ICD-10 Coding System
;******************************************************************************
;******************************************************************************
;
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^HBHCRP18",ZTDESC="HBPC Active Census with ICD Code/Text 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="Active Census with ICD Code/Text"
S HBHCHDR="W !,""Patient Name"",?40,""Last Four"",?61,""Date"",?82,"""_$$ICDTEXT^HBHCUTL3(HBHCBEG1,HBHCEND1)_" Code"",?102,""Diagnosis Text"""
S 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 W @IOF 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,!,"Active Census Total: ",HBHCTOT,!,HBHCZ
D END132^HBHCUTL1
EXIT ; Exit module
D ^%ZISC
K HBHCADDT,HBHCBEG1,HBHCBEG2,HBHCCC,HBHCCOLM,HBHCDFN,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCHDR,HBHCHEAD,HBHCICDP,HBHCNAME,HBHCNOD0,HBHCPAGE,HBHCTDY,HBHCTMP,HBHCTOT,HBHCY,HBHCZ,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)
N HBHCDXCODE,HBHCDXDESC
S HBHCDPT0=^DPT($P(HBHCNOD0,U),0),HBHCICDP=$P(HBHCNOD0,U,19)
I HBHCICDP]"" D I 1
. S HBHCDXCODE=$$CODEC^ICDEX(80,HBHCICDP)
. S HBHCDXDESC=$$VSTD^ICDEX(HBHCICDP)
S ^TMP("HBHC",$J,$P(HBHCDPT0,U),HBHCADDT)=$E($P(HBHCDPT0,U,9),6,9)_U_$G(HBHCDXCODE)_U_$G(HBHCDXDESC)
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 Y=HBHCADDT D DD^%DT
S HBHCTMP=^TMP("HBHC",$J,HBHCNAME,HBHCADDT)
W !,HBHCNAME,?40,$P(HBHCTMP,U),?61,Y,?82,$P(HBHCTMP,U,2),?102,$P(HBHCTMP,U,3),!,HBHCY
S HBHCTOT=HBHCTOT+1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHBHCRP18 3380 printed Oct 16, 2024@17:59:09 Page 2
HBHCRP18 ;LR VAMC(IRMS)/MJT - HBHC rpt, file 631, All active (admitted but not D/C) cases by date range, sorted by patient name, includes: name, Last Four, adm date, primary diagnosis @ adm (code & text), & total ;12/21/05 3:31pm
+1 ;;1.0;HOSPITAL BASED HOME CARE;**6,22,24,25**;NOV 01, 1993;Build 45
+2 ;
+3 ; This routine references the following supported ICRs:
+4 ; 5747 $$CODEC^ICDEX
+5 ; 5747 $$VSTD^ICDEX
+6 ;
+7 ;******************************************************************************
+8 ;******************************************************************************
+9 ; --- ROUTINE MODIFICATION LOG ---
+10 ;
+11 ;PKG/PATCH DATE DEVELOPER MODIFICATION
+12 ;----------- ---------- ----------- ----------------------------------------
+13 ;HBH*1.0*25 FEB 2012 K GUPTA Support for ICD-10 Coding System
+14 ;******************************************************************************
+15 ;******************************************************************************
+16 ;
+17 DO START^HBHCUTL
+18 if (HBHCBEG1=-1)!(HBHCEND1=-1)
GOTO EXIT
+19 SET %ZIS="Q"
SET HBHCCC=0
KILL IOP,ZTIO,ZTSAVE
DO ^%ZIS
if POP
GOTO EXIT
+20 IF $DATA(IO("Q"))
SET ZTRTN="DQ^HBHCRP18"
SET ZTDESC="HBPC Active Census with ICD Code/Text 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="Active Census with ICD Code/Text"
+4 SET HBHCHDR="W !,""Patient Name"",?40,""Last Four"",?61,""Date"",?82,"""_$$ICDTEXT^HBHCUTL3(HBHCBEG1,HBHCEND1)_" Code"",?102,""Diagnosis Text"""
+5 SET HBHCCOLM=(132-(30+$LENGTH(HBHCHEAD))\2)
if HBHCCOLM'>0
SET HBHCCOLM=1
+6 DO TODAY^HBHCUTL
if IO'=IO(0)!($DATA(IO("S")))
DO HDR132^HBHCUTL
+7 IF '$DATA(IO("S"))
IF (IO=IO(0))
SET HBHCCC=HBHCCC+1
WRITE @IOF
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,!,"Active Census Total: ",HBHCTOT,!,HBHCZ
+5 DO END132^HBHCUTL1
EXIT ; Exit module
+1 DO ^%ZISC
+2 KILL HBHCADDT,HBHCBEG1,HBHCBEG2,HBHCCC,HBHCCOLM,HBHCDFN,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCHDR,HBHCHEAD,HBHCICDP,HBHCNAME,HBHCNOD0,HBHCPAGE,HBHCTDY,HBHCTMP,HBHCTOT,HBHCY,HBHCZ,X,X1,X2,Y,^TMP("HBHC",$JOB)
+3 QUIT
PROCESS ; Process record & build ^TMP("HBHC",$J) global
+1 if ($PIECE(HBHCNOD0,U,40)]"")&($PIECE(HBHCNOD0,U,40)<HBHCEND1)
QUIT
+2 NEW HBHCDXCODE,HBHCDXDESC
+3 SET HBHCDPT0=^DPT($PIECE(HBHCNOD0,U),0)
SET HBHCICDP=$PIECE(HBHCNOD0,U,19)
+4 IF HBHCICDP]""
Begin DoDot:1
+5 SET HBHCDXCODE=$$CODEC^ICDEX(80,HBHCICDP)
+6 SET HBHCDXDESC=$$VSTD^ICDEX(HBHCICDP)
End DoDot:1
IF 1
+7 SET ^TMP("HBHC",$JOB,$PIECE(HBHCDPT0,U),HBHCADDT)=$EXTRACT($PIECE(HBHCDPT0,U,9),6,9)_U_$GET(HBHCDXCODE)_U_$GET(HBHCDXDESC)
+8 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 Y=HBHCADDT
DO DD^%DT
+3 SET HBHCTMP=^TMP("HBHC",$JOB,HBHCNAME,HBHCADDT)
+4 WRITE !,HBHCNAME,?40,$PIECE(HBHCTMP,U),?61,Y,?82,$PIECE(HBHCTMP,U,2),?102,$PIECE(HBHCTMP,U,3),!,HBHCY
+5 SET HBHCTOT=HBHCTOT+1
+6 QUIT