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

67 lines
3.2 KiB
Mathematica

NURACEW0 ;HIRMFO/RM,MD,FT-DRIVER CHECK FOR PATIENTS NOT CLASSIFIED BY WARD ;8/14/96 09:59
;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ; ENTER ROUTINE FROM MENU OPTION NURAPP-UNCLOC
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S (NURQUEUE,OUTSW)=0,PRTSW=1
D EDIT I OUTSW D QUIT Q
W ! D QUEUE,EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
PR ;
S (NURQUIT,NURSW1)=0 G SORT
EN2 ; ENTRY FROM OPTION NURAPC-UNCWRD
Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
S (NURQUEUE,PRTSW,OUTSW)=0
D EDIT I OUTSW D QUIT Q
D WAIT^DICD G SORT
EDIT ; SELECT WARD TO SEARCH
S DIC="^NURSF(211.4,",DIC("A")="Enter UNIT you want to search: ",DIC(0)="AEQMZ",DIC("S")="I $S('$D(^(""I"")):1,$P(^(""I""),U)'=""I"":1,1:0),$S('$D(^(1)):1,$P(^(1),U)=""A"":1,1:0)"
W ! D ^DIC K DIC
I (X="^")!(+Y'>0) S OUTSW=1 Q
S WARDNAM=+Y
; CHECK TO SEE IF ANY PATIENTS REGISTERED ON WARD
I $O(^NURSF(214,"AF","A",WARDNAM,0))'>0 S NPWARD=WARDNAM D EN6^NURSAUTL W !,*7,"**** NO PATIENTS REGISTERED ON UNIT ",NPWARD," ****" S OUTSW=1 Q
K NURSTABL S TCNT=0
Q
QUEUE ; QUEUE REPORT TO TASKMAN
S ZTRTN="PR^NURACEW0"
Q
PRINT ; PRINT REPORT FOR PTS. NOT CLASSIFIED BY WARD
S PAGE=0 U IO D HEADER
I '$D(NURSTABL(1)) W !!,"ALL PATIENTS ON THIS UNIT ARE CLASSIFIED",!! G Q
D SORTTABL^NURACEW1 F TCNT=1:1 D:$D(NURSTABL(TCNT))&'NURQUIT CHKCONT Q:'$D(NURSTABL(TCNT))!NURQUIT
Q R:'NURQUEUE&(IO'="")&($E(IOST)="C")&('NURQUIT) !!,"Press return to continue ",X:DTIME
D QUIT2^NURACEW1
Q
CHKCONT ;
W !,ROOMTABL(TCNT),?17,$E($P(NURSTABL(TCNT),"^",2),1,20)
I NURSDTSW S Y=DATETABL(TCNT) D:+Y D^DIQ W ?45,Y
S DFN=+NURSTABL(TCNT) D ^NURSAPCH W ?70,NURSX
D:$Y>(IOSL-6) HEADER
Q
HEADER ; PRINT REPORT HEADER
I 'NURQUEUE,$E(IOST)="C",NURSW1 W $C(7),! R X:DTIME I '$T!(X="^") S NURQUIT=1 Q
S PAGE=PAGE+1 S:'NURSW1 NURSW1=1
W @IOF,$E(DT,4,5),"/",$E(DT,6,7),"/",$E(DT,2,3),?17,"CURRENT UNCLASSIFIED PATIENT REPORT FOR LOCATION " S NPWARD=WARDNAM D EN6^NURSAUTL W NPWARD,?73,"PAGE: ",PAGE
W !!,"ROOM-BED",?17,"PATIENT",?45,"LAST CLASSIFIED",?68,"ABSENCE",!
S $P(NURSXX,"-",80)="" W NURSXX
W !
Q
SORT ; CHECK TO SEE IF EACH PATIENT ON WARD IS VALID
F DFN=0:0 S DFN=$O(^NURSF(214,"AF","A",WARDNAM,DFN)) Q:DFN'>0 D BGNVIEW
G ENDIT
BGNVIEW ;
S NBED=$S($D(^NURSF(214,DFN,0)):$P(^(0),"^",4),1:""),NBED(0)=$S(NBED="":"",$D(^NURSF(213.3,NBED,0)):$P(^(0),"^"),1:"")
Q:NBED(0)=""!(NBED(0)="HEMODIALYSIS")!(NBED(0)="DOMICILIARY")!(NBED(0)="RECOVERY ROOM")
D 1^VADPT S XRMBD=VAIN(5)
D EN6^NURSCUTL S NURSCLAS("CL")=1 D EN2^NURSCUTL
I NURSCLAS'>0 S DATEX="NOT CLASSIFIED YET",NWRDVAR="" G FILLTABL
S DATEX=$S('$D(^NURSA(214.6,NURSCLAS,0)):"",1:$P(^(0),"^",1)),NWRDVAR=$S($D(^NURSA(214.6,NURSCLAS,0)):$P(^(0),"^",8),1:"")
FILLTABL ; ADD PATIENT TO LIST OF PATIENTS ON WARD IF VALID
I DATEX<DT!(NWRDVAR'=WARDNAM) S TCNT=TCNT+1,NURSTABL(TCNT)=DFN_"^"_VADM(1),DATETABL(TCNT)=DATEX,ROOMTABL(TCNT)=XRMBD,NURSCNT=TCNT
Q
ENDIT ; EDIT PATIENTS NOT CLASSIFIED BY WARD
D EN1^NURACEW1:'PRTSW,PRINT:PRTSW D:PRTSW ^%ZISC
D QUIT Q
QUIT ;KILL LOCAL VARIABLES
D KVAR^VADPT K VA K DATEX,NURSCLAS,CHKVAR,WARDNAM,XRMBD,DATETABL,DIC,G,DFN,ROOMTABL,PAGE,NBED,NURSZ,NURSX,NURSCNT,NURSY,NURSDTSW,OUTSW,LINE,PRTSW,NURSWHO,NURQUEUE,NWRDVAR,NURQUIT,NURSW1,TCNT,ZTSK,NURSADM,NPWARD,NURSXX,VAROOT
Q