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

40 lines
2.9 KiB
Mathematica

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