Changeset 5732


Ignore:
Timestamp:
Nov 19, 2019, 11:23:33 AM (3 years ago)
Author:
olle
Message:

Refs #1029. Referral form generation updated in generation of referral forms for project NordicTrip:
a. The form type identification suffix added after the referral ID in the bar code for referral forms with label stickers should consist of a single lower-case letter.
b. The whole blood forms (except that for clinical testing, that should not have any bar code or text added) bar code text of label stickers 7 and 8 from the left (the referral form sheet contains 9 label stickers) should have an added suffix "1" and "2" at the end of the the bar code text. The bar code width should not exceed 17mm, to fit on the used test tubes.

  1. Java servlet class/file ReferralGeneratorServlet.java in src/net/sf/basedb/meludi/servlet/ updated:
    a. New private static HashMap<String,String> refFormTemplTypeIdentSuffixHM defined.
    b. Protected method void doGet(HttpServletRequest req, HttpServletResponse resp) updated to call new private method void initializeRefFormTemplTypeIdentSuffixHashMap(SessionControl sc).
    c. New private method void initializeRefFormTemplTypeIdentSuffixHashMap(SessionControl sc) added. It maps a two- or three-letter form type identification string to a single lower-case letter.
    d. Private method PdfUtil createBarcodeStickerForm(DbControl dc, PdfUtil pdfUtil, File pdfFile, String itemId, String formTemplateName, List<String> formTemplateFileList) updated for the NordicTrip project to obtain a two- or three-letter form type identification string from the form template filename, and then call private static HashMap<String,String> refFormTemplTypeIdentSuffixHM to obtain a single lower-case letter to use as form type identification suffix. Also, the bar code text of label stickers 7 and 8 from the left (the referral form sheet contains 9 label stickers) will have an added suffix "1" and "2" at the end of the the bar code text. The bar code on these labels have been modified to not have a width larger then 17mm.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.meludi/trunk/src/net/sf/basedb/meludi/servlet/ReferralGeneratorServlet.java

    r5727 r5732  
    161161
    162162  private static HashMap<String,String> refFormTemplNameStartHM;
     163  private static HashMap<String,String> refFormTemplTypeIdentSuffixHM;
    163164  private static int SITE_PREFIX_LENGTH_DEFAULT = 2;
    164165  private int sitePrefixLength = SITE_PREFIX_LENGTH_DEFAULT;
     
    195196    }
    196197    initializeRefFormTemplNameStartHashMap(sc);
     198    initializeRefFormTemplTypeIdentSuffixHashMap(sc);
     199
    197200    String progressId = "";
    198201    System.out.println("ReferralGeneratorServlet::doGet(): cmd = " + cmd + " After initialization");
     
    12211224  }
    12221225
     1226  private void initializeRefFormTemplTypeIdentSuffixHashMap(SessionControl sc)
     1227  {
     1228    System.out.println("ReferralGeneratorServlet::initializeRefFormTemplTypeIdentSuffixHashMap(): Start");
     1229    DbControl dc = sc.newDbControl();
     1230    Project activeProject = Project.getById(dc, sc.getActiveProjectId());
     1231    String projectName = activeProject.getName();
     1232    refFormTemplTypeIdentSuffixHM = new HashMap<>();
     1233    if (projectName.equals("NordicTrip"))
     1234    {
     1235      refFormTemplTypeIdentSuffixHM.put("B0B", "a");
     1236      refFormTemplTypeIdentSuffixHM.put("B0C", "b");
     1237      refFormTemplTypeIdentSuffixHM.put("T0A", "c");
     1238      refFormTemplTypeIdentSuffixHM.put("T0B", "d");
     1239      refFormTemplTypeIdentSuffixHM.put("B1A", "e");
     1240      refFormTemplTypeIdentSuffixHM.put("B1B", "f");
     1241      refFormTemplTypeIdentSuffixHM.put("T1A", "g");
     1242      refFormTemplTypeIdentSuffixHM.put("T1B", "h");
     1243      refFormTemplTypeIdentSuffixHM.put("B2", "i");
     1244      refFormTemplTypeIdentSuffixHM.put("T3A", "j");
     1245      refFormTemplTypeIdentSuffixHM.put("T3B", "k");
     1246      refFormTemplTypeIdentSuffixHM.put("B4", "m");
     1247      refFormTemplTypeIdentSuffixHM.put("B5", "n");
     1248      refFormTemplTypeIdentSuffixHM.put("B6", "p");
     1249      refFormTemplTypeIdentSuffixHM.put("T6", "q");
     1250    }
     1251    System.out.println("ReferralGeneratorServlet::initializeRefFormTemplTypeIdentSuffixHashMap(): End");
     1252    dc.close();
     1253  }
     1254
    12231255  /**
    12241256   * Returns path to be used for referral start info file.
     
    22002232    }
    22012233    System.out.println("ReferralGeneratorServlet::createBarcodeStickerForm(): pdfFile.getName() = " + pdfFile.getName() + " itemId = " + itemId + " formTemplateFileList = " + formTemplateFileList);
    2202     if (!formTemplateFileList.contains(pdfFile.getName()))
    2203     {
    2204       formTemplateFileList.add(pdfFile.getName());
     2234    String pdfFilename = pdfFile.getName();
     2235    if (!formTemplateFileList.contains(pdfFilename))
     2236    {
     2237      formTemplateFileList.add(pdfFilename);
    22052238    }
    22062239    InputStream pdfInStream = pdfFile.getDownloadStream(0);
     
    22252258    }
    22262259
     2260    // Referral form identification suffix for NordicTrip project
     2261    String refFormIdentSuffix = "";
     2262    if (projectName.equals("NordicTrip"))
     2263    {
     2264      // Find form type suffix from form template filename
     2265      String formTypeSuffix = "";
     2266      if (pdfFilename.indexOf("_blood") > -1)
     2267      {
     2268        formTypeSuffix = "B";
     2269      }
     2270      else if (pdfFilename.indexOf("_Tissue") > -1)
     2271      {
     2272        formTypeSuffix = "T";
     2273      }
     2274      // Find form number suffix
     2275      String formNumberSuffix = "";
     2276      int usIndex;
     2277      usIndex = pdfFilename.lastIndexOf("_");
     2278      if (usIndex > -1)
     2279      {
     2280        // Get part of filename after last underscore
     2281        formNumberSuffix = pdfFilename.substring(usIndex + 1);
     2282        // Get part of form number suffix before first dot "."
     2283        int dotIndex;
     2284        dotIndex = formNumberSuffix.indexOf(".");
     2285        if (dotIndex > -1)
     2286        {
     2287          formNumberSuffix = formNumberSuffix.substring(0, dotIndex);
     2288        }
     2289      }
     2290      // Construct referral form identification suffix
     2291      refFormIdentSuffix = formTypeSuffix + formNumberSuffix;
     2292      // Map original referral from identification string to single lower-case letter suffix
     2293      refFormIdentSuffix = refFormTemplTypeIdentSuffixHM.get(refFormIdentSuffix);
     2294     
     2295      itemId = itemId + refFormIdentSuffix;
     2296    }
     2297   
    22272298    // Whole blood form flag
    22282299    Boolean wholeBloodFormFlag = false;
     2300    String wholeBloodLabelSuffixStart = ".b";
     2301    float wholeBloodLabelBarcodeWidth = 61.7f;
     2302    float wholeBloodLabelBarcodeHeight = 13.5f;
    22292303    if (formTemplateName.equals(REF_FORM_TEMPLATE_WHOLE_BLOOD))
    22302304    {
    22312305      wholeBloodFormFlag = true;
    22322306    }
    2233     if (projectName.equals("NordicTrip") && (pdfFile.getName().indexOf("_blood") > -1))
     2307    if (projectName.equals("NordicTrip") && (pdfFilename.indexOf("_blood") > -1))
    22342308    {
    22352309      wholeBloodFormFlag = true;
     2310      wholeBloodLabelSuffixStart = "";
     2311      wholeBloodLabelBarcodeWidth = 48.5f;
     2312      wholeBloodLabelBarcodeHeight = 16.7f;
    22362313    }
    22372314
     
    23002377        if (i >= bloodLabelStartNo && i <= bloodLabelStopNo)
    23012378        {
    2302           text = itemId + ".b" + (i - bloodLabelStartNo + 1);
     2379          text = itemId + wholeBloodLabelSuffixStart + (i - bloodLabelStartNo + 1);
    23032380        }
    23042381      }
     
    23122389    // Barcode on labels
    23132390    String labelText = itemId;
    2314     float labelBarcodeWidth = 61.7f;
    2315     float labelBarcodeHeight = 13.5f;
     2391    float labelBarcodeWidthNormal = 61.7f;
     2392    float labelBarcodeHeightNormal = 13.5f;
    23162393    float rotationDegrees = 90.0f;
    2317     float xLabelBarcodeLeft = 67.8f;
     2394    float xLabelBarcodeLeftNormal = 67.8f;
    23182395    float yLabelBarcodeLeft = 72.5f;
    23192396    align = Element.ALIGN_LEFT;
     
    23212398    {
    23222399      labelText = itemId;
     2400      float labelBarcodeWidth = labelBarcodeWidthNormal;
     2401      float labelBarcodeHeight = labelBarcodeHeightNormal;
     2402      float xLabelBarcodeLeft =  xLabelBarcodeLeftNormal;
    23232403      if (wholeBloodFormFlag)
    23242404      {
    23252405        if (i >= bloodLabelStartNo && i <= bloodLabelStopNo)
    23262406        {
    2327           labelText = itemId + ".b" + (i - bloodLabelStartNo + 1);
     2407          labelText = itemId + wholeBloodLabelSuffixStart + (i - bloodLabelStartNo + 1);
     2408          labelBarcodeWidth = wholeBloodLabelBarcodeWidth;
     2409          labelBarcodeHeight = wholeBloodLabelBarcodeHeight;
     2410          xLabelBarcodeLeft = xLabelBarcodeLeftNormal - (labelBarcodeHeight - labelBarcodeHeightNormal);
    23282411        }
    23292412      }
    23302413      float xLabelBarcodeLeft2 = xLabelBarcodeLeft + i*xLowerLeftDiff + xDiffSpecArr[i];
     2414      float xLabelBarcodeLeft2Normal = xLabelBarcodeLeftNormal + i*xLowerLeftDiff + xDiffSpecArr[i];
    23312415      pdfUtil.addBarcode(labelText, xLabelBarcodeLeft2, yLabelBarcodeLeft, labelBarcodeWidth, labelBarcodeHeight, align, rotationDegrees);
    23322416      // Barcode label text
    2333       float xLabelTextLeft = xLabelBarcodeLeft2 + 22.0f;
     2417      //float xLabelTextLeft = xLabelBarcodeLeft2 + 22.0f;
     2418      float xLabelTextLeft = xLabelBarcodeLeft2Normal + 22.0f;
    23342419      float yLabelTextLeft = yLabelBarcodeLeft;
    23352420      float labelTextFontSize = 9.0f;
Note: See TracChangeset for help on using the changeset viewer.