source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LR7OSUM5.m@ 1520

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

initial load of FOIAVistA 6/30/08 version

File size: 5.7 KB
Line 
1LR7OSUM5 ;slc/dcm - Silent Patient cum cont. ;8/11/97
2 ;;5.2;LAB SERVICE;**121,187,228,241,250,251,256,356**;Sep 27, 1994;Build 8
3TS ;from LR7OSUM3
4 N A,B,I,J,LRII,LRCTR,LRFALT,LRCL,LRCW,LRTLOC,X,XZ,Z
5 I LRACT'=0 S X="",$P(X,"=",GIOM)="" D LN S ^TMP("LRC",$J,GCNT,0)=X
6 S I=0,LRII=0
7 F S LRII=$O(^LAB(64.5,1,1,LRMH,1,LRSH,1,LRII)) Q:LRII<1 S I=I+1,I(I)=LRII
8 S LRFALT=0,LRCTR=0,LRACT=LRACT+1,J=LRJS+1,LRCL=20
9 I J'>LRSHD D LINE^LR7OSUM4,LN S ^TMP("LRC",$J,GCNT,0)="",^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(CCNT,CCNT,LRTOPP)_$$S^LR7OS(LRCL,CCNT,"")
10 F I=J:1:LRSHD S Z=^LAB(64.5,1,1,LRMH,1,LRSH,1,I(I),0),LRCW=$P(Z,U,2) Q:(GIOM-LRCL)<LRCW D
11 . S LRCL=LRCL+LRCW,A=$L($P(Z,U,3))\2,B=LRCW\2,^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,$J($E($P(Z,U,3),1,(LRCW-1)),(A+B)))_$$S^LR7OS(LRCL,CCNT,"")
12 . S:'$P($G(^TMP("LRT",$J,$P(Z,"^",3))),"^",2) $P(^TMP("LRT",$J,$P(Z,"^",3)),"^",2)=GCNT
13 S LRJS=(I-1)
14 S:LRACT=LRPL LRJS=LRJS+1
15 F I=J:1:LRJS Q:'$D(^LAB(64.5,"A",1,LRMH,LRSH,I(I))) S Z=^(I(I)) S:$L($P(Z,U,2))!$L($P(Z,U,11)) LRFALT=1
16 I LRFALT D
17 . D LN S ^TMP("LRC",$J,GCNT,0)="" D
18 . . S LRCL=20
19 . . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(CCNT,CCNT,$S($L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(J)),U,11)):"Therapeutic low",1:"Ref range low"))_$$S^LR7OS(LRCL,CCNT,"")
20 . . D TS1
21 . D LN S ^TMP("LRC",$J,GCNT,0)="" D
22 . . S LRCL=20
23 . . S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(CCNT,CCNT,$S($L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(J)),U,11)):"Therapeutic high",1:"Ref range high"))_$$S^LR7OS(LRCL,CCNT,"")
24 . . D TS2
25 F I=J:1:LRJS Q:'$D(^LAB(64.5,"A",1,LRMH,LRSH,I(I))) S:$L($P(^(I(I)),U,7)) LRFALT=1
26 I LRFALT S LRCL=20 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(LRCL,CCNT,"") F I=J:1:LRJS D TS3
27 S LRFALT=0,XZ="",$P(XZ,"-",GIOM)=""
28 D LN
29 S ^TMP("LRC",$J,GCNT,0)=XZ
30LRFDT ;
31 S:LRNP LRFFDT=LRFDT,LRNP=0
32 S LRFDT=$O(^TMP($J,LRDFN,LRMH,LRSH,LRFDT)) G:LRFDT<1 LOOP^LR7OSUM3 S LRTLOC=$P(^(LRFDT,0),U,1)
33 S:LRFDT>LRLFDT LRLFDT=LRFDT
34GOUT ;
35 D QRS
36 I LRCTR>LRLNS&(LRACT'<LRPL) S LRFULL=1 D TXT1 G:$O(^TMP($J,LRDFN,LRMH,LRSH,LRLFDT))<1 LRSH^LR7OSUM3 D HEAD^LR7OSUM6,LRLNS^LR7OSUM3 S LRFULL=0,LRFDT=LRLFDT G TS
37 I LRCTR>LRLNS&(LRACT<LRPL) S LRFDT=LRFFDT G TS
38 G LRFDT
39QRS ;
40 S LRCTR=LRCTR+1
41 F I=J:1:LRJS I $D(^TMP($J,LRDFN,LRMH,LRSH,LRFDT,I(I))) S:$L(^(I(I))) LRFALT=1
42 Q:'LRFALT
43 S LRFALT=0,LRTM=1
44 D UDT^LR7OSUM3
45 S LRCL=20,LRTM=0
46 D LN
47 S ^TMP("LRC",$J,GCNT,0)=""
48 S:'LRNXSW ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(2,CCNT,""),^(0)=^(0)_$$S^LR7OS(3,CCNT,"")
49 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,LRUDT)
50 F I=J:1:LRJS S LRG=^LAB(64.5,1,1,LRMH,1,LRSH,1,I(I),0) S X=^(0) D QRS1
51 Q
52QRS1 ;
53 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(LRCL,CCNT,""),LRCW=$P(LRG,U,2),LRDP=$P(X,U,6)
54 Q:(GIOM-LRCL)<LRCW
55 S LRCL=LRCL+LRCW
56 I $D(^TMP($J,LRDFN,LRMH,LRSH,LRFDT,I(I))) S X=^(I(I)) D C(.X,.X1) S:$L($P(LRG,U,4))&($L(X)) @("X="_$P(LRG,U,4)),^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,X_X1) D
57 . I '$L($P(LRG,U,4)) S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,X_X1)
58 Q
59TXT ;from LR7OSUM4
60 S LRVAR=0,LRIV=0
61 F S LRIV=$O(^TMP($J,LRDFN,LRMH,LRSH,LRFDT,"TX",LRIV)) Q:LRIV<1 S X=^(LRIV,0),LRVAR=LRVAR+1 D
62 . I LRVAR>1 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(3,CCNT,"")
63 . S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,X)
64 Q
65LRLO ;from LR7OSUM4
66 S @("LRLO="_$S($L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,2)):$P(^(I(I)),U,2),$L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,11)):$P(^(I(I)),U,11),1:""""""))
67LRHI S @("LRHI="_$S($L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,3)):$P(^(I(I)),U,3),$L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,12)):$P(^(I(I)),U,12),1:"""""")),P7=$P(^(I(I)),U,7)
68 I LRLO'="",LRHI'="" S LRLOHI=LRLO_" to "_LRHI Q
69 I LRLO'="",LRHI="" S LRLOHI=$S(LRLO?.AP:LRLO,1:"low: "_LRLO) Q
70 I LRLO="",LRHI'="" S LRLOHI=$S(LRHI?.AP:LRHI,1:"high: "_LRHI) Q
71 S LRLOHI=""
72 Q
73TXT1 ;from LR7OSUM3, LR7OSUM4
74 S XZ="",$P(XZ,"=",GIOM)=""
75 Q:'$D(LRTM(0))
76 N C6,I,L
77 S C6=0
78 F S C6=$O(^TMP($J,"TM",C6)) Q:C6<1 S X=^(C6) D
79 . D LN
80 . S I=$S($L($P(X,"^"))>1:2,1:3),^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(I,CCNT,$P(X,U)_". "),L(0)=0,L=0 D
81 . F S L=$O(^TMP($J,"TM",C6,L)) Q:L<1 S X=^(L),L(0)=L(0)+1 D
82 .. I L(0)>1 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(6,CCNT,"")
83 .. S ^(0)=^TMP("LRC",$J,GCNT,0)_X
84 Q
85C(X,X1) ;
86 N X2
87 S X1=" "_$P(X,U,2),X=$P(X,U,1)
88 I $L($P(LRG,U,4)) S LRCW=LRCW-3 Q
89 I "<>"[$E(X,1),$E(X,2,$L(X))?.N.P1N S X2=$E(X,1),X=$E(X,2,$L(X))
90 S LRCW(1)=LRCW-3
91 I X?.N.P1N!(LRDP="")!(X?.N1".".N) S X=$S(LRDP="":$J(X,LRCW(1)),1:$J(X,LRCW(1),LRDP)) D C2(.X,.X2)
92 Q
93C1(X,X1) ;from LR7OSUM4
94 S LRCW=$S('$L(X1):7,1:10),X1=$S($L(X1)=1:" "_X1_" ",$L(X1)=0:X1,1:" "_X1)
95 I $L($P(LRG,U,4)) S LRCW=7 Q
96 S X=$S($L(X1):X_X1,1:X)
97 Q
98C2(X,X2) ;
99 Q:'$D(X2)
100 Q:'$D(X)
101 N X3
102 F X3=1:1:$L(X) I $E(X,X3)'=" " S X=$E(X,1,X3-2)_X2_$E(X,X3,$L(X)) Q
103 Q
104TS1 ;Print low therapeutic or reference range values
105 F I=J:1:LRJS S LRCW=$P(^LAB(64.5,1,1,LRMH,1,LRSH,1,I(I),0),U,2),LRCL=LRCL+LRCW D
106 . S @("LRLO="_$S($L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,2)):$P(^(I(I)),U,2),$L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,11)):$P(^(I(I)),U,11),1:""""""))
107 . S A=$L(LRLO)\2,B=LRCW\2
108 . S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,$J(LRLO,(A+B))),^(0)=^(0)_$$S^LR7OS(LRCL,CCNT,"")
109 Q
110TS2 ;Print high therapeutic or reference range values
111 F I=J:1:LRJS S LRCW=$P(^LAB(64.5,1,1,LRMH,1,LRSH,1,I(I),0),U,2),LRCL=LRCL+LRCW D
112 . S @("LRHI="_$S($L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,3)):$P(^(I(I)),U,3),$L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,12)):$P(^(I(I)),U,12),1:"""""")),P7=$P(^(I(I)),U,7)
113 . S A=$L(LRHI)\2,B=LRCW\2
114 . S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,$J(LRHI,(A+B))),^(0)=^(0)_$$S^LR7OS(LRCL,CCNT,"")
115 Q
116TS3 ;Print units
117 S LRCW=$P(^LAB(64.5,1,1,LRMH,1,LRSH,1,I(I),0),U,2)
118 Q:(GIOM-LRCL)<LRCW
119 S LRCL=LRCL+LRCW,A=$L($P(^LAB(64.5,"A",1,LRMH,LRSH,I(I)),U,7))\2,B=LRCW\2,X=^(I(I))
120 S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,$J($P(X,U,7),(A+B)))
121 S ^TMP("LRC",$J,GCNT,0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(LRCL,CCNT,""),LRFALT=0
122 Q
123LN ;
124 S GCNT=GCNT+1,CCNT=1
125 Q
Note: See TracBrowser for help on using the repository browser.