VistA-FOIAVistA/r/AUTOMATED_LAB_INSTRUMENTS-LA/LADMND.m

35 lines
1.6 KiB
Mathematica

LADMND ;SLC/RWF - DEMAND ANALYZER IN MODE 3 ;7/20/90 08:06 ;
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK BY ID OR IDE
;Internal entry # for CHEM TESTS field in auto instrument file must match the identifying # for each test.
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 LRTOP=$P(^LAB(69.9,1,1),"^",3) D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP"),PSEQ=0,ID=0
LA2 S TOUT=0,BAD=0 D IN G QUIT:TOUT,LA2:IN="",LA2:$E(IN,1)'="D" S SEQ=$E(IN,2,5) ;D SEND:SEQ'=PSEQ
F IX=17:13 S V=$E(IN,IX+2,IX+10),I=+$E(IN,IX,IX+1) Q:I<1 I $D(TC(I)) X TC(I,2) S @TC(I,1)=V ;V COULD BE MODIFIED ON THIS LINE
I PSEQ'=SEQ S ID=+$E(IN,2,5),TRAY=1,CUP=+ID,V=$E(IN,6,16),IDE=+V
D SAVE:ID S PSEQ=SEQ K TV G LA2
SAVE I PSEQ'=SEQ X LAGEN
F I=0:0 S I=$O(TV(I)) Q:I<1 I TV(I,1)]"" S X=TV(I,1) D PACK S ^LAH(LWL,1,ISQN,I)=+X
Q
QC ;QC TESTING HERE; S BAD=1 IF DONT STORE
F I=6:13 Q:I>$L(IN) S T=+$E(IN,I,I+1),X=$E(IN,I+2,I+10),F=$E(IN,I+11,I+12) D QC3:T=66,QC2
Q
QC2 Q:'$D(TC(T)) S X="" F J=1:1:$L(V) S:$A(V,J)>32 X=X_$E(V,J)
S @TC(T,1)=V Q
QC3 F K="L","I","H" F L=0:0 S L=$O(TC(L)) Q:L<1 I TC(L,2)="66"_K S T=L D QC2
S T=0 Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 5 G IN
S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
S:IN["~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
Q
OUT S CNT=^LA(TSK,"O")+1,^("O")=CNT,^("O",CNT)=TSK_OUT
LOCK ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=TSK LOCK
Q
QUIT LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK),^TMP($J),^TMP("LA",$J)
Q
TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
Q
PACK S Y=X,X="" F J=1:1:$L(Y) S:$A(Y,J)-32 X=X_$E(Y,J)
Q:X="" W:X'?.P1N.NP X="*" Q