source: WorldVistAEHR/trunk/r/HOSPITAL_BASED_HOME_CARE-HBH/HBHCRP25.m@ 1450

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1HBHCRP25 ; 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
2 ;;1.0;HOSPITAL BASED HOME CARE;**21**;NOV 01, 1993
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^HBHCRP25",ZTDESC="HBPC Address Included Program Census Report",ZTSAVE("HBHC*")="" D ^%ZTLOAD G EXIT
7DQ ; De-queue
8 U IO
9 K ^TMP("HBHC",$J)
10 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
11 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"""
12 D TODAY^HBHCUTL D:IO'=IO(0)!($D(IO("S"))) HDR132^HBHCUTL
13 I '$D(IO("S")),(IO=IO(0)) S HBHCCC=HBHCCC+1 D HDR132^HBHCUTL
14LOOP ; Loop thru ^HBHC(631) "AD" (admission date) cross-ref to build report
15 S X1=HBHCBEG1,X2=-1 D C^%DTC S HBHCADDT=X
16 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
17 W:'$D(^TMP("HBHC",$J)) !!,"No data found for Date Range selected."
18 I $D(^TMP("HBHC",$J)) D PRTLOOP W !!,HBHCZ,!,"Program Census Total: ",HBHCTOT,!,HBHCZ
19 D END132^HBHCUTL1
20EXIT ; Exit module
21 D ^%ZISC
22 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
23 K HBHCTOT,HBHCY,HBHCZ,HBHCZIP,X,X1,X2,Y,^TMP("HBHC",$J)
24 Q
25PROCESS ; Process record & build ^TMP("HBHC",$J) global
26 Q:($P(HBHCNOD0,U,40)]"")&($P(HBHCNOD0,U,40)<HBHCEND1)
27 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)
28 S HBHCDPT=$P(HBHCNOD0,U),HBHCDPT0=^DPT(HBHCDPT,0),HBHCDPTA=$G(^DPT($P(HBHCNOD0,U),.11))
29 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:""))
30 S HBHCPHON=$P($G(^DPT($P(HBHCNOD0,U),.13)),U)
31 ; Remove alpha characters, (, ), -, & blanks from phone number
32 S HBHCPHON=$TR(HBHCPHON,"("),HBHCPHON=$TR(HBHCPHON,")"),HBHCPHON=$TR(HBHCPHON,"-"),HBHCPHON=$TR(HBHCPHON," "),HBHCPHON=$TR(HBHCPHON,"ABCEDFGHIJKLMNOPQRSTUVWXYZ"),HBHCPHON=$TR(HBHCPHON,"abcdefghijklmnopqrstuvwxyz")
33 S:$L(HBHCPHON>10) HBHCPHON=$E(HBHCPHON,1,10)
34 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)
35 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
36 Q
37PRTLOOP ; Print loop
38 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
39 Q
40PRINT ; Print report
41 I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDR132^HBHCUTL
42 S HBHCTMP=^TMP("HBHC",$J,HBHCNAME,HBHCADDT)
43 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),","))
44 W:$P(HBHCTMP,U,3)]"" !?41,$P(HBHCTMP,U,3)
45 W:$P(HBHCTMP,U,4)]"" !?41,$P(HBHCTMP,U,4)
46 W !,HBHCY
47 S HBHCTOT=HBHCTOT+1
48 Q
Note: See TracBrowser for help on using the repository browser.