| [613] | 1 | LRMITSE ;SLC/STAFF - MICRO TREND ENTRY ;3/4/93  17:07 | 
|---|
|  | 2 | ;;5.2;LAB SERVICE;**96,257**;Sep 27, 1994 | 
|---|
|  | 3 | ; from LRMITS | 
|---|
|  | 4 | ; collect input data for trend report | 
|---|
|  | 5 | ; LRAP(drug node)=organism #  if antibiotic pattern defined | 
|---|
|  | 6 | ; LRDETAIL  detailed report with patient results | 
|---|
|  | 7 | ; LREND  flag to end program | 
|---|
|  | 8 | ; LRHELP  help frame | 
|---|
|  | 9 | ; LRLOS  length of stay | 
|---|
|  | 10 | ; LRMERGE  none/spec/col sample/any  "N"/"S"/"C"/"A" | 
|---|
|  | 11 | ; LRM(type of report,"A")="" all values | 
|---|
|  | 12 | ; LRM(type of report,"S",value #)=value name  selected values | 
|---|
|  | 13 | ; LROTYPE(type of organism)=""  organism types  "B"/"F"/"M"/"P"/"V" | 
|---|
|  | 14 | ; LRSORG(type of organism,organism #)=""  if specific organisms selected | 
|---|
|  | 15 | ; LRSORT Defines antibiotic reporting order by alph or print order | 
|---|
|  | 16 | ; LRSUSR(interp)=""  interpretations forced to 'R' | 
|---|
|  | 17 | ; LRSUSS(interp)=""  interpretations forced to 'S' | 
|---|
|  | 18 | ; LRUNK  "Unknown" - used for any value | 
|---|
|  | 19 | ; LRTBEG  begin time | 
|---|
|  | 20 | ; LRTEND  end time | 
|---|
|  | 21 | ; | 
|---|
|  | 22 | W @IOF,?30,"MICROBIOLOGY TREND REPORT",! | 
|---|
|  | 23 | ; initialize variables and defaults | 
|---|
|  | 24 | K LRAP,LRM,LROTYPE,LRSORG,LRSUSR,LRSUSS | 
|---|
|  | 25 | DIV ;MULTIDIVISIONAL PATCH LR*5.2*257 - 3/01 | 
|---|
|  | 26 | ;ASK IF WANT REPORT BY DIVISION | 
|---|
|  | 27 | S LRASK="DIV",LRHELP="LRMITS OPTION" | 
|---|
|  | 28 | W !!,"Report by: DIVISION" | 
|---|
|  | 29 | S LRPX=$S($D(LRM(LRASK,"A")):"All",1:"No") K DIC,DIR,LRM(LRASK) | 
|---|
|  | 30 | 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 | 
|---|
|  | 31 | S DIR("?")="Enter 'A'll, 'S'elected, or 'N'o.",DIR("??")=LRHELP | 
|---|
|  | 32 | S DIR("?",1)="Select 'A' to obtain a report grouped by all divisions." | 
|---|
|  | 33 | S DIR("?",2)="Select 'S' to obtain a report grouped for selected divisions." | 
|---|
|  | 34 | S DIR("?",3)="Select 'N' if you DO NOT want a report grouped by division." | 
|---|
|  | 35 | S DIR("?",4)="Enter '^' to exit." | 
|---|
|  | 36 | D ^DIR I $D(DIRUT) S LREND=1 Q | 
|---|
|  | 37 | I Y="A" S LRM(LRASK,"A")="" | 
|---|
|  | 38 | ; if specific values are requested, obtain selections | 
|---|
|  | 39 | I Y="S" D | 
|---|
|  | 40 | .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 | 
|---|
|  | 41 | K DIC I $D(DTOUT) S LREND=1 | 
|---|
|  | 42 | ; | 
|---|
|  | 43 | S LRDETAIL=0,LRHELP="LRMITS OPTION",LRLOS=0,LRMERGE="S",LROTYPE("B")="",LRUNK="Unknown" | 
|---|
|  | 44 | S (LRSUSR("I"),LRSUSR("R"),LRSUSS("MS"),LRSUSS("S"))="" | 
|---|
|  | 45 | S OK=1 | 
|---|
|  | 46 | S LRBLIK="" | 
|---|
|  | 47 | D FILSCAN ;<------DRH patch 96 | 
|---|
|  | 48 | Q:'OK | 
|---|
|  | 49 | I $D(^TMP("LRM",$J)) D QUERY | 
|---|
|  | 50 | F LRX="O","S","L","D","P","C" I $D(^LAB(69.9,1,"MIT","B",LRX)) S LRM(LRX,"A")="" | 
|---|
|  | 51 | ; default reports | 
|---|
|  | 52 | I 'OK S LREND=1 QUIT | 
|---|
|  | 53 | SORT K DIR S DIR(0)="SAMO^A:Alphabetically;P:Print Order",DIR("B")="A" | 
|---|
|  | 54 | S DIR("A")="Sort the Antibiotic output by: " | 
|---|
|  | 55 | S DIR("?")="Enter 'A'lphabetically or 'P'rint Order" | 
|---|
|  | 56 | S DIR("?",1)="This allows you to choose how the Antibiotics will be" | 
|---|
|  | 57 | S DIR("?",2)="sorted. Alphabetically will sort by the mnemonics and " | 
|---|
|  | 58 | S DIR("?",3)="Print Order will use the order defined in file #62.06" | 
|---|
|  | 59 | S DIR("?",4)="ANTIMICROBIAL SUSCEPTIBILITY" D ^DIR I $D(DIRUT) S LREND=1 Q | 
|---|
|  | 60 | S LRSORT=$S(Y="P":1,1:0) | 
|---|
|  | 61 | ; | 
|---|
|  | 62 | K DIR S DIR(0)="Y",DIR("A")="Use default reports HERE",DIR("B")="YES" | 
|---|
|  | 63 | S DIR("?")="Enter 'Y'es or 'N'o",DIR("??")=LRHELP | 
|---|
|  | 64 | S DIR("?",1)="Default reports are setup in the Laboratory Site file, 69.9." | 
|---|
|  | 65 | S DIR("?",2)="If you answer 'NO', you can select individual antibiotic trend reports" | 
|---|
|  | 66 | S DIR("?",3)="grouped by: organism, site/specimen, location, patient, physician, and/or" | 
|---|
|  | 67 | S DIR("?",4)="collection sample.  You can select all items or a single item for each group." | 
|---|
|  | 68 | S DIR("?",5)="Example: a trend report on a single patient." | 
|---|
|  | 69 | D ^DIR I $D(DIRUT) G SORT | 
|---|
|  | 70 | K DIR,LRX | 
|---|
|  | 71 | ; get specific input if not using default data | 
|---|
|  | 72 | I 'Y D ^LRMITSEC Q:LREND  D ^LRMITSES Q:LREND | 
|---|
|  | 73 | ; if no reports selected quit | 
|---|
|  | 74 | I '$D(LRM) W !,"No reports were selected!" S LREND=1 Q | 
|---|
|  | 75 | ; get date range | 
|---|
|  | 76 | W ! K DIR S DIR(0)="D^::AE",DIR("A")="Start Date" | 
|---|
|  | 77 | S DIR("?")="^D HELP^%DTC",DIR("??")=LRHELP | 
|---|
|  | 78 | D ^DIR I $D(DIRUT) S LREND=1 Q | 
|---|
|  | 79 | S LRTBEG=Y\1 ;S LRTBEG=$E(Y,1,5)_"00" | 
|---|
|  | 80 | K DIR S DIR(0)="D^::AE",DIR("A")="End Date" | 
|---|
|  | 81 | S DIR("?")="^D HELP^%DTC",DIR("??")=LRHELP | 
|---|
|  | 82 | D ^DIR I $D(DIRUT) S LREND=1 Q | 
|---|
|  | 83 | S LRTEND=Y\1 ;S LRTEND=$E(Y,1,5)_"00" | 
|---|
|  | 84 | I LRTEND<LRTBEG S X=LRTBEG,LRTBEG=LRTEND,LRTEND=X | 
|---|
|  | 85 | W ! K DIR,LRHELP,X,Y | 
|---|
|  | 86 | Q | 
|---|
|  | 87 | ;-------------------LR*5.2*96------------------------------------ | 
|---|
|  | 88 | FILSCAN ; scan ^LAB(62.06 FOR non std DEFAULT INTERPS ie RES, SUS etc  <-- | 
|---|
|  | 89 | K ^TMP("LRM",$J) | 
|---|
|  | 90 | S LRSCN("R")="R",LRSCN("MS")="MS",LRSCN("I")="I",LRSCN("S")="S" | 
|---|
|  | 91 | S LRTIC=0,LRCNT=1 | 
|---|
|  | 92 | F  S LRTIC=$O(^LAB(62.06,LRTIC)) Q:+LRTIC'>0  D | 
|---|
|  | 93 | .  S LRCN=0 | 
|---|
|  | 94 | .  F  S LRCN=$O(^LAB(62.06,LRTIC,1,LRCN)) Q:+LRCN'>0  S NODE=^(LRCN,0) D | 
|---|
|  | 95 | ..  S NODE=$P(NODE,U,2) Q:NODE?1P.E!(+NODE'=0)  I 'NODE D MISSNG | 
|---|
|  | 96 | ..  F LRTAC="I","S","R","MS" S:LRTAC=NODE LRGOT1=1 | 
|---|
|  | 97 | ..  Q:NODE=""  I $G(LRGOT1)'=1 S ^TMP("LRM",$J,NODE)="" S LRCNT=LRCNT+1 | 
|---|
|  | 98 | ..  K LRGOT1 | 
|---|
|  | 99 | K NODE,LRCN,LRSCN,LRTIC,LRTAC | 
|---|
|  | 100 | Q | 
|---|
|  | 101 | MISSNG ; | 
|---|
|  | 102 | Q:$G(LRBLIK)=1 | 
|---|
|  | 103 | ;W !!,"You have required fields without data. Please check file 62.06 for deletions.",$C(7) | 
|---|
|  | 104 | ;Commented out for future use | 
|---|
|  | 105 | S LRBLIK=1 | 
|---|
|  | 106 | Q | 
|---|
|  | 107 | QUERY ; Present to user non std entries from ^TMP classify per std. | 
|---|
|  | 108 | ; LRSUSR(interp)=""  interpretations forced to 'R' | 
|---|
|  | 109 | ; LRSUSS(interp)=""  interpretations forced to 'S' | 
|---|
|  | 110 | W !!,"I scanned your Antimicrobial Susceptibility File and was" | 
|---|
|  | 111 | W !,"surprised to see you have non-standard entries in the default" | 
|---|
|  | 112 | W !,"interpretation field." | 
|---|
|  | 113 | W !!,"In order for me to proceed, I need to know what the entry means." | 
|---|
|  | 114 | K DIR | 
|---|
|  | 115 | S DIR(0)="SOM^1:RESISTANT;2:SUSCEPTIBLE" | 
|---|
|  | 116 | S DIR("A")="Please enter your response here" | 
|---|
|  | 117 | S LRNTRP="",OK=1 | 
|---|
|  | 118 | F  S LRNTRP=$O(^TMP("LRM",$J,LRNTRP)) Q:LRNTRP=""!'OK  W !!!,?32,"*****",LRNTRP,"*****" D | 
|---|
|  | 119 | .  Q:'$D(LRNTRP)  D ^DIR | 
|---|
|  | 120 | .  S:$D(DIRUT) OK="" I 'OK QUIT | 
|---|
|  | 121 | .  I Y=1 S LRSUSR(LRNTRP)="" | 
|---|
|  | 122 | .  E  S LRSUSS(LRNTRP)="" | 
|---|
|  | 123 | K ^TMP("LRM") | 
|---|
|  | 124 | K LRNTRP | 
|---|
|  | 125 | ;--------------------------------------------------------------------- | 
|---|
|  | 126 | Q | 
|---|