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

LAXSYMBL.m

Go to the documentation of this file.
  1. LAXSYMBL ;MLD/ABBOTT/SLC/RAF - ABBOTT AxSYM BUILD 'DWNLD' FILE ; 6/12/96 0900;
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**11,19**;Sep 27, 1994
  1. ;
  1. Q ; call line tag
  1. ;
  1. BLDLST ; Build the worklist in prep for dwnlding to AxSYM
  1. ; Called from LADOWN with the following set:
  1. ; LRLL = load list pointer
  1. ; LRCUP1 = starting cup #
  1. ; LRTRAY,LRTRAY1 = starting tray #
  1. ; LRINST = Auto Instrument pointer
  1. ; LRFORCE = 1 if send tray and cup
  1. ;
  1. N I,D,H,P,O,L,X,STX,ETX,CR,LF,CNT,LATEST,LRAN,LRACC,LRAD,LRFRM,SSN
  1. N LRFRAME,LRDFN,LRNAME,INST,LANM,LRTEST
  1. ;
  1. L +^LA(LRINST,"O") ; get global 1st!
  1. S D="|",STX=$C(2),ETX=$C(3),LF=$C(10),CR=$C(13),INST=LRINST
  1. S X="ERR^LAXSYMBL",@^%ZOSF("TRAP"),(LRTEST,LRFRAME,I)=0
  1. S LRCUP=LRCUP1-1 ; reset for $ORDER
  1. ; LATEST array
  1. F S I=$O(^LAB(62.4,INST,3,I)) Q:'I S X=$G(^(I,0)) S LATEST(+X)=$P(X,U,4)
  1. ;
  1. ; Main Loop thru Load/Work List file
  1. F S LRCUP=$O(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP)) Q:'LRCUP D GETACCN
  1. ;
  1. K LRCUP1,LRCUP2,LRTRAY1 ; not killed in calling routine (LADOWN)
  1. L -^LA(INST,"O") ; release lock
  1. S LREND=1,^LA(INST,"Q")="" ; set dwnld-ready flag
  1. ;
  1. QUIT
  1. ;
  1. GETACCN ; Get and save work/load list data to downlaod to AxSYM
  1. N LRAA
  1. S LRAA=$G(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP,0)) Q:LRAA=""
  1. S LRAN=$P(LRAA,U,3) Q:LRAN="" ; no accn num
  1. S LRAD=$P(LRAA,U,2) Q:LRAD="" ; no accn date
  1. D PNM Q:LRACC="" ; no accn
  1. S LRAN=$E("0000",$L(LRAN),4)_LRAN ; pad with zeros to 4 digits
  1. D FRAME
  1. Q
  1. ;
  1. PNM ; Get patient name and last 4 from an accession.
  1. N DFN,X,PT S (LRACC,DFN,LRNAME)=""
  1. S X=$G(^LRO(68,+LRAA,1,LRAD,1,+LRAN,0)) Q:X="" ; no accn on file
  1. S LRACC=$G(^(.2)),X=^LR(+X,0) ;Q:$P(X,U,2)'=2 ; Naked Ref=^LRO(68,LRAA,1,LRAD,1,+LRAN,.2) & ^LRO(68,LRAA,1,LRAD,1,+LRAN,X,0)
  1. ; "patient" could be in one of several files: 2, 62.3, 67, 67.1 etc.
  1. S DFN=$P(X,U,3),PT=$G(^DIC(+$P(X,U,2),0,"GL"))
  1. Q:PT="" ; could not find global ref
  1. S PT=PT_+DFN_",0)",PT=$G(@PT),LRNAME=$P(PT,U),SSN=$P(PT,U,9)
  1. Q
  1. ;
  1. FRAME ; Build frame to transmit to AxSYM (stored in ^LA(INST,"O",CNT) nodes)
  1. N I,FRM
  1. F I="H","P","O","L" D ; loop thru frame types
  1. .S LRFRM=$G(LRFRM)+1 S:(LRFRM=8) LRFRM=0 ; increment frame cntr
  1. .S FRM=LRFRM_$S(I="H":$$H,I="P":$$P,I="O":$$O,1:$$L)_CR_ETX
  1. .S CKSM=$$CKSUM^LAXSYMU(FRM) ; CR_ETX is counted in chksum
  1. .; * build msg frame: <STX>~|~msg text~|~<CR><ETX>~checksum~<CR><LF>
  1. .S FRM=STX_FRM_CKSM_CR_LF
  1. .; set frame to ^LA( "O"utput node
  1. .S CNT=$G(^LA(INST,"O"))+1,^LA(INST,"O")=CNT,^LA(INST,"O",CNT)=FRM
  1. ;
  1. Q
  1. ;
  1. H() ; Build hdr frame
  1. N H S H="H|\^&",$P(H,D,12,13)="P|1"
  1. Q H
  1. ;
  1. P() ; Build Patient frame
  1. N P S P="P|1"
  1. ; 20 chars is size limit for rev 1.xx 15 will be limit for rev.2!
  1. S $P(P,D,4)=$E(LRACC,1,15)_"^" ; see above re: size limits
  1. S $P(P,D,5)=$G(SSN)
  1. S $P(P,D,6)=$E($P(LRNAME,","),1,20)_U_$E($P($P(LRNAME,",",2)," "),1,20)_U_$E($P(LRNAME," ",2))
  1. Q P
  1. ;
  1. O() ; Build Order frame NOTE:
  1. ; a. 10 chars is size limit for rev 1.xx 15 will be limit for rev 2
  1. ; b. Potential for REPEAT (multiple) tests to cause the Order frame
  1. ; to exceed 247 chars! However, if the AxSYM doesn't offer more
  1. ; than about 25 tests, this should not be a problem.
  1. ;
  1. B N O,CNT,DLM,PRI,LRPRI,LRTEST,LRTST
  1. S (CNT,PRI,LRTEST)=0,LRPRI=9,$P(O,D,5)=""
  1. F S LRTEST=$O(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP,1,LRTEST)) Q:'LRTEST D
  1. .S CNT=CNT+1 S DLM=$S(CNT>1:"\",1:"")
  1. .S LRTST=$$PNL ; get AxSYM's internal tst #
  1. .S:LRTST="" CNT=CNT-1
  1. .Q:LRTST="" ; test not in Auto Inst file
  1. .S $P(O,D,5)=$P(O,D,5)_DLM_"^^^"_LRTST ; 'repeat' tests use '\'
  1. .S PRI=+$P($G(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP,1,LRTEST,0)),U,2)
  1. .I PRI,(PRI<LRPRI) S LRPRI=PRI ; take 'highest' prio
  1. ;
  1. S LRPRI=$E($P($G(^LAB(62.05,LRPRI,0)),U)) S:LRPRI="" LRPRI="R"
  1. ; 2nd pc is (hardcoded) # of 'O' frames. Change if loop is needed
  1. S $P(O,D,1,3)="O|1|"_LRAN
  1. S $P(O,D,6)=LRPRI,$P(O,D,12)="A",$P(O,D,26)="O"
  1. Q O
  1. ;
  1. L() ; Build Last (termination) frame
  1. Q "L|1"
  1. ;
  1. PNL() ; Expand panel from load/work list
  1. N CT,I,T,TST,DLM S (CT,I,T)=0,TST=""
  1. Q:$D(LATEST(LRTEST)) LATEST(LRTEST) ; return single test
  1. ; expand panel
  1. F S I=$O(^LAB(60,LRTEST,2,I)) Q:'I S T=+$G(^(I,0)) D:T
  1. .S CT=CT+1 S DLM=$S(CT>1:"\^^^",1:"")
  1. .I $D(LATEST(T)) S TST=TST_DLM_LATEST(T)
  1. .I '$D(LATEST(T)) S CT=CT-1
  1. .Q
  1. ; Return panel tests that should look like: 321\^^^678\^^^452
  1. Q TST
  1. ;
  1. ERR ; Error Trap
  1. D ^LABERR H 1
  1. K ^LA(INST,"O") ; remove incomplete list
  1. L -^LA(INST,"O")
  1. Q