source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LAMIVT6.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.2 KB
RevLine 
[613]1LAMIVT6 ;SLC/DLG/DAL/FHS - VITEK MICRO DATA ENCODED NEW FORMAT UNI AMS 06.1;8/16/90 13:37 ;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**42**;Sep 27, 1994
3 ;THIS WAS PREVIOUS TO V 5.2 LAMIVTK ****
4 ;THIS ROUTINE CAN ONLY BE USED FOR UNIDIRECTIONAL OPERATIONAL UPLOADING
5 ;CROSS LINK BY ID OR IDE
6LA1 S LANM=$T(+0),TSK=$O(^LAB(62.4,"C",LANM,0)) Q:TSK<1
7 Q:'$D(^LA(TSK,"I",0))
8 K LATOP D ^LASET Q:'TSK S LROVER=1,X="TRAP^"_LANM,@^%ZOSF("TRAP")
9LA2 K Y,ORG,MIC S TOUT=0,A=1 D IN G QUIT:TOUT,LA2:$E(IN,1,3)'="SSS" S Y(1)=IN
10 ;F I=1:1:2 D IN S Y(1)=Y(1)_IN
11 ;S IN=Y(1)
12 S V=$E(IN,4,9) D NUM S (IDE,ID)=+$E(V,2,6),ISOL=+$E(IN,10)+1,TRAY=$F("ABCD",$E(IN,12))-1,CUP=+$E(IN,13,14),READER=+$E(IN,11) S:READER>1 TRAY=TRAY+4 S:ISOL=0 ISOL=1
13 S CARD=+$O(^LAB(62.4,TSK,7,"B",$E(IN,15,16),0)),X=$E(IN,19,20) G:CARD'>0 LA2 D HEX S TIME=X/4
14 S BAD=0 I $D(^LAB(62.4,TSK,7,CARD,"OK")) X ^("OK") G LA2:BAD ;Return BAD=1 if card not OK
15 S IN=$E(IN,21,255) I $D(^LAB(62.4,TSK,7,CARD,3)) X ^(3) G LA2:BAD G LA2:'$D(ORG)
16LA3 X LAGEN G LA2:'ISQN ;Can be changed by the cross-link code
17 S LRA=$P(^LAH(LWL,1,ISQN,0),U,3,5),LRAA=+LRA,LRAD=+$P(LRA,U,2)
18 I 'LRAD S LRAD=$$CADT^LA7UTIL(LRAA) ; Calculate default date based on accession transform.
19 G:'$D(^LRO(68,LRAA,1,LRAD,1,ID,0))#2 LA2
20 I +$G(^LRO(68,LRAA,1,LRAD,1,ID,5,1,0)) S LRSP=+^(0)
21 E S LRSP=+$O(^LAB(61,"B","UNKNOWN",0))
22 S ^LAH(LWL,1,ISQN,3,ISOL,0)=$S($D(^LAH(LWL,1,ISQN,3,ISOL,0))#2:^(0)_"^"_CARD,1:ORG(ISOL)_"^^"_CARD) D LA4
23 S ^LAH(LWL,1,ISQN,2,1)=Y(1)
24 S ^LAH(LWL,1,ISQN,2,2)=$S($D(^(2)):^(2)_"^"_CARD,1:"CARD^"_CARD)
25 I $L($G(RMK)) S JJ="" F II=1:0 S JJ=$O(^LAH(LWL,1,ISQN,3,ISOL,1,JJ)) S:JJ]"" II=JJ I JJ="" S ^LAH(LWL,1,ISQN,3,ISOL,1,II,0)=RMK Q
26 G LA2
27 Q
28LA4 F J=0:0 S J=$O(MIC(ISOL,J)) Q:J<1 S K=MIC(ISOL,J)_"^" D INTRP S ^LAH(LWL,1,ISQN,3,ISOL,J)=K_S
29 Q
30INTRP S S="" S:LRSP="" LRSP="UNKNOWN" S:LRSP="UNKNOWN" LRSP="ANY" S K1=$P(K,"^",1)
31 S S2=$P(^LAB(61.2,ORG(ISOL),0),U,3) G:S2="" A1 S S2=$S(S2="N":"GRAM NEG",S2="P":"GRAM POS",1:"")
32A1 I $D(^LAB(62.06,"AI",J,K1,ORG(ISOL),LRSP))#2 S S=^(LRSP) G AS
33 I $D(^LAB(62.06,"AI",J,K1,ORG(ISOL),"ANY"))#2 S S=^("ANY") G AS
34 G:S2="" A2
35 I $D(^LAB(62.06,"AI",J,K1,S2,LRSP))#2 S S=^(LRSP) G AS
36 I $D(^LAB(62.06,"AI",J,K1,S2,"ANY"))#2 S S=^("ANY") G AS
37A2 I $D(^LAB(62.06,"AI",J,K1))#2 S S=^(K1)
38AS I $D(^LAB(62.06,"AS",J,ORG(ISOL),LRSP))#2 S S=S_"^"_^(LRSP) G AS1
39 I $D(^LAB(62.06,"AS",J,ORG(ISOL),"ANY"))#2 S S=S_"^"_^("ANY") G AS1
40 G:S2="" AS2
41 I $D(^LAB(62.06,"AS",J,S2,LRSP))#2 S S=S_"^"_^(LRSP) G AS1
42 I $D(^LAB(62.06,"AS",J,S2,"ANY"))#2 S S=S_"^"_^("ANY") G AS1
43AS2 I $D(^LAB(62.06,"AS",J))#2 S S=S_"^"_^(J)
44AS1 K S2,K1 Q
45NUM S X="" F JJ=1:1:$L(V) S:$A(V,JJ)>32 X=X_$E(V,JJ)
46 S V=X Q
47IN S CNT=^LA(TSK,"I",0)+1 IF '$D(^(CNT)) S TOUT=TOUT+1 Q:TOUT>9 H 5 G IN
48 S ^LA(TSK,"I",0)=CNT,IN=^(CNT),TOUT=0
49 S:IN["~" CTRL=$P(IN,"~",2),IN=$P(IN,"~",1)
50 Q
51HEX S XX=X,X="" F II=1:1:$L(XX) S X=X*16+($F("0123456789ABCDEF",$E(XX,II))-2)
52 Q
53OUT S CNT=^LA(TSK,"O")+1,^("O")=CNT,^("O",CNT)=TSK_OUT
54 LOCK ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=TSK LOCK
55 Q
56QUIT I (^LA(TSK,"I")'=^LA(TSK,"I",0)) G LA2
57 I $D(^LA(TSK,"O",0)),^LA(TSK,"O")'=^LA(TSK,"O",0) G LA2
58 LOCK ^LA(TSK) H 1 K ^LA(TSK),^LA("LOCK",TSK),^TMP($J),TMP("LA",$J)
59 Q
60TRAP D ^LABERR S T=TSK D SET^LAB G @("LA2^"_LANM) ;ERROR TRAP
Note: See TracBrowser for help on using the repository browser.