source: WorldVistAEHR/trunk/r/GEN_MED_REC_GENERATOR-GMRG/GMRGRUT0.m@ 836

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1GMRGRUT0 ;CISC/RM-ROUTINE UTILITIES ;10/25/88
2 ;;3.0;Text Generator;;Jan 24, 1996
3STAT ; ENTRY TO GIVE THE TYPE AND DATE OF THE LAST MODIFICATION ON THE
4 ; SELECTION DEFINED BY GMRGST, AND GMR TEXT ENTRY GMRGST(1),
5 ; AND GMRGST(2) IF PASSED WILL BE THE DATE/TIME THAT YOU
6 ; WANT THE INFORMATION FOR THIS TERM.
7 ; RETURNED IS GMRGSTAT=IEN OF AUDIT TRAIL^D/T^MOD
8 Q:'$D(GMRGST) I '$D(GMRGST(2)) S GMRGST(2)=0
9 E S GMRGST(2)=9999999-GMRGST(2)-.000001
10 S GMRGST("DT")=$O(^GMR(124.3,GMRGST(1),1,GMRGST,2,"AA",GMRGST(2))),GMRGST("MOD")=$S(GMRGST("DT")>0:$O(^(GMRGST("DT"),0)),1:""),GMRGST(0)=$S(GMRGST("MOD")>0:$O(^(GMRGST("MOD"),0)),1:"")
11 S GMRGSTAT=$S(GMRGST(0)>0:GMRGST(0)_"^"_(9999999-GMRGST("DT"))_"^"_GMRGST("MOD"),1:0)
12 K GMRGST
13 Q
14FNDPRM ; FIND PRIME DOCUMENT(S) FOR THE TERM IN NODE GMRGND RETURNED IS
15 ; IS GMRGPRM(IEN) WITH ALL PRIME DOCUMENTS FOR THIS TERM
16 S GMRGND(1)=1
17 S GMRGND(2)=0 F GMRGND(1)=1:1 S GMRGND(2)=$O(^GMRD(124.2,"AKID",GMRGND,GMRGND(2))) Q:GMRGND(2)'>0 S:GMRGND(2)=GMRGCYC(0)!$D(GMRGCYC(GMRGND(2))) GMRGCYC=1 D:GMRGND(2)'=GMRGCYC(0)&'$D(GMRGCYC(GMRGND(2))) PRMCHK
18 K GMRGCYC(GMRGND),GMRGND,GMRGTMP
19 Q
20PRMCHK ;
21 S GMRGND("C")=$S($D(^GMRD(124.2,GMRGND(2),0)):$P(^(0),"^",4),1:""),GMRGND("CI")=$S(GMRGND("C")="":"",$D(^GMRD(124.25,$P(^GMRD(124.2,GMRGND(2),0),"^",4),0)):$P(^(0),"^"),1:"")
22 I GMRGND("CI")="PRIME DOCUMENT" S GMRGPRM(GMRGND(2))="" Q
23 S GMRGTMP=GMRGND(2) N GMRGND S GMRGND=GMRGTMP,GMRGCYC(GMRGND)="" D FNDPRM
24 Q
25STLST ; GIVEN THAT GMRGND=ENTRY IN 124.3, AND GMRGND(0)=TERM THAT HAS BEEN
26 ; ADDED TO PLAN, UPDATE THE LIST XREF FOR GMRGND(0)'S PARENT
27 F GMRGND(1)=0:0 S GMRGND(1)=$O(^GMRD(124.2,"AKID",GMRGND(0),GMRGND(1))) Q:GMRGND(1)'>0 S:'$D(GMRGRT)&$D(GMRG(0,GMRGND(1)))&'$D(^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1))) ^(GMRGND(1),1)="^0" D:$D(^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1))) PARST
28 K GMRGND
29 Q
30PARST ;
31 K GMRGND("L")
32 S GMRGND("O")=0,GMRGND("L")=""
33 F GMRGND(2)=0:0 S GMRGND(2)=$O(^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND(2))) Q:GMRGND(2)'>0 S GMRGND("L",GMRGND(2))=^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND(2)) I GMRGND("L",GMRGND(2))[("^"_GMRGND(0)_"^") S GMRGND("O")=1 Q
34 I 'GMRGND("O") D ST0
35 I 'GMRGND("O"),GMRGND("L")'="" S ^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND("L")+1)="^"_GMRGND(0)_"^0"
36 Q
37ST0 F GMRGND(2)=0:0 S GMRGND(2)=$O(GMRGND("L",GMRGND(2))) Q:GMRGND(2)'>0 D ST2
38 Q
39ST2 S GMRGND("L")=GMRGND(2)
40 I ($L($P(GMRGND("L",GMRGND(2)),U,1,($L(GMRGND("L",GMRGND(2)),U)-1)))+2+$L(GMRGND(0))+$L($P(GMRGND("L",GMRGND(2)),U,$L(GMRGND("L",GMRGND(2)),U))))<245 D ST1
41 Q
42ST1 S ^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND(2))=$P(GMRGND("L",GMRGND(2)),U,1,($L(GMRGND("L",GMRGND(2)),U)-1))_U_GMRGND(0)_U_$P(GMRGND("L",GMRGND(2)),U,$L(GMRGND("L",GMRGND(2)),U)) S GMRGND("O")=1
43 Q
44DLLST ; GIVEN THAT GMRGND=ENTRY IN 124.3, AND GMRGND(0)=TERM THAT HAS BEEN
45 ; DELETED FROM PLAN, UPDATE THE LIST XREF FOR GMRGND(0)'S PARENT(S)
46 F GMRGND(1)=0:0 S GMRGND(1)=$O(^GMRD(124.2,"AKID",GMRGND(0),GMRGND(1))) Q:GMRGND(1)'>0 D PARDL
47 K GMRGND
48 Q
49PARDL ;
50 S GMRGND("O")=0
51 F GMRGND(2)=0:0 S GMRGND(2)=$O(^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND(2))) Q:GMRGND(2)'>0 S GMRGND("L")=^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND(2)) I GMRGND("L")[("^"_GMRGND(0)_"^") D DL0
52 Q
53DL0 ;
54 S GMRGND("L")=$P(GMRGND("L"),("^"_GMRGND(0)_"^"))_"^"_$P(GMRGND("L"),("^"_GMRGND(0)_"^"),2)
55 S ^GMR(124.3,GMRGND,1,"ALIST",GMRGND(1),GMRGND(2))=GMRGND("L")
56 Q
57ALIST(IEN,PAR,CHIL) ; GIVEN THE 124.3 IEN (IEN), PARENT (PAR), AND CHILD
58 ; (CHIL), THIS FUNCTION WILL RETURN TRUE(1)/FALSE(0) IF THIS CHILD IS
59 ; PART OF "ALIST" XREF FOR THIS PARENT.
60 N X,FXN S FXN=0
61 S Y=$P($G(^GMRD(124.2,PAR,0)),"^",2) I Y=3 S FXN=1
62 E S X=0 F S X=$O(^GMR(124.3,IEN,1,"ALIST",PAR,X)) Q:X'>0 I $G(^GMR(124.3,IEN,1,"ALIST",PAR,X))[("^"_CHIL_"^") S FXN=1 Q
63 Q FXN
Note: See TracBrowser for help on using the repository browser.