VistA-FOIAVistA/r/FEE_BASIS-FB/FBNHAMI2.m

41 lines
2.3 KiB
Mathematica
Raw Permalink Normal View History

FBNHAMI2 ;AISC/CMR-CNH STAYS IN EXCESS OF 90 DAYS ;1DEC00
;;3.5;FEE BASIS;**25**;JAN 30, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
W !!,"Use of this option will provide you with all 'ACTIVE' stays that are in excess",!,"of 90 days. The active stays are as of the date you choose.",!
S %DT="APEX",%DT("A")="Enter Effective Date : " D ^%DT G END:Y<0 S FBDT=Y
S VAR="FBDT",VAL=FBDT,PGM="START^FBNHAMI2" D ZIS^FBAAUTL G END:FBPOP
START K ^TMP($J,"FBSTAY") S FBHD="=",$P(FBHD,"=",80)="=",FBUL="-",$P(FBUL,"-",37)="-" U IO W:$E(IOST,1,2)["C-" @IOF D HED
S (FBADM,FBASSOC)=0
F S FBADM=$O(^FBAACNH("AC",FBADM)) Q:'FBADM S FBCHK=0 D I FBCHK=0 D SET
.F S FBASSOC=$O(^FBAACNH("AC",FBADM,FBASSOC)) Q:'FBASSOC D
..Q:FBADM=FBASSOC
..S FBI=$G(^FBAACNH(FBASSOC,0)),FBTYPE=$P(FBI,"^",3) Q:FBTYPE'="D" S FBDDT=$P(FBI,"^") I FBDDT'>FBDT S FBCHK=1
S FBNAME=""
F S FBNAME=$O(^TMP($J,"FBSTAY",FBNAME)) Q:FBNAME']""!($G(FBAAOUT)) S DFN=0 F S DFN=$O(^TMP($J,"FBSTAY",FBNAME,DFN)) Q:'DFN!($G(FBAAOUT)) D
.S FBI=^TMP($J,"FBSTAY",FBNAME,DFN),FBID=$P(FBI,"^"),FBADT=$P(FBI,"^",2),FBVNAME=$P(FBI,"^",3),FBLOS=$P(FBI,"^",4) D PRINT
G END:$G(FBAAOUT)
W !!?5,"***LOS = Length of Stay as of ",$$DATX^FBAAUTL(FBDT)
I $E(IOST,1,2)="C-" S DIR(0)="E" D ^DIR K DIR
END ;
K %DT,FBDT,FBAAOUT,DFN,FBNAME,FBID,FBVNAME,FBHD,FBTYPE,FBUL,VAR,VAL,PGM,FBPOP,FBADM,FBASSOC,FBCHK,FBI,FBDDT,FBADT,FBLOS,^TMP($J,"FBSTAY"),FBMS,VA,VADM
D CLOSE^FBAAUTL
Q
SET ;SETS UP TMP GLOBAL
S FBADT=+^FBAACNH(FBADM,0)
S FBLOS=$$DTC^FBUCUTL(FBDT,FBADT)
Q:FBLOS<90
S FBI=$G(^FBAACNH(FBADM,0)),DFN=$P(FBI,"^",2) Q:'$G(DFN) S FBNAME=$$NAME^FBCHREQ2(DFN),FBID=$$SSN^FBAAUTL(DFN),FBVNAME=$P($G(^FBAAV($P(FBI,"^",9),0)),"^")
S ^TMP($J,"FBSTAY",FBNAME,DFN)=FBID_"^"_FBADT_"^"_FBVNAME_"^"_FBLOS_"^"_DFN
K FBNAME,FBID,FBVNAME,FBLOS,DFN Q
PRINT ;
I $E(IOST,1,2)["C-",$Y+2>IOSL S DIR(0)="E" D ^DIR K DIR I 'Y S FBAAOUT=1 Q
I $Y+2>IOSL W @IOF D HED
W !,$E(FBNAME,1,15),?18,FBID
D DEM^VADPT S FBMS=$E($P(VADM(10),"^",2),1) K VA,VADM
W ?32,FBMS,?35,$$DATX^FBAAUTL($E(FBADT,1,7)),?45,$J(FBLOS,6),?53,$E(FBVNAME,1,27)
Q
HED ;
W !?22,"ACTIVE CNH STAYS IN EXCESS OF 90 DAYS",!?33,"AS OF ",$$DATX^FBAAUTL(FBDT),!?22,FBUL,!!
W ?28,"MARITAL",!,"VETERAN",?20,"Pt. ID",?30,"ST.",?35,"ADM. DATE",?48,"LOS",?60,"VENDOR",!,FBHD
Q