Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: NURCUT0

NURCUT0.m

Go to the documentation of this file.
NURCUT0 ;HIRMFO/MD,RM,FT-PATIENT SELECTION UTILITY BY WARD, ROOM OR SINGLE PATIENT ;7/24/97
 ;;4.0;NURSING SERVICE;**2,7,21**;Apr 25, 1997
WARDPAT ; SELECT ASSIGNMENT SHEET BY 1. WHOLE WARD, 2. SELECTED ROOMS ON WARD, 3. PATIENT
 S (NUROUT,NURQUIT)=0 W !,"By (U)nit, (S)elected unit rooms, or (P)atient? " R NUREDB:DTIME I "^"[NUREDB!('$T) S (NUROUT,NURQUIT)=1 Q
 S:NUREDB?1L NUREDB=$C($A(NUREDB)-32) I "Uu"[NUREDB!("Ss"[NUREDB)!("Pp"[NUREDB) G WP1
 I NUREDB?1"?".E G WARDPAT
 W !,$C(7),?5,"INVALID ENTRY ??" G WARDPAT
WP1 ;
 I "Uu"[NUREDB!("Ss"[NUREDB) D WARDSEL Q:NURQUIT  G WARDPAT:$G(NORM),QUIT
 D PATDAT I +Y'>0 W ! G WARDPAT
 G QUIT
WARDSEL ; SELECT WARD TO BE SEARCHED
 W ! S NORM=0,DIC="^NURSF(211.4,",DIC(0)="AEQMZ",DIC("S")="I $S('$D(^NURSF(211.4,""D"",""I"",+Y)):1,$P(^NURSF(211.4,+Y,1),U,1)=""I"":0,1:1)"
 S DIC("A")="Select Unit: "
 D ^DIC K DIC I X="^"!(+Y'>0) S:$D(NURLOCSW) NURQUIT=1 Q:NURQUIT=1  W ! G WARDPAT
 W ! S (NURWARD,NPWARD)=+Y,DFN=$O(^NURSF(214,"E",NURWARD,0)) D EN6^NURSAUTL
 ; CHECK TO SEE IF ANY PATIENTS REGISTERED ON WARD
 I DFN="" W !,$C(7),"**** NO PATIENTS REGISTERED ON UNIT ",NPWARD," ****" S NURQUIT=1 Q
 Q:"Uu"[NUREDB
 K NRM F NDA=0:0 S NDA=$O(^NURSF(211.4,+Y,3,NDA)) Q:NDA'>0  S NWLOC=$P(^NURSF(211.4,+Y,3,NDA,0),"^") D RMST
 K NMRC S NURSY="" F NURSX=1:1 S NURSY=$O(NRM(NURSY)) Q:NURSY=""  S NMRC(NURSX)=NURSY
 K NRM S NORM=$S($O(NMRC(""))'="":0,1:1) W:NORM !,$C(7),"NO ROOMS ON THIS UNIT",! Q:NORM  D EN3 S NORM=$S($O(NRMBD(""))'="":0,1:1) W:NORM&('NURQUIT) !!,$C(7),"NO ROOMS SELECTED CANNOT RUN THIS REPORT.",! K NMRC
 Q
RMST ;
 I $D(^DG(405.4,0)) F ND1=0:0 S ND1=$O(^DG(405.4,"W",NWLOC,ND1)) Q:ND1'>0  S NRM=$S($D(^DG(405.4,ND1,0)):$P($P(^(0),"^"),"-",1,2),1:"") I NRM'="" S NRM(NRM)=""
 Q
PATDAT ; SINGLE PATIENT SELECTION
 S:'$D(NACT) NACT=1
 S DIC(0)="EQMZ",NASK=1 D EN7^NURSCUTL I DFN'>0 S NURQUIT=1 Q
 S DFN=+Y
 Q
EN3 ; SELECT ROOMS ON A GIVEN WARD
 K NURP,NRMBD S NURP(1)=1,NURP(2)=21,NURP(3)=41,NURP(4)=61,NURP(5)=81 W !,"Unit "_NPWARD_" has the following rooms:",! F NURSX=0:0 S NURSX=$O(NMRC(NURSX)) Q:NURSX'<21!'(NURSX>0)  D
 .  W ! W:$G(NMRC($G(NURP(1))))'="" NURP(1),". ",?6,$G(NMRC(NURP(1))) W:$G(NMRC($G(NURP(2))))'="" ?16,NURP(2),".  ",$G(NMRC(NURP(2))) W:$G(NMRC($G(NURP(3))))'="" ?33,NURP(3),".  ",$G(NMRC(NURP(3)))
 .   W:$G(NMRC($G(NURP(4))))'="" ?49,NURP(4),".  ",$G(NMRC(NURP(4))) W:$G(NMRC($G(NURP(5))))'="" ?65,NURP(5),".  ",$G(NMRC(NURP(5)))
 .  S NURP(1)=(NURP(1)+1),NURP(2)=(NURP(2)+1),NURP(3)=(NURP(3)+1),NURP(4)=(NURP(4)+1),NURP(5)=(NURP(5)+1)
 .  Q
 W !!,"Select the NUMBER(S) of the rooms: "
 R NURRMST:DTIME S:'$T NURRMST="^" I "^"[NURRMST S:NURRMST["^" NURQUIT=1 Q
 W ! I NURRMST?1"?".E W !,?5,"Type in number(s) associated with the rooms you want,",!,?5,"separated by commas or hyphens if there is more than one room",!,?5,"(e.g.,  1-3,5 would be entries 1,2,3 and 5)." G EN3
 I '(NURRMST?.N!(NURRMST?.NP&(NURRMST["-"!(NURRMST[",")))) W $C(7),"  ??" G EN3
 F NURI=1:1 S NURLEN=$P(NURRMST,",",NURI) Q:NURLEN=""  S NURLEN(1)=$P(NURLEN,"-",2)_"+"_NURLEN F NURX=+NURLEN:1:+NURLEN(1) S:'$D(NMRC(NURX)) NURQUIT=1 S:$D(NMRC(NURX)) NRMBD(NMRC(NURX))=""
 I NURQUIT S NURQUIT=0 G EN3
 Q
QUIT ;
 K NURP,NDA,ND1,NWLOC,NURSY,NURSX,NURRMST,NURI,NURLEN,NORM,NMRC,NURX,NACT,NASK,RMSEL,X,Y
 Q