source: FOIAVistA/trunk/r/LAB_SERVICE-LR-LS/LRMITSRS.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1LRMITSRS ;SLC/STAFF - MICRO TREND REPORT SETUP ;11/7/93 12:33
2 ;;5.2;LAB SERVICE;**96**;Sep 27, 1994
3 ; from LRMITSR
4 ; sets up static information on reports
5 ;
6 K LRHDR S LRHDR1=$P($$HTE^XLFDT($H),":",1,2)_" ANTIBIOTIC TREND REPORT (from "_LRFBEG_" to: "_LRFEND_" "
7 S LRSPACE=$$REPEAT^XLFSTR(" ",5)
8 I $D(LROTYPE("B")) D
9 .S LRHDR(2)=LRSPACE,LRABRV="",LRAPRT=0
10 .I '$D(^TMP($J,"PSRT")) F S LRABRV=$O(^TMP($J,"AB",LRABRV)) Q:LRABRV="" S LRHDR(2)=LRHDR(2)_"|"_$E(LRABRV,1,3)
11 .I $D(^TMP($J,"PSRT")) F S LRAPRT=$O(^TMP($J,"PSRT",LRAPRT)) Q:+LRAPRT'>0 S LRABRV=$G(^TMP($J,"PSRT",LRAPRT)),LRHDR(2)=LRHDR(2)_"|"_$E(LRABRV,1,3)
12 .S LRHDR(2)=LRHDR(2)_"|"
13 I LRLOS S LRHDR(3)=" ** Reports only those specimens collected > "_LRLOS_$S(LRLOS>1:" days",1:" day")_" from admission date **"
14 S LRHDR(4)=(IOM-5)\4 S LRHDR(4)=" "_$$REPEAT^XLFSTR("|---",(LRHDR(4)))
15 I $D(LRAP) D
16 . S LRHDR(5)="* ANTIBIOTIC PATTERN *",LRHDR(6)=LRSPACE
17 . S LRABRV="" F S LRABRV=$O(^TMP($J,"AB",LRABRV)) Q:LRABRV="" S LRDN=+^(LRABRV) D
18 ..S LRHDR(6)=LRHDR(6)_"|"_$J($G(LRAP(LRDN)),3)
19 .S LRHDR(6)=LRHDR(6)_"|"
20 ; header information
21 K LRLINE S LRLINE1="ANTIBIOTIC TREND REPORT BY "
22 S LRCNT=2,LRX=LRFBEG_" - "_LRFEND,LRLINE(LRCNT)=$J(LRX,IOM+$L(LRX)\2)
23 S LRCNT=LRCNT+1,LRLINE(LRCNT)="",LRCNT=LRCNT+1,LRLINE(LRCNT)="Data reported on: "
24 S LRN="" F S LRN=$O(LROTYPE(LRN)) Q:LRN="" D
25 .S LRLINE(LRCNT)=LRLINE(LRCNT)_$S(LRN="B":"Bacteria",LRN="F":"Fungus",LRN="M":"Mycobacteria",LRN="P":"Parasite",1:"Virus")_$S($L($O(LROTYPE(LRN))):", ",1:"")
26 I $D(LRSORG) D
27 .S LRCNT=LRCNT+1,LRLINE(LRCNT)="** Only the following organisms are reported:"
28 .K LRTEMP S LRNM="" F S LRNM=$O(LRSORG(LRNM)) Q:LRNM="" D
29 ..S LRN=0 F S LRN=$O(LRSORG(LRNM,LRN)) Q:LRN<1 S LRX=$P(^LAB(61.2,LRN,0),U),LRX=$E(LRX)_$$LOW^XLFSTR($E(LRX,2,99)),LRTEMP(LRNM_LRN)=LRX
30 .D HLIST("LRTEMP","LRLINE",", ",IOM,.LRCNT) K LRTEMP
31 I LRLOS S LRCNT=LRCNT+1,LRLINE(LRCNT)="** Data are restricted to specimens collected within "_LRLOS_" days of admission."
32 I $D(LRAP) S LRCNT=LRCNT+1,LRLINE(LRCNT)="** Data are restricted to a specific antibiotic pattern."
33 I LRDETAIL S LRCNT=LRCNT+1,LRLINE(LRCNT)="** This report includes detailed information on all isolates."
34 I LRMERGE="N" S LRCNT=LRCNT+1,LRLINE(LRCNT)="Isolates are NOT merged."
35 I LRMERGE'="N" D
36 .S LRCNT=LRCNT+1,LRLINE(LRCNT)="Isolates are merged when same patient, same organism, and "_$S(LRMERGE="S":"same specimen",LRMERGE="C":"same collection sample",1:"any sample")_" exists."
37 .S LRCNT=LRCNT+1,LRLINE(LRCNT)="Merged isolates are those not having conflicting antibiotic patterns."
38 I $D(LROTYPE("B")) D
39 .S LRCNT=LRCNT+1,LRLINE(LRCNT)=""
40 .S LRCNT=LRCNT+1,LRLINE(LRCNT)="Antibiotics:"
41 .K LRTEMP S LRABRV="" F S LRABRV=$O(^TMP($J,"AB",LRABRV)) Q:LRABRV="" S LRTEMP(LRABRV)=LRABRV_"="_$P(^(LRABRV),U,2)
42 .D HLIST("LRTEMP","LRLINE",", ",IOM,.LRCNT) K LRTEMP
43 S LRCNT=LRCNT+1,LRLINE(LRCNT)=""
44 Q
45HLIST(IN,OUT,DEL,LEN,CNT) ; transforms array IN to horizontal list array OUT, delimited by DEL for maximum length of LEN
46 ; CNT is the starting subscript for the OUT array, CNT can be called by reference
47 N NEXT,SUB,VALUE S:'$D(LEN) LEN=$S($D(IOM):IOM,1:80) S:'$D(CNT) CNT=0
48 S CNT=CNT+1,(@OUT@(CNT),SUB)="" F S SUB=$O(@IN@(SUB)) Q:SUB="" S VALUE=$P(@IN@(SUB),U),NEXT=$P($O(@IN@(SUB)),U) D
49 .I $L(@OUT@(CNT))+$L(VALUE)>(LEN-$L(DEL)) S CNT=CNT+1,@OUT@(CNT)=""
50 .S @OUT@(CNT)=@OUT@(CNT)_VALUE_$S($L(NEXT):DEL,1:"")
51 Q
Note: See TracBrowser for help on using the repository browser.