NURACE6 ;HIRMFO/RM-PATIENT CLASSIFICATION EXTENDED CARE ;NOVEMBER 17, 1986
;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ;ENTER IN CLASSIFICATION FACTORS
S ABORTSW=0,CHANGESW=0,NURS1SW=0,NURS4SW=0,NURS7SW=0,NURS10SW=0,NURS13SW=0
I FACT["?" D EN4^NURACE3 S REENTSW=1 Q
F I=1:1:$L(FACT) S:(($A(FACT,I)<65)!($E(FACT,I)'?1A)!($A(FACT,I)>79)) ABORTSW=1 Q:ABORTSW=1 S FACT($E(FACT,I))=0
I ABORTSW=1 W *7," *** BAD ENTRY - TRY AGAIN ***" S REENTSW=1 Q
D EN1^NURACE8
S FACT="",NXT="" F I=0:0 S NXT=$O(FACT(NXT)) Q:NXT="" S FACT=FACT_NXT
I ((FACT="")&(FACTORS="")) W !,*7,"**** NO FACTORS ENTERED - CLASSIFICATION NOT UPDATED ****" H 3 S OUTSW=1 Q
I NURS1SW=1 W !,*7,"*** FACTORS A,B or C CANNOT BE USED TOGETHER ***" S REENTSW=1 Q
I NURS4SW=1 W !,*7,"*** FACTORS D,E or F CANNOT BE USED TOGETHER ***" S REENTSW=1 Q
I NURS7SW=1 W !,*7,"*** FACTORS G,H or I CANNOT BE USED TOGETHER ***" S REENTSW=1 Q
I NURS10SW=1 W !,*7,"*** FACTORS J,K or L CANNOT BE USED TOGETHER ***" S REENTSW=1 Q
I NURS13SW=1 W !,*7,"*** FACTORS M,N or O CANNOT BE USED TOGETHER ***" S REENTSW=1 Q
I ((FACT="")!(FACT=FACTORS)) S NURSCKSW=1 G EN2
I ((FACT'["A")&(FACT'["B")&(FACT'["C")) W !,*7,"*** YOU MUST PICK ONE OF THE FIRST THREE FACTORS A,B or C ***" S REENTSW=1 Q
I ((FACT'["D")&(FACT'["E")&(FACT'["F")) W !,*7,"*** YOU MUST PICK ONE OF THE SECOND THREE FACTORS D,E or F ***" S REENTSW=1 Q
I ((FACT'["G")&(FACT'["H")&(FACT'["I")) W !,*7,"*** YOU MUST PICK ONE OF THE THIRD THREE FACTORS G,H or I ***" S REENTSW=1 Q
I ((FACT'["J")&(FACT'["K")&(FACT'["L")) W !,*7,"*** YOU MUST PICK ONE OF THE FOURTH THREE FACTORS J,K or L ***" S REENTSW=1 Q
I ((FACT'["M")&(FACT'["N")&(FACT'["O")) W !,*7,"*** YOU MUST PICK ONE OF THE FIFTH THREE FACTORS M,N or O ***" S REENTSW=1 Q
S FACTORS=FACT F I=1:1:$L(FACT) S:I=1 FACTX=$E(FACT,1) S:I'=1 FACTX=FACTX_","_$E(FACT,I)
S CHANGESW=1
EN2 ;DETERMINE NEW CLASSIFICATION
S (CAT(1),CAT(2),CAT(3))=0
F I="A","D","G","J","M" S:FACTORS[I CAT(1)=CAT(1)+1
F I="B","E","H","K","N" S:FACTORS[I CAT(2)=CAT(2)+1
F I="C","F","I","L","O" S:FACTORS[I CAT(3)=CAT(3)+1
I ((CAT(1)>CAT(2))&(CAT(1)>CAT(3))) S CLASSX=1 G CHKCLASS
I (((CAT(2)>CAT(1))!(CAT(2)=CAT(1)))&(CAT(2)>CAT(3))) S CLASSX=2 G CHKCLASS
S CLASSX=3
CHKCLASS ;ENTER NEW CLASSIFICATION IF DESIRED
Q:NURSNSW=1
I $D(XCLAS) I ((NURSCKSW=1)&(CLASSX=XCLAS)) S CHANGESW=1
CHKCLAS1 ;
W !,"Enter Classification: " W:(CLASSX'="") CLASSX,"//" R X:DTIME S X=$E(X,1,2)
I (X="^")!('$T) D EN4^NURACE8 S OUTSW=1 Q
I X["?" W !,"ANSWER WITH A NUMBER BETWEEN 1 AND 3" G CHKCLAS1
I $L(X)=0 S:CHANGESW=1 CONFIGX="COMPUTER" Q
I (($L(X)>1)!(X?1A)!(X<1)!(X>3)) W *7," *** BAD ENTRY - TRY AGAIN ***" G CHKCLASS
I X=CLASSX S:CHANGESW=1 CONFIGX="COMPUTER" Q
S CHANGESW=1,CLASSX=X,CONFIGX="USER"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HNURACE6 2800 printed Dec 13, 2024@02:18:58 Page 2
NURACE6 ;HIRMFO/RM-PATIENT CLASSIFICATION EXTENDED CARE ;NOVEMBER 17, 1986
+1 ;;4.0;NURSING SERVICE;;Apr 25, 1997
EN1 ;ENTER IN CLASSIFICATION FACTORS
+1 SET ABORTSW=0
SET CHANGESW=0
SET NURS1SW=0
SET NURS4SW=0
SET NURS7SW=0
SET NURS10SW=0
SET NURS13SW=0
+2 IF FACT["?"
DO EN4^NURACE3
SET REENTSW=1
QUIT
+3 FOR I=1:1:$LENGTH(FACT)
if (($ASCII(FACT,I)<65)!($EXTRACT(FACT,I)'?1A)!($ASCII(FACT,I)>79))
SET ABORTSW=1
if ABORTSW=1
QUIT
SET FACT($EXTRACT(FACT,I))=0
+4 IF ABORTSW=1
WRITE *7," *** BAD ENTRY - TRY AGAIN ***"
SET REENTSW=1
QUIT
+5 DO EN1^NURACE8
+6 SET FACT=""
SET NXT=""
FOR I=0:0
SET NXT=$ORDER(FACT(NXT))
if NXT=""
QUIT
SET FACT=FACT_NXT
+7 IF ((FACT="")&(FACTORS=""))
WRITE !,*7,"**** NO FACTORS ENTERED - CLASSIFICATION NOT UPDATED ****"
HANG 3
SET OUTSW=1
QUIT
+8 IF NURS1SW=1
WRITE !,*7,"*** FACTORS A,B or C CANNOT BE USED TOGETHER ***"
SET REENTSW=1
QUIT
+9 IF NURS4SW=1
WRITE !,*7,"*** FACTORS D,E or F CANNOT BE USED TOGETHER ***"
SET REENTSW=1
QUIT
+10 IF NURS7SW=1
WRITE !,*7,"*** FACTORS G,H or I CANNOT BE USED TOGETHER ***"
SET REENTSW=1
QUIT
+11 IF NURS10SW=1
WRITE !,*7,"*** FACTORS J,K or L CANNOT BE USED TOGETHER ***"
SET REENTSW=1
QUIT
+12 IF NURS13SW=1
WRITE !,*7,"*** FACTORS M,N or O CANNOT BE USED TOGETHER ***"
SET REENTSW=1
QUIT
+13 IF ((FACT="")!(FACT=FACTORS))
SET NURSCKSW=1
GOTO EN2
+14 IF ((FACT'["A")&(FACT'["B")&(FACT'["C"))
WRITE !,*7,"*** YOU MUST PICK ONE OF THE FIRST THREE FACTORS A,B or C ***"
SET REENTSW=1
QUIT
+15 IF ((FACT'["D")&(FACT'["E")&(FACT'["F"))
WRITE !,*7,"*** YOU MUST PICK ONE OF THE SECOND THREE FACTORS D,E or F ***"
SET REENTSW=1
QUIT
+16 IF ((FACT'["G")&(FACT'["H")&(FACT'["I"))
WRITE !,*7,"*** YOU MUST PICK ONE OF THE THIRD THREE FACTORS G,H or I ***"
SET REENTSW=1
QUIT
+17 IF ((FACT'["J")&(FACT'["K")&(FACT'["L"))
WRITE !,*7,"*** YOU MUST PICK ONE OF THE FOURTH THREE FACTORS J,K or L ***"
SET REENTSW=1
QUIT
+18 IF ((FACT'["M")&(FACT'["N")&(FACT'["O"))
WRITE !,*7,"*** YOU MUST PICK ONE OF THE FIFTH THREE FACTORS M,N or O ***"
SET REENTSW=1
QUIT
+19 SET FACTORS=FACT
FOR I=1:1:$LENGTH(FACT)
if I=1
SET FACTX=$EXTRACT(FACT,1)
if I'=1
SET FACTX=FACTX_","_$EXTRACT(FACT,I)
+20 SET CHANGESW=1
EN2 ;DETERMINE NEW CLASSIFICATION
+1 SET (CAT(1),CAT(2),CAT(3))=0
+2 FOR I="A","D","G","J","M"
if FACTORS[I
SET CAT(1)=CAT(1)+1
+3 FOR I="B","E","H","K","N"
if FACTORS[I
SET CAT(2)=CAT(2)+1
+4 FOR I="C","F","I","L","O"
if FACTORS[I
SET CAT(3)=CAT(3)+1
+5 IF ((CAT(1)>CAT(2))&(CAT(1)>CAT(3)))
SET CLASSX=1
GOTO CHKCLASS
+6 IF (((CAT(2)>CAT(1))!(CAT(2)=CAT(1)))&(CAT(2)>CAT(3)))
SET CLASSX=2
GOTO CHKCLASS
+7 SET CLASSX=3
CHKCLASS ;ENTER NEW CLASSIFICATION IF DESIRED
+1 if NURSNSW=1
QUIT
+2 IF $DATA(XCLAS)
IF ((NURSCKSW=1)&(CLASSX=XCLAS))
SET CHANGESW=1
CHKCLAS1 ;
+1 WRITE !,"Enter Classification: "
if (CLASSX'="")
WRITE CLASSX,"//"
READ X:DTIME
SET X=$EXTRACT(X,1,2)
+2 IF (X="^")!('$TEST)
DO EN4^NURACE8
SET OUTSW=1
QUIT
+3 IF X["?"
WRITE !,"ANSWER WITH A NUMBER BETWEEN 1 AND 3"
GOTO CHKCLAS1
+4 IF $LENGTH(X)=0
if CHANGESW=1
SET CONFIGX="COMPUTER"
QUIT
+5 IF (($LENGTH(X)>1)!(X?1A)!(X<1)!(X>3))
WRITE *7," *** BAD ENTRY - TRY AGAIN ***"
GOTO CHKCLASS
+6 IF X=CLASSX
if CHANGESW=1
SET CONFIGX="COMPUTER"
QUIT
+7 SET CHANGESW=1
SET CLASSX=X
SET CONFIGX="USER"
+8 QUIT