Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<div style="page-break-after:always"></div>

Example:

Expand
titleExample Complete Code
Code Block
#foreach ($spmn in $allSpecimens)
      <div style="page-break-after: always;"></div>
        #if ($visit.extensionDetail.attrsMap.service_request && $spmn.lineage == 'New' && $spmn.collectionEvent.time && ($spmn.label.startsWith("P1") || $spmn.label.startsWith("P6")))
          <tr>
            <td class="label">First Name</td>
            <td>: <![CDATA[$cpr.participant.firstName]]></td>
          </tr>
          <tr>
            <td class="label">Last Name</td>
            <td>: <![CDATA[$cpr.participant.lastName]]></td>
          </tr>
          <tr>
              <td class="label">MRN</td>
              <td>: <![CDATA[$cpr.participant.empi]]></td>
          </tr>
          <tr>
              <td class="label">Date of Birth</td>
              <td>: $dateOnlyFmt.format($cpr.participant.birthDate)</td>
          </tr>
          <tr>
              <td class="label">Participant ID</td>
              <td>: <![CDATA[$cpr.ppid]]></td>
          </tr>
          <tr>
            <td class="label">PI Name</td>
            <td>: <![CDATA[$cp.principalInvestigator.firstName $cp.principalInvestigator.lastName]]></td>
          </tr> 
          <tr>
            <td class="label">PI Email</td>
            <td>: <![CDATA[$cp.principalInvestigator.emailAddress]]></td>
          </tr>
          #foreach ($request in $visit.extensionDetail.attrsMap.service_request)
              #if (($spmn.label.startsWith("P1") && $request.service_requested == 'DNA Extraction') || ($spmn.label.startsWith("P6") && $request.service_requested == 'PBMC Processing'))
                <tr>
                  <td class="label">Service Requested</td>
                  <td>: <![CDATA[$request.service_requested]]></td>
                </tr>
                <tr>
                  <td class="label">Number of tubes</td>
                  <td>: <![CDATA[$request.number_of_tubes]]></td>                 
                </tr>
                <tr>
                  <td class="label">Volume in each tube</td>
                  <td>: <![CDATA[$request.volume_in_each_tube2]]></td>
                </tr>
                <tr>
                  <td class="label">Collection Date</td>
                  <tr>: <![CDATA[$dateFmt.format($spmn.collectionEvent.time)]]></tr>
                </tr>
                #if ($request.comments)
                  <tr>
                    <td class="label">Comments</td>
                    <td>: <![CDATA[$request.comments]]></td>
                  </tr>
                #end
              #end
          #end	
          <tr>
            <td>----------------------------------------------------------------------------------</td>
            <td>-----------------------------------------</td>  
          </tr>				
        #end
    #end

...

View file
namenew_page_example.pdf

4. Is it possible to sort the specimen table in order manifest based on the ascending order of PPID? 

Ans: Yes. You need to implement the sorting function directly within the HTML template as shown below.

Syntax

Code Block
#set($numItems = $items.size())
#set($range = $numItems - 1)
#foreach ($i in [0..$range])
  #set($subRange = $range - $i - 1)
  #if ($subRange >= 0)
    #foreach ($j in [0..$subRange])
      #if ($items.get($j).specimen.ppid.compareTo($items.get($j + 1).specimen.ppid) > 0)
        #set ($temp = $items[$j])
        #set ($items[$j] = $items[$j + 1])
        #set ($items[$j + 1] = $temp)
      #end
    #end
  #end
#end

Example:

Expand
titleComplete code
Code Block
#set($numItems = $items.size())
#set($range = $numItems - 1)
#foreach ($i in [0..$range])
  #set($subRange = $range - $i - 1)
  #if ($subRange >= 0)
    #foreach ($j in [0..$subRange])
      #if ($items.get($j).specimen.ppid.compareTo($items.get($j + 1).specimen.ppid) > 0)
        #set ($temp = $items[$j])
        #set ($items[$j] = $items[$j + 1])
        #set ($items[$j + 1] = $temp)
      #end
    #end
  #end
#end

<html>
  <head>
    <style>
      @page {
        size: A4 portrait;
        margin: 20mm 15mm;

        @top-left {
          content: element(top-left);
          padding: 1mm;
          border: 1px solid white;
          background: transparent;
        }

        @top-right {
          content: element(top-right);
          text-align: right;
        }

        @bottom-right {
          content: counter(page) " of " counter(pages);
        }
      }

      .order-info:after {
        clear: both;
        content: ' ';
        display: block;
      }

      .order-info table {
        border-collapse: collapse;
        border-spacing: 0;
        margin-bottom: 20px;
        width: 60%;
        float: left;
      }

      .order-info table td.label {
        font-weight: bold;
      }

      .order-info .barcode {
        float: right;
        width: 40%;
      }

      .order-info .barcode img {
        display: block;
        width: 100%;
      }

      table.specimens {
        -fs-table-paginate: paginate;
        width: 100%;
        border-collapse: collapse;
        border-spacing: 0;
        margin-bottom: 20px;
      }

      table.specimens tr {
        page-break-inside: avoid;
      }

      table.specimens td {
        padding: 15px;
        border: 1px solid black;
        word-wrap: break-word;
      }

      table.specimens th {
        padding: 15px;
        background: #eee;
        border: 1px solid black;
        text-align: center;
        font-weight: 400;
        font-size: 16px;
      }

      .title, .sub-title {
        text-align: center;
        width: 100%;
      }

      #top-left {
        position: running(top-left);
      }

      #top-right {
        position: running(top-right);
        text-align: right;
        display: block;
      }
    </style>

    <title>Order manifest</title>
  </head>

  <body>
    <span id="top-left">
      <img src="$appUrl/images/os_email_logo.png"></img>
    </span>

    <span id="top-right"><![CDATA[$dp.shortTitle]]></span>

    <h3 class="title"><![CDATA[$dp.shortTitle]]></h3>
    <h4 class="sub-title">Order Manifest</h4>
    <hr></hr>

    <div class="order-info">
          
      <table>
        <tbody>
          <tr>
            <td class="label">Order ID</td>
            <td>: $order.id</td>
          </tr>
          <tr>
            <td class="label">Requester</td>
            <td>:
              <span><![CDATA[$order.requester.firstName]]></span>
              <span><![CDATA[$order.requester.lastName]]></span>
            </td>
          </tr>
          #if ($order.status == 'EXECUTED')
            <tr>
              <td class="label">Distributor</td>
              <td>:
                <span><![CDATA[$order.distributor.firstName]]></span>
                <span><![CDATA[$order.distributor.lastName]]></span>
              </td>
            </tr>
          #end
          #if ($order.siteName)
            <tr>
              <td class="label">Receiving Site</td>
              <td>: <![CDATA[$order.siteName ($order.instituteName)]]> </td>
            </tr>
          #end
          <tr>
            <td class="label">Status</td>
            <td>:
              #if ($order.status == 'EXECUTED')
                <span>Executed</span>
              #else
                <span>Draft</span>
              #end
            </td>
          </tr>
          #if ($order.status == 'EXECUTED')
            <tr>
              <td class="label">Distribution Date</td>
              <td>: $dateFmt.format($order.executionDate) </td>
            </tr>
          #end
          #if ($order.trackingUrl)
            <tr>
              <td class="label">Tracking URL</td>
              <td>: <![CDATA[$order.trackingUrl]]> </td>
            </tr>
          #end
        </tbody>
      </table>
      <div class="barcode">
        #if ($order.name)
          <img src="data:image/png;base64, $barcodeGenerator.base64Png('CODE_128', $order.name, 0, 40)"></img>
        #end
      </div>
    </div>

    <hr></hr>

    <h3> Specimens </h3>

    <table class="specimens">
      <thead>
        <tr>
          <th>Label</th>
          <th>Lineage</th>
          <th>Type</th>
          <th>Collection Protocol</th>
          <th>PPID</th>
          <th>Visit Name</th>
          <th>Tracking URL</th>
          <th>Status</th>
        </tr>
      </thead>

      <tbody>
        #foreach ($item in $items)
          <tr>
            <td>
              <span><![CDATA[$item.specimen.label]]></span>
            </td>
            <td>
              <span><![CDATA[$item.specimen.lineage]]></span>
            </td>
            <td>
              <span><![CDATA[$item.specimen.type]]></span>
            </td>
            <td>
              <span><![CDATA[$item.specimen.cpShortTitle]]></span>
            </td>
            <td>
              <span><![CDATA[$item.specimen.ppid]]></span>
            </td>
            <td>
              <span><![CDATA[$item.specimen.visitName]]></span>
            </td>
            <td>
              <span><![CDATA[$order.trackingUrl]]></span>
            </td>
            <td>
              #if ($item.status == 'DISTRIBUTED')
                <span>Distributed</span>
              #elseif ($item.status == 'DISTRIBUTED_AND_CLOSED')
                <span>Distributed &amp; Closed</span>
              #elseif ($item.status == 'RETURNED')
                <span>Returned</span>
              #end
            </td>
          </tr>
        #end
      </tbody>
    </table>
  </body>
</html>

View file
namesortingSpecimenTablebyPPID.html