source: WorldVistAEHR/trunk/r/GEN_MED_REC_GENERATOR-GMRG/GMRGRUT1.m@ 1742

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1GMRGRUT1 ;CISC/RM-ROUTINE UTILITIES (cont.) ;2/21/89
2 ;;3.0;Text Generator;;Jan 24, 1996
3FITLINE ; THIS UTILITY TAKES A LINE OF TEXT IN GMRGPLN AND A LENGTH IN
4 ; GMRGLEN, AND SETS GMRGPLN(0)=THE FIRST N-WORDS OF GMRGPLN THAT
5 ; WILL FIT IN LENGTH GMRGLEN, AND GMRGPLN(1)=REST OF GMRGPLN
6 ; KILLS GMRGLEN AND RETURNS GMRGPLN,GMRGPLN(0),GMRGPLN(1).
7 S GMRG100=0,GMRGPLN(0)="",GMRGPLN(1)=GMRGPLN
8 I $L(GMRGPLN)>GMRGLEN F GMRG101=0:0 S GMRG102=$F(GMRGPLN," ",GMRG100) Q:GMRG102'>0!(GMRG102>GMRGLEN) S GMRG100=GMRG102
9 S GMRGPLN(0)=$E(GMRGPLN,1,$S(GMRG100>0:GMRG100-1,1:GMRGLEN)),GMRGPLN(1)=$E(GMRGPLN,$S(GMRG100>0:GMRG100,1:GMRGLEN+1),$L(GMRGPLN))
10 I GMRGPLN(0)?1." ",$L(GMRGPLN)>GMRGLEN S GMRGPLN(0)=$E(GMRGPLN,1,GMRGLEN),GMRGPLN(1)=$E(GMRGPLN,GMRGLEN+1,$L(GMRGPLN))
11 K GMRG100,GMRG101,GMRG102,GMRGLEN
12 Q
13STORETXT ; THIS UTILITY TAKES THE FOLLOWING ELEMENTS OF THE GMRGNAR ARRAY
14 ; GMRGNAR=AGGY IEN^O/P FORM.^SPACES LT MARG.^CHILD?^SPACES RT. MARG.
15 ; GMRGNAR(0) = TEXT OF AGGY TERM ^ PATIENT TEXT (IF EXISTS)
16 ; GMRGNAR("LEAD") = LEAD TEXT FOR AGGY TERM
17 ; GMRGNAR("TRAIL") = TRAIL TEXT FOR AGGY TERM
18 ; AND STORES THE APPROPRIATE INFORMATION IN THE APPROPRIATE FORMAT
19 ; INTO THE UTILITY($J,"GMRGNAR",AGGY CLASS,AGGY IEN,LINE) GLOBAL
20 Q:'$D(GMRGNAR) Q:'$D(^TMP($J,"GMRGNAR",GMRGCLAS,$P(GMRGNAR,"^"),0)) S GMRG01=$P(^(0),"^",2),GMRG14=$P(GMRGNAR,"^",3),GMRG15="" F GMRG02=1:1:GMRG14 S GMRG15=GMRG15_" "
21 S GMRGXPRT(0)=$P(GMRGNAR(0),"^",2),GMRGXPRT=$P(GMRGNAR(0),"^"),GMRGXPRT(1)="^^^^1^1" D EN1^GMRGRUT2 S GMRG11=GMRGXPRT K GMRGXPRT
22 S GMRG17=$P(GMRGNAR,"^",5),GMRG16=$S((IOM-GMRG14)>0:IOM-GMRG14,1:IOM),GMRG10=$P(GMRGNAR,"^",4),GMRG18=0
23 I GMRG10 S GMRG08=" "_$S(GMRG10=1:"",GMRG10=2:"and ",1:""),GMRG04=$S(GMRG10=1:",",1:"."),GMRG05=$S(GMRG01:GMRG01,1:1),GMRG06=$L(^TMP($J,"GMRGNAR",GMRGCLAS,$P(GMRGNAR,"^"),GMRG01)),GMRGPLN=$E(^(GMRG01),GMRGSPC,GMRG06)
24 I S GMRG18=$S($E(GMRGPLN)'="-":0,1:1),GMRGPLN=$E(GMRGPLN,$S(GMRG18!($E(GMRGPLN)=" "):2,1:1),$L(GMRGPLN)) D NOB^GMRGRUT4 G QS
25 S:$P(GMRGNAR,"^",2)="B" (GMRGNAR("LEAD"),GMRGNAR("TRAIL"))="" S GMRG18=1
26 S (GMRG08,GMRGPLN)="" I 'GMRGSSW,($P(GMRGNAR,"^",2)="B"!($P(GMRGNAR,"^",2)="T")) S GMRG05=GMRG01+1
27 E S:GMRGSSW GMRG08=" ",GMRGPLN=$S(GMRGSSW:$E(^TMP($J,"GMRGNAR",GMRGCLAS,$P(GMRGNAR,"^"),GMRG01),GMRGSPC+1,$L(^TMP($J,"GMRGNAR",GMRGCLAS,$P(GMRGNAR,"^"),GMRG01))),1:""),GMRG18=0 S GMRG05=$S('GMRGSSW:GMRG01+1,GMRG01:GMRG01,1:1)
28 S GMRG04="" D NOB^GMRGRUT4
29QS K GMRG01,GMRG02,GMRG03,GMRG04,GMRG05,GMRG06,GMRG08,GMRG10,GMRG11,GMRG12,GMRG13,GMRG14,GMRG15,GMRG16,GMRG17,GMRG18,GMRGNAR,GMRGPLN
30 Q
Note: See TracBrowser for help on using the repository browser.