LRMITRZ3 ;AVAMC/REG,SLC/BA- MICRO TRENDS CONTINUED ; 10/7/87 08:23 ;
;;V~5.0~;LAB;;02/27/90 17:09
;from LRMITRZ2
REPORT S LRT="O" I LRM(LRT)'="N" S LRSINGLE=$S(LRM(LRT)="S":1,1:0) S LRPG=0 D HDR,BUG
F LRT="S","L","D","P","C" I LRM(LRT)'="N" S LRSINGLE=$S(LRM(LRT)="S":1,1:0) S LRPG=0 D HDR,C
Q
BUG S LRBI=0 F I=0:0 S LRBI=$O(^UTILITY($J,"B",LRBI)) Q:LRBI="" S LRBG=$O(^UTILITY($J,"B",LRBI,0)) I LRM(LRT)="A"!(LRSINGLE&(LRBG=LRM(LRT,"S"))) D:$Y>60 HDR W !!,$E(LRBI,2,99),!,?18,$J(^UTILITY($J,"BG",LRBG),5) D ANTI
Q
ANTI S LRLIN="",$P(LRLIN,"| ",O+1)="|",LRTOT=LRLIN,LRANTI=0 F I=0:0 S LRANTI=$O(^UTILITY($J,"BAS",LRBG,LRANTI)) Q:LRANTI="" S LRND=^UTILITY($J,LRBA,LRBG,LRANTI),LRSM=+LRND D WRT
D NUM
Q
C S LRCT=LRT_"T",LRCBA=LRT_"BA",LRCTB=LRT_"TB"
S S=0 F I=0:0 S S=$O(^UTILITY($J,LRCBA,S)) Q:S="" I LRM(LRT)="A"!(LRSINGLE&(S=LRM(LRT,"S"))) D:$Y>60 HDR W !!,S W:LRT="S"!(LRT="C") " (",^UTILITY($J,LRCT,S),"):" W !,"---------------" D B
Q
B S LRBI=0 F I=0:0 S LRBI=$O(^UTILITY($J,LRCBA,S,LRBI)) Q:LRBI="" D:$Y>60 HDR W !!,$P(^LAB(61.2,LRBI,0),U),!,?18,$J(^UTILITY($J,LRCTB,S,LRBI),5) D A
Q
A S LRLIN="",$P(LRLIN,"| ",O+1)="|",LRTOT=LRLIN,LRANTI=0 F I=0:0 S LRANTI=$O(^UTILITY($J,LRCBA,S,LRBI,LRANTI)) Q:LRANTI="" S LRND=^UTILITY($J,LRCBA,S,LRBI,LRANTI),LRSM=+LRND D WRT
D NUM
Q
WRT S $P(LRLIN,"|",LRZ(LRANTI)+1)=$J($P(LRND,U,2)/LRSM*100,5,1),$P(LRTOT,"|",LRZ(LRANTI)+1)=LRSM_$E(" ",1,5-$L(LRSM))
Q
NUM W ?23,LRLIN,!
D:$Y>60 HDR W !?5,"# tested",?23,LRTOT
Q
HDR S LRPG=LRPG+1,%DT="T",X="N" D ^%DT,D^LRU W @IOF,Y,?21,"ANTIBIOTIC TREND REPORT (from: ",LRBEG," to: ",LRFIN," ",+^UTILITY($J,0)," patients)"
W ?100,$S(LRT="O":"BY ORGANISM",LRT="S":"BY SITE/SPECIMEN",LRT="L":"BY LOCATION",LRT="P":"BY PATIENT",LRT="C":"BY COLLECTION SAMPLE",1:"BY PHYSICIAN"),?122,"PAGE ",$J(LRPG,5)
I LRLOS W !,?2,"** Reports only those specimens collected > ",LRLOS,$S(LRLOS>1:" days",1:" day")," from admission date **"
W !?23 F I=0:0 S I=$O(B(I)) Q:I="" W "| ",$P(B(I),U,2)," "
I $D(LRAP) W "|",!,"* ANTIBIOTIC PATTERN *",?23 F I=0:0 S I=$O(B(I)) Q:I="" W "| ",$S($L($P(B(I),U,3)):$P(B(I),U,3),1:" ")," "
W "|",! F X=1:1:IOM-1 W "-"
Q
LRMITRZ3 ;AVAMC/REG,SLC/BA- MICRO TRENDS CONTINUED ; 10/7/87 08:23 ;
+1 ;;V~5.0~;LAB;;02/27/90 17:09
+2 ;from LRMITRZ2
REPORT SET LRT="O"
IF LRM(LRT)'="N"
SET LRSINGLE=$SELECT(LRM(LRT)="S":1,1:0)
SET LRPG=0
DO HDR
DO BUG
+1 FOR LRT="S","L","D","P","C"
IF LRM(LRT)'="N"
SET LRSINGLE=$SELECT(LRM(LRT)="S":1,1:0)
SET LRPG=0
DO HDR
DO C
+2 QUIT
BUG SET LRBI=0
FOR I=0:0
SET LRBI=$ORDER(^UTILITY($JOB,"B",LRBI))
IF LRBI=""
QUIT
SET LRBG=$ORDER(^UTILITY($JOB,"B",LRBI,0))
IF LRM(LRT)="A"!(LRSINGLE&(LRBG=LRM(LRT,"S")))
IF $Y>60
DO HDR
WRITE !!,$EXTRACT(LRBI,2,99),!,?18,$JUSTIFY(^UTILITY($JOB,"BG",LRBG),5)
DO ANTI
+1 QUIT
ANTI SET LRLIN=""
SET $PIECE(LRLIN,"| ",O+1)="|"
SET LRTOT=LRLIN
SET LRANTI=0
FOR I=0:0
SET LRANTI=$ORDER(^UTILITY($JOB,"BAS",LRBG,LRANTI))
IF LRANTI=""
QUIT
SET LRND=^UTILITY($JOB,LRBA,LRBG,LRANTI)
SET LRSM=+LRND
DO WRT
+1 DO NUM
+2 QUIT
C SET LRCT=LRT_"T"
SET LRCBA=LRT_"BA"
SET LRCTB=LRT_"TB"
+1 SET S=0
FOR I=0:0
SET S=$ORDER(^UTILITY($JOB,LRCBA,S))
IF S=""
QUIT
IF LRM(LRT)="A"!(LRSINGLE&(S=LRM(LRT,"S")))
IF $Y>60
DO HDR
WRITE !!,S
IF LRT="S"!(LRT="C")
WRITE " (",^UTILITY($JOB,LRCT,S),"):"
WRITE !,"---------------"
DO B
+2 QUIT
B SET LRBI=0
FOR I=0:0
SET LRBI=$ORDER(^UTILITY($JOB,LRCBA,S,LRBI))
IF LRBI=""
QUIT
IF $Y>60
DO HDR
WRITE !!,$PIECE(^LAB(61.2,LRBI,0),U),!,?18,$JUSTIFY(^UTILITY($JOB,LRCTB,S,LRBI),5)
DO A
+1 QUIT
A SET LRLIN=""
SET $PIECE(LRLIN,"| ",O+1)="|"
SET LRTOT=LRLIN
SET LRANTI=0
FOR I=0:0
SET LRANTI=$ORDER(^UTILITY($JOB,LRCBA,S,LRBI,LRANTI))
IF LRANTI=""
QUIT
SET LRND=^UTILITY($JOB,LRCBA,S,LRBI,LRANTI)
SET LRSM=+LRND
DO WRT
+1 DO NUM
+2 QUIT
WRT SET $PIECE(LRLIN,"|",LRZ(LRANTI)+1)=$JUSTIFY($PIECE(LRND,U,2)/LRSM*100,5,1)
SET $PIECE(LRTOT,"|",LRZ(LRANTI)+1)=LRSM_$EXTRACT(" ",1,5-$LENGTH(LRSM))
+1 QUIT
NUM WRITE ?23,LRLIN,!
+1 IF $Y>60
DO HDR
WRITE !?5,"# tested",?23,LRTOT
+2 QUIT
HDR SET LRPG=LRPG+1
SET %DT="T"
SET X="N"
DO ^%DT
DO D^LRU
WRITE @IOF,Y,?21,"ANTIBIOTIC TREND REPORT (from: ",LRBEG," to: ",LRFIN," ",+^UTILITY($JOB,0)," patients)"
+1 WRITE ?100,$SELECT(LRT="O":"BY ORGANISM",LRT="S":"BY SITE/SPECIMEN",LRT="L":"BY LOCATION",LRT="P":"BY PATIENT",LRT="C":"BY COLLECTION SAMPLE",1:"BY PHYSICIAN"),?122,"PAGE ",$JUSTIFY(LRPG,5)
+2 IF LRLOS
WRITE !,?2,"** Reports only those specimens collected > ",LRLOS,$SELECT(LRLOS>1:" days",1:" day")," from admission date **"
+3 WRITE !?23
FOR I=0:0
SET I=$ORDER(B(I))
IF I=""
QUIT
WRITE "| ",$PIECE(B(I),U,2)," "
+4 IF $DATA(LRAP)
WRITE "|",!,"* ANTIBIOTIC PATTERN *",?23
FOR I=0:0
SET I=$ORDER(B(I))
IF I=""
QUIT
WRITE "| ",$SELECT($LENGTH($PIECE(B(I),U,3)):$PIECE(B(I),U,3),1:" ")," "
+5 WRITE "|",!
FOR X=1:1:IOM-1
WRITE "-"
+6 QUIT