Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: LAEPXD

LAEPXD.m

Go to the documentation of this file.
LAEPXD ;SLC/DLG - ABBOTT EPX BUILD DOWNLOAD FILE. ;7/20/90  08:20 ;
 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
 ;Call with LRLL = load list to build
 ;Call with LRTRAY1 = Starting tray number
 ;Call with LRLL = Auto Instrument pointer
 ;Call with LRFORCE=1 if send tray and cup.
A S:$D(ZTQUEUED) ZTREQ="@" S T=LRINST D SET S LRECORD="100010#",F=1 D SEN S LRECORD="140011A#",F=1 D SEN ;TEST LIST BY NAME AND AUTO SEND
 F LRTRAY=LRTRAY1:0 D:$D(^LRO(68.2,LRLL,1,LRTRAY)) TRAY S LRTRAY=$O(^LRO(68.2,LRLL,1,LRTRAY)) Q:LRTRAY'>0  S LRCUP1=1
 S LREND=1 Q
TRAY I LRCUP1=1 S LRECORD="120013C"_$E(100+LRTRAY,2,3)_"#",F=1 D SEN ;CLEAR TRAY INFORMATION
 F LRCUP=LRCUP1-1:0 S LRCUP=$O(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP)) Q:LRCUP'>0  D SAMPLE S LRECORD=""
 Q
SAMPLE S STAT="N",LRL=^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP,0),LRAA=+LRL,LRAD=$P(LRL,"^",2),LRAN=$P(LRL,"^",3) D PNM,TEST S L=NT*8+97
 S LRECORD="11"_$E(10000+L,2,5)_$E(LRAN_"                    ",1,20)_STAT_"N"
 S LRECORD=LRECORD_$E(SSN_"                    ",1,20)_"          "_$E(100+LRTRAY,2,3)_$E(100+LRCUP,2,3)_"                            "_$E(1000+NT,2,4)
 I X]"" S F=1 F I=1:1:NT S L=$L(LRECORD)+8 S:L<255 LRECORD=LRECORD_$E($P(X,"^",I)_"        ",1,8) I L>252 D SEN S LRECORD="",F=0
 S LRECORD=LRECORD_"#" D SEN ;SEND DATA
 Q
TEST S NT=0,X="" F LRTEST=0:0 S LRTEST=$O(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP,1,LRTEST)) Q:LRTEST'>0  S STAT=$S($P(^(LRTEST,0),U,2)=1:"Y",1:"N") D T2
 Q
T2 Q:'$D(^TMP($J,LRTEST))  F I=0:0 S I=$O(^TMP($J,LRTEST,I)) Q:I'>0  S Y=^(I) S:X'[Y NT=NT+1,$P(X,"^",NT)=Y ;Don't repete a test
 Q
PNM ;Get patient name and last 4 from an accession.
 S PNM="" Q:'$D(^LRO(68,LRAA,1,LRAD,1,LRAN,0))  S X=^(0),X=^LR(+X,0) I $P(X,"^",2)=2 S DFN=$P(X,"^",3) D PT^LRX S SSN=$E(SSN,1,3)_$E(SSN,5,6)_$E(SSN,8,11)
 Q
SEN S:F=1 SUM=$A(LRECORD,1) F II=$S(F:2,1:1):1:$L(LRECORD) S M=SUM,N=$A(LRECORD,II),B=64,SUM=0 X "F JJ=1:1:7 S K=M\B,L=N\B,O=$S(K=L:0,1:1),SUM=SUM*2+O,M=M#B,N=N#B,B=B\2"
 Q:$E(LRECORD,$L(LRECORD))'="#"
 S SUM=SUM#128,X=SUM\16 D HEX S LRECORD=LRECORD_X,X=SUM#16 D HEX S LRECORD=LRECORD_X
 L ^LA(LRINST,"O") S (Q,^LA(LRINST,"O"))=^LA(LRINST,"O")+1,^("O",Q)=LRECORD L
 Q
HEX S X=$E("0123456789ABCDEF",(X+1)) Q
SET S:'$D(^LA(T,"O"))#2 ^LA(T,"O")=0,^("O",0)=0 Q