[% # PROCESS dumper.tt dump = history.reported.time %] [% # PROCESS dumper.tt dump = required_fields %] [% # PROCESS dumper.tt dump = has_optional %] [% # PROCESS dumper.tt dump = report_data %] [% # PROCESS dumper.tt dump = request_data %] [% # PROCESS dumper.tt dump = draft_reports %] [% # PROCESS dumper.tt dump = draft_report_data %] [% BLOCK required_field %] * [% END %] [% IF draft_reports.size AND NOT history.reported AND NOT is_outreach %]
This request has [% draft_reports.size %] draft report[% 's' IF draft_reports.size > 1 %]:
    [% FOREACH entry IN draft_reports; # INCLUDE dumper.tt dump = entry.as_tree %]
  1. [% entry.user.first_name.ucfirst %] [% entry.user.last_name.upper %] :: [% entry.updated_at.strftime('%d.%b.%Y') %] [ preview ]
  2. [% END %]
[% END %] [% IF spelling_checked AND NOT has_unrecognised.size %]

Spellchecker reports no unrecognised words

[% END %]
[% IF report_data.diagnosis # include diagnosis_id in case amendment: %] [% END %] [% IF want_biopsy_site OR report_data.biopsy_site; sites_list = []; # create array of site names for legacy data FOREACH s IN anatomical_sites; sites_list.push(s.site_name); END; # INCLUDE dumper.tt dump = anatomical_sites %] [% END %] [% IF want_gross_description; # OR request_data.request_gross_description; why?? # can't rely on request_report_view for gross_description as it inner # joins rrd with rsd so using left-join'd rsd as separate table request_gross_description = request_data.request_specimen_detail.gross_description; draft_gross_description = draft_report_data.gross_description; # need to load original request_data gross description first in case also # have a draft gross_description: gross_description = request_gross_description OR draft_gross_description; %] [% END %] [% UNLESS authorisation_request %] [% END %] [% specimen_quality = report_data.specimen_quality; DEFAULT specimen_quality = 'adequate' IF is_genomics; # maybe make hidden field ?? %] [% IF is_outreach # use select menu %] [% UNLESS authorisation_request %] [% END %] [% UNLESS is_outreach %] [% END %] [% IF is_outreach; INCLUDE outreach/followup.tt; ELSIF is_genomics; ''; ELSE; %] [% IF NOT previous_requests.this_id.size AND NOT report_data.status; class = 'bkgd_light_yellow'; unknown_patient = 1; %] [% ELSE; class = 'normal'; END %] [% END %] [% UNLESS authorisation_request OR is_outreach %] [% END %] [% IF history.authorised %] [% ELSIF status_options.authorised.is_active.match('yes') AND ( c.query.param('pre-authorisation-check') OR self_authorisable ) %] [% END %] [% IF have_outstanding_results %] [% END %] [% disable_submit = 0 IF # override disabled submit button if: is_outreach # is Outreach case AND disable_submit # submit button *is* disabled AND NOT is_locked # record not locked AND c.user_can('report'); # use can report %] [% UNLESS disable_submit # set above %] [% END %]
Request notes:
[% INCLUDE required_field IF required_fields.clinical_details %] Request details: [% error_clinical_details %]

Specimen details:
[% INCLUDE required_field %] Anatomical site: [% # get list of biopsy_sites from report_data.biopsy_site field: biopsy_sites = report_data.biopsy_site.split('; '); # will be single entry if no ';' # INCLUDE dumper.tt dump = biopsy_sites; # work out if any biopsy site NOT in sites_list: unrecognised_sites = []; FOREACH s IN biopsy_sites; # INCLUDE dumper.tt dump = s; unrecognised_sites.push(s) UNLESS sites_list.grep('^' _ s _ '$').size; END; # INCLUDE dumper.tt dump = unrecognised_sites; IF unrecognised_sites.size; # load free-text entry: %] [%# this needs to be reversed when legacy cases reported %] [% error_biopsy_site %] [% ELSE; # no unrecognised sites - load select menu: %]
[% error_biopsy_site; # PROCESS dumper.tt dump = sites_list %]
[% END %] [% IF unrecognised_sites.size %]
WARNING: unrecognised anatomical site
[% END %] [% IF unrecognised_biopsy_site_words.size; PROCESS report/highlight.tt this_text = highlighted_biopsy_site this_field = 'biopsy_site'; PROCESS report/speller.tt list = unrecognised_biopsy_site_words; END; %]
[% INCLUDE required_field %] Gross description: [% error_gross_description %] [% # IF both draft & request_data gross_description, and both different: IF request_gross_description AND draft_gross_description AND request_gross_description != draft_gross_description %]
DRAFT: [% draft_gross_description %]
[% END %] [% IF unrecognised_gross_description_words.size; PROCESS report/highlight.tt this_text = highlighted_gross_description this_field = 'gross_description'; PROCESS report/speller.tt list = unrecognised_gross_description_words; END %]
[% INCLUDE required_field IF required_fields.morphology %] Morphology: [% error_morphology %] [% IF unrecognised_morphology_words.size; PROCESS report/highlight.tt this_text = highlighted_morphology this_field = 'morphology'; PROCESS report/speller.tt list = unrecognised_morphology_words; END %]
[% INCLUDE required_field IF required_fields.specimen_quality %] Specimen quality: [% FOREACH option IN ['good', 'adequate', 'poor']; quality_match = specimen_quality.match(option) ? 1 : 0; %]   [% END %] [% error_specimen_quality %]

Diagnosis details:
[% INCLUDE required_field IF required_fields.diagnosis_id %] Primary diagnosis: [% ELSE; # use autosuggest PROCESS site/autosuggest.tt varname = 'name' param_id = 'diagnosis_id' param_name = 'diagnosis' method_name = 'get_diagnoses' watermark = 'no' # to recover legacy diagnosis if no longer active: optional_params = [ "diagnosis_id=${report_data.diagnosis.id}" ] %]
[% INCLUDE required_field IF required_fields.comment %] Comment: [% error_comment %] [% IF unrecognised_comment_words.size; PROCESS report/highlight.tt this_text = highlighted_comment this_field = 'comment'; PROCESS report/speller.tt list = unrecognised_comment_words; END %]
Secondary diagnosis:

** this patient is unknown to HILIS **
[% INCLUDE required_field IF required_fields.status %] Request status: [% FOREACH option IN [ 'new', 'relapse', 'default' ]; status_match = report_data.status.match(option) ? 1 : 0 %]   [% END %] [% error_status %] [% IF unknown_patient %] « is this a new ICDO diagnosis ? [% END %]
Others: [% IF request_options.teaching.is_active.match('yes') %] Teaching case:   X [% END %]
Report by: [% IF history.reported.user %] [% history.reported.user.first_name | ucfirst; ' '; history.reported.user.last_name | ucfirst %] on [% history.reported.time.strftime('%a %d.%b.%Y @ %H:%M') %] [% ELSE %] [% this_user.first_name | ucfirst %] [% this_user.last_name | ucfirst %] [% END %]
Authorised by: [% history.authorised.user.first_name | ucfirst; ' '; history.authorised.user.last_name | ucfirst; %] on [% history.authorised.time.strftime('%a %d.%b.%Y @ %H:%M') %]
Authorise report: [% IF this_user.username == history.reported.user.username AND NOT self_authorisable; disable_submit = 1 %] *** self-authorisation not permitted *** [% ELSE %] [% END %]
[% IF have_outstanding_tests %]
ACKNOWLEDGE OUTSTANDING TESTS: [% IF error_confirm_outstanding_tests %] [% error_confirm_outstanding_tests %] [% ELSE %] « required [% END %]
[% ELSIF # can't do if outstanding tests ( status_options.authorised.is_active.match('yes') ? history.authorised.time : history.reported.time ) AND NOT data.status_option.description.match('complete') %]
CONFIRM FINAL DIAGNOSIS: BUT DO NOT ISSUE NEW REPORT:
[% # error__diagnosis_id # don't need %] [% END %]
ACKNOWLEDGE OUTSTANDING RESULTS: [% IF error_confirm_outstanding_results %] [% error_confirm_outstanding_results %] [% ELSE %] « required [% END %]
[% IF is_outreach # status row skipped %] [% END %] [% IF spelling_checked # set flag for target rm update_report(): || c.cfg('settings').require_spell_check.match('no') # not needed || authorisation_request # not needed %] [% site.html.submit # seems to be suppressed by multiple-select jquery ?? || '' %] [% ELSE %] [% IF c.cfg('settings').have_draft_report AND NOT history.reported AND NOT is_outreach %] [% END %] [% END %]
[% UNLESS authorisation_request OR report_data.comment %]

Comment section templates: [% div_name = 'report_tmpl'; INCLUDE site/snippets/toggleview.tt %]

[% END %]