VistA-WorldVistAEHR/r/NURSING_SERVICE-NUR/NURSCPLD.m

32 lines
1.3 KiB
Mathematica

NURSCPLD ;HIRMFO/RM-DISCHARGE MODULE TO DISCHARGE PATIENT FROM NURSING ;SEPTEMBER 1986
;;4.0;NURSING SERVICE;;Apr 25, 1997
;MODIFIED BY MD 06/27/87
EN1 ;
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
D QUIT
LOCATE ; SELECT AND VALIDATE PATIENT
W ! S NASK=1,DIC(0)="EQM",NACT=0 D EN5^NURSCUTL
G:DFN="" QUIT
DISCONT ;
I '$D(^NURSF(214,DFN,0)) D ERRSTAT G QUIT
S NURSDIS=$P(^NURSF(214,DFN,0),"^",6)
I NURSDIS="",$P(^NURSF(214,DFN,0),"^",2)="A" G DISQUES1
DISQUES I NURSDIS'="" W !,"PATIENT HAS ALREADY BEEN DISCHARGED FROM THE NURSING SYSTEM.",!,"DO YOU WANT TO CHANGE THE DISCHARGE DATE? NO//" R X:DTIME
G QUIT:(X="^")!('$T),DISEDIT:(X?1"Y".E),NURSCPLD:(X="")!(X?1"N".E)
W !,"ANSWER YES OR NO" G DISQUES
DISQUES1 ;
S %DT(0)=$P(^NURSF(214,DFN,0),"^",5),%DT("A")="DATE/TIME DISCHARGED: ",%DT("B")="NOW",%DT="AET" D ^%DT K %DT
G:(X="^")!(Y=-1) NURSCPLD
S NURSDIS=Y
S DA=DFN,DR="1///^S X=""I"";5///^S X=NURSDIS",DIE="^NURSF(214," D ^DIE
D DEM^VADPT W !,VADM(1)," is discharged from the Nursing System."
G NURSCPLD
DISEDIT ; EDIT DISCHARGE DATE
S DA=DFN,DR="1///^S X=""I"";5",DIE="^NURSF(214," D ^DIE
G NURSCPLD
ERRSTAT ;
W !!,*7,"THIS PATIENT IS NOT ADMITTED CURRENTLY IN THE NURSING SYSTEM - CANNOT DISCHARGE"
QUIT ; KILL LOCAL VARIABLES
K DA,DIPGM,DR,%DT,NACT,NASK,DFN,DIC,I,NURSDIS,%Y,D,D0,DI,DIE,VA,VADM,VAERR
Q