VistA-WorldVistAEHR/r/FEE_BASIS-FB/FBNHAMIE.m

27 lines
2.1 KiB
Mathematica

FBNHAMIE ;AISC/CMR-CNH Admission/Discharge Output ;4/28/93 11:04
;;3.5;FEE BASIS;;JAN 30, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
D DATE^FBAAUTL Q:FBPOP
S VAR="BEGDATE^ENDDATE",VAL=BEGDATE_"^"_ENDDATE,PGM="START^FBNHAMIE" D ZIS^FBAAUTL G END:FBPOP
START S FBHD="=",$P(FBHD,"=",80)="=",FBUL="-",$P(FBUL,"-",29)="-",FBAAOUT=0 U IO W:$E(IOST,1,2)["C-" @IOF D HED
F FBDT=BEGDATE-.001:0 S FBDT=$O(^FBAACNH("B",FBDT)) Q:'FBDT!(FBDT>(ENDDATE+.9999))!(FBAAOUT) F FBIEN=0:0 S FBIEN=$O(^FBAACNH("B",FBDT,FBIEN)) Q:'FBIEN!(FBAAOUT) S FB(0)=$G(^FBAACNH(+FBIEN,0)) I FB(0)]"" D
.S (FBTP,FB("TP"))="",FBTYPE=$S($P(FB(0),"^",3)="A":"ADMISSION",$P(FB(0),"^",3)="D":"DISCHARGE",1:0) Q:FBTYPE=0 D Q:FBAAOUT
..I $E(FBTYPE)="A" S FBTP=$P(FB(0),"^",6),FB("TP")=$S(FBTP=4:"ALL OTHER",FBTP=3:"FROM ASIH <15 DAYS",FBTP=1:"AFTER RE-HOSPITALIZATION >15 DAYS",FBTP=2:"TRANSFER FROM OTHER CNH",1:"")
..I $E(FBTYPE)="D" S FBTP=$P(FB(0),"^",8),FB("TP")=$S(FBTP=1:"REGULAR",FBTP=2:"DEATH",FBTP=3:"TRANSFER FROM OTHER CNH",FBTP=4:"ASIH",FBTP=5:"DEATH WHILE ASIH",FBTP=6:"REGULAR - PRIVATE PAY",1:"")
..S DFN=$P(FB(0),"^",2) Q:'$G(DFN) S FBNAME=$$NAME^FBCHREQ2(DFN),FBID=$$SSN^FBAAUTL(DFN),FTP=+$P(FB(0),"^",9)
..S FBVEN=$G(^FBAAV(FTP,0)),FBVNAME=$P(FBVEN,"^"),FBVID=$P(FBVEN,"^",2),FBVSTR=$P(FBVEN,"^",3),FBVCITY=$P(FBVEN,"^",4),FBVST=$P($G(^DIC(5,+$P(FBVEN,"^",5),0)),"^"),FBVZIP=$P(FBVEN,"^",6)
..S FBPHONE=$P($G(^FBAAV(FTP,1)),U),FBPHONE=$S(FBPHONE="":"Not entered",1:FBPHONE)
..D ELIG^VADPT,PRINT
END ;
K BEGDATE,ENDDATE,FBDT,FBAAOUT,FBIEN,FB,DFN,FBPHONE,FBNAME,FBID,FBPSA,FTP,FBVEN,FBVNAME,FBVID,FBVSTR,FBVCITY,FBVST,FBVZIP,FBHD,FBTYPE,FBUL,VAEL,VAERR,FBTP
D CLOSE^FBAAUTL Q
PRINT ;
I $E(IOST,1,2)["C-",$Y+8>IOSL S DIR(0)="E" D ^DIR K DIR I 'Y S FBAAOUT=1 Q
I $Y+8>IOSL W @IOF D HED
W !!,FBNAME,?32,FBID,?48,$P(VAEL(1),"^",2),!?3,FBTYPE," DATE: ",$$DATX^FBAAUTL(FBDT),?36,FBTYPE," TYPE: ",$E(FB("TP"),1,28)
I $G(FTP) W !?10,FBVNAME,?42,FBVID,!?10,FBVSTR,!?10,FBVCITY," ",FBVST," ",FBVZIP,!?10,"Phone #: ",FBPHONE
Q
HED ;
W !?22,"CNH ADMISSIONS AND DISCHARGES",!?24,$$DATX^FBAAUTL(BEGDATE)," THROUGH ",$$DATX^FBAAUTL(ENDDATE),!?22,FBUL,!
Q