[613] | 1 | PSJORMA1 ;BIR/MV-COLLECT MAR DATA FOR U/D AND INPATIENT MED PENDINGS. ; 10 Mar 98 / 8:50 AM
|
---|
| 2 | ;;5.0; INPATIENT MEDICATIONS ;**2**;16 DEC 97
|
---|
| 3 | BLANK(LEN) ;
|
---|
| 4 | NEW X
|
---|
| 5 | S $P(X," ",LEN)=" "
|
---|
| 6 | Q $G(X)
|
---|
| 7 | ;
|
---|
| 8 | TXT(TXT,LEN) ;
|
---|
| 9 | ;* Input: TXT = TXT string
|
---|
| 10 | ;* LEN = format length
|
---|
| 11 | ;* Output: MARX array.
|
---|
| 12 | ;*
|
---|
| 13 | NEW OLD D SPLIT
|
---|
| 14 | S X=0,X1=1,Y="" F S X=$O(OLD(X)) Q:'X D
|
---|
| 15 | . I $L(Y_OLD(X))>LEN S MARX(X1)=Y,X1=X1+1,Y=""
|
---|
| 16 | . S Y=Y_OLD(X)
|
---|
| 17 | S:Y]"" MARX(X1)=Y
|
---|
| 18 | S MARX=X1
|
---|
| 19 | Q
|
---|
| 20 | ;
|
---|
| 21 | SPLIT ;* Split a word string into individual words.
|
---|
| 22 | ;* Output: OLD(X)
|
---|
| 23 | ;*
|
---|
| 24 | NEW BSD,NEW,X,X1,Y
|
---|
| 25 | S OLD(1)=TXT Q:$L(TXT)<LEN
|
---|
| 26 | F BSD=" ","/","-" S:'$O(OLD(0)) OLD(1)=TXT D:TXT[BSD DELIM(BSD)
|
---|
| 27 | I '$O(OLD(1)),($L(TXT)>LEN) D LEN(1,TXT) K OLD D
|
---|
| 28 | . F X=0:0 S X=$O(NEW(X)) Q:'X S OLD(X)=NEW(X)
|
---|
| 29 | Q
|
---|
| 30 | LEN(X1,OLD) ;* Wrap word around if it doesn't fit the display lenght.
|
---|
| 31 | NEW X
|
---|
| 32 | Q:$L(OLD)'>LEN
|
---|
| 33 | S X=$E(OLD,1,($L(OLD)-1)) I X["/"!(X["-") Q
|
---|
| 34 | I $L(OLD)>LEN F X=1:1 S NEW(X1)=$E(OLD,((LEN*X)-LEN+1),(LEN*X)),X1=X1+1 Q:($L(OLD)'>(LEN*X))
|
---|
| 35 | Q
|
---|
| 36 | DELIM(BSD) ;* BSD=" ","/","-"
|
---|
| 37 | K NEW
|
---|
| 38 | S X=0,X1=0 F S X=$O(OLD(X)) Q:'X F Y=1:1:$L(OLD(X),BSD) D
|
---|
| 39 | . S X1=X1+1
|
---|
| 40 | . S NEW(X1)=$P(OLD(X),BSD,Y)
|
---|
| 41 | . I $L(OLD(X),BSD)>1,(Y<$L(OLD(X),BSD)) S NEW(X1)=NEW(X1)_BSD
|
---|
| 42 | . D LEN(.X1,NEW(X1))
|
---|
| 43 | K OLD F X=0:0 S X=$O(NEW(X)) Q:'X S OLD(X)=NEW(X)
|
---|
| 44 | Q
|
---|
| 45 | ;
|
---|
| 46 | MARLB(LEN) ;
|
---|
| 47 | ;;;LEN=LENGHT
|
---|
| 48 | NEW L,X,TXT K MARLB,DRUGNAME
|
---|
| 49 | S L=1
|
---|
| 50 | ;I ON["P",(PSGLRN["___") S MARLB(L)=PSGLOD_" | P E N D I N G"
|
---|
| 51 | I ON["P",+NODE(4) S MARLB(L)=PSGLOD_" | P E N D I N G"
|
---|
| 52 | E S MARLB(L)=PSGLOD_" |"_PSGLSD_" |"_PSGLFD
|
---|
| 53 | S MARLB(L)=$$SETSTR^VALM1("("_PSGLBS5_")",MARLB(L),36,7)
|
---|
| 54 | S L=L+1
|
---|
| 55 | D DRGDISP^PSJLMUT1(DFN,PSGORD,LEN,39,.DRUGNAME,0)
|
---|
| 56 | F X=0:0 S X=$O(DRUGNAME(X)) Q:'X S MARLB(L)=DRUGNAME(X)_$S(X=1:$$BLANK(41-$L(DRUGNAME(X)))_PSGLST,1:""),L=L+1
|
---|
| 57 | D TXT^PSGMUTL(PSGLSI,LEN)
|
---|
| 58 | S X=0 F S X=$O(MARX(X)) Q:'X S MARLB(L)=MARX(X),L=L+1
|
---|
| 59 | K MARX
|
---|
| 60 | S X=$E("WS",1,PSGLWS*2)_$S(PSGLSM:$E("HSM",PSGLSM,3),1:"")_$E("NF",1,PSGLNF*2)
|
---|
| 61 | I TS<L,(X=""),($L(MARLB(L-1))<24),(L=6) S L=L-1 D
|
---|
| 62 | . S X=MARLB(L)_$$BLANK(23-$L(MARLB(L)))_"RPH: "_$S(PSGLRPH]""&(PSGLRPH'="0"):PSGLRPH,1:"_____")
|
---|
| 63 | . S X=X_$$BLANK(33-$L(X))_"RN: "_$S(PSGLRN]""&(PSGLRN'="0"):PSGLRN,1:"_____")
|
---|
| 64 | . S MARLB(L)=X
|
---|
| 65 | E D
|
---|
| 66 | . I L#5>0 F L=L:1:5 S MARLB(L)=""
|
---|
| 67 | .; S:L=4 MARLB(4)="",L=5
|
---|
| 68 | . S X=$E("WS",1,PSGLWS*2)
|
---|
| 69 | . S X=X_$$BLANK(4-$L(X))_$S(PSGLSM:$E("HSM",PSGLSM,3),1:"")
|
---|
| 70 | . S X=X_$$BLANK(8-$L(X))_$E("NF",1,PSGLNF*2)
|
---|
| 71 | . S X=X_$$BLANK(23-$L(X))_"RPH: "_$S(PSGLRPH]""&(PSGLRPH'="0"):PSGLRPH,1:"____")
|
---|
| 72 | . S X=X_$$BLANK(33-$L(X))_"RN: "_$S(PSGLRN]""&(PSGLRN'="0"):PSGLRN,1:"_____")
|
---|
| 73 | . S MARLB(L)=X
|
---|
| 74 | S MARLB=L
|
---|
| 75 | I MARLB>5!($G(TS)>5) D MARLB2
|
---|
| 76 | Q
|
---|
| 77 | ;
|
---|
| 78 | MARLB2 ;Slit array into 2 labels.
|
---|
| 79 | ;TS array must be defined. (TS^PSGMAR3(ADMIN TIMES))
|
---|
| 80 | NEW INIT,X,Y
|
---|
| 81 | S INIT=MARLB(MARLB),Y=5
|
---|
| 82 | F X=5:1:MARLB S X(X)=MARLB(X)
|
---|
| 83 | F X=5:1:($S(MARLB>TS:MARLB,1:TS)-1) D
|
---|
| 84 | . I (X#5)=0 S MARLB(X)="See next label for continuation" Q
|
---|
| 85 | . I Y<(MARLB) S MARLB(X)=X(Y),Y=Y+1 Q
|
---|
| 86 | . S MARLB(X)=""
|
---|
| 87 | S X=X+1 F Y=Y:1:MARLB-1 S MARLB(X)=$G(X(Y)),X=X+1
|
---|
| 88 | F X=X:0 Q:(X#5)=0 S MARLB(X)="",X=X+1
|
---|
| 89 | S MARLB(X)=INIT,MARLB=X
|
---|
| 90 | Q
|
---|
| 91 | N X F X=5:1:MARLB S X(X+1)=MARLB(X)
|
---|
| 92 | S MARLB(5)="See next label for continuation"
|
---|
| 93 | F X=7:1:MARLB S MARLB(X)=X(X)
|
---|
| 94 | F X=X+1:1:11 S MARLB(X)=""
|
---|
| 95 | S MARLB(10)=X(MARLB+1)
|
---|
| 96 | S MARLB=10
|
---|
| 97 | Q
|
---|
| 98 | ;
|
---|