VistA-WorldVistAEHR/r/AUTOMATED_LAB_INSTRUMENTS-LA/LARAPMT.m

42 lines
2.3 KiB
Mathematica

LARAPMT ;SLC/DLG - RAPIMAT URINE PAD ROUTINE ;7/20/90 10:04 ;
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
LA1 S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)) Q:TSK<1
Q:'$D(^LA(TSK,"I",0))
S MISCREEN="MICROSCOPIC EXAMINATION NOT INDICATED"
K LATOP D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP") S:'$D(LALCT) LALCT="" Q:LALCT="N"
LA2 K TV,TY,Y,MICFLAG S TOUT=0,A=1,RMK="" D IN G QUIT:TOUT D QC
S (TOUT,BAD)=0
S V=+$E(IN,2,11) D NUM S (ID,IDE,CUP)=V,TRAY=1
F A=2:1 D IN Q:+$E(IN,2,11)'=CUP D QC
X S ^LA(TSK,"I",0)=CNT-1 F A=0:0 S A=$O(Y(A)) Q:A<1!(A>80) S X=Y(A) X TC(A,2) S:$D(V) @TC(A,1)=V
LA3 X LAGEN G LA2:'ISQN
F I=0:0 S I=$O(TV(I)) Q:I<1 S:TV(I,1)]"" ^LAH(LWL,1,ISQN,I)=TV(I,1)
I $D(MICFLAG)=0 S RMK=MISCREEN
I $D(RMK),$L(RMK) D RMK^LASET
G LA2
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
S V=$E(IN,33,34) D NUM S TN=V,V=$E(IN,41,55) D NUM,RNUM S Y(TN)=V Q
;S Y(A)=IN Q
NUM S X="" F JJ=1:1:$L(V) S:$A(V,JJ)>32 X=X_$E(V,JJ)
S V=X Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1,IN="" Q:TOUT>9 H 5 G IN
S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0 G IN:$E(IN,1)'="D" G IN:+$E(IN,2,11)<1
Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK),^TMP("LA",$J)
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
RNUM ;PUT TOGETHER EXPONENT AND VALUE OF TEST DCN/BUF 31 AUG 87
I $P(V,"E",2)=0 Q
S EXP=$P(V,"E",2),FACTOR=$S(EXP="01":10,EXP="02":100,EXP="03":1000,EXP="-01":.1,EXP="-02":.01,1:1)
S V=V*FACTOR Q
COLOR ;THIS AREA SETS THE VALUES FOR URINE COLOR
S V=$S(X=1:"COLORLESS",X=2:"STRAW",X=3:"YELLOW",X=4:"AMBER",X=5:"BROWN",X=6:"ORANGE",X=7:"RED",X=8:"BLUE",X=9:"BLACK",X=10:"OTHER",1:"") Q
APPEAR ;THIS AREA SETS THE VALUE FOR URINE APPEARANCE
S V=$S(X=1:"CLEAR",X=2:"HAZY",X=3:"SL. CLOUDY",X=4:"CLOUDY",X=5:"TURBID",X=6:"FLOCCULATED",X=7:"MILKY",X=8:"MUCOID",X=9:"OTHER",1:"") S:V'="CLEAR" MICFLAG=1 Q
MICRO ;THIS SECTION IS USED TO DETERMINE MICROSCOPIC VALUES
S V=$S(X=0:"",X=9:"NONE",X=10:"1+",X=11:"2+",X=12:"3+",X=13:"4+",X<9:"RANGE",1:"")
I A=17 S V=$S(X=1:"0-2",X=2:"3-10",X=3:"11-20",X=4:"21-50",X=5:">50",1:"")
I A=18 S V=$S(X=1:"0-5",X=2:"6-10",X=3:"11-20",X=4:"21-50",X=5:">50",1:"")
I A=19 S V=$S(X=10:"0-2",X=11:"3-10",X=12:"11-25",X=13:">26",1:"")
I (A>30)&(A<55) S V=$S(X=10:"0-2",X=11:"3-10",X=12:"11-25",X=13:">26",1:"")