VistA-WorldVistAEHR/r/LAB_SERVICE-LR-LS/LRAC2.m

42 lines
3.0 KiB
Mathematica
Raw Normal View History

2009-11-29 13:37:14 -05:00
LRAC2 ;SLC/DCM - CUMULATIVE CONT. ; 12/12/88 10:16 ;
;;5.2;LAB SERVICE;**225**;Sep 27, 1994
TST1 Q:LRSPM'=LRSPM1
I $L(LX1),LX2,$D(^LAC(LRXLR,LRDFN,1,LX1,1,LX2,1,LRIIDT,1,LRTSTS)),LRMH_":"_LRSH=(LX1_":"_LX2) S LRNON=1 Q
SBSET S LRMHN=$P(^LAB(64.5,1,1,LRMH,0),U,1),LRTF=^(1,LRSH,0),$P(LRTF,U,4)=$P(LRTF,U,3),$P(LRTF,U,3)=$P(^(1,0),U,4),LRNON=1,LRIIDT=LRVIDT
I '$D(^LAC(LRXLR,LRDFN,1,LRMH,0)) S ^(0)=LRMHN,LRZO="^LAC("""_LRXLR_""","_LRDFN_",1,",LRZ1=64.701,LRZ3=LRMH D Z^LRWU
I '$D(^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,0))!($D(^(0))=10) S ^(0)=LRTF_U,LRZO="^LAC("""_LRXLR_""","_LRDFN_",1,"_LRMH_",1,",LRZ1=64.703,LRZ3=LRSH D Z^LRWU
I '$D(^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,1,LRIIDT,0)) S ^(0)=LRVIDT_U_LRTLOC_U_LRVDT_U_LRAN_U_LRIDT,LRZO="^LAC("""_LRXLR_""","_LRDFN_",1,"_LRMH_",1,"_LRSH_",1,",LRZ1="64.704D",LRZ3=LRIIDT D Z^LRWU
LRTSTVAL S ^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,1,LRIIDT,1,LRTSTS,0)=LRTSTVAL_U_X1_U_LRSUB,LRZO="^LAC("""_LRXLR_""","_LRDFN_",1,"_LRMH_",1,"_LRSH_",1,"_LRIIDT_",1,",LRZ1=64.705,LRZ3=LRTSTS D Z^LRWU
I $D(^LR(LRDFN,"CH",LRIDT,1,0)) D TEXT
I '$L(LX1)!(LX2&(LX1_":"_LX2'=(LRMH_":"_LRSH))),'$D(^LAC("LGOT",LRDFN,LRMH)) S ^(LRMH)="",^LAC("LRAC",LRDFN,1,LRMH,.5)=1
S:'LRRE ^LRO(68,"AC",LRDFN,LRIDT,LRSUB)=LRMH_"^"_LRSH
Q
SUB1 I '$D(^LR(LRDFN,"CH",LRIDT,LRSUB)) K ^LRO(68,"AC",LRDFN,LRIDT,LRSUB) Q
S LRTST=$O(^LAB(60,"C","CH;"_LRSUB_";1",0)) I LRTST="" K ^LRO(68,"AC",LRDFN,LRIDT,LRSUB) Q
S LX2=$P(LX1,"^",2),LX1=$P(LX1,"^")
SUB2 ;from LRACM2
S LRTSTVAL=$P(^LR(LRDFN,"CH",LRIDT,LRSUB),U,1),X1=$P(^(LRSUB),U,2)
I "IN"[$P(^LAB(60,LRTST,0),U,3) K ^LRO(68,"AC",LRDFN,LRIDT,LRSUB) Q
G S LRNOFL=""
I '$D(^LAB(64.5,"AC",LRSUB)),LX1'="MISC" D MISC^LRAC2A Q
K LRNON
S LRMH=0 F S LRMH=$O(^LAB(64.5,"AC",LRSUB,1,LRMH)) Q:'LRMH S LRSH=0 F S LRSH=$O(^LAB(64.5,"AC",LRSUB,1,LRMH,LRSH)) Q:'LRSH S LRTSTS=0 F S LRTSTS=$O(^LAB(64.5,"AC",LRSUB,1,LRMH,LRSH,LRTSTS)) Q:'LRTSTS S LRSPM1=^(LRTSTS) D TST1
I '$D(LRNON),LX1'="MISC" D MISC^LRAC2A
K LX1,LX2 Q
LRIDT ;from LRAC1
I $D(^LR(LRDFN,"CH",LRIDT,0))[0 K ^LRO(68,"AC",LRDFN,LRIDT) Q
LRSPM S X=^LR(LRDFN,"CH",LRIDT,0),LRIIDT=$P(X,U,1),LRTNN=1,LRVIDT=LRIIDT
OD S LRSPM=$P(X,U,5),LRIPG=$P(X,U,9),LRTLOC=$E($P(X,U,11),1,7),LRVDT=$P(X,U,3),LRAN=$P(X,U,6)
Q:'$L(LRVDT) S LRSUB=1 F S LRSUB=$O(^LRO(68,"AC",LRDFN,LRIDT,LRSUB)) Q:LRSUB<1 S LX1=^(LRSUB) D SUB1
Q
TEXT S LRYESCOM=0 K ^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,1,LRIIDT,"TX")
S M=0 F S M=$O(^LR(LRDFN,"CH",LRIDT,1,M)) Q:'M!(LRYESCOM) F N=1:1:$L(^LR(LRDFN,"CH",LRIDT,1,M,0)) Q:LRYESCOM S:$E(^(0),N)'[$C(32) LRYESCOM=1
Q:'LRYESCOM
S ^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,1,LRIIDT,"TX",0)="^^1^1^"_LRIIDT
S L=0 F S L=$O(^LR(LRDFN,"CH",LRIDT,1,L)) Q:'L S ^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,1,LRIIDT,"TX",L,0)=^LR(LRDFN,"CH",LRIDT,1,L,0)
I +LRIPG<0 S ^LAC(LRXLR,LRDFN,1,LRMH,1,LRSH,1,LRIIDT,"TX",.1,0)="ATTENTION: This data has been modified from previously reported results!!! "
Q
LRCALE ;from LRAC1, LRACM2, LRACM3
S A7=0 F S A7=$O(^LAB(64.5,1,1,A7)) Q:A7<1 S B3=0 F S B3=$O(^LAB(64.5,1,1,A7,1,B3)) Q:B3<1 S:$P(^LAB(64.5,1,1,A7,1,B3,0),U,4) LRCALE(A7,B3)=1
K A7,B3 Q