LRMISEZA ;AVAMC/REG/SLC/BA - MICROBIOLOGY INF CONTROL DATA ; 10/9/87  16:18 ;
 ;;5.2;LAB SERVICE;;Sep 27, 1994
 ;from LRMISEZ
ASK1 F I=0:0 S %=2 W !!,"Will all reports be for a single bacterium" D YN^DICN Q:%'=0  W !,"Do you want all survey data for just one organism?"
 I %<0 S LREND=1 Q
 I %=1 S DIC="61.2",DIC(0)="AEQMOZ",DIC("A")="Select Bacterium: ",DIC("S")="I $P(^(0),U,5)=""B""" D ^DIC K DIC S:X=U LREND=1 Q:X=U  I Y>0 S LRSGL=+Y,LRM("O")="S",LRM("O","S")=LRSGL
SAMPLE F I=0:0 W !!,"Will all reports be by (S)ite/specimen or (C)ollection sample? ",LRSIT(1) R "// ",X:DTIME S:X="" X=LRSIT(1) S:"SC"[X LRSIT(1)=X Q:X="S"!(X="C")!(X=U)  W !,"Select 'S' or 'C', or '^' to exit."
 W ! I X=U S LREND=1 Q
LOS F I=0:0 W !!,"Number of days from patient's admission date to collection date of specimen",! R "to be excluded from all reports.  0// ",X:DTIME S:X="" X=0 Q:X[U!(X?1N.N)  W !,"Enter number of days to exclude."
 W ! I X[U S LREND=1 Q
 S LRLOS=X
AP K LRAP F I=0:0 W !!,"Will all reports require a specific antibiotic pattern" S %=2 D YN^DICN Q:%  W !,"You may restrict all reports to only those that have specific antibiotic",!,"interpretations."
 I %=-1 S LREND=1 Q
 I %=1 S DIC=62.06,DIC(0)="AEMOQZ",DIC("A")="Select Antibiotic: ",DIC("S")="I +$P(^(0),U,2),$L($P(^(0),U,5))" F I=0:0 D ^DIC Q:Y<1  S LRBN=$P(Y(0),U,2) F I=0:0 R !,"Select Interpretation: ",X:DTIME Q:X[U!'$L(X)  S LROK=0 D CHECK Q:LROK
PROMPT K DIC F LRASK="L","O","D","P" D:'(LRASK="O"&($D(LRSGL))) ASK Q:LREND
 Q
ASK S LRPROMPT=$S(LRASK="L":"Location",LRASK="O":"Organism",LRASK="D":"Provider",1:"Patient") W !,"Survey by:  ",LRPROMPT
 F I=0:0 W !,"(A)ll ",LRPROMPT,"s, (S)ingle ",LRPROMPT,", or (N)o ",LRPROMPT," Survey? ",LRM(LRASK) R "// ",X:DTIME S:X="" X=LRM(LRASK) S:"ANS"[X LRM(LRASK)=X Q:X="A"!(X="N")!(X=U)  D:X'="S" INFO1 I X="S" D SINGLE Q
 I X=U S LREND=1 Q
 Q
SINGLE I LRASK="L" K DIC S DIC="44",DIC(0)="AEMOQZ",DIC("A")="Select Location: " D ^DIC K DIC Q:Y<1  S LRM(LRASK,"S")=$P(^SC(+Y,0),U,2) Q
 I LRASK="O" K DIC S DIC="61.2",DIC(0)="AEMOQZ",DIC("A")="Select Organism: ",DIC("S")="I $P(^(0),U,5)=""B""" D ^DIC K DIC Q:Y<1  S LRM(LRASK,"S")=+Y Q
 I LRASK="D" K DIC S DIC="^VA(200,",DIC(0)="AEQMZ",DIC("A")="Select Provider: ",DIC("S")="I $D(^VA(200,""AK.PROVIDER"",$P(^(0),U)))" D ^DIC K DIC Q:Y<1  S LRM(LRASK,"S")=$E($P(^VA(200,+Y,0),U),1,15)_U_+Y Q
 I LRASK="P" K DIC,DFN K DIC S DIC(0)="EMQZ",PNM="" D ^LRDPA Q:LRDFN=-1!($D(DUOUT))!($D(DTOUT))  S LRM(LRASK,"S")=LRDFN
 Q
CHECK I '$D(^LAB(62.06,"AJ",LRBN,X)) W:X'="?" !,"Not an interpretation for this antibiotic." S J=0 W !,"You must use:" F I=0:0 S J=$O(^LAB(62.06,"AJ",LRBN,J)) Q:J=""  W !,?5,J
 I $D(^LAB(62.06,"AJ",LRBN,X)) S LROK=1,LRAP(LRBN)=X
 Q
INFO1 W !,"Select 'A' to obtain a survey grouped by all ",LRPROMPT,"s.",!,"Select 'S' to obtain a survey for only one ",LRPROMPT,".",!,"Select 'N' if you DO NOT want a survey grouped by ",LRPROMPT,".",!,"'^' to exit",!
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLRMISEZA   2952     printed  Sep 23, 2025@19:53:03                                                                                                                                                                                                    Page 2
LRMISEZA  ;AVAMC/REG/SLC/BA - MICROBIOLOGY INF CONTROL DATA ; 10/9/87  16:18 ;
 +1       ;;5.2;LAB SERVICE;;Sep 27, 1994
 +2       ;from LRMISEZ
ASK1       FOR I=0:0
               SET %=2
               WRITE !!,"Will all reports be for a single bacterium"
               DO YN^DICN
               if %'=0
                   QUIT 
               WRITE !,"Do you want all survey data for just one organism?"
 +1        IF %<0
               SET LREND=1
               QUIT 
 +2        IF %=1
               SET DIC="61.2"
               SET DIC(0)="AEQMOZ"
               SET DIC("A")="Select Bacterium: "
               SET DIC("S")="I $P(^(0),U,5)=""B"""
               DO ^DIC
               KILL DIC
               if X=U
                   SET LREND=1
               if X=U
                   QUIT 
               IF Y>0
                   SET LRSGL=+Y
                   SET LRM("O")="S"
                   SET LRM("O","S")=LRSGL
SAMPLE     FOR I=0:0
               WRITE !!,"Will all reports be by (S)ite/specimen or (C)ollection sample? ",LRSIT(1)
               READ "// ",X:DTIME
               if X=""
                   SET X=LRSIT(1)
               if "SC"[X
                   SET LRSIT(1)=X
               if X="S"!(X="C")!(X=U)
                   QUIT 
               WRITE !,"Select 'S' or 'C', or '^' to exit."
 +1        WRITE !
           IF X=U
               SET LREND=1
               QUIT 
LOS        FOR I=0:0
               WRITE !!,"Number of days from patient's admission date to collection date of specimen",!
               READ "to be excluded from all reports.  0// ",X:DTIME
               if X=""
                   SET X=0
               if X[U!(X?1N.N)
                   QUIT 
               WRITE !,"Enter number of days to exclude."
 +1        WRITE !
           IF X[U
               SET LREND=1
               QUIT 
 +2        SET LRLOS=X
AP         KILL LRAP
           FOR I=0:0
               WRITE !!,"Will all reports require a specific antibiotic pattern"
               SET %=2
               DO YN^DICN
               if %
                   QUIT 
               WRITE !,"You may restrict all reports to only those that have specific antibiotic",!,"interpretations."
 +1        IF %=-1
               SET LREND=1
               QUIT 
 +2        IF %=1
               SET DIC=62.06
               SET DIC(0)="AEMOQZ"
               SET DIC("A")="Select Antibiotic: "
               SET DIC("S")="I +$P(^(0),U,2),$L($P(^(0),U,5))"
               FOR I=0:0
                   DO ^DIC
                   if Y<1
                       QUIT 
                   SET LRBN=$PIECE(Y(0),U,2)
                   FOR I=0:0
                       READ !,"Select Interpretation: ",X:DTIME
                       if X[U!'$LENGTH(X)
                           QUIT 
                       SET LROK=0
                       DO CHECK
                       if LROK
                           QUIT 
PROMPT     KILL DIC
           FOR LRASK="L","O","D","P"
               if '(LRASK="O"&($DATA(LRSGL)))
                   DO ASK
               if LREND
                   QUIT 
 +1        QUIT 
ASK        SET LRPROMPT=$SELECT(LRASK="L":"Location",LRASK="O":"Organism",LRASK="D":"Provider",1:"Patient")
           WRITE !,"Survey by:  ",LRPROMPT
 +1        FOR I=0:0
               WRITE !,"(A)ll ",LRPROMPT,"s, (S)ingle ",LRPROMPT,", or (N)o ",LRPROMPT," Survey? ",LRM(LRASK)
               READ "// ",X:DTIME
               if X=""
                   SET X=LRM(LRASK)
               if "ANS"[X
                   SET LRM(LRASK)=X
               if X="A"!(X="N")!(X=U)
                   QUIT 
               if X'="S"
                   DO INFO1
               IF X="S"
                   DO SINGLE
                   QUIT 
 +2        IF X=U
               SET LREND=1
               QUIT 
 +3        QUIT 
SINGLE     IF LRASK="L"
               KILL DIC
               SET DIC="44"
               SET DIC(0)="AEMOQZ"
               SET DIC("A")="Select Location: "
               DO ^DIC
               KILL DIC
               if Y<1
                   QUIT 
               SET LRM(LRASK,"S")=$PIECE(^SC(+Y,0),U,2)
               QUIT 
 +1        IF LRASK="O"
               KILL DIC
               SET DIC="61.2"
               SET DIC(0)="AEMOQZ"
               SET DIC("A")="Select Organism: "
               SET DIC("S")="I $P(^(0),U,5)=""B"""
               DO ^DIC
               KILL DIC
               if Y<1
                   QUIT 
               SET LRM(LRASK,"S")=+Y
               QUIT 
 +2        IF LRASK="D"
               KILL DIC
               SET DIC="^VA(200,"
               SET DIC(0)="AEQMZ"
               SET DIC("A")="Select Provider: "
               SET DIC("S")="I $D(^VA(200,""AK.PROVIDER"",$P(^(0),U)))"
               DO ^DIC
               KILL DIC
               if Y<1
                   QUIT 
               SET LRM(LRASK,"S")=$EXTRACT($PIECE(^VA(200,+Y,0),U),1,15)_U_+Y
               QUIT 
 +3        IF LRASK="P"
               KILL DIC,DFN
               KILL DIC
               SET DIC(0)="EMQZ"
               SET PNM=""
               DO ^LRDPA
               if LRDFN=-1!($DATA(DUOUT))!($DATA(DTOUT))
                   QUIT 
               SET LRM(LRASK,"S")=LRDFN
 +4        QUIT 
CHECK      IF '$DATA(^LAB(62.06,"AJ",LRBN,X))
               if X'="?"
                   WRITE !,"Not an interpretation for this antibiotic."
               SET J=0
               WRITE !,"You must use:"
               FOR I=0:0
                   SET J=$ORDER(^LAB(62.06,"AJ",LRBN,J))
                   if J=""
                       QUIT 
                   WRITE !,?5,J
 +1        IF $DATA(^LAB(62.06,"AJ",LRBN,X))
               SET LROK=1
               SET LRAP(LRBN)=X
 +2        QUIT 
INFO1      WRITE !,"Select 'A' to obtain a survey grouped by all ",LRPROMPT,"s.",!,"Select 'S' to obtain a survey for only one ",LRPROMPT,".",!,"Select 'N' if you DO NOT want a survey grouped by ",LRPROMPT,".",!,"'^' to exit",!
 +1        QUIT