[% META title = 'Patient » PAS Query' -%]
<h3>
PAS query
</h3>
<p class="warning">TODO: ? tack request_id on end of url to redirect back to request</p>
<p class="info">Require minumum of 2 fields for PAS search:</p>
<form method="post" action="[% app_url %]/pas/do_search">
<div class="indent">
<p>
Last name:
<input type="text" name="last_name" size="10" [% site.html.on_focus %] />
[ [% patient.last_name %] ]
</p>
<p>
First name:
<input type="text" name="first_name" size="10" [% site.html.on_focus %] />
[ [% patient.first_name %] ]
</p>
<p>
Date of Birth:
<input type="text" name="dob" size="10" [% site.html.on_focus %] />
[ [% patient.dob.ymd %] ]
</p>
<p>
Unit Number:
<input type="text" name="unit_number" size="10" [% site.html.on_focus %] />
[ [% unit_numbers.join(' ') %] ]
</p>
<p>
NHS Number:
<input type="text" name="nhs_number" size="10" [% site.html.on_focus %] />
[ [% patient.nhs_number %] ]
</p>
<p>
Post code:
<input type="text" name="post_code" size="10" [% site.html.on_focus %] />
<input type="submit" name="_do_pas_search" value="Go" class="button" />
</p>
</div>
<p>
[% site.html.back_button %]
</p>
<input type="hidden" name="LN" value="[% c.query.param('LN') %]" />
<input type="hidden" name="_patient_id" value="[% patient.id %]" />
</form>
[% IF pas_results %][% # PROCESS dumper.tt dump = pas_results %]
[% IF is_arrayref(pas_results) %]
<h3>
PAS query results [[% pas_results.size %] ]:
</h3>
<table>
<tr>
<th>LastName</th>
<th>FirstName</th>
<th>DoB</th>
<th>PatientNo</th>
<th>NHSNo</th>
<th>Address</th>
<th>Zip</th>
<th>URL</th>
</tr>
[% FOREACH entry IN pas_results %] [% # PROCESS dumper.tt dump = entry %]
<tr>
<td>[% entry.last_name %]</td>
<td>[% entry.first_name %]</td>
<td>[% entry.dob %]</td>
<td>[% entry.unit_number %]</td>
<td>[% entry.nhs_number %]</td>
<td>[% entry.address %]</td>
<td>[% entry.zip %]</td>
<td>
[% SET qs =
'last_name=' _ entry.last_name _ ';' _
'first_name=' _ entry.first_name _ ';' _
'nhs_number=' _ entry.nhs_number _ ';' _
'unit_number=' _ entry.unit_number _ ';' _
'dob=' _ entry.dob
%]
<a href="[% app_url %]/patient/edit_patient/[% patient.id %]?[% qs %]"
class="href">
<img class="href" src="/images/edit.jpg" alt="Edit" title="Edit patient">
</a>
</td>
</tr>
[% END %]
</table>
[% ELSE %]
<p class="info">No PAS matches found.</p>
[% END %]
[% END %]