<!-- BEGIN record/report.tt -->
[% PROCESS site/popup.tt height=280, width=900, top=280 %]
[% # PROCESS dumper.tt dump = request_data.request_secondary_diagnosis %]
[% # PROCESS dumper.tt dump = previous_diagnoses %]
[% # PROCESS dumper.tt dump = history.keys %]
[% # PROCESS dumper.tt dump = all_results %]
[% # PROCESS dumper.tt dump = has_optional %]
[%
is_outreach = specimen_map.item(data.id).sample_code.grep('CMP').size
AND c.cfg('settings').have_outreach;
%]
[% # need to prevent non-lab-staff users viewing unauthorised report:
is_lab_staff = c.is_lab_staff;
IF has_optional.report
AND status_options.authorised.is_active.match('yes')
AND NOT history.authorised
AND request_data.year > 2005 # eg Molecular Misc requests pre-2006 never auth'd
AND NOT is_lab_staff %]
<p class="indent">[report pending authorisation]</p>
[% ELSE;
class = 'normal'; # for hidden div:
IF has_optional.report
AND NOT history.authorised
AND status_options.authorised.is_active.match('yes')
AND is_lab_staff; # hide it if lab-staff and not auth'd:
class = 'itemhidden';
%]
<p class="indent"><span class="grey">view unauthorised report</span>:
[% div_name = 'report'; INCLUDE site/snippets/toggleview.tt %]
</p>
[% END %]
<div id="[% div_name || 'normal' %]" class="[% class %]">
<table>
[% IF has_optional.report AND request_data.request_report.clinical_details %]
<tr>
<td class="label no-wrap">Request details:</td>
<td class="data">
[% request_data.request_report.clinical_details %]
</td>
</tr>
[% END %]
<tr>
<td class="label no-wrap">Specimen details:</td>
<td class="data">
[% IF has_optional.report %]
<i>Quality</i>:
[% request_data.request_report.specimen_quality -%]
[%- ELSE -%]
<span class="grey">[pending]</span>
[%- END; IF request_data.request_report.gross_description -%].
<i>Gross description</i>:
[% request_data.request_report.gross_description %]
[%- END; IF request_data.request_report.biopsy_site -%].
<i>Biopsy site</i>:
[% request_data.request_report.biopsy_site; END; -%]
</td>
</tr>
[% IF result_summaries %]
[% FOREACH entry IN result_summaries; section_name = entry.key %]
<tr>
<td class="label" style="vertical-align: top">
[% section_name.replace(' ', ' ') # prevent line-break %]:
</td>
<td class="data">
[% symbolise(entry.value.results_summary) # escapeHTML already done %]
[% test_results = []; FOREACH test IN all_results.item(section_name).test;
NEXT UNLESS test.value.result; # PROCESS dumper.tt dump = test;
test_results.push(test); END;
IF test_results.size;
%]
[% div_name = section_name _ '_tests';
INCLUDE site/snippets/toggleview.tt %]
<div id="[% div_name %]" class="itemhidden">
<p class="classname">
[% FOREACH test IN test_results %]
<i>[% test.key %]</i><sup>[% test.value.result %]</sup>[% ','
UNLESS loop.last %]
[% END %]
</p>
</div>
[% END %]
</td>
</tr>
[% END %]
[% END %]
[% # PROCESS dumper.tt dump = history.keys.grep('(amend|modifi)ed [Cc]omment') %]
[% IF has_optional.report AND request_data.request_report.morphology %]
<tr>
<td class="label" style="vertical-align: top">
[% IF history.keys.grep('(amend|modifi)ed [Mm]orphology').size AND is_lab_staff %]
<a href="[% app_url %]/history/morphology/[% data.id %]">Morphology</a>:
[% ELSE %]Morphology:[% END %]
</td>
<td class="data">
[% symbolise(request_data.request_report.morphology) | html_line_break %]
</td>
</tr>
[% END %]
[% IF has_optional.report AND request_data.request_report.comment %]
<tr>
<td class="label" style="vertical-align: top">
[% IF history.keys.grep('(amend|modifi)ed [Cc]omment').size AND is_lab_staff %]
<a href="[% app_url %]/history/comment/[% data.id %]">Comment</a>:
[% ELSE %]Comment:[% END %]
</td>
<td class="data">
[% symbolise(request_data.request_report.comment) | html_line_break %]
</td>
</tr>
[% END %]
<tr>
<td class="label">Diagnosis:</td>
<td class="data">
[% IF has_optional.report %]
<strong>
[% IF c.user_can('report') AND previous_diagnoses.size %]
<a href="[% app_url %]/history/previous_diagnosis/[% request_data.id %]"
onclick="return popup(this.href);">
[% request_data.request_report.diagnosis.name | html %]
</a> [ [% previous_diagnoses.size %] ]
[% ELSE %]
[% request_data.request_report.diagnosis.name | html %]
[% END %]
[% UNLESS request_data.request_report.status.match('default') %]
[ <span class="red">[% request_data.request_report.status | upper %]</span> ]
[% END %]
</strong>
[% ELSE %]
<span class="grey">[pending]</span>
[% END %]
[% INCLUDE site/snippets/hmrn_info_link.tt %]
[% FOREACH entry IN history; # PROCESS dumper.tt dump = entry.value.time;
IF entry.value.action.match('diagnosis status alert'); # if multiple 'cc':
diagnosis_alert = entry; # only need 1st one
LAST;
END;
END;
IF diagnosis_alert;
%]
<span style="margin-left: 1em; vertical-align: middle">
<img src="/images/emailed.jpg" />
[[% diagnosis_alert.value.time.strftime('%d.%b.%Y @ %H:%M') %]]
</span>
[% ELSIF # new/relasped case:
NOT request_data.request_report.status.match('default')
AND c.cfg('settings').have_diagnosis_status_alert # or ? use cron script instead
AND ( # authorised (if in use):
history.authorised OR
( status_options.authorised.is_active.match('no') AND history.reported )
)
AND c.user_can('report') # has an mdt contact address configured:
AND has_mdt_contact(request_data.patient_case.referral_source_id)
%]
<span style="margin-left: 1em">
<a href="[% app_url %]/request/email_alert/[% request_data.id %]">
<img class="menu" src="/images/email.jpg"
style="vertical-align: middle; border: 1px solid red !important" />
</a>
</span>
<span class="red">
<span class="blink">« e-mail alert</span>
</span>
[% END %]
[% IF request_data.request_secondary_diagnosis %]
<div class="bold">
Secondary diagnosis:
[% request_data.request_secondary_diagnosis.diagnosis.name | html %]
</div>
[% END %]
</td>
</tr>
</table>
</div>
[% END # lab-staff section %]
[% PROCESS site/make_chart.tt format_info = special_formatting %]
[% # PROCESS dumper.tt dump = history %]
[% IF history.reported; user = history.reported.user %]
<p>
Reported by
<b>[% user.first_name | ucfirst %]</b>
<b>[% user.last_name | ucfirst %]</b>
on <b>[% history.reported.time.strftime('%a %d.%b.%Y @ %H:%M') %]</b>
</p>
[% END %]
[% IF history.authorised; user = history.authorised.user %]
<p>
Authorised by
<b>[% user.first_name | ucfirst %]</b>
<b>[% user.last_name | ucfirst %]</b>
on <b>[% history.authorised.time.strftime('%a %d.%b.%Y @ %H:%M') %]</b>
</p>
[% END %]
<!-- END record/report.tt -->