RSS Git Download  Clone
Raw Blame History
<!-- BEGIN worklist/local/pre_screen.tt -->
  [% META title = 'Worklist &raquo; Pre-screen' -%]

  [% # PROCESS dumper.tt dump = flow_screen_data %]
  [% # PROCESS dumper.tt dump = specimen_map %]
  [% # PROCESS dumper.tt dump = request_section_notes_map %]
  [% # PROCESS dumper.tt dump = unregistered_cases %]
  [% # PROCESS dumper.tt dump = unregistered_request_lab_tests %]
  
  <h3 class="header">Pre-screen worklist</h3>

  [% # define some data structures:
    headers = [ 'LabNo' 'Sample' 'Surname' 'DoB' 'PCS' 'BLS' 'SCS' 'TLS' 'RIT'
      'OUT' 'Date/Details'];
      
    lab_tests_map = {
      plasma_cell => 'PCS',
      b_lymphoid  => 'BLS',
      stem_cell   => 'SCS',
      t_lymphoid  => 'TLS',
      rituximab   => 'RIT',
      outreach    => 'OUT',
    };
    
    col_names = [ 'PCS' 'BLS' 'SCS' 'TLS' 'RIT' 'OUT' ];
  %]
  
  [% lot_numbers = BLOCK # define lot numbers block for re-use %]
    <tr>
      <td colspan="3" class="borderless"></td>
      <td class="borderless">LOT No:</td>
      [% FOREACH i IN [1 .. 6] %]<td></td>[% END %]
      <td colspan="3" class="borderless"></td>
    </tr>
  [% END %]  

  [% IF flow_screen_data.size || unregistered_cases.size %]
  <table class="indent">
    [% lot_numbers %]
    <tr>
      [% FOREACH item IN headers %]<th>[% item %]</th>[% END %]
      <td class="borderless"></td>
    </tr>
     	
    [% FOREACH entry IN flow_screen_data.keys.sort; # PROCESS dumper.tt dump = entry;
      import( flow_screen_data.item(entry) );
      # PROCESS dumper.tt dump = request_id;
      # PROCESS dumper.tt dump = lab_tests;
    %] 
    <tr>
      <td>
        <a href="[% app_url %]/search/=/[% request_id %]">[% entry %]</a>
      </td>
      <td>[% specimen_map.item(request_id).sample_code.join(', ') %]</td>
      <td>[% patient.last_name  | upper %]</td>
      <td>[% # empty DoB field %]</td>
      [% FOREACH col_name IN col_names; # BLS, TLC, PCS, etc %]
      <td align="center">
        [% FOREACH test IN lab_tests; # array of lab_test data from flow_screen_data
            abbreviated_test_name = lab_tests_map.item(test.name); # BLS, TLS, etc
            NEXT UNLESS abbreviated_test_name == col_name;
        %]
          [% IF test.status.match('new') %]x
          [% ELSE %]
			<span class="acronym" title="[% test.user.username | upper %]">
				<img src="/images/tick.gif" />
			</span>
          [% END %]
        [% END %]
      </td>
      [% END %]
      <td>
        [% request_section_notes_map.item(request_id) %]
      </td>
      <td class="borderless" colspan="2"></td>
    </tr>
    [% END %]
    
    [% FOREACH entry IN unregistered_cases; # can have multiple specimens, or none:
        IF entry.pre_registration_specimen; # has had initial processing:
          FOREACH reg_specimen IN entry.pre_registration_specimen;
            PROCESS worklist/local/preregistration/specimen_row.tt;
          END;
        ELSE; # not yet had specimen(s) allocated:
          PROCESS worklist/local/preregistration/no_specimen_row.tt;
        END;
      END;
    %]
    
    [% lot_numbers %]
  </table>
  [% ELSE %]
	<p class="info indent">No outstanding pre-screen requests</p>
  [% END %]