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

LRMITSE.m

Go to the documentation of this file.
  1. LRMITSE ;VA/SLC/STAFF - MICRO TREND ENTRY ;JUL 06, 2010 3:14 PM
  1. ;;5.2;LAB SERVICE;**96,257,1027**;NOV 01, 1997
  1. ; from LRMITS
  1. ; collect input data for trend report
  1. ; LRAP(drug node)=organism # if antibiotic pattern defined
  1. ; LRDETAIL detailed report with patient results
  1. ; LREND flag to end program
  1. ; LRHELP help frame
  1. ; LRLOS length of stay
  1. ; LRMERGE none/spec/col sample/any "N"/"S"/"C"/"A"
  1. ; LRM(type of report,"A")="" all values
  1. ; LRM(type of report,"S",value #)=value name selected values
  1. ; LROTYPE(type of organism)="" organism types "B"/"F"/"M"/"P"/"V"
  1. ; LRSORG(type of organism,organism #)="" if specific organisms selected
  1. ; LRSORT Defines antibiotic reporting order by alph or print order
  1. ; LRSUSR(interp)="" interpretations forced to 'R'
  1. ; LRSUSS(interp)="" interpretations forced to 'S'
  1. ; LRUNK "Unknown" - used for any value
  1. ; LRTBEG begin time
  1. ; LRTEND end time
  1. ;
  1. W @IOF,?30,"MICROBIOLOGY TREND REPORT",!
  1. ; initialize variables and defaults
  1. K LRAP,LRM,LROTYPE,LRSORG,LRSUSR,LRSUSS
  1. DIV ;MULTIDIVISIONAL PATCH LR*5.2*257 - 3/01
  1. ;ASK IF WANT REPORT BY DIVISION
  1. S LRASK="DIV",LRHELP="LRMITS OPTION"
  1. W !!,"Report by: DIVISION"
  1. S LRPX=$S($D(LRM(LRASK,"A")):"All",1:"No") K DIC,DIR,LRM(LRASK)
  1. S DIR(0)="SAM^A:All;S:Selected;N:No",DIR("A")="(A)ll Divisions, (S)elected Divisions, or (N)o Division Report? ",DIR("B")=LRPX
  1. S DIR("?")="Enter 'A'll, 'S'elected, or 'N'o.",DIR("??")=LRHELP
  1. S DIR("?",1)="Select 'A' to obtain a report grouped by all divisions."
  1. S DIR("?",2)="Select 'S' to obtain a report grouped for selected divisions."
  1. S DIR("?",3)="Select 'N' if you DO NOT want a report grouped by division."
  1. S DIR("?",4)="Enter '^' to exit."
  1. D ^DIR I $D(DIRUT) S LREND=1 Q
  1. I Y="A" S LRM(LRASK,"A")=""
  1. ; if specific values are requested, obtain selections
  1. I Y="S" D
  1. .S DIC=4,DIC(0)="AEMOQ",DIC("A")="Select Division: " F D ^DIC Q:Y<1 S LRM(LRASK,"S",+Y)=$P(Y,U,2),LRSDIV=+Y
  1. K DIC I $D(DTOUT) S LREND=1
  1. ;
  1. S LRDETAIL=0,LRHELP="LRMITS OPTION",LRLOS=0,LRMERGE="S",LROTYPE("B")="",LRUNK="Unknown"
  1. S (LRSUSR("I"),LRSUSR("R"),LRSUSS("MS"),LRSUSS("S"))=""
  1. S OK=1
  1. S LRBLIK=""
  1. D FILSCAN ;<------DRH patch 96
  1. Q:'OK
  1. I $D(^TMP("LRM",$J)) D QUERY
  1. F LRX="O","S","L","D","P","C" I $D(^LAB(69.9,1,"MIT","B",LRX)) S LRM(LRX,"A")=""
  1. ; default reports
  1. I 'OK S LREND=1 QUIT
  1. SORT K DIR S DIR(0)="SAMO^A:Alphabetically;P:Print Order",DIR("B")="A"
  1. S DIR("A")="Sort the Antibiotic output by: "
  1. S DIR("?")="Enter 'A'lphabetically or 'P'rint Order"
  1. S DIR("?",1)="This allows you to choose how the Antibiotics will be"
  1. S DIR("?",2)="sorted. Alphabetically will sort by the mnemonics and "
  1. S DIR("?",3)="Print Order will use the order defined in file #62.06"
  1. S DIR("?",4)="ANTIMICROBIAL SUSCEPTIBILITY" D ^DIR I $D(DIRUT) S LREND=1 Q
  1. S LRSORT=$S(Y="P":1,1:0)
  1. ;
  1. K DIR S DIR(0)="Y",DIR("A")="Use default reports HERE",DIR("B")="YES"
  1. S DIR("?")="Enter 'Y'es or 'N'o",DIR("??")=LRHELP
  1. S DIR("?",1)="Default reports are setup in the Laboratory Site file, 69.9."
  1. S DIR("?",2)="If you answer 'NO', you can select individual antibiotic trend reports"
  1. S DIR("?",3)="grouped by: organism, site/specimen, location, patient, physician, and/or"
  1. S DIR("?",4)="collection sample. You can select all items or a single item for each group."
  1. S DIR("?",5)="Example: a trend report on a single patient."
  1. D ^DIR I $D(DIRUT) G SORT
  1. K DIR,LRX
  1. ; get specific input if not using default data
  1. I 'Y D ^LRMITSEC Q:LREND D ^LRMITSES Q:LREND
  1. ; if no reports selected quit
  1. I '$D(LRM) W !,"No reports were selected!" S LREND=1 Q
  1. ; get date range
  1. W ! K DIR S DIR(0)="D^::AE",DIR("A")="Start Date"
  1. S DIR("?")="^D HELP^%DTC",DIR("??")=LRHELP
  1. D ^DIR I $D(DIRUT) S LREND=1 Q
  1. S LRTBEG=Y\1 ;S LRTBEG=$E(Y,1,5)_"00"
  1. K DIR S DIR(0)="D^::AE",DIR("A")="End Date"
  1. S DIR("?")="^D HELP^%DTC",DIR("??")=LRHELP
  1. D ^DIR I $D(DIRUT) S LREND=1 Q
  1. S LRTEND=Y\1 ;S LRTEND=$E(Y,1,5)_"00"
  1. I LRTEND<LRTBEG S X=LRTBEG,LRTBEG=LRTEND,LRTEND=X
  1. W ! K DIR,LRHELP,X,Y
  1. Q
  1. ;-------------------LR*5.2*96------------------------------------
  1. FILSCAN ; scan ^LAB(62.06 FOR non std DEFAULT INTERPS ie RES, SUS etc <--
  1. K ^TMP("LRM",$J)
  1. S LRSCN("R")="R",LRSCN("MS")="MS",LRSCN("I")="I",LRSCN("S")="S"
  1. S LRTIC=0,LRCNT=1
  1. F S LRTIC=$O(^LAB(62.06,LRTIC)) Q:+LRTIC'>0 D
  1. . S LRCN=0
  1. . F S LRCN=$O(^LAB(62.06,LRTIC,1,LRCN)) Q:+LRCN'>0 S NODE=^(LRCN,0) D
  1. .. S NODE=$P(NODE,U,2) Q:NODE?1P.E!(+NODE'=0) I 'NODE D MISSNG
  1. .. F LRTAC="I","S","R","MS" S:LRTAC=NODE LRGOT1=1
  1. .. Q:NODE="" I $G(LRGOT1)'=1 S ^TMP("LRM",$J,NODE)="" S LRCNT=LRCNT+1
  1. .. K LRGOT1
  1. K NODE,LRCN,LRSCN,LRTIC,LRTAC
  1. Q
  1. MISSNG ;
  1. Q:$G(LRBLIK)=1
  1. ;W !!,"You have required fields without data. Please check file 62.06 for deletions.",$C(7)
  1. ;Commented out for future use
  1. S LRBLIK=1
  1. Q
  1. QUERY ; Present to user non std entries from ^TMP classify per std.
  1. ; LRSUSR(interp)="" interpretations forced to 'R'
  1. ; LRSUSS(interp)="" interpretations forced to 'S'
  1. W !!,"I scanned your Antimicrobial Susceptibility File and was"
  1. W !,"surprised to see you have non-standard entries in the default"
  1. W !,"interpretation field."
  1. W !!,"In order for me to proceed, I need to know what the entry means."
  1. K DIR
  1. S DIR(0)="SOM^1:RESISTANT;2:SUSCEPTIBLE"
  1. S DIR("A")="Please enter your response here"
  1. S LRNTRP="",OK=1
  1. F S LRNTRP=$O(^TMP("LRM",$J,LRNTRP)) Q:LRNTRP=""!'OK W !!!,?32,"*****",LRNTRP,"*****" D
  1. . Q:'$D(LRNTRP) D ^DIR
  1. . S:$D(DIRUT) OK="" I 'OK QUIT
  1. . I Y=1 S LRSUSR(LRNTRP)=""
  1. . E S LRSUSS(LRNTRP)=""
  1. K ^TMP("LRM")
  1. K LRNTRP
  1. ;---------------------------------------------------------------------
  1. Q