1 | GMRGPNB1 ;HIRMFO/RM-SENTENCE BUILDER ;1/23/96
|
---|
2 | ;;3.0;Text Generator;;Jan 24, 1996
|
---|
3 | SNT ;
|
---|
4 | S GMRGSNT(1)=GMRGA0,(GMRGSPTR("C"),GMRGSPTR)=1,GMRGSPTR("P",1)=0
|
---|
5 | S GMRGSNT(1,"LEAD")=$S($D(^GMRD(124.2,GMRGA0,4)):^(4),1:""),GMRGSNT(1,"TRAIL")=$S($D(^GMRD(124.2,GMRGA0,5)):^(5),1:""),GMRGSNT(1,"SUB")=0,GMRGSNT(1,0)=$S($D(^GMRD(124.2,GMRGA0,0)):^(0),1:"")
|
---|
6 | S GMRGF0(0)=GMRGA0
|
---|
7 | F GMRGF0=0:0 S GMRGF0=$O(^GMRD(124.2,GMRGA0,1,"B",GMRGF0)) Q:GMRGF0'>0 I $S(GMRGCSW&'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$D(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$D(^GMR(124.3,GMRGPDA,1,"B",GMRGF0))) D SNT1
|
---|
8 | F GMRGSNT=0:0 S GMRGSNT=$O(GMRGSNT(GMRGSNT)) Q:GMRGSNT'>0 I $O(GMRGSNT(GMRGSNT,0))!($P(GMRGSNT(GMRGSNT,0),"^",2)=3) D SNTP^GMRGPNB2
|
---|
9 | S GMRGSSW=0
|
---|
10 | Q
|
---|
11 | SNT1 ;
|
---|
12 | I GMRGF0(0) Q:'$D(^GMRD(124.2,"AKID",GMRGF0,GMRGF0(0)))
|
---|
13 | S GMRGC0=GMRGF0 N GMRGF0 S GMRGF0(0)=GMRGC0
|
---|
14 | S GMRGE0(4)=$S($D(^GMRD(124.2,GMRGC0,4)):^(4),1:""),GMRGE0(5)=$S($D(^GMRD(124.2,GMRGC0,5)):^(5),1:""),GMRGE0(0)=$S($D(^GMRD(124.2,GMRGC0,0)):^(0),1:"")
|
---|
15 | I (GMRGE0(4)=""&(GMRGE0(5)="")) D INSERT Q
|
---|
16 | S GMRGSPTR=GMRGSPTR+1,GMRGSPTR("P",GMRGSPTR)=GMRGSPTR("C"),GMRGSPTR("C")=GMRGSPTR,GMRGSNT(GMRGSPTR("C"))=GMRGF0(0),GMRGSNT(GMRGSPTR("C"),"LEAD")=GMRGE0(4),GMRGSNT(GMRGSPTR("C"),"TRAIL")=GMRGE0(5),GMRGSNT(GMRGSPTR("C"),"SUB")=0
|
---|
17 | S GMRGSNT(GMRGSPTR("C"),0)=GMRGE0(0)
|
---|
18 | F GMRGF0=0:0 S GMRGF0=$O(^GMRD(124.2,GMRGF0(0),1,"B",GMRGF0)) Q:GMRGF0'>0 D
|
---|
19 | . Q:'$$ALIST^GMRGRUT0(GMRGPDA,GMRGF0(0),GMRGF0)
|
---|
20 | . I $S(GMRGCSW&'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$D(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$D(^GMR(124.3,GMRGPDA,1,"B",GMRGF0))) D SNT1
|
---|
21 | . Q
|
---|
22 | S GMRGSPTR("C")=GMRGSPTR("P",GMRGSPTR("C"))
|
---|
23 | Q
|
---|
24 | INSERT ;
|
---|
25 | S GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")=0
|
---|
26 | S GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE")=$S($D(GMRGSNT(GMRGSPTR("C"),"INS"))#2:GMRGSNT(GMRGSPTR("C"),"INS"),1:0),GMRGSNT(GMRGSPTR("C"),"INS")=GMRGF0(0)
|
---|
27 | F GMRGF0=0:0 S GMRGF0=$O(^GMRD(124.2,GMRGF0(0),1,"B",GMRGF0)) Q:GMRGF0'>0 I $S(GMRGCSW&'$D(^GMR(124.3,GMRGPDA,1,"ALIST",GMRGF0)):0,GMRGCSW:1,1:$D(^GMR(124.3,"B",GMRGF0,GMRGPDA))!$D(^GMR(124.3,GMRGPDA,1,"B",GMRGF0))) D INS1
|
---|
28 | I 'GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE") D INSTRM
|
---|
29 | I 'GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE") K GMRGSNT(GMRGSPTR("C"),"INS")
|
---|
30 | E S GMRGSNT(GMRGSPTR("C"),"INS")=GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"PRE") K GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0))
|
---|
31 | Q
|
---|
32 | INS1 ;
|
---|
33 | Q:'$D(^GMRD(124.2,"AKID",GMRGF0,GMRGF0(0))) S GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")=GMRGSNT(GMRGSPTR("C"),"INS",GMRGF0(0),"CPE")+1
|
---|
34 | D SNT1
|
---|
35 | Q
|
---|
36 | INSTRM ;
|
---|
37 | S GMRGSNT(GMRGSPTR("C"),"SUB")=GMRGSNT(GMRGSPTR("C"),"SUB")+1,GMRGSNT(GMRGSPTR("C"),GMRGSNT(GMRGSPTR("C"),"SUB"))=GMRGF0(0)
|
---|
38 | Q
|
---|