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

HBHCRP4.m

Go to the documentation of this file.
HBHCRP4 ; LR VAMC(IRMS)/MJT-HBHC report on file 632, visit data by date range, sorted alphabetically by provider, then by visit date, includes all fields, & total ; Jan 2000
 ;;1.0;HOSPITAL BASED HOME CARE;**6,8,15,16,14**;NOV 01, 1993
 ; calls PROV^HBHCUTL2, EN^HBHCUTL2, TOT^HBHCUTL2, FTOT^HBHCUTL2, DX^HBHCUTL3, CPT^HBHCUTL3
 D PROV^HBHCUTL2,EN^HBHCUTL2
 G:(%=-1)!($D(DTOUT))!($D(DUOUT)) EXIT
 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^HBHCRP4",ZTDESC="HBPC Visit Data Date Range Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
DQ ; De-queue
 U IO
 K ^TMP("HBHC",$J)
 S HBHCTEXT="  Modifier:   - ",HBHCTXT="Visit",HBHCONE=1,(HBHCFTOT,HBHCTOT)=0,$P(HBHCY,"-",81)="",HBHCMSG="(continued from previous page...)",HBHCHEAD="Visit Data by Date Range",HBHCCOLM=(80-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
LOOP ; Loop thru ^HBHC(632) "C" (visit date) cross-ref to build report
 S X1=HBHCBEG1,X2=-1 D C^%DTC S HBHCDATE=X_.9999
 F  S HBHCDATE=$O(^HBHC(632,"C",HBHCDATE)) Q:(HBHCDATE="")!($P(HBHCDATE,".")>HBHCEND1)  S HBHCDFN="" F  S HBHCDFN=$O(^HBHC(632,"C",HBHCDATE,HBHCDFN)) Q:HBHCDFN=""  D PROCESS
 I '$D(^TMP("HBHC",$J)) K HBHCNAM D HDRRANGE^HBHCUTL W !!,"No Visits found for Date Range selected."
 I $D(^TMP("HBHC",$J)) D PRTLOOP I '$D(HBHCPRVL) S HBHCTXT="All Providers Visit" D FTOT^HBHCUTL2
 D ENDRPT^HBHCUTL1
EXIT ; Exit module
 D ^%ZISC
 K DIC,DTOUT,DUOUT,HBHCBEG1,HBHCBEG2,HBHCCC,HBHCCLM1,HBHCCOLM,HBHCCPT,HBHCCPTA,HBHCDATE,HBHCDFN,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCFILE,HBHCFTOT,HBHCHEAD,HBHCI,HBHCJ,HBHCMSG,HBHCNAM,HBHCNOD0,HBHCONE,HBHCPAGE,HBHCPRV,HBHCPRVL
 K HBHCSUB,HBHCTDY,HBHCTEXT,HBHCTMP,HBHCTOT,HBHCTXT,HBHCWHO,HBHCWHOC,HBHCWHOS,HBHCXREF,HBHCY,HBHCZ,X,X1,X2,Y,^TMP("HBHC",$J),%
 Q
PROCESS ; Process record & create ^TMP("HBHC",$J global
 S HBHCNOD0=^HBHC(632,HBHCDFN,0),HBHCDPT0=^DPT($P(HBHCNOD0,U),0)
 Q:$P(HBHCNOD0,U,7)]""  ; Q if cancelled appointment
 Q:($D(HBHCPRVL))&('$D(HBHCPRVL($P(HBHCNOD0,U,4))))  ; Q if not selected provider
 S HBHCPRV=$S($P(HBHCNOD0,U,4)]"":$E($P(^VA(200,$P(^HBHC(631.4,$P(HBHCNOD0,U,4),0),U,2),0),U),1,23)_"  ("_$P(^HBHC(631.4,$P(HBHCNOD0,U,4),0),U)_")",1:"None")
 S ^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,1)=$E($P(HBHCDPT0,U),1,21)_U_$E($P(HBHCDPT0,U,9),6,9)
 D DX^HBHCUTL3
 ; Note use of "DX" as subscript
 S (HBHCSUB,HBHCI)=0 F  S HBHCI=$O(HBHCDX(HBHCI)) Q:HBHCI'>0  S HBHCSUB=HBHCSUB+1,^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,"DX",HBHCI)=HBHCDX(HBHCI)
 D CPT^HBHCUTL3
 ; HBHCSUB must be initialized to 1, since node 1 is hardcoded above
 S HBHCSUB=1,HBHCI=0 F  S HBHCI=$O(HBHCCPTA(HBHCI)) Q:HBHCI'>0  S HBHCSUB=HBHCSUB+1,^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,HBHCSUB)=HBHCCPTA(HBHCI) S HBHCJ=0 F  S HBHCJ=$O(HBHCCPTA(HBHCI,HBHCJ)) Q:HBHCJ'>0  D SETMOD
 Q
SETMOD ; Set TMP global with CPT Modifier info
 S ^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,HBHCSUB,HBHCJ)=HBHCCPTA(HBHCI,HBHCJ)
 Q
PRTLOOP ; Print loop
 S HBHCPRV=""
 F  S HBHCPRV=$O(^TMP("HBHC",$J,HBHCPRV)) D TOT Q:HBHCPRV=""  D HDR S HBHCDATE="" F  S HBHCDATE=$O(^TMP("HBHC",$J,HBHCPRV,HBHCDATE)) Q:HBHCDATE=""  S HBHCDFN="" F  S HBHCDFN=$O(^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN)) Q:HBHCDFN=""  D PRINT
 Q
PRINT ; Print report
 K HBHCTMP
 S HBHCTMP(1)=^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,1)
 W !,"Visit Date:  ",$E(HBHCDATE,4,5)_"-"_$E(HBHCDATE,6,7)_"-"_(1700+$E(HBHCDATE,1,3)),?26,"Patient Name:  ",$P(HBHCTMP(1),U),?67,"Last 4:  ",$P(HBHCTMP(1),U,2) S HBHCTOT=HBHCTOT+1
 S HBHCI=0 F  S HBHCI=$O(^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,"DX",HBHCI)) Q:HBHCI'>0  D NEWPAGE W ! W:HBHCI=1 "Diagnosis:   " W ?13,^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,"DX",HBHCI)
 ; HBHCI must be initialized to 1, since node 1 is hardcoded above
 S HBHCI=1
 F  S HBHCI=$O(^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,HBHCI)) Q:HBHCI'>0  D CPTPRT S HBHCJ=0 F  S HBHCJ=$O(^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,HBHCI,HBHCJ)) Q:HBHCJ'>0  W !,HBHCTEXT,^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,HBHCI,HBHCJ)
 W !,HBHCY
 Q
HDR ; Report header setup
 S HBHCPAGE=0,HBHCNAM=HBHCPRV,HBHCCLM1=(80-(16+$L(HBHCNAM))\2) S:HBHCCLM1'>0 HBHCCLM1=1
 W @IOF D HDRRANGE^HBHCUTL
 Q 
TOT ; Print total
 Q:HBHCTOT=0
 D TOT^HBHCUTL2
 Q
CPTPRT ; CPT print
 D NEWPAGE
 W ! W:HBHCI=2 "CPT Code:  "  W ?13,^TMP("HBHC",$J,HBHCPRV,HBHCDATE,HBHCDFN,HBHCI)
 Q
NEWPAGE ; Check if new page needed
 I ((IOSL-$Y)<8) W @IOF D HDRRANGE^HBHCUTL W !,HBHCMSG,!
 Q