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

LAMIAUT3.m

Go to the documentation of this file.
LAMIAUT3 ;DALOI/JMC -  MICRO DISPLAY ANTIBIOTICS FOR VERIFY ;06/04/12  16:23
 ;;5.2;AUTOMATED LAB INSTRUMENTS;**74**;Sep 27, 1994;Build 229
 ;
 ;
BACT ; From LAMIAUT1, LAMIAUT4, LAMIAUT6, LAMIVTL4
 ;
 N A,B,LR1PASS,LR2ORMOR,LRAO,LRABCNT,LRACNT,LRBN,LRBUG,LRCOMTAB,LRINT,LRRES
 S LR2ORMOR=1,LREND=0 Q:+$O(^LR(LRDFN,"MI",LRIDT,3,0))<1
 D BUGHDR
 ;
 S LRBUG=0
 F A=1:1 S LRBUG=+$O(^LR(LRDFN,"MI",LRIDT,3,LRBUG)) Q:LRBUG<1  D
 . I +$O(^LR(LRDFN,"MI",LRIDT,3,LRBUG,2))'["2." S A=A-1 Q
 . D CHECK
 ;
 S (LRABCNT,LRBN)=0
 F  S LRBN=+$O(LRRES(LRBN)) Q:LRBN<1  S LRABCNT=LRABCNT+1
 I 'LRABCNT W !!?10,"There are NO antibiotics in the patient's file",!! Q
 Q:LREND
 ;
 S LRCOMTAB=$S(LRFMT="B":A*13+17,1:A*5+17)
 S (LRAO,LREND,LRACNT)=0
 F  S LRAO=$O(^LAB(62.06,"AO",LRAO)) Q:LRAO<.001  D  Q:LREND
 . S B=$O(^LAB(62.06,"AO",LRAO,0))
 . I B>0,$D(^LAB(62.06,B,0)) D  Q:LREND
 . . D AB
 . . I $Y>(IOSL-3) D WAIT
 ;
 W !
 ;
 Q
 ;
 ;
CHECK ;
 ;
 N LRBN,LR1PASS,LRFLAG,B,B1,B2,B3
 ;
 S LRFLAG=0
 F LRBN=2:0 S LRBN=+$O(^LR(LRDFN,"MI",LRIDT,3,LRBUG,LRBN)) Q:$E(LRBN,1,2)'="2."  D
 . S B=^LR(LRDFN,"MI",LRIDT,3,LRBUG,LRBN),B1=$P(B,U),B2=$P(B,U,2),B3=$P(B,U,3)
 . I B1'="",$D(^LAB(62.06,"AI",LRBN,B1)) D FIRST
 ;
 S LRBN=2
 F  S LRBN=+$O(LR1PASS(LRBN)) Q:LRBN<1  S B=LR1PASS(LRBN),B1=$P(B,U),B2=$P(B,U,2),B3=$P(B,U,3) D LAB
 ;
 Q
 ;
 ;
FIRST ;
 S B2=$S(B2]"":B2,1:^LAB(62.06,"AI",LRBN,B1))
 S:$E(B2)'="R"&("A"[B3) LRFLAG=1
 S LR1PASS(LRBN)=B1_U_B2_U_B3,^LR(LRDFN,"MI",LRIDT,3,LRBUG,LRBN)=LR1PASS(LRBN)
 Q
 ;
 ;
LAB ;
 I $D(LRLABKY),'$D(LRWRDVEW) D  Q
 . N X
 . S X=$S(B3="N"!(B3="R"&LRFLAG):B1_"*",1:B1)
 . S $P(LRRES(LRBN),U,A)=X
 . S X=$S(B3="N"!(B3="R"&LRFLAG):B2_"*",1:B2)
 . S $P(LRINT(LRBN),U,A)=X
 ;
 I B3=""!(B3="A")!(B3="R"&'LRFLAG) S $P(LRRES(LRBN),U,A)=B1,$P(LRINT(LRBN),U,A)=B2
 ;
 Q
 ;
 ;
AB ;
 ; Check if entry is for a bacterial drug, not an AFB drug.
 S J=$P(^LAB(62.06,B,0),U,2)
 I J="" Q
 I $D(LRINT(J)),LRINT(J)'?."^" W !,$E($P(^LAB(62.06,B,0),U),1,14) S LRDCOM=$P(^(0),U,3),LRACNT=LRACNT+1 D SIR
 Q
 ;
 ;
BUGHDR ;
 N A,J,LRBUG,LRORG,LRORGCOM,LRX
 W @IOF
 W !?5,PNM,"  SSN: ",SSN,!,LRACCN,"  ",$P(^LAB(62,LRSAMP,0),U),"  ",$P(^LAB(61,LRSPEC,0),U),!
 ;
 S LRBUG=0
 F A=0:1 S LRBUG=+$O(^LR(LRDFN,"MI",LRIDT,3,LRBUG)) Q:LRBUG<1  D
 . S LRX=$G(^LR(LRDFN,"MI",LRIDT,3,LRBUG,0))
 . I LRX="" Q
 . S LRORG=$P(LRX,U),LRORGCOM=$P(LRX,U,2),LRORG=$P(^LAB(61.2,LRORG,0),U)
 . S:+$O(^LR(LRDFN,"MI",LRIDT,3,LRBUG,2))'["2." A=A-1 I +$O(^(2))["2." D ORG
 I LRFMT="B" W ! F J=1:1:A W ?J-1*13+15,":"
 W !
 F J=1:1:A W:LRFMT'="B" ?(J*5+10),":" I LRFMT="B" W ?J-1*13+15,"SUSC  INTP"
 Q
 ;
 ;
ORG ;
 N J
 W !
 I A>0 F J=1:1:A W ?($S(LRFMT="B":J-1*13+15,1:J*5+10)),":"
 W ?($S(LRFMT="B":A*13+15,1:A*5+15)),$S(LR2ORMOR:LRBUG_". ",1:""),LRORG,$S(LRORGCOM'="":" ("_LRORGCOM_")",1:"")
 Q
 ;
 ;
SIR ;
 ;
 N II
 F II=1:1:10 D:$P(LRINT(J),U,II,10)="" DCOM Q:$P(LRINT(J),U,II,10)=""  D
 . I LRFMT'="B" W ?(II*5+10),$S(LRFMT="I":$P(LRINT(J),U,II),1:$P(LRRES(J),U,II)) Q
 . W ?(II-1*13+15),$S($D(LRRES(J)):$P(LRRES(J),U,II),1:""),?(II-1*13+21),$P(LRINT(J),U,II),"  "
 Q
 ;
 ;
DCOM ;
 ;
 N A,K
 W ?LRCOMTAB,LRDCOM
 I $D(LRDCOM(J)) D
 . S (A,K)=0
 . F  S A=+$O(LRDCOM(J,A)) Q:A<1  W:'('K&(LRDCOM="")) ! W ?LRCOMTAB,LRDCOM(J,A) S K=1
 Q
 ;
 ;
WAIT ; End of page/continue prompt
 N DIR,DIROUT,DIRUT,STOUT,X,Y
 ;
 S DIR(0)="E"
 D ^DIR
 I $D(DIRUT) S LREND=1 Q
 ;
 W @IOF D BUGHDR
 ;
 Q