source: WorldVistAEHR/trunk/r/LAB_SERVICE-LR-LS/LRDIST.m@ 1697

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

initial load of WorldVistAEHR

File size: 4.4 KB
Line 
1LRDIST ;SLC/CJS - DATA DISTRIBUTION ;2/20/91 10:09 ;
2 ;;5.2;LAB SERVICE;**64,71,160,108,153**;Sep 27, 1994
3 D DT^LRX K DIC D ^LRDPA G END:(LRDFN=-1)!$D(DUOUT)!$D(DTOUT)
4ENT ;from LRQC
5 I $O(^LR(LRDFN,0))="" W !,"NO LAB DATA ON THIS PATIENT!",$C(7) Q
6 D ENT1
7END S:$D(ZTQUEUED) ZTREQ="@"
8 D ^%ZISC K A,A9,DFN,DIC,DOB,I,K,LAST,LRORD,LRCHM,LRCOUNT,LRCTRL,LRCW,LRDPF
9 K LRCV,LREDT,LREND,LRFLAG,LRFOOT,LRHIGH,LRIDT,LRII,LRIY,LRLM1,LRLM1F,LRLM2,LRLM2F
10 K LRLOW,LRM,LRTEST,LRNC,LRNEX,LRNM,LRNSET,LRNT,LRNTN,LRNX,LROK
11 K LRPANEL,LRSB,LRSDNORM,LRSDT,LRSPC,LRSPEC,LRSS,LRSSP,LRSSX,LRSTEPS
12 K ^TMP("LR",$J,"X"),LRSTS,LRSUB,LRSX,LRTN,LRVAL,LRWRD,N,PNM,SSN,X,Y,Z
13 K LRCV,LRECV,LREM,LRESD,LRLF,LRSD,LRSDD,LRTAB,LRXF,LRTEC,LRTM60,LRTS,LRTX,LRUSI,LRVF,LRVOL,LRVRM,LRWDTL,LRXD,LRXDH,LRXDP,S2,T1
14 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
15 Q
16ENT1 S LRCW=8,LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX
17 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."
18 I LRCTRL Q:%<0 S:%=1 LRFLAG=1,LRSDNORM=1
19 K LREDT D ^LRWU3 Q:LREND
20 S LRNSET=80,N=LRNSET
21L2 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"
22 Q:X[U S:X'="" LRNSET=X S N=LRNSET
23L3 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
24L4 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
25 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
26 IF $L($P(^LAB(60,+Y,.1),U,5)) W !,"ASK FOR TESTS INDIVIDUALLY" Q
27TX S LRSSP=LRSSP+1,LRTEST(LRSSP)=+Y_U_Y(0) D ^DIC G TX:Y>0
28 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
29 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
30 K %ZIS S %ZIS="Q" D ^%ZIS Q:POP
31 I $D(IO("Q")) K IO("Q") S ZTRTN="DQ^LRDIST",ZTSAVE("LR*")="" D ^%ZTLOAD G L3
32 D LIST U IO(0) G L3
33LIST U IO D DT^LRX S LREND=0
34 I LRFLAG D ^LRDIST2
35 S LRTN=0 F S LRTN=$O(LRTEST(LRTN)) Q:LRTN<1 D L40 K:LREND ^TMP("LR",$J,"X"),X,LRTEST Q:LREND
36 Q
37L40 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
38 S LRIDT=9999999-LRSDT,LAST=9999999-$S(LREDT<1:0,1:LREDT),LRCOUNT=0,LRSX=0,LRSSX=0,LRNC=0 K LRLOW,LRHIGH
39 S R1=0 IF LRSDNORM=1&LRCTRL S T=$O(^LAB(62.3,DFN,1,"B",+LRTEST(LRTN),0))
40 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
41 D ^LRDIST1
42 Q
43LREND K DIC Q
44DQ S:$D(ZTQUEUED) ZTREQ="@" S LRDPF=$P(^LR(LRDFN,0),U,2),DFN=$P(^(0),U,3) D PT^LRX D LIST G END
45OR ;OE/RR entry point
46 Q:'$D(ORVP)
47 ;-------------------------------------------------------------------
48 ; Patch LR*5.2*62 Need PNM, SSN etc....DRH
49 ;S:'$G(DFN) DFN=+ORVP S LRDFN=$G(^DPT(DFN,"LR")) Q:'$G(LRDFN) D DEM^LRX
50 ;Commented OR+4 To fix patch LR*5.2*64
51 ;-------------------------------------------------------------------
52 K LR,LRABV,LRAX,LRBLOOD,LRCAPA,LRDPAF,LRDT0,LRH,LRSF,LRT,LRU,LRWHO
53 S KILL=1 I '$D(LRPARAM) D EN^LRPARAM S KILL=0
54 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
55 D ENT
56 I 'KILL K LRBLOOD,LRDT0,LRORN,LRPARAM,LRPLASMA,LRSERUM,LRUNKNOW,LRURINE
57 K KILL Q
58EX2 ;
59 S LRSUB=$P(X,U,6) I $D(^LAB(60,+X,4)),$P(^(4),"^",2) S LRCFL=LRCFL_$P(^(4),"^",2)_U
60 I $L(LRSUB) S S2=$P(LRSUB,";",2) D:'$D(^TMP("LR",$J,"TMP",S2)) ORD Q
61 S S1=S1+1,S1(S1)=X,S1(S1,1)=J
62 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
63 S X=S1(S1),J=S1(S1,1),S1=S1-1
64 Q
65ORD S LRNX=LRNX+1,LRORD(LRNX)=S2,^TMP("LR",$J,"TMP",S2)=+X S:$P(X,U,18) LRM(S2)=+X,LRMX(+X)="" Q
66 ;LRNX is set by caller
67 Q
Note: See TracBrowser for help on using the repository browser.