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

AZXRBUG5.m

Go to the documentation of this file.
  1. AZXRBUG5 ;BUGDRUG2 Report PROGRAM [ 09/23/94 9:52 AM ]
  1. ;Version 1
  1. ;"Antibiotic Sensitivities Report"
  1. ;09/04/92 JOHN H. LYNCH
  1. ;
  1. ;ALLOWS THE DATA ENTRY PERSON TO RUN A REPORT
  1. ;GIVING INFORMATION ON THE TOTAL NUMBER OF ENTRIES
  1. ;IN THE DATABASE FOR A GIVEN FACILITY AND DATE
  1. ;RANGE FOR ALL ORGANISM SENSITIVITIES TO DIFFERENT
  1. ;DRUGS.
  1. ;THE ROUTINES THAT CALL AZXRBUG5:
  1. ;AZXRBUG3, Report Menu
  1. ;THE ROUTINES THAT AZXRBUG5 CALLS:
  1. ;AZXRBUG7, Report Input
  1. ;%ZIS= (FILEMAN DEVICE HANDLER)
  1. ;Variable List
  1. ;PG= Current page count.
  1. ;LN= Current line count.
  1. ;FACBKUP= Flag returned from AZXRBUG7 with data on
  1. ; whether user wants to quit.
  1. ;FCLTY= Internal Number of site from SITES file.
  1. ;BORDER1= Special border for report.
  1. ;BORDER2= Special border for report.
  1. ;HEADER= Special header for report.
  1. ;%ZIS("B")= Don't use HOME as default device.
  1. ;LDATE= Current date used in print loop (REPORT SUB-
  1. ; ROUTINE).
  1. ;ORG= Current organism used in print loop (REPORT
  1. ; SUB-ROUTINE).
  1. ;DA= Current internal entry number used in print
  1. ; loop (REPORT SUB-ROUTINE).
  1. ;Y= Date used for date conversion.
  1. ;FDATE= Users starting date input; this value is
  1. ; exported from AZXRBUG7.
  1. ;TDATE= Users ending date input; this value is
  1. ; exported from AZXRBUG7.
  1. ;RFDATE= Starting report date in external format.
  1. ;RTDATE= Ending report date in external format.
  1. ;ORGCHK= Starts as a copy of ORG but ends up in an
  1. ; external form of Organism_Name.
  1. ;ZERONODE= The current node of BUGDRUG2 which drug
  1. ; sensitivities are being extracted.
  1. ;FAC= External form of current facility.
  1. ;YN= Users input of whether to print another report.
  1. ;Variables Used for Drug Sensitivity Calculations
  1. ;%AK,%AM,%AUG,%C,%CAX,%CB,%CC,%CF,%CFX,%CP,%CRM,%DP
  1. ;%E1,%FM,%GM,%NA,%P,%PI,%SxT,%TE,%TI,%VA
  1. ;AK,AM,AUG,C,CAX,CB,CC,CF,CFX,CP,CRM,DP
  1. ;E1,FM,GM,NA,P,PI,SxT,TE,TI,VA
  1. MAIN ;AZXRBUG5 PROGRAM CONTROL
  1. ;SET LOCAL VARIABLES
  1. S PG=0 ;INITIALIZE PAGE NUMBER
  1. S LN=0 ;INITIALIZE LINE COUNTER
  1. D INITDRG ;INITIALIZE DRUG VARIABLES
  1. D ^AZXRBUG7 ;CALL INPUT ROUTINE
  1. ;FOR FACILITY & DATE RANGE
  1. I FACBKUP="Y" Q ;FACBKUP= RETURNED FROM
  1. ; ^AZXRBUG7;USER WANTS
  1. ; TO QUIT
  1. D REPORT
  1. D CONT
  1. D KILL
  1. Q
  1. REPORT ;SETUP VALUES TO PREPARE FOR REPORT PRINT (RPTPRT)
  1. ;SET LOCAL VARIABLES
  1. S BORDER1="______________________________________________________________________________________________________________________"
  1. S BORDER2="_____________________________|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|"
  1. S HEADER="Organism |AK |AM |AUG|C |CAX|CB |CC |CF |CFX|CP |CRM|DP |E |FM |GM |NA |P |PI |SxT|TE |TI |VA |"
  1. S %ZIS("B")="" ;DON'T USE HOME AS DEFAULT
  1. ;DEVICE
  1. D ^%ZIS U IO ;OPEN DEVICE
  1. I IO="" Q ;USER WANTS OUT
  1. I IO(0)=IO W !,*7,"This report must be printed.",! G REPORT
  1. D DTCNVRT,HEADING ;PRINT OUT FIRST PAGE HEADING
  1. S ORG="" ;INITIALIZE Organism
  1. F S ORG=$O(^DIZ(1991020,"FOD",FCLTY,ORG)) Q:'ORG S LDATE=FDATE-1 F S LDATE=$O(^DIZ(1991020,"FOD",FCLTY,ORG,LDATE)) D:('LDATE)!(LDATE>TDATE) RPTPRT Q:('LDATE)!(LDATE>TDATE) S DA="" F S DA=$O(^DIZ(1991020,"FOD",FCLTY,ORG,LDATE,DA)) Q:'DA D INCRMNT
  1. ;DO SEARCH LOOP
  1. ;CALL REPORT PRINT
  1. X ^%ZIS("C") ;CLOSE DEVICE
  1. Q
  1. RPTPRT ;ACTUAL PRINTING OF REPORT DATA
  1. ;SETTING DRUG SENSITIVITY PERCENTAGES
  1. I (LN+4)>IOSL D HEADING ;CHECK IF NEW PAGE IS NEEDED
  1. D EXTORG ;CONVERT Organism_Name TO
  1. ;EXTERNAL FORMAT
  1. ;PRINT Organism_Name
  1. I AK S %AK=((%AK*100)/(AK)) ;SET DRUG SENSITIVITY
  1. I AM S %AM=((%AM*100)/(AM)) ;PERCENTAGES
  1. I AUG S %AUG=((%AUG*100)/(AUG))
  1. I C S %C=((%C*100)/(C))
  1. I CAX S %CAX=((%CAX*100)/(CAX))
  1. I CB S %CB=((%CB*100)/(CB))
  1. I CC S %CC=((%CC*100)/(CC))
  1. I CF S %CF=((%CF*100)/(CF))
  1. I CFX S %CFX=((%CFX*100)/(CFX))
  1. I CP S %CP=((%CP*100)/(CP))
  1. I CRM S %CRM=((%CRM*100)/(CRM))
  1. I DP S %DP=((%DP*100)/(DP))
  1. I E1 S %E1=((%E1*100)/(E1))
  1. I FM S %FM=((%FM*100)/(FM))
  1. I GM S %GM=((%GM*100)/(GM))
  1. I NA S %NA=((%NA*100)/(NA))
  1. I P S %P=((%P*100)/(P))
  1. I PI S %PI=((%PI*100)/(PI))
  1. I SxT S %SxT=((%SxT*100)/(SxT))
  1. I TE S %TE=((%TE*100)/(TE))
  1. I TI S %TI=((%TI*100)/(TI))
  1. I VA S %VA=((%VA*100)/(VA))
  1. ;PRINT DRUG SENSITIVITY PERCENTAGES
  1. W ?28,"%|",?30,$J(%AK,3,0),"|",?34,$J(%AM,3,0),"|"
  1. W ?38,$J(%AUG,3,0),"|",?42,$J(%C,3,0),"|",?46,$J(%CAX,3,0),"|"
  1. W ?50,$J(%CB,3,0),"|",?54,$J(%CC,3,0),"|",?58,$J(%CF,3,0),"|"
  1. W ?62,$J(%CFX,3,0),"|",?66,$J(%CP,3,0),"|",?70,$J(%CRM,3,0),"|"
  1. W ?74,$J(%DP,3,0),"|",?78,$J(%E1,3,0),"|",?82,$J(%FM,3,0),"|"
  1. W ?86,$J(%GM,3,0),"|",?90,$J(%NA,3,0),"|",?94,$J(%P,3,0),"|"
  1. W ?98,$J(%PI,3,0),"|",?102,$J(%SxT,3,0),"|",?106,$J(%TE,3,0),"|"
  1. W ?110,$J(%TI,3,0),"|",?114,$J(%VA,3,0),"|",!
  1. ;PRINT OUT NUMBER TESTED
  1. W ?28,"#|",?30,$J(AK,3,0),"|",?34,$J(AM,3,0),"|"
  1. W ?38,$J(AUG,3,0),"|",?42,$J(C,3,0),"|",?46,$J(CAX,3,0),"|"
  1. W ?50,$J(CB,3,0),"|",?54,$J(CC,3,0),"|",?58,$J(CF,3,0),"|"
  1. W ?62,$J(CFX,3,0),"|",?66,$J(CP,3,0),"|",?70,$J(CRM,3,0),"|"
  1. W ?74,$J(DP,3,0),"|",?78,$J(E1,3,0),"|",?82,$J(FM,3,0),"|"
  1. W ?86,$J(GM,3,0),"|",?90,$J(NA,3,0),"|",?94,$J(P,3,0),"|"
  1. W ?98,$J(PI,3,0),"|",?102,$J(SxT,3,0),"|",?106,$J(TE,3,0),"|"
  1. W ?110,$J(TI,3,0),"|",?114,$J(VA,3,0),"|",!
  1. ;INITIALIZE DRUG VARIABLES
  1. D INITDRG
  1. W BORDER2,!
  1. S LN=LN+4 ;INCREMENT LINE COUNT
  1. Q
  1. DTCNVRT ;CONVERT TDATE & FDATE TO EXTERNAL FORMAT (RTDATE, RFDATE)
  1. S Y=FDATE ;CONVERT TO EXTERNAL DATE
  1. D DD^%DT ;VALUE RETURNED IN Y
  1. S RFDATE=Y ;RFDATE= REPORT DATE
  1. S Y=TDATE ;CONVERT TO EXTERNAL DATE
  1. D DD^%DT ;VALUE RETURNED IN Y
  1. S RTDATE=Y ;RTDATE= REPORT DATE
  1. Q
  1. EXTORG ;CONVERT Organism_Name TO EXTERNAL FORMAT FOR PRINTING
  1. S ORGCHK=ORG ;ORGCHK= Organism_Name
  1. S DIC(0)="NXZ" ;N= INTERNAL NUMBER LOOKUP
  1. ;X= EXACT MATCH REQUIRED
  1. ;Z= VALUES RETURNED IN Y=N^S
  1. ; N= INTERNAL ENTRY NUMBER
  1. ; S= VALUE OF .01 FIELD
  1. S DIC="^DIZ(1991018," ;DIC= ORGANISM FILE
  1. S X=ORGCHK ;X= LOOKUP VALUE (ORG)
  1. D ^DIC ;DO FILEMAN LOOKUP
  1. S ORGCHK=$P(^DIZ(1991018,$P(Y,U,1),0),U,1)
  1. ;ORGCHK= Organism_Name
  1. W !,$E(ORGCHK,1,27) ;PRINT Organism_Name
  1. Q
  1. INCRMNT ;INCREMENT ALL VARIABLES FOR % SENSITIVE, # TESTED
  1. S ZERONODE=^DIZ(1991020,DA,0) ;ZERONODE= CURRENT ENTRY
  1. ;INCREMENT # SENSITIVE & INCREMENT # TESTED
  1. I $P(ZERONODE,U,6)="S" S %AK=%AK+1,AK=AK+1
  1. I $P(ZERONODE,U,6)="R" S AK=AK+1
  1. I $P(ZERONODE,U,8)="S" S %AM=%AM+1,AM=AM+1
  1. I $P(ZERONODE,U,8)="R" S AM=AM+1
  1. I $P(ZERONODE,U,7)="S" S %AUG=%AUG+1,AUG=AUG+1
  1. I $P(ZERONODE,U,7)="R" S AUG=AUG+1
  1. I $P(ZERONODE,U,14)="S" S %C=%C+1,C=C+1
  1. I $P(ZERONODE,U,14)="R" S C=C+1
  1. I $P(ZERONODE,U,11)="S" S %CAX=%CAX+1,CAX=CAX+1
  1. I $P(ZERONODE,U,11)="R" S CAX=CAX+1
  1. I $P(ZERONODE,U,9)="S" S %CB=%CB+1,CB=CB+1
  1. I $P(ZERONODE,U,9)="R" S CB=CB+1
  1. I $P(ZERONODE,U,16)="S" S %CC=%CC+1,CC=CC+1
  1. I $P(ZERONODE,U,16)="R" S CC=CC+1
  1. I $P(ZERONODE,U,13)="S" S %CF=%CF+1,CF=CF+1
  1. I $P(ZERONODE,U,13)="R" S CF=CF+1
  1. I $P(ZERONODE,U,10)="S" S %CFX=%CFX+1,CFX=CFX+1
  1. I $P(ZERONODE,U,10)="R" S CFX=CFX+1
  1. I $P(ZERONODE,U,15)="S" S %CP=%CP+1,CP=CP+1
  1. I $P(ZERONODE,U,15)="R" S CP=CP+1
  1. I $P(ZERONODE,U,12)="S" S %CRM=%CRM+1,CRM=CRM+1
  1. I $P(ZERONODE,U,12)="R" S CRM=CRM+1
  1. I $P(ZERONODE,U,19)="S" S %DP=%DP+1,DP=DP+1
  1. I $P(ZERONODE,U,19)="R" S DP=DP+1
  1. I $P(ZERONODE,U,17)="S" S %E1=%E1+1,E1=E1+1
  1. I $P(ZERONODE,U,17)="R" S E1=E1+1
  1. I $P(ZERONODE,U,21)="S" S %FM=%FM+1,FM=FM+1
  1. I $P(ZERONODE,U,21)="R" S FM=FM+1
  1. I $P(ZERONODE,U,18)="S" S %GM=%GM+1,GM=GM+1
  1. I $P(ZERONODE,U,18)="R" S GM=GM+1
  1. I $P(ZERONODE,U,20)="S" S %NA=%NA+1,NA=NA+1
  1. I $P(ZERONODE,U,20)="R" S NA=NA+1
  1. I $P(ZERONODE,U,22)="S" S %P=%P+1,P=P+1
  1. I $P(ZERONODE,U,22)="R" S P=P+1
  1. I $P(ZERONODE,U,23)="S" S %PI=%PI+1,PI=PI+1
  1. I $P(ZERONODE,U,23)="R" S PI=PI+1
  1. I $P(ZERONODE,U,24)="S" S %SxT=%SxT+1,SxT=SxT+1
  1. I $P(ZERONODE,U,24)="R" S SxT=SxT+1
  1. I $P(ZERONODE,U,25)="S" S %TE=%TE+1,TE=TE+1
  1. I $P(ZERONODE,U,25)="R" S TE=TE+1
  1. I $P(ZERONODE,U,26)="S" S %TI=%TI+1,TI=TI+1
  1. I $P(ZERONODE,U,26)="R" S TI=TI+1
  1. I $P(ZERONODE,U,27)="S" S %VA=%VA+1,VA=VA+1
  1. I $P(ZERONODE,U,27)="R" S VA=VA+1
  1. Q
  1. HEADING ;PRINT OUT THE HEADING FOR EACH NEW PAGE
  1. I PG>0 W # ;SEND FORMFEED
  1. S PG=PG+1 ;INCREMENT PAGE COUNTER
  1. W !,BORDER1,!
  1. W !,"BugDrug2 Antibiotic Sensitivity"
  1. W ?64,"From Date: ",RFDATE,?91,"--",?97,"To Date: ",RTDATE
  1. W !!,"Facility: ",FAC,?100,"Page: ",PG
  1. W !,BORDER1
  1. W !!,HEADER
  1. W !,BORDER2,!
  1. S LN=10 ;INITIALIZE LINE COUNTER
  1. ;HEADER USES 10 LINES
  1. Q
  1. INITDRG ;INITIALIZE THE DRUG VARIABLES
  1. S %AK=0,%AM=0,%AUG=0,%C=0,%CAX=0,%CB=0,%CC=0,%CF=0,%CFX=0
  1. S %CP=0,%CRM=0,%DP=0,%E1=0,%FM=0,%GM=0,%NA=0,%P=0,%PI=0
  1. S %SxT=0,%TE=0,%TI=0,%VA=0
  1. S AK=0,AM=0,AUG=0,C=0,CAX=0,CB=0,CC=0,CF=0,CFX=0
  1. S CP=0,CRM=0,DP=0,E1=0,FM=0,GM=0,NA=0,P=0,PI=0
  1. S SxT=0,TE=0,TI=0,VA=0
  1. ;INITIALIZE DRUG VARIABLES
  1. Q
  1. CONT ;ASK USER WHETHER TO CONTINUE WITH REPORT PRINT
  1. ;SET LOCAL VARIABLES
  1. S PG=0 ;INITIALIZE PAGE COUNTER
  1. S LN=0 ;INITIALIZE LINE COUNTER
  1. D INITDRG ;INITIALIZE DRUG VARIABLES
  1. W !!!!!!!,"Do you want to print another"
  1. R " 'Antibiotic Sensitivity' report? N//",YN
  1. ;ASK USER WHETHER TO CONTINUE?
  1. I YN?1.3"?" W !!,"Answer with: Y= Yes, N= No" G CONT
  1. ;USER WANTS HELP
  1. I (YN?1"Y")!(YN?1"y")!(YN?1"YES")!(YN?1"yes") D ^AZXRBUG7 I FACBKUP="N" D REPORT G CONT
  1. ;FACBKUP= RETURNED FROM
  1. ; ^AZXRBUG7;USER WANTS
  1. ; TO QUIT
  1. Q
  1. KILL ;KILL LOCAL VARIABLES AND EXIT ROUTINE AZXRBUG5
  1. K PG,LN,FACBKUP,BORDER1,BORDER2,HEADER,%ZIS
  1. K LDATE,FCLTY,ORG,DA,%AK,AK,%AM,AM,%AUG,AUG
  1. K %C,C,%CAX,CAX,%CB,CB,%CC,CC,%CF,CF
  1. K %CFX,CFX,%CP,CP,%CRM,CRM,%DP,DP,%E1,E1
  1. K %FM,FM,%GM,GM,%NA,NA,%P,P,%PI,PI
  1. K %SxT,SxT,%TE,TE,%TI,TI,%VA,VA,Y,FDATE,TDATE
  1. K RFDATE,ORGCHK,DIC,ZERONODE,FAC,YN
  1. Q