68 lines
4.4 KiB
Mathematica
68 lines
4.4 KiB
Mathematica
LRDIST ;SLC/CJS - DATA DISTRIBUTION ;2/20/91 10:09 ;
|
|
;;5.2;LAB SERVICE;**64,71,160,108,153**;Sep 27, 1994
|
|
D DT^LRX K DIC D ^LRDPA G END:(LRDFN=-1)!$D(DUOUT)!$D(DTOUT)
|
|
ENT ;from LRQC
|
|
I $O(^LR(LRDFN,0))="" W !,"NO LAB DATA ON THIS PATIENT!",$C(7) Q
|
|
D ENT1
|
|
END S:$D(ZTQUEUED) ZTREQ="@"
|
|
D ^%ZISC K A,A9,DFN,DIC,DOB,I,K,LAST,LRORD,LRCHM,LRCOUNT,LRCTRL,LRCW,LRDPF
|
|
K LRCV,LREDT,LREND,LRFLAG,LRFOOT,LRHIGH,LRIDT,LRII,LRIY,LRLM1,LRLM1F,LRLM2,LRLM2F
|
|
K LRLOW,LRM,LRTEST,LRNC,LRNEX,LRNM,LRNSET,LRNT,LRNTN,LRNX,LROK
|
|
K LRPANEL,LRSB,LRSDNORM,LRSDT,LRSPC,LRSPEC,LRSS,LRSSP,LRSSX,LRSTEPS
|
|
K ^TMP("LR",$J,"X"),LRSTS,LRSUB,LRSX,LRTN,LRVAL,LRWRD,N,PNM,SSN,X,Y,Z
|
|
K LRCV,LRECV,LREM,LRESD,LRLF,LRSD,LRSDD,LRTAB,LRXF,LRTEC,LRTM60,LRTS,LRTX,LRUSI,LRVF,LRVOL,LRVRM,LRWDTL,LRXD,LRXDH,LRXDP,S2,T1
|
|
K LRDFN,DUOUT,DTOUT,R1,LRACD,LRAOD,LRCDT,LRCFL,LRDAT,LRDEL,LRDV,LRDVF,LREAL,LREDIT,LREXEC,LRFAN,LRFFLG,LRFP,LRGVP,LRINI,LRIOZERO,LRLAN,LRLCT,LRMD,LRMETH,LRNG,LRNG2,LRNG3,LRNG4,LRNG5,LRODT,LROUTINE,LRPER,LRPLOC,LRSAMP,LRSN,LRSSQ,LRSTAR
|
|
Q
|
|
ENT1 S LRCW=8,LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX
|
|
S LRFLAG="",LRCTRL=$S(LRDPF=62.3:1,1:0) I LRCTRL F I=0:0 W !,"Display cumulative summary (NO, displays graph)" S %=1 D YN^DICN Q:% W " Answer 'Y'es or 'N'o."
|
|
I LRCTRL Q:%<0 S:%=1 LRFLAG=1,LRSDNORM=1
|
|
K LREDT D ^LRWU3 Q:LREND
|
|
S LRNSET=80,N=LRNSET
|
|
L2 F I=0:0 W !,"How many time points? ",LRNSET,"//" R X:DTIME Q:X[U!'$L(X)!(X\1=X&(X'<1)) W " Enter a number"
|
|
Q:X[U S:X'="" LRNSET=X S N=LRNSET
|
|
L3 K ^TMP("LR",$J,"TMP"),^TMP("LR",$J,"X"),X,LRORD,DIC,ZTRTN,ZTIO,ZTDESC,ZTSAVE,ZTSK S LRSPEC=-1,DIC(0)="AEOQZ" I LRDPF'=62.3 S DIC="^LAB(61,",DIC("A")="Select SITE/SPECIMEN: ANY//" D ^DIC G:$D(DUOUT) END S LRSPEC=+Y
|
|
L4 S LRSS="CH" K DIC("A") S:'LRFLAG LRSDNORM=0 IF (LRSPEC>0!LRCTRL)&'LRFLAG W !,"Plot relative to ",$S(LRCTRL:"expected",1:"normal")," values (if available)" S %=1 D YN^DICN Q:%=-1 G L4:%=0 S:%=1 LRSDNORM=1
|
|
S:N<2 N=30 S LRSSP=0,DIC="^LAB(60,",DIC("S")="I $P(^(0),U,4)=""CH"""_$S(LRCTRL:"",1:$S('$D(^XUSEC("LRSUPER",DUZ)):",""N""'[$P(^(0),U,3)",1:"")) D ^DIC G LREND:Y<1
|
|
IF $L($P(^LAB(60,+Y,.1),U,5)) W !,"ASK FOR TESTS INDIVIDUALLY" Q
|
|
TX S LRSSP=LRSSP+1,LRTEST(LRSSP)=+Y_U_Y(0) D ^DIC G TX:Y>0
|
|
S LRNX=0,LRPANEL=0 K ^TMP("LR",$J,"X"),X,^TMP("LR",$J,"TMP"),LRORD,DIC F I=1:1 Q:'$D(LRTEST(I)) S X=LRTEST(I),(LRNTN,LRNT)=I,(S1,J)=0,LRCFL="" D EX2
|
|
K LRTEST,^TMP("LR",$J,"TMP") S I=0 F S I=$O(LRORD(I)) Q:I<1 S J=LRORD(I),LRTEST(I)=$O(^LAB(60,"C","CH;"_J_";1",0))_U_$P(^LAB(60,$O(^(0)),0),U,1)_U_J,LRNM=I
|
|
K %ZIS S %ZIS="Q" D ^%ZIS Q:POP
|
|
I $D(IO("Q")) K IO("Q") S ZTRTN="DQ^LRDIST",ZTSAVE("LR*")="" D ^%ZTLOAD G L3
|
|
D LIST U IO(0) G L3
|
|
LIST U IO D DT^LRX S LREND=0
|
|
I LRFLAG D ^LRDIST2
|
|
S LRTN=0 F S LRTN=$O(LRTEST(LRTN)) Q:LRTN<1 D L40 K:LREND ^TMP("LR",$J,"X"),X,LRTEST Q:LREND
|
|
Q
|
|
L40 S LRSB=$P(LRTEST(LRTN),U,3),LRCHM=$P(LRTEST(LRTN),U,2),LRCHM(.1)=$S($D(^LAB(60,+LRTEST(LRTN),.1)):$P(^(.1),U,3),1:""),N=LRNSET
|
|
S LRIDT=9999999-LRSDT,LAST=9999999-$S(LREDT<1:0,1:LREDT),LRCOUNT=0,LRSX=0,LRSSX=0,LRNC=0 K LRLOW,LRHIGH
|
|
S R1=0 IF LRSDNORM=1&LRCTRL S T=$O(^LAB(62.3,DFN,1,"B",+LRTEST(LRTN),0))
|
|
I LRSDNORM=1,LRCTRL I T>0 S T=^LAB(62.3,DFN,1,T,0),X=$P(T,U,2),Y=(3*$P(T,U,3)),LRLOW=X-Y,LRHIGH=X+Y,R1=1 I '$L($P(T,U,2))!('$L($P(T,U,3))) W !,"Expected values not available for "_$P(LRTEST(LRTN),U,2),! Q
|
|
D ^LRDIST1
|
|
Q
|
|
LREND K DIC Q
|
|
DQ S:$D(ZTQUEUED) ZTREQ="@" S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX D LIST G END
|
|
OR ;OE/RR entry point
|
|
Q:'$D(ORVP)
|
|
;-------------------------------------------------------------------
|
|
; Patch LR*5.2*62 Need PNM, SSN etc....DRH
|
|
;S:'$G(DFN) DFN=+ORVP S LRDFN=$G(^DPT(DFN,"LR")) Q:'$G(LRDFN) D DEM^LRX
|
|
;Commented OR+4 To fix patch LR*5.2*64
|
|
;-------------------------------------------------------------------
|
|
K LR,LRABV,LRAX,LRBLOOD,LRCAPA,LRDPAF,LRDT0,LRH,LRSF,LRT,LRU,LRWHO
|
|
S KILL=1 I '$D(LRPARAM) D EN^LRPARAM S KILL=0
|
|
D DT^LRX K DIC S LREND=0,DFN=+ORVP,LRDPF=+$P(@("^"_$P(ORVP,";",2)_"0)"),"^",2)_"^"_$P(ORVP,";",2) D END^LRDPA Q:LRDFN<1
|
|
D ENT
|
|
I 'KILL K LRBLOOD,LRDT0,LRORN,LRPARAM,LRPLASMA,LRSERUM,LRUNKNOW,LRURINE
|
|
K KILL Q
|
|
EX2 ;
|
|
S LRSUB=$P(X,U,6) I $D(^LAB(60,+X,4)),$P(^(4),"^",2) S LRCFL=LRCFL_$P(^(4),"^",2)_U
|
|
I $L(LRSUB) S S2=$P(LRSUB,";",2) D:'$D(^TMP("LR",$J,"TMP",S2)) ORD Q
|
|
S S1=S1+1,S1(S1)=X,S1(S1,1)=J
|
|
S J=0 F S J=$O(^LAB(60,+S1(S1),2,J)) Q:J<1 S Y=+^(J,0),X=Y_U_^LAB(60,Y,0) D EX2
|
|
S X=S1(S1),J=S1(S1,1),S1=S1-1
|
|
Q
|
|
ORD S LRNX=LRNX+1,LRORD(LRNX)=S2,^TMP("LR",$J,"TMP",S2)=+X S:$P(X,U,18) LRM(S2)=+X,LRMX(+X)="" Q
|
|
;LRNX is set by caller
|
|
Q
|