1 | GMRGED7 ;HIRMFO/RM-PATIENT DATA EDIT (cont.) ;1/9/96
|
---|
2 | ;;3.0;Text Generator;;Jan 24, 1996
|
---|
3 | NOTMIN ; IF THE MINIMUM NUMBER OF SELECTIONS IS NOT MADE FOR A FRAME
|
---|
4 | ; THEN THAT FRAME AND ALL SELECTED CHILDREN WILL BE DELETED.
|
---|
5 | S GMRGDLT("G")="",GMRGDLT("P")=$P(GMRGTERM,"^"),GMRGDLT("T")=$P(GMRGTERM,"^",3)
|
---|
6 | NMIN ; LOOP THROUGH CHILDREN (TO DELETE IF NECESSARY) AND DELETE THE
|
---|
7 | ; TERM ID'D BY GMRGDLT("P") IF NECESSARY.
|
---|
8 | ;
|
---|
9 | ; THE FOLLOWING 3 LINES OF COMMENTED CODE WILL BE SAVED UNTIL TG V4.
|
---|
10 | ; THEY MAY BE NEEDED IF THE FIX IN THE TWO LINES THAT FOLLOW THEM
|
---|
11 | ; CAUSE ANY PROBLEMS.
|
---|
12 | ;F GMRGDLT("C")=0:0 S GMRGDLT("C")=$O(^GMRD(124.2,GMRGDLT("P"),1,"B",GMRGDLT("C"))) Q:GMRGDLT("C")'>0 I $D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGDLT("C"))) D CHMIN
|
---|
13 | ;S GMRGTDL(0)=0 I GMRGDLT("G")'="" S GMRGND=GMRGDLT("P") F GMRGTDL=0:0 S GMRGTDL=$O(^GMRD(124.2,"AKID",GMRGDLT("P"),GMRGTDL)) Q:GMRGTDL'>0 I GMRGTDL'=GMRGDLT("G"),$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGTDL)) S GMRGTDL(0)=1 Q
|
---|
14 | ;I 'GMRGTDL(0),GMRGDLT("T")>0,GMRGDLT("P")'=+GMRGRT D DELMIN
|
---|
15 | F GMRGDLT("C")=0:0 S GMRGDLT("C")=$O(^GMRD(124.2,GMRGDLT("P"),1,"B",GMRGDLT("C"))) Q:GMRGDLT("C")'>0 I '$$OTHPAR(GMRGPDA,GMRGDLT("C"),GMRGDLT("P")),$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGDLT("C"))) D CHMIN
|
---|
16 | I '$$OTHPAR(GMRGPDA,GMRGDLT("P"),GMRGDLT("G")),GMRGDLT("T")>0,GMRGDLT("P")'=+GMRGRT D DELMIN
|
---|
17 | Q
|
---|
18 | CHMIN ; CALL NMIN RECURSIVELY FOR THE CHILDREN ACTIVE IN THE PLAN
|
---|
19 | S GMRGTDL(0)=GMRGDLT("P"),GMRGTDL=GMRGDLT("C") N GMRGDLT S GMRGDLT("G")=GMRGTDL(0),GMRGDLT("P")=GMRGTDL
|
---|
20 | S GMRGDLT("T")=$O(^GMR(124.3,GMRGPDA,1,"B",GMRGDLT("P"),0)) Q:GMRGDLT("T")'>0 Q:'$D(^GMR(124.3,GMRGPDA,1,GMRGDLT("T"),0))
|
---|
21 | D NMIN
|
---|
22 | Q
|
---|
23 | DELMIN ; DELETE THIS ENTRY FROM THE PLAN
|
---|
24 | S GMRGTDL=0,GMRGDLT(0)=$G(^GMR(124.3,GMRGPDA,1,GMRGDLT("T"),0))
|
---|
25 | I '$P(GMRGDLT(0),"^",3) F GMRG1=0:0 S GMRG1=$O(^GMR(124.3,GMRGPDA,1,GMRGDLT("T"),2,"AA",GMRG1)) S:GMRG1'>0 GMRGTDL=1 Q:GMRG1'>0 D DMIN Q:'GMRG1(1)
|
---|
26 | I GMRGTDL,'$P(GMRGDLT(0),"^",3) S DA(1)=GMRGPDA,DA=GMRGDLT("T"),DIK="^GMR(124.3,DA(1),1," D ^DIK
|
---|
27 | I $P(GMRGDLT(0),"^",3) S DA(1)=GMRGPDA,DA=GMRGDLT("T"),GMRGY=0,X=$P(GMRGDLT(0),"^") D EN1^GMRGUTL ;WE MAY HAVE TO EXECUTE ACTION ON FILING HERE, NOT SURE AT THIS TIME.
|
---|
28 | Q
|
---|
29 | DMIN ;
|
---|
30 | S GMRG1(0)=$O(^GMR(124.3,GMRGPDA,1,GMRGDLT("T"),2,"AA",GMRG1,"")),DA=$S(GMRG1(0)="":0,1:$O(^GMR(124.3,GMRGPDA,1,GMRGDLT("T"),2,"AA",GMRG1,GMRG1(0),0)))
|
---|
31 | S GMRG1(0)=$S(DA'>0:"",$D(^GMR(124.3,GMRGPDA,1,GMRGDLT("T"),2,DA,0)):^(0),1:"") Q:GMRG1(0)'>0
|
---|
32 | S GMRG1(1)=$P(GMRG1(0),"^",2) Q:'GMRG1(1) S DA(2)=GMRGPDA,DA(1)=GMRGDLT("T")
|
---|
33 | I $D(^GMR(124.3,DA(2),1,DA(1),2,DA,"ADD")),^("ADD")'="" D ADM
|
---|
34 | I $D(^GMR(124.3,DA(2),1,DA(1),2,DA,0)),$P(^(0),"^",4)'="" D APM
|
---|
35 | S DIK="^GMR(124.3,DA(2),1,DA(1),2," D ^DIK
|
---|
36 | Q
|
---|
37 | ADM ;
|
---|
38 | S GMRG1=DA,DA=DA(1),DA(1)=DA(2) K DA(2) S X=$S($D(^GMR(124.3,DA(1),1,DA,"ADD")):^("ADD"),1:"") I X'="" F GMRG2=0:0 S GMRG2=$O(^DD(124.31,2,1,GMRG2)) Q:GMRG2'>0 X:$D(^DD(124.31,2,1,GMRG2,2)) ^(2)
|
---|
39 | S X=^GMR(124.3,DA(1),1,DA,2,GMRG1,"ADD") F GMRG2=0:0 S GMRG2=$O(^DD(124.31,2,1,GMRG2)) Q:GMRG2'>0 X:$D(^DD(124.31,2,1,GMRG2,1)) ^(1)
|
---|
40 | S DA(2)=DA(1),DA(1)=DA,DA=GMRG1
|
---|
41 | Q
|
---|
42 | APM ;
|
---|
43 | S GMRG1=DA,DA=DA(1),DA(1)=DA(2) K DA(2) S X=$S($D(^GMR(124.3,DA(1),1,DA,0)):$P(^(0),"^",2),1:"") I X'="" F GMRG2=0:0 S GMRG2=$O(^DD(124.31,1,1,GMRG2)) Q:GMRG2'>0 X:$D(^DD(124.31,1,1,GMRG2,2)) ^(2)
|
---|
44 | S X=$P(^GMR(124.3,DA(1),1,DA,2,GMRG1,0),"^",4) F GMRG2=0:0 S GMRG2=$O(^DD(124.31,1,1,GMRG2)) Q:GMRG2'>0 X:$D(^DD(124.31,1,1,GMRG2,1)) ^(1)
|
---|
45 | S DA(2)=DA(1),DA(1)=DA,DA=GMRG1
|
---|
46 | Q
|
---|
47 | BEGADD ; IF THE RECORD WHICH IS ABOUT TO BE EDITED HAS ANY ADDED FLAGS
|
---|
48 | ; WHICH INDICATED NO THEN THESE FLAGS WILL BE FLIPPED TO INDICATE YES
|
---|
49 | S DA(1)=GMRGPDA F DA=0:0 S DA=$O(^GMR(124.3,GMRGPDA,1,"ANOT",DA)) Q:DA'>0 I $D(^GMR(124.3,DA(1),1,DA,0)),'$P(^(0),"^",3) S GMRGTERM=$P(^(0),"^",1,2)_"^"_DA,GMRGTERM(0)=$S($D(^GMRD(124.2,+GMRGTERM,0)):^(0),1:"") D ADS^GMRGED6
|
---|
50 | Q
|
---|
51 | OTHPAR(IEN,CHIL,PAR) ; Given the IEN of 124.3 entry (IEN) and Aggregate
|
---|
52 | ; Term file pointers for the Child (CHIL) and Parent (PARN), this
|
---|
53 | ; function will return True (1) if CHIL has another parent'=PARN
|
---|
54 | ; that it is active for in IEN, else the function returns False (0).
|
---|
55 | N FXN,X S FXN=0
|
---|
56 | I PAR'="" S X=0 F S X=$O(^GMRD(124.2,"AKID",CHIL,X)) Q:X'>0 I X'=PAR,$D(^GMR(124.3,IEN,1,"ALIST",X)) S FXN=1 Q
|
---|
57 | Q FXN
|
---|