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

BLRALBM1.m

Go to the documentation of this file.
BLRALBM1 ;DAOU/ALA-Build Micro Results for Bacteria [ 11/18/2002  1:33 PM ]
 ;;5.2;LR;**1013,1015**;NOV 18, 2002
 ;
 ;
ANTI ;EP
 I $P($G(^LR(LRDFN,"MI",LRIDT,14,0)),U,4)>0 D
 . S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=$E(BLRABLKS,1,28)_"Antibiotic Level(s):"
 . S BLRAZ="ANTIBIOTIC",BLRAZ1=20 D Z1
 . S BLRAZ=BLRAZ_"CONC RANGE (ug/ml)",BLRAZ1=42 D Z1
 . S BLRAZ=BLRAZ_"DRAW TIME"
 . S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=BLRAZ
 . S B=0 F  S B=$O(^LR(LRDFN,"MI",LRIDT,14,B)) Q:B<1  D
 .. S BLRALAL=$G(^LR(LRDFN,"MI",LRIDT,14,B,0))
 .. S BLRAZ=$P(BLRALAL,U),BLRAZ1=20 D Z1
 .. S BLRAZ=BLRAZ_$P(BLRALAL,U,3),BLRAZ1=42 D Z1
 .. S BLRAZ=BLRAZ_$S($P(BLRALAL,U,2)="P":"PEAK",$P(BLRALAL,U,2)="T":"TROUGH",1:"")
 .. S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=BLRAZ
 Q
BACT ;EP
 I '$L($P($G(^LR(LRDFN,"MI",LRIDT,1)),U)) Q:'$D(LRWRDVEW)  Q:LRSB'=1
 D BUG
 I $D(^LR(LRDFN,"MI",LRIDT,2,0)) D GRAM
 I $D(^LR(LRDFN,"MI",LRIDT,25,0)) D BSMEAR
 I $D(^LR(LRDFN,"MI",LRIDT,3,0)) D BRMK,BACT^BLRALBM4
 I $D(^LR(LRDFN,"MI",LRIDT,4,0)),$P($G(^(0)),U,4)>0 D
 . S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="Bacteriology Remark(s):"
 . S B=0 F  S B=+$O(^LR(LRDFN,"MI",LRIDT,4,B)) Q:B<1  D
  .. S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="   "_$G(^LR(LRDFN,"MI",LRIDT,4,B,0))
 Q
 ;
BUG S BLRABUG=$G(^LR(LRDFN,"MI",LRIDT,1))
 S LRTUS=$P(BLRABUG,U,2),DZ=$P(BLRABUG,U,3),LRUS=$P(BLRABUG,U,6)
 S LRNS=$P(BLRABUG,U,5),Y=$P(BLRABUG,U) D D^LRU
 S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="* BACTERIOLOGY "_$S(LRTUS="F":"FINAL",LRTUS="P":"PRELIMINARY",1:"")_" REPORT => "_Y_"   TECH CODE: "_DZ  ;IHS/ANMC/CLS 08/18/96
 S LRPRE=19 D PRE
 I $L(LRUS) S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="URINE SCREEN: "_$S(LRUS="N":"Negative",LRUS="P":"Positive",1:LRUS)
 I $L(LRNS) S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="SPUTUM SCREEN:  "_LRNS
 Q
 ;
GRAM S BLRAZ="GRAM STAIN:",BLRAZ1=14 D Z1
 S LRGRM=0 F  S LRGRM=+$O(^LR(LRDFN,"MI",LRIDT,2,LRGRM)) Q:LRGRM<1  D
 . S BLRAZ=BLRAZ_$G(^LR(LRDFN,"MI",LRIDT,2,LRGRM,0))
 . S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=BLRAZ
 . S BLRAZ=$E(BLRABLKS,1,14)
 Q
 ;
BSMEAR S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="BACTERIOLOGY SMEAR/PREP:"
 S LRMYC=0 F  S LRMYC=+$O(^LR(LRDFN,"MI",LRIDT,25,LRMYC)) Q:LRMYC<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SP+1,^TMP($J,"BLRA",BLRADSP,0)=BLRAZ
 Q
 ;
CMNT S LRPC=0
 F A=0:1 S LRPC=+$O(^LR(LRDFN,"MI",LRIDT,3,LRBUG,1,LRPC)) Q:LRPC<1  D
 . I A=0 D  Q
 .. S BLRAZ="Comment: ",BLRAZ1=20 D Z1
 .. S BLRAZ=BLRAZ_$G(^LR(LRDFN,"MI",LRIDT,3,LRBUG,1,LRPC,0))
 .. S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=$E(BLRABLKS,1,20)_BLRAZ
 . S BLRAZ=$G(^LR(LRDFN,"MI",LRIDT,3,LRBUG,1,LRPC,0))
 . S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=$E(BLRABLKS,1,29)_BLRAZ
 Q
 ;
PRE ;EP
 Q:LRTUS["F"&('$D(^XUSEC("LRLAB",DUZ))!$D(LRWRDVEW))
 I +$O(^LR(LRDFN,"MI",LRIDT,LRPRE,0)) D
 . S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)="Preliminary Comments: "
 . S J=0 F  S J=+$O(^LR(LRDFN,"MI",LRIDT,LRPRE,J)) Q:J<1  D
 .. S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=$E(BLRABLKS,1,3)_$G(^LR(LRDFN,"MI",LRIDT,LRPRE,J,0))
 D LIN
 Q
 ;
Z1 ;  Pad with trailing spaces
 F BLRAI=1:1:(BLRAZ1-$L(BLRAZ)) S BLRAZ=BLRAZ_" "
 Q
 ;
LIN ;EP
 ; Set a Blank Line
 S BLRADSP=BLRADSP+1,^TMP($J,"BLRA",BLRADSP,0)=" "
 Q