source: WorldVistAEHR/trunk/r/HOSPITAL_BASED_HOME_CARE-HBH/HBHCRP18.m@ 701

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

initial load of WorldVistAEHR

File size: 2.4 KB
Line 
1HBHCRP18 ; 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
2 ;;1.0;HOSPITAL BASED HOME CARE;**6,22**;NOV 01, 1993;Build 2
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^HBHCRP18",ZTDESC="HBPC Active Census with ICD9 Code/Text 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="Active Census with ICD9 Code/Text",HBHCHDR="W !,""Patient Name"",?40,""Last Four"",?61,""Date"",?82,""ICD9 Code"",?102,""Diagnosis Text"""
11 S HBHCCOLM=(132-(30+$L(HBHCHEAD))\2) S:HBHCCOLM'>0 HBHCCOLM=1
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 W @IOF 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,!,"Active Census Total: ",HBHCTOT,!,HBHCZ
19 D END132^HBHCUTL1
20EXIT ; Exit module
21 D ^%ZISC
22 K HBHCADDT,HBHCBEG1,HBHCBEG2,HBHCCC,HBHCCOLM,HBHCDFN,HBHCDPT0,HBHCEND1,HBHCEND2,HBHCHDR,HBHCHEAD,HBHCICD0,HBHCNAME,HBHCNOD0,HBHCPAGE,HBHCTDY,HBHCTMP,HBHCTOT,HBHCY,HBHCZ,X,X1,X2,Y,^TMP("HBHC",$J)
23 Q
24PROCESS ; Process record & build ^TMP("HBHC",$J) global
25 Q:($P(HBHCNOD0,U,40)]"")&($P(HBHCNOD0,U,40)<HBHCEND1)
26 S HBHCDPT0=^DPT($P(HBHCNOD0,U),0),HBHCICD0=$S($P(HBHCNOD0,U,19)]"":^ICD9($P(HBHCNOD0,U,19),0),1:"")
27 S ^TMP("HBHC",$J,$P(HBHCDPT0,U),HBHCADDT)=$E($P(HBHCDPT0,U,9),6,9)_U_$P(HBHCICD0,U)_U_$P(HBHCICD0,U,3)
28 Q
29PRTLOOP ; Print loop
30 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
31 Q
32PRINT ; Print report
33 I ($D(ZTRTN)!(HBHCCC=0))&((IOSL-$Y)<5) W @IOF D HDR132^HBHCUTL
34 S Y=HBHCADDT D DD^%DT
35 S HBHCTMP=^TMP("HBHC",$J,HBHCNAME,HBHCADDT)
36 W !,HBHCNAME,?40,$P(HBHCTMP,U),?61,Y,?82,$P(HBHCTMP,U,2),?102,$P(HBHCTMP,U,3),!,HBHCY
37 S HBHCTOT=HBHCTOT+1
38 Q
Note: See TracBrowser for help on using the repository browser.