source: WorldVistAEHR/trunk/r/NURSING_SERVICE-NUR/NURCCPU5.m@ 862

Last change on this file since 862 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.9 KB
RevLine 
[613]1NURCCPU5 ;HIRMFO/RD/RM-NURSING CARE PLAN UTILITIES (cont.) ;8/29/96
2 ;;4.0;NURSING SERVICE;;Apr 25, 1997
3DCINT ; DC ALL INTERVENTIONS UNDER A PROBLEM
4 S NURSORD=+$O(^GMRD(124.25,"AA","NURSC","ORDERABLE",0)),NURSINT=+$O(^GMRD(124.25,"AA","NURSC","NURSING INTERVENTION",0)),NURSPROB=+$O(^GMRD(124.25,"AA","NURSC","NURSING PROBLEM",0))
5 F X=0:0 S X=$O(^GMRD(124.2,+GMRGTERM,1,"B",X)) Q:X'>0 S Y=$G(^GMRD(124.2,X,0)) I $P(Y,"^",4)=NURSINT D PRCINT(X)
6 Q
7PRCINT(DA) ; STEP THROUGH CHILDREN OF X IF CHILD ORDERABLE THEN DC IF IN NCP
8 N X
9 F X=0:0 S X=$O(^GMRD(124.2,DA,1,"B",X)) Q:X'>0 S Y=$G(^GMRD(124.2,X,0)) D PRC
10 Q
11PRC ; IF Y IS ORDERABLE THEN DC IF IN NCP, ELSE RECURSIVELY CALL PRCINT
12 I $P(Y,"^",4)=NURSORD S NURSI=+$O(^NURSC(216.8,NURSCPE,"ORD","AA",X,0)),NURSJ=+$O(^(NURSI,0)),Y=$G(^NURSC(216.8,NURSCPE,"ORD",NURSJ,0)) D DC:Y]""&($P(Y,"^",3)'=1) Q
13 D PRCINT(X)
14 Q
15DC ; DC AN ORDER
16 Q:'$$DCOK(X) S Y=X N DA,X
17 S DA(1)=NURSCPE,NURSZN=$P(^NURSC(216.8,NURSCPE,"ORD",0),"^",3,4),DA=$P(NURSZN,"^",1)+1,NURSNUM=$P(NURSZN,"^",2) F DA=DA:1 Q:'$D(^NURSC(216.8,NURSCPE,"ORD",DA,0))
18 S $P(^NURSC(216.8,DA(1),"ORD",0),"^",3,4)=DA_"^"_(NURSNUM+1),^NURSC(216.8,DA(1),"ORD",DA,0)=NURSNWDT_"^"_Y_"^1^"_DUZ
19 S DIK="^NURSC(216.8,DA(1),""ORD""," D IX1^DIK
20 Q
21DCOK(X) ; ARE ALL PROBLEMS UNDER WHICH AGGY TERM WITH IEN X LIES RESOLVED
22 ; THIS FUNCTION RETURNS 1 IF THIS STATEMENT IS TRUE, ELSE 0.
23 N Y,Z,OK
24 S OK=1 F Y=0:0 S Y=$O(^GMRD(124.2,"AKID",X,Y)) Q:Y'>0 S Z=$G(^GMRD(124.2,Y,0)),OK=$S($P(Z,"^",4)=NURSPROB:$$OK(Y),1:$$DCOK(Y)) Q:'OK
25 Q OK
26OK(Z) ; PART OF DCOK WHICH RETURNS 0 IF PROBLEM Z IS NOT RESOLVED, ELSE 1
27 Q:'$D(^GMR(124.3,GMRGPDA,1,"ALIST",Z)) 1
28 S Z=+$O(^NURSC(216.8,NURSCPE,"EVAL","AA",Z,0)),Z=+$O(^(Z,0))
29 Q Z'>0!+$P($G(^NURSC(216.8,NURSCPE,"EVAL",Z,0)),"^",4)
30 ;
31METGOAL(STAT) ; IF PROBLEM IS RESOLVED SET GOAL STATUS TO STAT.
32 N NURSGOAL,NURSGOEX
33 S NURSGOAL=+$O(^GMRD(124.25,"AA","NURSC","GOAL",0)),NURSGOEX=+$O(^GMRD(124.25,"AA","NURSC","GOALS/EXPECTED OUTCOMES",0)),NURSPROB=+$O(^GMRD(124.25,"AA","NURSC","NURSING PROBLEM",0))
34 F X=0:0 S X=$O(^GMRD(124.2,+GMRGTERM,1,"B",X)) Q:X'>0 S Y=$G(^GMRD(124.2,X,0)) I $P(Y,"^",4)=NURSGOEX D PRCGO(X)
35 Q
36PRCGO(DA) ; STEP THROUGH CHILDREN OF X IF CHILD GOAL THEN DC IF IN NCP
37 N X
38 F X=0:0 S X=$O(^GMRD(124.2,DA,1,"B",X)) Q:X'>0 S Y=$G(^GMRD(124.2,X,0)) D PRCG
39 Q
40PRCG ; IF Y IS GOAL THEN STATUS=MET IF IN NCP, ELSE RECURSIVELY CALL PRCGO
41 I $P(Y,"^",4)=NURSGOAL S NURSI=+$O(^NURSC(216.8,NURSCPE,"TARG","AA",X,0)),NURSJ=+$O(^(NURSI,0)),Y=$G(^NURSC(216.8,NURSCPE,"TARG",NURSJ,0)) D MET:Y]""&($P(Y,"^",2)'=1) Q
42 D PRCGO(X)
43 Q
44MET ; SET STATUS OF GOAL TO STAT
45 Q:'$$DCOK(X) S Y=X N DA,X
46 S DA(1)=NURSCPE,NURSZN=$P(^NURSC(216.8,NURSCPE,"TARG",0),"^",3,4),DA=$P(NURSZN,"^",1)+1,NURSNUM=$P(NURSZN,"^",2) F DA=DA:1 Q:'$D(^NURSC(216.8,NURSCPE,"TARG",DA,0))
47 S $P(^NURSC(216.8,DA(1),"TARG",0),"^",3,4)=DA_"^"_(NURSNUM+1),^NURSC(216.8,DA(1),"TARG",DA,0)=NURSNWDT_"^"_STAT_"^"_Y_"^"_DUZ_"^"_NURSNWDT
48 S DIK="^NURSC(216.8,DA(1),""TARG""," D IX1^DIK
49 Q
Note: See TracBrowser for help on using the repository browser.