LACOLT2 ; IHS/DIR/FJE - COULTER S PLUS II DATA PROCESSING 7/20/90 07:53 ;
;;5.2;LA;;NOV 01, 1997
;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
;CROSS LINK ID = SEQ # ,TRAY=1, CUP = ID, IDE=0
LA1 S:$D(ZTQUEUED) ZTREQ="@" S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)),U="^" Q:TSK<1
Q:'$D(^LA(TSK,"I",0))
S TOUT=0,TP="",LRTOP=$P(^LAB(69.9,1,1),U,1) D ^LASET Q:'TSK S X="TRAP^"_LANM,@^%ZOSF("TRAP")
S SS="CH"
F I=1:1:15 S ZZ(I)=$P("DATE^TEST^WBC^RBC^HGB^HCT^MCV^MCH^MCHC^RDW^PLT^MPV^LY%^LY#",U,I)
LA2 K Y S A=0,TOUT=0 D IN G QUIT:TOUT,C3:IN["DATE",LA2:IN'["-------"
;
C2 S TOUT=0 D IN G QUIT:TOUT,SAVE:IN["-------",C2:IN'[","
C3 ;S A=A+1,Y(A)=""
S X="" F I=1:1:$L(IN) S:$A(IN,I)-32 X=X_$E(IN,I)
S NM=$P(X,",",1),NM=$S(NM?1P.A:$E(NM,2,9),1:NM) F A=1:1:15 Q:ZZ(A)=NM
G C2:A>14 S Y(A)=$P(X,",",2),F(A)=$E(IN,1)
;IF NM'[$P(ZZ,U,A) G LOST:$P(ZZ,U,A)'="DATE" G C2
S X=Y(A),Y(A)=$S(X=".....":"",1:+X)_$S(A>2&(F(A)]" "):F(A),1:"") G C2
SAVE G LOST:'$D(Y(2)) F I=0:0 S I=$O(TC(I)) Q:I<1 X TC(I,2) S @TC(I,1)=V
S ID=+Y(2),TRAY=1,CUP=ID,IDE=0 G LA2:ID'>0 S SPEC=$P(^LAB(69.9,1,1),U,1)
LA3 X LAGEN G LA2:ISQN<1
F I=0:0 S I=$O(TV(I)) Q:I<1 D LA4
G LA2
LA4 I $D(TV(I,1)),TV(I,1)]"" S ^LAH(LWL,1,ISQN,I)=TV(I,1) Q
Q
LOST S:'$D(^LA("LOST",DT)) ^LA("LOST",DT)=1
S AA=^LA("LOST",DT),^LA("LOST",DT,AA)=IN,^LA("LOST",DT)=AA+1
G LA2
Q
IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 9 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(TQ,"O")+1,^("O")=CNT,^("O",CNT)=OUT
LOCK ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=TQ 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
TEST S ^LA(5,"I",0)=0 G LACOLT2
LACOLT2 ; IHS/DIR/FJE - COULTER S PLUS II DATA PROCESSING 7/20/90 07:53 ;
+1 ;;5.2;LA;;NOV 01, 1997
+2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
+3 ;CROSS LINK ID = SEQ # ,TRAY=1, CUP = ID, IDE=0
LA1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
SET LANM=$TEXT(+0)
SET TSK=$ORDER(^LAB(62.4,"C",LANM,0))
SET U="^"
IF TSK<1
QUIT
+1 IF '$DATA(^LA(TSK,"I",0))
QUIT
+2 SET TOUT=0
SET TP=""
SET LRTOP=$PIECE(^LAB(69.9,1,1),U,1)
DO ^LASET
IF 'TSK
QUIT
SET X="TRAP^"_LANM
SET @^%ZOSF("TRAP")
+3 SET SS="CH"
+4 FOR I=1:1:15
SET ZZ(I)=$PIECE("DATE^TEST^WBC^RBC^HGB^HCT^MCV^MCH^MCHC^RDW^PLT^MPV^LY%^LY#",U,I)
LA2 KILL Y
SET A=0
SET TOUT=0
DO IN
IF TOUT
GOTO QUIT
IF IN["DATE"
GOTO C3
IF IN'["-------"
GOTO LA2
+1 ;
C2 SET TOUT=0
DO IN
IF TOUT
GOTO QUIT
IF IN["-------"
GOTO SAVE
IF IN'[","
GOTO C2
C3 ;S A=A+1,Y(A)=""
+1 SET X=""
FOR I=1:1:$LENGTH(IN)
IF $ASCII(IN,I)-32
SET X=X_$EXTRACT(IN,I)
+2 SET NM=$PIECE(X,",",1)
SET NM=$SELECT(NM?1P.A:$EXTRACT(NM,2,9),1:NM)
FOR A=1:1:15
IF ZZ(A)=NM
QUIT
+3 IF A>14
GOTO C2
SET Y(A)=$PIECE(X,",",2)
SET F(A)=$EXTRACT(IN,1)
+4 ;IF NM'[$P(ZZ,U,A) G LOST:$P(ZZ,U,A)'="DATE" G C2
+5 SET X=Y(A)
SET Y(A)=$SELECT(X=".....":"",1:+X)_$SELECT(A>2&(F(A)]" "):F(A),1:"")
GOTO C2
SAVE IF '$DATA(Y(2))
GOTO LOST
FOR I=0:0
SET I=$ORDER(TC(I))
IF I<1
QUIT
XECUTE TC(I,2)
SET @TC(I,1)=V
+1 SET ID=+Y(2)
SET TRAY=1
SET CUP=ID
SET IDE=0
IF ID'>0
GOTO LA2
SET SPEC=$PIECE(^LAB(69.9,1,1),U,1)
LA3 XECUTE LAGEN
IF ISQN<1
GOTO LA2
+1 FOR I=0:0
SET I=$ORDER(TV(I))
IF I<1
QUIT
DO LA4
+2 GOTO LA2
LA4 IF $DATA(TV(I,1))
IF TV(I,1)]""
SET ^LAH(LWL,1,ISQN,I)=TV(I,1)
QUIT
+1 QUIT
LOST IF '$DATA(^LA("LOST",DT))
SET ^LA("LOST",DT)=1
+1 SET AA=^LA("LOST",DT)
SET ^LA("LOST",DT,AA)=IN
SET ^LA("LOST",DT)=AA+1
+2 GOTO LA2
+3 QUIT
IN SET CNT=^LA(TSK,"I",0)+1
IF '$DATA(^(CNT))
SET TOUT=TOUT+1
IF TOUT>9
QUIT
HANG 9
GOTO IN
+1 SET ^LA(TSK,"I",0)=CNT
SET IN=^(CNT)
SET TOUT=0
+2 IF IN["~"
SET CTRL=$PIECE(IN,"~",2)
SET IN=$PIECE(IN,"~",1)
+3 QUIT
OUT SET CNT=^LA(TQ,"O")+1
SET ^("O")=CNT
SET ^("O",CNT)=OUT
+1 LOCK ^LA("Q")
SET Q=^LA("Q")+1
SET ^("Q")=Q
SET ^("Q",Q)=TQ
LOCK
+2 QUIT
QUIT LOCK ^LA(TSK)
HANG 1
KILL ^LA(TSK),^LA("LOCK",TSK),^TMP($JOB),^TMP("LA",$JOB)
+1 QUIT
TRAP ;ERROR TRAP
DO ^LABERR
SET T=TSK
DO SET^LAB
GOTO @("LA2^"_LANM)
TEST SET ^LA(5,"I",0)=0
GOTO LACOLT2