source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LAPERD.m@ 1683

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

initial load of FOIAVistA 6/30/08 version

File size: 1.6 KB
Line 
1LAPERD ;SLC/DLG - AMERICAN MONITOR PERSPECTIVE BUILD DOWNLOAD FILE. ;7/20/90 09:58 ;
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;;Sep 27, 1994
3 ;Call with LRLL = load list to build
4 ;Call with LRTRAY = 'A'll or a tray number
5 ;Call with LRINST = Auto Instrument pointer
6 ;Call with LRFORCE=1 if send tray and cup.
7 I '$D(^LA(LRINST,"I")) S T=LRINST D SET^LASET
8A S:$D(ZTQUEUED) ZTREQ="@" I LRTRAY D TRAY G Q
9 F LRTRAY=0:0 S LRTRAY=$O(^LRO(68.2,LRLL,1,LRTRAY)) Q:LRTRAY'>0 D TRAY
10Q S LREND=0 L ^LA("Q") S Q=^LA("Q")+1,^("Q")=Q,^("Q",Q)=LRINST L
11 Q
12TRAY S LRECORD="+" F LRCUP=0:0 S LRCUP=$O(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP)) Q:LRCUP'>0 D SAMPLE S LRECORD="+"
13 Q
14SAMPLE S LRL=^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP,0),LRAA=+LRL,LRAD=$P(LRL,"^",2),LRAN=$P(LRL,"^",3) D PNM S LRECORD=LRECORD_PNM_" 10 9 11 12" D SEN
15 S LRECORD=$E(10000+LRAN,2,5) D SEN
16 D TEST S LRECORD=X D SEN S LRECORD=LRTRAY D SEN S LRECORD=LRCUP D SEN
17 Q
18TEST S X="" F LRTEST=0:0 S LRTEST=$O(^LRO(68.2,LRLL,1,LRTRAY,1,LRCUP,1,LRTEST)) Q:LRTEST'>0 D T2
19 S:$E(X,$L(X))=" " X=$E(X,1,($L(X)-1)) Q
20T2 Q:'$D(^TMP($J,LRTEST)) F I=0:0 S I=$O(^TMP($J,LRTEST,I)) Q:I'>0 S X=X_^(I)_" "
21 Q
22PNM ;Get patient ssn for sample id.
23 S X=^LRO(68,LRAA,1,LRAD,1,LRAN,0),X=^LR(+X,0),PNM="" S:$P(X,"^",2)=2 DFN=$P(X,"^",3) D:DFN]"" PT^LRX S:PNM="" PNM=$S(LRCUP=1:"0302",LRCUP=2:"0303",1:"111111111")
24 Q
25SEN S CNT=^LA(LRINST,"O")+1,^("O")=CNT,^("O",CNT)=LRECORD Q
26ACK I $D(NCNT),NCNT>3 K NCNT Q ;TO MANY ERRORS JUST QUIT
27 I IN[$C(6)!IN["~F" S O=^LA(LRINST,"O",0)+1,^(0)=O,OUT=^(O),T=T-BASE K NCNT
28 E S O=^LA(T,"O",0),OUT=^(O),T=T-BASE S:'$D(NCNT) NCNT=0 S NCNT=NCNT+1
29 I $D(^LA("TP")) L ^LA("TP") S O=^LA("TP",0)+1,^(0)=O,^(O)="SENT: "_LRINST_"^"_OUT L
30 Q
Note: See TracBrowser for help on using the repository browser.