NURCPPS4 ;HIRMFO/RM-NURSING CARE PLAN SEARCH Part 2 ;3/03/89
;;4.0;NURSING SERVICE;;Apr 25, 1997
;This is a Cont. of Patient Problem Listing, Data Processor:
NOGOIN ; SET DATA FOR NON-GOALS AND NON-INTERVENTIONS
S GMRGPAR(0)=$S(NURSPLN="C":1,1:0)_"^"_(NURSRM-$S(IOM'<132:0,1:3))_"^0^R",GMRGPAR=NURSC D EN1^GMRGPNBL
S ^TMP($J,"NURSOT",NURSP,NURSC)=""
K:$P(^TMP($J,"GMRGNAR","R",NURSC,0),"^",2)=0 ^(0),^TMP($J,"NURSOT",NURSP,NURSC)
Q
GOIN ; GOAL OR INTERVENTION PROESSING
S NURSCLAS=$S(NURSA=1:NURSG(0),1:NURSG(1)),GMRGPAR=NURSG,GMRGPAR(0)=$S(NURSPLN="C":1,1:0)_"^"_(NURSRM+(NURSA-1*3))_"^0^"_NURSCLAS D EN1^GMRGPNBL
I $P(^TMP($J,"GMRGNAR",NURSCLAS,NURSG,0),"^",2)=0 K ^(0) Q:NURSPLN="C"
I $P(NURSCHIL,"^",4)=NURSICK S ^TMP($J,"NURSIN",NURSP,NURSG(0))="",NURSK=0 D STORD
I $P(NURSCHIL,"^",4)=NURSGCK S ^TMP($J,"NURSGO",NURSP,NURSG(0))="",NURSK=0 D STARG
S NURSL=NURSG,NURSK=0,NURSDA=$O(^GMR(124.3,GMRGPDA,1,"B",NURSG,0)) D:NURSDA>0 STAUD
Q
STEVAL ; STORE EVALUATION DATES
S NURPR=0 F NURSI(0)=0:0 S NURSI(0)=$O(^NURSC(216.8,NURSPOI,"EVAL","AA",NURSP,NURSI(0))) Q:NURSI(0)'>0 D STV Q:NURSPLN="C"&NURPR
Q
STV ;
F NURSI=0:0 S NURSI=$O(^NURSC(216.8,NURSPOI,"EVAL","AA",NURSP,NURSI(0),NURSI)) Q:NURSI'>0 D STV1 Q:NURSPLN="C"&NURPR
Q
STV1 ;
S NURSJ=$S($D(^NURSC(216.8,NURSPOI,"EVAL",NURSI,0)):^(0),1:"") I +NURSJ S NURSJ(0)=0_"^"_$S(+$P(NURSJ,"^",5):$P(NURSJ,"^",5),1:+NURSJ)_"^"_$P(NURSJ,"^",3)_"^"_$P("E^R^S^U","^",$P(NURSJ,"^",4)+1),NURSJ(1)=NURSP D STUT
Q
STAUD ; STORE AUDIT TRAIL INFO
S NURPR=0 F NURSI(0)=0:0 S NURSI(0)=$O(^GMR(124.3,GMRGPDA,1,NURSDA,2,"AA",NURSI(0))) Q:NURSI(0)'>0 D STA2 Q:NURSPLN="C"&NURPR
Q
STA2 ;
F NURSI(1)=-1:0 S NURSI(1)=$O(^GMR(124.3,GMRGPDA,1,NURSDA,2,"AA",NURSI(0),NURSI(1))) Q:NURSI(1)="" D STA Q:NURSPLN="C"&NURPR
Q
STA ;
F NURSI=0:0 S NURSI=$O(^GMR(124.3,GMRGPDA,1,NURSDA,2,"AA",NURSI(0),NURSI(1),NURSI)) Q:NURSI'>0 D STA1 Q:NURSPLN="C"&NURPR
Q
STA1 ;
S NURSJ=$S($D(^GMR(124.3,GMRGPDA,1,NURSDA,2,NURSI,0)):^(0),1:"") I +NURSJ,$P(NURSJ,"^",2)'=2 S NURSJ(1)=NURSL,NURSJ(0)=1_"^"_+NURSJ_"^"_$P(NURSJ,"^",3)_"^"_$S('$P(NURSJ,"^",2):"@",1:"") D STUT
Q
STARG ; STORE TARGET DATES
S NURPR=0 F NURSI(0)=0:0 S NURSI(0)=$O(^NURSC(216.8,NURSPOI,"TARG","AA",NURSG,NURSI(0))) Q:NURSI(0)'>0 D STG Q:NURSPLN="C"&NURPR
Q
STG ;
F NURSI=0:0 S NURSI=$O(^NURSC(216.8,NURSPOI,"TARG","AA",NURSG,NURSI(0),NURSI)) Q:NURSI'>0 D STG1 Q:NURSPLN="C"&NURPR
Q
STG1 ;
S NURSJ=$S($D(^NURSC(216.8,NURSPOI,"TARG",NURSI,0)):^(0),1:"") I +NURSJ S NURSJ(1)=NURSG,NURSJ(0)=0_"^"_$S(+$P(NURSJ,"^",5):$P(NURSJ,"^",5),1:+NURSJ)_"^"_$P(NURSJ,"^",4)_"^"_$S('$P(NURSJ,"^",2):"T",$P(NURSJ,"^",2)=2:"DC",1:"M") D STUT
Q
STORD ; STORE ORDER DATES
F NURSI(0)=0:0 S NURSI(0)=$O(^NURSC(216.8,NURSPOI,"ORD","AA",NURSG,NURSI(0))) Q:NURSI(0)'>0 D STO Q:NURSPLN="C"&NURPR
Q
STO ;
F NURSI=0:0 S NURSI=$O(^NURSC(216.8,NURSPOI,"ORD","AA",NURSG,NURSI(0),NURSI)) Q:NURSI'>0 D STO1 Q:NURSPLN="C"&NURPR
Q
STO1 ;
S NURSJ=$S($D(^NURSC(216.8,NURSPOI,"ORD",NURSI,0)):^(0),1:"") I +NURSJ,$P(NURSJ,"^",3)'="" S NURSJ(1)=NURSG,NURSJ(0)=0_"^"_+NURSJ_"^"_$P(NURSJ,"^",4)_"^"_$S($P(NURSJ,"^",3):"DC",$P(NURSJ,"^",3)=0:"R",1:"") D STUT
Q
STUT ;
F NURSK=1:1 Q:$S('$D(^TMP($J,"NURSDATE",NURSJ(1),9999999-NURSJ,NURSK)):1,^(NURSK)=NURSJ(0):1,1:0)
S ^TMP($J,"NURSDATE",NURSJ(1),9999999-NURSJ,NURSK)=NURSJ(0),NURPR=1
Q
NURCPPS4 ;HIRMFO/RM-NURSING CARE PLAN SEARCH Part 2 ;3/03/89
+1 ;;4.0;NURSING SERVICE;;Apr 25, 1997
+2 ;This is a Cont. of Patient Problem Listing, Data Processor:
NOGOIN ; SET DATA FOR NON-GOALS AND NON-INTERVENTIONS
+1 SET GMRGPAR(0)=$SELECT(NURSPLN="C":1,1:0)_"^"_(NURSRM-$SELECT(IOM'<132:0,1:3))_"^0^R"
SET GMRGPAR=NURSC
DO EN1^GMRGPNBL
+2 SET ^TMP($JOB,"NURSOT",NURSP,NURSC)=""
+3 IF $PIECE(^TMP($JOB,"GMRGNAR","R",NURSC,0),"^",2)=0
KILL ^(0),^TMP($JOB,"NURSOT",NURSP,NURSC)
+4 QUIT
GOIN ; GOAL OR INTERVENTION PROESSING
+1 SET NURSCLAS=$SELECT(NURSA=1:NURSG(0),1:NURSG(1))
SET GMRGPAR=NURSG
SET GMRGPAR(0)=$SELECT(NURSPLN="C":1,1:0)_"^"_(NURSRM+(NURSA-1*3))_"^0^"_NURSCLAS
DO EN1^GMRGPNBL
+2 IF $PIECE(^TMP($JOB,"GMRGNAR",NURSCLAS,NURSG,0),"^",2)=0
KILL ^(0)
IF NURSPLN="C"
QUIT
+3 IF $PIECE(NURSCHIL,"^",4)=NURSICK
SET ^TMP($JOB,"NURSIN",NURSP,NURSG(0))=""
SET NURSK=0
DO STORD
+4 IF $PIECE(NURSCHIL,"^",4)=NURSGCK
SET ^TMP($JOB,"NURSGO",NURSP,NURSG(0))=""
SET NURSK=0
DO STARG
+5 SET NURSL=NURSG
SET NURSK=0
SET NURSDA=$ORDER(^GMR(124.3,GMRGPDA,1,"B",NURSG,0))
IF NURSDA>0
DO STAUD
+6 QUIT
STEVAL ; STORE EVALUATION DATES
+1 SET NURPR=0
FOR NURSI(0)=0:0
SET NURSI(0)=$ORDER(^NURSC(216.8,NURSPOI,"EVAL","AA",NURSP,NURSI(0)))
IF NURSI(0)'>0
QUIT
DO STV
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STV ;
+1 FOR NURSI=0:0
SET NURSI=$ORDER(^NURSC(216.8,NURSPOI,"EVAL","AA",NURSP,NURSI(0),NURSI))
IF NURSI'>0
QUIT
DO STV1
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STV1 ;
+1 SET NURSJ=$SELECT($DATA(^NURSC(216.8,NURSPOI,"EVAL",NURSI,0)):^(0),1:"")
IF +NURSJ
SET NURSJ(0)=0_"^"_$SELECT(+$PIECE(NURSJ,"^",5):$PIECE(NURSJ,"^",5),1:+NURSJ)_"^"_$PIECE(NURSJ,"^",3)_"^"_$PIECE("E^R^S^U","^",$PIECE(NURSJ,"^",4)+1)
SET NURSJ(1)=NURSP
DO STUT
+2 QUIT
STAUD ; STORE AUDIT TRAIL INFO
+1 SET NURPR=0
FOR NURSI(0)=0:0
SET NURSI(0)=$ORDER(^GMR(124.3,GMRGPDA,1,NURSDA,2,"AA",NURSI(0)))
IF NURSI(0)'>0
QUIT
DO STA2
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STA2 ;
+1 FOR NURSI(1)=-1:0
SET NURSI(1)=$ORDER(^GMR(124.3,GMRGPDA,1,NURSDA,2,"AA",NURSI(0),NURSI(1)))
IF NURSI(1)=""
QUIT
DO STA
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STA ;
+1 FOR NURSI=0:0
SET NURSI=$ORDER(^GMR(124.3,GMRGPDA,1,NURSDA,2,"AA",NURSI(0),NURSI(1),NURSI))
IF NURSI'>0
QUIT
DO STA1
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STA1 ;
+1 SET NURSJ=$SELECT($DATA(^GMR(124.3,GMRGPDA,1,NURSDA,2,NURSI,0)):^(0),1:"")
IF +NURSJ
IF $PIECE(NURSJ,"^",2)'=2
SET NURSJ(1)=NURSL
SET NURSJ(0)=1_"^"_+NURSJ_"^"_$PIECE(NURSJ,"^",3)_"^"_$SELECT('$PIECE(NURSJ,"^",2):"@",1:"")
DO STUT
+2 QUIT
STARG ; STORE TARGET DATES
+1 SET NURPR=0
FOR NURSI(0)=0:0
SET NURSI(0)=$ORDER(^NURSC(216.8,NURSPOI,"TARG","AA",NURSG,NURSI(0)))
IF NURSI(0)'>0
QUIT
DO STG
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STG ;
+1 FOR NURSI=0:0
SET NURSI=$ORDER(^NURSC(216.8,NURSPOI,"TARG","AA",NURSG,NURSI(0),NURSI))
IF NURSI'>0
QUIT
DO STG1
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STG1 ;
+1 SET NURSJ=$SELECT($DATA(^NURSC(216.8,NURSPOI,"TARG",NURSI,0)):^(0),1:"")
IF +NURSJ
SET NURSJ(1)=NURSG
SET NURSJ(0)=0_"^"_$SELECT(+$PIECE(NURSJ,"^",5):$PIECE(NURSJ,"^",5),1:+NURSJ)_"^"_$PIECE(NURSJ,"^",4)_"^"_$SELECT('$PIECE(NURSJ,"^",2):"T",$PIECE(NURSJ,"^",2)=2:"DC",1:"M")
DO STUT
+2 QUIT
STORD ; STORE ORDER DATES
+1 FOR NURSI(0)=0:0
SET NURSI(0)=$ORDER(^NURSC(216.8,NURSPOI,"ORD","AA",NURSG,NURSI(0)))
IF NURSI(0)'>0
QUIT
DO STO
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STO ;
+1 FOR NURSI=0:0
SET NURSI=$ORDER(^NURSC(216.8,NURSPOI,"ORD","AA",NURSG,NURSI(0),NURSI))
IF NURSI'>0
QUIT
DO STO1
IF NURSPLN="C"&NURPR
QUIT
+2 QUIT
STO1 ;
+1 SET NURSJ=$SELECT($DATA(^NURSC(216.8,NURSPOI,"ORD",NURSI,0)):^(0),1:"")
IF +NURSJ
IF $PIECE(NURSJ,"^",3)'=""
SET NURSJ(1)=NURSG
SET NURSJ(0)=0_"^"_+NURSJ_"^"_$PIECE(NURSJ,"^",4)_"^"_$SELECT($PIECE(NURSJ,"^",3):"DC",$PIECE(NURSJ,"^",3)=0:"R",1:"")
DO STUT
+2 QUIT
STUT ;
+1 FOR NURSK=1:1
IF $SELECT('$DATA(^TMP($JOB,"NURSDATE",NURSJ(1),9999999-NURSJ,NURSK))
QUIT
+2 SET ^TMP($JOB,"NURSDATE",NURSJ(1),9999999-NURSJ,NURSK)=NURSJ(0)
SET NURPR=1
+3 QUIT