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

NURCPPS2.m

Go to the documentation of this file.
NURCPPS2 ;HIRMFO/JH/RM-NURSING CARE PLAN DATABASE SEARCH  part 2 ;4/17/92
 ;;4.0;NURSING SERVICE;;Apr 25, 1997
 ;This is a Cont. of Patient Problem Listing, Data Processor:
PROB ; PROCESS PROBLEM LIST   NURSP=AGGY IEN
 D STEVAL^NURCPPS4
 S NURSK=0,NURSL=NURSP,NURSDA=$O(^GMR(124.3,GMRGPDA,1,"B",NURSP,0)) D:NURSDA>0 STAUD^NURCPPS4
 I NURSPLN="C" S NURSI=$O(^TMP($J,"NURSDATE",NURSP,0)),NURSJ=$O(^(+NURSI,0)) I $D(^TMP($J,"NURSDATE",NURSP,+NURSI,+NURSJ)),"^R^S^U^"[("^"_$P(^(+NURSJ),"^",4)_"^") Q
 F NURSC=0:0 S NURSC=$O(^GMRD(124.2,NURSP,1,"B",NURSC)) Q:NURSC'>0  D:$D(^GMRD(124.2,"AKID",NURSC,NURSP,0)) PROBCHIL
 Q
PROBCHIL ; PROCESS NURSP's CHILDREN
 ; NURSP=AGGY IEN OF PROBLEM, NURSC=AGGY IEN OF CHILD
 I NURSPLN="C" S NURSI=$O(^GMR(124.3,GMRGPDA,1,"B",NURSC,0)),NURSI=$O(^GMR(124.3,GMRGPDA,1,+NURSI,2,"AA",0)),NURSJ=$O(^(+NURSI,0)) Q:'NURSJ
 S NURSCHIL=$S($D(^GMRD(124.2,NURSC,0)):^(0),1:"")
 I '($P(NURSCHIL,"^",4)=NURSGCK!($P(NURSCHIL,"^",4)=NURSICK)) D NOGOIN^NURCPPS4 Q
 S NURSA=0,NURSG(0)=NURSC
PCR ;
 S NURSA=NURSA+1
 F NURSG(NURSA)=0:0 S NURSG(NURSA)=$O(^GMRD(124.2,NURSC,1,"B",NURSG(NURSA))) Q:NURSG(NURSA)'>0  D:$D(^GMRD(124.2,"AKID",NURSG(NURSA),NURSC,0)) GIPR
 S NURSA=NURSA-1 S:NURSA NURSC=NURSG(NURSA-1)
 Q
GIPR ;
 S X=$O(^GMRD(124.2,NURSC,1,"B",NURSG(NURSA),0)) Q:$P($G(^GMRD(124.2,NURSC,1,+X,0)),"^",6)!'$O(^GMR(124.3,GMRGPDA,1,$S(NURSPLN="A":"B",1:"ALIST"),NURSG(NURSA),0))  S NURSB(0)=$O(^GMR(124.3,GMRGPDA,1,"B",NURSG(NURSA),0)) Q:'NURSB(0)
 S NURSA(1)=$S($D(^GMRD(124.2,+NURSG(NURSA),0)):^(0),1:1)
 I NURSPLN="C",$P(NURSA(1),"^",4)=NURSGOCK S X=$O(^NURSC(216.8,NURSPOI,"TARG","AA",+NURSG(NURSA),0)),X=$O(^(+X,0)) I $P($G(^NURSC(216.8,NURSPOI,"TARG",+X,0)),"^",2) Q  ;IF GOAL MET OR DC'D AND CURRENT REPORT, THEN DO NOT ADD TO SORT
 I NURSPLN="C",$P(NURSA(1),"^",4)=NURSINCK S X=$O(^NURSC(216.8,NURSPOI,"ORD","AA",+NURSG(NURSA),0)),X=$O(^(+X,0)) I $P($G(^NURSC(216.8,NURSPOI,"ORD",+X,0)),"^",3) Q  ;IF ORDER DC'D AND CURRENT REPORT, THEN DO NOT ADD TO SORT
 I $P(NURSA(1),"^",4)=NURSGOCK!($P(NURSA(1),"^",4)=NURSINCK) S NURSG=NURSG(NURSA) D GOIN^NURCPPS4 Q
 S NURSB=NURSA-1*3,GMRGXPRT=$P(NURSA(1),"^"),GMRGXPRT(0)=$S($D(^GMR(124.3,GMRGPDA,1,NURSB(0),0)):$P(^(0),"^",2),1:""),GMRGXPRT(1)="0^245^0^0^1" D EN1^GMRGRUT2
 S:'$D(^TMP($J,"GMRGNAR",NURSG(0),NURSG(1),0)) ^(0)="0^0"
 S NURSO(0)=^TMP($J,"GMRGNAR",NURSG(0),NURSG(1),0),NURSO=$P(NURSO(0),"^",2)+1,GMRGPLN="-"_$S($E(GMRGXPRT)'?1L:$E(GMRGXPRT),1:$C($A($E(GMRGXPRT))-32))_$E(GMRGXPRT,2,$L(GMRGXPRT)),GMRGLEN=IOM-NURSRM-NURSB+1
 F NURSB(0)=0:1 D FITLINE^GMRGRUT1 S ^TMP($J,"GMRGNAR",NURSG(0),NURSG(1),NURSO)=$E(NURSSS,1,NURSB-1)_GMRGPLN(0),^(0)=NURSA_"^"_NURSO_"^"_NURSG(NURSA),NURSO=NURSO+1 Q:GMRGPLN(1)=""  S GMRGPLN=" "_GMRGPLN(1),GMRGLEN=IOM-NURSRM-NURSB+1
 S NURSC=NURSG(NURSA) D PCR
 Q