NURCPP8 ;HIRMFO/JH/RM-NURSING CARE PLAN DATA OUTPUT - PRINT ;4/29/93
;;4.0;NURSING SERVICE;;Apr 25, 1997
; This is the Patient Problem Listing,Data Processor,Output Routine
; 132 Col. Compressed print
X ; SET UTILITY GLOBAL
; NURS=TEXT TO BE ADDED,NURS(0)=$S(0:PROBLEM,1:GOAL,2:INTERVENTION)
; NURS(1)=LINE IN ^TMP TO BE ADDED
; THE VARIABLE NURS WILL BE KILLED
S NURS("OLD")=$S($D(^TMP($J,"NURSDATA",NURS(1))):^(NURS(1)),1:"")
F NURS(2)=1:1:5 S NURS("OLD")=$P(NURS("OLD"),"|",1,NURS(2)-1)_$S(NURS(2)=1:"",1:"|")_$E($P(NURS("OLD"),"|",NURS(2))_NURSSS,1,$S(NURS(2)=1:13,NURS(2)=2!(NURS(2)=5):29,NURS(2)=3:28,NURS(2)=4:14,1:14))_"|"_$P(NURS("OLD"),"|",NURS(2)+1,5)
I NURS(0)=0 S NURS("NEW")=$E($P(NURS,"|")_$E(NURSSS,1,13),1,13)_"|"_$E($P(NURS,"|",2)_$E(NURSSS,1,29),1,29)_"|"_$E(NURS("OLD"),45,$L(NURS("OLD")))
I NURS(0)=1 S NURS("NEW")=$E(NURS("OLD"),1,43)_"|"_$E($P(NURS,"|")_$E(NURSSS,1,28),1,28)_"|"_$E($P(NURS,"|",2)_$E(NURSSS,1,14),1,14)_"|"_$E(NURS("OLD"),89,$L(NURS("OLD")))
I NURS(0)=2 S NURS("NEW")=$E(NURS("OLD"),1,87)_"|"_$E($P(NURS,"|")_$E(NURSSS,1,29),1,29)_"|"_$E($P(NURS,"|",2)_$E(NURSSS,1,14),1,14)
S ^TMP($J,"NURSDATA",NURS(1))=NURS("NEW")
K NURS
Q
GLP1 ;
S NURSA(0)=$S($D(^TMP($J,"GMRGNAR",NURSRTK,NURSG(1),0)):^(0),1:""),NURSA=$P(NURSA(0),"^"),NURSA(1)=+$P(NURSA(0),"^",3)
F NURSK=1:1:$P(NURSA(0),"^",2) S NURS=$S($D(^TMP($J,"GMRGNAR",NURSRTK,NURSG(1),NURSK)):^(NURSK),1:"")_"||",NURS(0)=1,NURS(1)=NURSO1 D X S NURSO1=NURSO1+1
F NURSG=0:0 S NURSG=$O(^TMP($J,"GMRGNAR",NURSG(1),NURSG)) Q:NURSG'>0 S NURSG(0)=NURSG(1) D GOAL
S NURSA(0)=+$O(^GMR(124.3,GMRGPDA,1,"B",NURSA(1),0)) I $D(^GMR(124.3,GMRGPDA,1,NURSA(0),"ADD")),^("ADD")]"" S NURSADD=^("ADD"),NURSRET=2,NURSLGT=0,NURSO4=NURSO1 D FORMAT^NURCPP7 S NURSO1=NURSO4
S NURS="",NURS(0)=1,NURS(1)=NURSO1 D X S NURSO1=NURSO1+1
Q
GOAL ; CHECK FOR GOAL GOAL/EXPECTED OUTCOME TARGET DATE
S NURSI=1,NURS=$S($D(^TMP($J,"GMRGNAR",NURSG(0),NURSG,NURSI)):$E(NURSSS,1,NURSA*3)_^(NURSI),1:"")
F NURST(0)=0:0 S NURST(0)=$O(^TMP($J,"NURSDATE",NURSG,NURST(0))) Q:NURST(0)'>0 F NURST=0:0 S NURST=$O(^TMP($J,"NURSDATE",NURSG,NURST(0),NURST)) Q:NURST'>0 D GOAL1
F NURST=NURSI:0 Q:NURS="" S NURS(0)=1,NURS(1)=NURSO1 D X S NURSO1=NURSO1+1 S NURST=$O(^TMP($J,"GMRGNAR",NURSG(0),NURSG,NURST)) Q:NURST="" S NURS=$E(NURSSS,1,NURSA*3+1)_^TMP($J,"GMRGNAR",NURSG(0),NURSG,NURST)
Q
;
GOAL1 ;
S X=$S($D(^TMP($J,"NURSDATE",NURSG,NURST(0),NURST)):^(NURST),1:"")
S Y=$P(X,"^",2) S:Y'="" Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)
S NURSTAT=$S($L($P(X,"^",4)):"("_$P(X,"^",4)_")"_$E(" ",1,2-$L($P(X,"^",4))),1:" ")
S NURSRN=$E($S($D(^VA(200,+$P(X,"^",3),0)):$E($P($P(^(0),"^"),",",2))_$E($P($P(^(0),"^"),",")),1:"")_" ",1,2)
;
GOAL2 S NURS=NURS_"|"_Y_NURSTAT_$J(NURSRN,2),NURS(0)=1,NURS(1)=NURSO1 D X S NURSO1=NURSO1+1
I $D(^TMP($J,"GMRGNAR",NURSG(0),NURSG,NURSI+1)),$P(^(NURSI+1),"^")'="" S NURSI=NURSI+1,NURS=$E(NURSSS,1,NURSA*3+1)_^TMP($J,"GMRGNAR",NURSG(0),NURSG,NURSI)
E S NURS=""
Q
NURCPP8 ;HIRMFO/JH/RM-NURSING CARE PLAN DATA OUTPUT - PRINT ;4/29/93
+1 ;;4.0;NURSING SERVICE;;Apr 25, 1997
+2 ; This is the Patient Problem Listing,Data Processor,Output Routine
+3 ; 132 Col. Compressed print
X ; SET UTILITY GLOBAL
+1 ; NURS=TEXT TO BE ADDED,NURS(0)=$S(0:PROBLEM,1:GOAL,2:INTERVENTION)
+2 ; NURS(1)=LINE IN ^TMP TO BE ADDED
+3 ; THE VARIABLE NURS WILL BE KILLED
+4 SET NURS("OLD")=$SELECT($DATA(^TMP($JOB,"NURSDATA",NURS(1))):^(NURS(1)),1:"")
+5 FOR NURS(2)=1:1:5
SET NURS("OLD")=$PIECE(NURS("OLD"),"|",1,NURS(2)-1)_$SELECT(NURS(2)=1:"",1:"|")_$EXTRACT($PIECE(NURS("OLD"),"|",NURS(2))_NURSSS,1,$SELECT(NURS(2)=1:13,NURS(2)=2!(NURS(2)=5):29,NURS(2)=3:28,NURS(2)=4:14,1:14))_"|"_$PIECE(NURS("OLD"),"|",NURS
(2)+1,5)
+6 IF NURS(0)=0
SET NURS("NEW")=$EXTRACT($PIECE(NURS,"|")_$EXTRACT(NURSSS,1,13),1,13)_"|"_$EXTRACT($PIECE(NURS,"|",2)_$EXTRACT(NURSSS,1,29),1,29)_"|"_$EXTRACT(NURS("OLD"),45,$LENGTH(NURS("OLD")))
+7 IF NURS(0)=1
SET NURS("NEW")=$EXTRACT(NURS("OLD"),1,43)_"|"_$EXTRACT($PIECE(NURS,"|")_$EXTRACT(NURSSS,1,28),1,28)_"|"_$EXTRACT($PIECE(NURS,"|",2)_$EXTRACT(NURSSS,1,14),1,14)_"|"_$EXTRACT(NURS("OLD"),89,$LENGTH(NURS("OLD")))
+8 IF NURS(0)=2
SET NURS("NEW")=$EXTRACT(NURS("OLD"),1,87)_"|"_$EXTRACT($PIECE(NURS,"|")_$EXTRACT(NURSSS,1,29),1,29)_"|"_$EXTRACT($PIECE(NURS,"|",2)_$EXTRACT(NURSSS,1,14),1,14)
+9 SET ^TMP($JOB,"NURSDATA",NURS(1))=NURS("NEW")
+10 KILL NURS
+11 QUIT
GLP1 ;
+1 SET NURSA(0)=$SELECT($DATA(^TMP($JOB,"GMRGNAR",NURSRTK,NURSG(1),0)):^(0),1:"")
SET NURSA=$PIECE(NURSA(0),"^")
SET NURSA(1)=+$PIECE(NURSA(0),"^",3)
+2 FOR NURSK=1:1:$PIECE(NURSA(0),"^",2)
SET NURS=$SELECT($DATA(^TMP($JOB,"GMRGNAR",NURSRTK,NURSG(1),NURSK)):^(NURSK),1:"")_"||"
SET NURS(0)=1
SET NURS(1)=NURSO1
DO X
SET NURSO1=NURSO1+1
+3 FOR NURSG=0:0
SET NURSG=$ORDER(^TMP($JOB,"GMRGNAR",NURSG(1),NURSG))
IF NURSG'>0
QUIT
SET NURSG(0)=NURSG(1)
DO GOAL
+4 SET NURSA(0)=+$ORDER(^GMR(124.3,GMRGPDA,1,"B",NURSA(1),0))
IF $DATA(^GMR(124.3,GMRGPDA,1,NURSA(0),"ADD"))
IF ^("ADD")]""
SET NURSADD=^("ADD")
SET NURSRET=2
SET NURSLGT=0
SET NURSO4=NURSO1
DO FORMAT^NURCPP7
SET NURSO1=NURSO4
+5 SET NURS=""
SET NURS(0)=1
SET NURS(1)=NURSO1
DO X
SET NURSO1=NURSO1+1
+6 QUIT
GOAL ; CHECK FOR GOAL GOAL/EXPECTED OUTCOME TARGET DATE
+1 SET NURSI=1
SET NURS=$SELECT($DATA(^TMP($JOB,"GMRGNAR",NURSG(0),NURSG,NURSI)):$EXTRACT(NURSSS,1,NURSA*3)_^(NURSI),1:"")
+2 FOR NURST(0)=0:0
SET NURST(0)=$ORDER(^TMP($JOB,"NURSDATE",NURSG,NURST(0)))
IF NURST(0)'>0
QUIT
FOR NURST=0:0
SET NURST=$ORDER(^TMP($JOB,"NURSDATE",NURSG,NURST(0),NURST))
IF NURST'>0
QUIT
DO GOAL1
+3 FOR NURST=NURSI:0
IF NURS=""
QUIT
SET NURS(0)=1
SET NURS(1)=NURSO1
DO X
SET NURSO1=NURSO1+1
SET NURST=$ORDER(^TMP($JOB,"GMRGNAR",NURSG(0),NURSG,NURST))
IF NURST=""
QUIT
SET NURS=$EXTRACT(NURSSS,1,NURSA*3+1)_^TMP($JOB,"GMRGNAR",NURSG(0),NURSG,NURST)
+4 QUIT
+5 ;
GOAL1 ;
+1 SET X=$SELECT($DATA(^TMP($JOB,"NURSDATE",NURSG,NURST(0),NURST)):^(NURST),1:"")
+2 SET Y=$PIECE(X,"^",2)
IF Y'=""
SET Y=$EXTRACT(Y,4,5)_"/"_$EXTRACT(Y,6,7)_"/"_$EXTRACT(Y,2,3)
+3 SET NURSTAT=$SELECT($LENGTH($PIECE(X,"^",4)):"("_$PIECE(X,"^",4)_")"_$EXTRACT(" ",1,2-$LENGTH($PIECE(X,"^",4))),1:" ")
+4 SET NURSRN=$EXTRACT($SELECT($DATA(^VA(200,+$PIECE(X,"^",3),0)):$EXTRACT($PIECE($PIECE(^(0),"^"),",",2))_$EXTRACT($PIECE($PIECE(^(0),"^"),",")),1:"")_" ",1,2)
+5 ;
GOAL2 SET NURS=NURS_"|"_Y_NURSTAT_$JUSTIFY(NURSRN,2)
SET NURS(0)=1
SET NURS(1)=NURSO1
DO X
SET NURSO1=NURSO1+1
+1 IF $DATA(^TMP($JOB,"GMRGNAR",NURSG(0),NURSG,NURSI+1))
IF $PIECE(^(NURSI+1),"^")'=""
SET NURSI=NURSI+1
SET NURS=$EXTRACT(NURSSS,1,NURSA*3+1)_^TMP($JOB,"GMRGNAR",NURSG(0),NURSG,NURSI)
+2 IF '$TEST
SET NURS=""
+3 QUIT