[% META title = 'Patient » PDS Query' -%] [% # PROCESS dumper.tt dump = patient.as_tree %] [% IF pds_query; # PROCESS dumper.tt dump = pds_query; patient_id = c.query.param('_patient_id'); # means matching patient found return_link = patient_id ? '/select_patient/' _ patient_id # back to registration form : ''; # triggers new patient registration %] [% IF is_code_ref(pds_query).match('HASH'); %]
| LastName | FirstName | DoB | Gender | NHSNo | Address | Post Code | |
|---|---|---|---|---|---|---|---|
| [% pds_query.last_name %] | [% pds_query.first_name %] | [% pds_query.dob %] | [% pds_query.gender %] | [% pds_query.nhs_number %] | [% pds_query.home_address %] | [% pds_query.post_code %] |
[% # split DoB into components:
ymd = pds_query.dob.split('-'); # PROCESS dumper.tt dump = ymd;
params = {
last_name => pds_query.last_name,
first_name => pds_query.first_name,
middle_name => pds_query.middle_name,
nhs_number => pds_query.nhs_number,
gender => pds_query.gender,
year => ymd.0,
month => ymd.1,
day => ymd.2,
# add ref_src_id passed in via hidden field:
referral_source_id => c.query.param('referral_source_id'),
};
%]
[%
IF patient.id; # ie patient exists in patient table
my_params = [];
fields = [ 'last_name' 'first_name' 'middle_name' 'nhs_number'
'gender' 'year' 'month' 'day' ];
FOREACH entry IN fields; # only want selected fields from params:
my_params.push(entry _ '=' _ params.$entry);
END;
%]
[% ELSE;
my_params = [];
FOREACH pair IN params.pairs; # want all params:
my_params.push(pair.key _ '=' _ pair.value);
END;
%]
[% END %]
|
| Not the above - continue » | |||||||
PDS returned: [% error_code %] [% error_str %] [% IF error_code.match('timeout') # LIMS error msg, not PDS error code %] please repeat query below, or skip PDS query » [% ELSE %]please refine query and repeat:[% END %]
[% END %] [% ELSE # pds_query isn't an arrayref %][% pds_query %] No PDS matches found :: continue »
[% END %] [% END %]Mandatory fields last-name, gender & dob for PDS query:
[% BLOCK row %]