<!-- BEGIN site/previous_cases.tt -->
  [% IF previous_cases.size %]
    <p class="title">Other records
      [[% previous_cases.this_id.size || 0 %] + [% previous_cases.others.size || 0 %]]:
	  [% div_name = 'previous'; INCLUDE site/snippets/toggleview.tt %]
    </p>

    <div id="[% div_name %]" class="itemhidden">
      <div class="indent">
        <table class="results">
        [% FOREACH data IN previous_cases.this_id %]
          <tr>
            <td align="right">[% PROCESS site/lab_number.tt
                want_url = 1, query_modifiers = [ '_return=1' ] %]
            </td>
            <td>[% data.request_report.diagnosis.name %]</td>
          </tr>
        [% END %]
        </table>
        
        [% IF previous_cases.others.size # possible matches:
			# AND NOT is_outreach # requires NHS number so have unique ID %]
          <p><i>Possible matches</i>:</p>
          <div class="indent">
            <table class="results">
            [% FOREACH data IN previous_cases.others %]
              <tr>
                <td align="right">[% PROCESS site/lab_number.tt
                    want_url = 1, query_modifiers = [ '_return=1' ] %]
                </td>
                <td>[% data.request_report.diagnosis.name %]</td>
              </tr>
            [% END %]
            </table>
          </div>
        [% END %]
      </div>
    </div>
    
    [% ELSE %]
      <p class="info">No previous patient matches found</p>
    [% END %]
<!-- END site/previous_cases.tt -->