source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LAXSYMBL.m@ 1742

Last change on this file since 1742 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.3 KB
Line 
1LAXSYMBL ;MLD/ABBOTT/SLC/RAF - ABBOTT AxSYM BUILD 'DWNLD' FILE ; 6/12/96 0900;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**11,19**;Sep 27, 1994
3 ;
4 Q ; call line tag
5 ;
6BLDLST ; Build the worklist in prep for dwnlding to AxSYM
7 ; Called from LADOWN with the following set:
8 ; LRLL = load list pointer
9 ; LRCUP1 = starting cup #
10 ; LRTRAY,LRTRAY1 = starting tray #
11 ; LRINST = Auto Instrument pointer
12 ; LRFORCE = 1 if send tray and cup
13 ;
14 N I,D,H,P,O,L,X,STX,ETX,CR,LF,CNT,LATEST,LRAN,LRACC,LRAD,LRFRM,SSN
15 N LRFRAME,LRDFN,LRNAME,INST,LANM,LRTEST
16 ;
17 L +^LA(LRINST,"O") ; get global 1st!
18 S D="|",STX=$C(2),ETX=$C(3),LF=$C(10),CR=$C(13),INST=LRINST
19 S X="ERR^LAXSYMBL",@^%ZOSF("TRAP"),(LRTEST,LRFRAME,I)=0
20 S LRCUP=LRCUP1-1 ; reset for $ORDER
21 ; LATEST array
22 F S I=$O(^LAB(62.4,INST,3,I)) Q:'I S X=$G(^(I,0)) S LATEST(+X)=$P(X,U,4)
23 ;
24 ; Main Loop thru Load/Work List file
25 F S LRCUP=$O(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP)) Q:'LRCUP D GETACCN
26 ;
27 K LRCUP1,LRCUP2,LRTRAY1 ; not killed in calling routine (LADOWN)
28 L -^LA(INST,"O") ; release lock
29 S LREND=1,^LA(INST,"Q")="" ; set dwnld-ready flag
30 ;
31 QUIT
32 ;
33GETACCN ; Get and save work/load list data to downlaod to AxSYM
34 N LRAA
35 S LRAA=$G(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP,0)) Q:LRAA=""
36 S LRAN=$P(LRAA,U,3) Q:LRAN="" ; no accn num
37 S LRAD=$P(LRAA,U,2) Q:LRAD="" ; no accn date
38 D PNM Q:LRACC="" ; no accn
39 S LRAN=$E("0000",$L(LRAN),4)_LRAN ; pad with zeros to 4 digits
40 D FRAME
41 Q
42 ;
43PNM ; Get patient name and last 4 from an accession.
44 N DFN,X,PT S (LRACC,DFN,LRNAME)=""
45 S X=$G(^LRO(68,+LRAA,1,LRAD,1,+LRAN,0)) Q:X="" ; no accn on file
46 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)
47 ; "patient" could be in one of several files: 2, 62.3, 67, 67.1 etc.
48 S DFN=$P(X,U,3),PT=$G(^DIC(+$P(X,U,2),0,"GL"))
49 Q:PT="" ; could not find global ref
50 S PT=PT_+DFN_",0)",PT=$G(@PT),LRNAME=$P(PT,U),SSN=$P(PT,U,9)
51 Q
52 ;
53FRAME ; Build frame to transmit to AxSYM (stored in ^LA(INST,"O",CNT) nodes)
54 N I,FRM
55 F I="H","P","O","L" D ; loop thru frame types
56 .S LRFRM=$G(LRFRM)+1 S:(LRFRM=8) LRFRM=0 ; increment frame cntr
57 .S FRM=LRFRM_$S(I="H":$$H,I="P":$$P,I="O":$$O,1:$$L)_CR_ETX
58 .S CKSM=$$CKSUM^LAXSYMU(FRM) ; CR_ETX is counted in chksum
59 .; * build msg frame: <STX>~|~msg text~|~<CR><ETX>~checksum~<CR><LF>
60 .S FRM=STX_FRM_CKSM_CR_LF
61 .; set frame to ^LA( "O"utput node
62 .S CNT=$G(^LA(INST,"O"))+1,^LA(INST,"O")=CNT,^LA(INST,"O",CNT)=FRM
63 ;
64 Q
65 ;
66H() ; Build hdr frame
67 N H S H="H|\^&",$P(H,D,12,13)="P|1"
68 Q H
69 ;
70P() ; Build Patient frame
71 N P S P="P|1"
72 ; 20 chars is size limit for rev 1.xx 15 will be limit for rev.2!
73 S $P(P,D,4)=$E(LRACC,1,15)_"^" ; see above re: size limits
74 S $P(P,D,5)=$G(SSN)
75 S $P(P,D,6)=$E($P(LRNAME,","),1,20)_U_$E($P($P(LRNAME,",",2)," "),1,20)_U_$E($P(LRNAME," ",2))
76 Q P
77 ;
78O() ; Build Order frame NOTE:
79 ; a. 10 chars is size limit for rev 1.xx 15 will be limit for rev 2
80 ; b. Potential for REPEAT (multiple) tests to cause the Order frame
81 ; to exceed 247 chars! However, if the AxSYM doesn't offer more
82 ; than about 25 tests, this should not be a problem.
83 ;
84 B N O,CNT,DLM,PRI,LRPRI,LRTEST,LRTST
85 S (CNT,PRI,LRTEST)=0,LRPRI=9,$P(O,D,5)=""
86 F S LRTEST=$O(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP,1,LRTEST)) Q:'LRTEST D
87 .S CNT=CNT+1 S DLM=$S(CNT>1:"\",1:"")
88 .S LRTST=$$PNL ; get AxSYM's internal tst #
89 .S:LRTST="" CNT=CNT-1
90 .Q:LRTST="" ; test not in Auto Inst file
91 .S $P(O,D,5)=$P(O,D,5)_DLM_"^^^"_LRTST ; 'repeat' tests use '\'
92 .S PRI=+$P($G(^LRO(68.2,LRLL,1,LRTRAY1,1,LRCUP,1,LRTEST,0)),U,2)
93 .I PRI,(PRI<LRPRI) S LRPRI=PRI ; take 'highest' prio
94 ;
95 S LRPRI=$E($P($G(^LAB(62.05,LRPRI,0)),U)) S:LRPRI="" LRPRI="R"
96 ; 2nd pc is (hardcoded) # of 'O' frames. Change if loop is needed
97 S $P(O,D,1,3)="O|1|"_LRAN
98 S $P(O,D,6)=LRPRI,$P(O,D,12)="A",$P(O,D,26)="O"
99 Q O
100 ;
101L() ; Build Last (termination) frame
102 Q "L|1"
103 ;
104PNL() ; Expand panel from load/work list
105 N CT,I,T,TST,DLM S (CT,I,T)=0,TST=""
106 Q:$D(LATEST(LRTEST)) LATEST(LRTEST) ; return single test
107 ; expand panel
108 F S I=$O(^LAB(60,LRTEST,2,I)) Q:'I S T=+$G(^(I,0)) D:T
109 .S CT=CT+1 S DLM=$S(CT>1:"\^^^",1:"")
110 .I $D(LATEST(T)) S TST=TST_DLM_LATEST(T)
111 .I '$D(LATEST(T)) S CT=CT-1
112 .Q
113 ; Return panel tests that should look like: 321\^^^678\^^^452
114 Q TST
115 ;
116ERR ; Error Trap
117 D ^LABERR H 1
118 K ^LA(INST,"O") ; remove incomplete list
119 L -^LA(INST,"O")
120 Q
Note: See TracBrowser for help on using the repository browser.