[%-
content_only = 1; # no html wrappers
# define some vars:
is_print_request = c.get_current_runmode.match('print') ? 1 : 0;
acronym_class = is_print_request ? 'normal' : 'acronym'; # don't display if print req
ref_time = status_options.authorised.is_active.match('yes')
? history.authorised.time : history.reported.time; # ref_time;
yy = data.year - 2000 | format('%02d');
text_str = {
csf => 'absence of involvement of the cerebro-spinal fluid does not'
_ ' exclude the possibility of intracerebral disease',
tests_pending => 'there are further laboratory investigations pending',
amended_report => 'amended report [supercedes any previous issued on'
_ ' HMDS ref ' _ data.request_number _ '/' _ yy _ ']',
service_url => 'the definitive report is available online at '
_ c.cfg('settings').service_url,
pb_sample => 'please send a peripheral blood sample with all bone marrows',
clinic_return => 'Currently unsuitable for community monitoring: an appointment'
_ ' will be made at the haematology clinic.',
pack_dispatch => 'Suitable for community monitoring: a pack will be sent out',
};
IF has_optional.report
AND status_options.authorised.is_active.match('yes')
AND NOT history.authorised.size # not authorised
AND request_data.year > 2005; # eg Molecular Misc requests pre-2006 never auth'd
# reset report:
report = 0; # 'here';
have_secondary_diagnosis
= request_data.request_secondary_diagnosis ? 1 : 0;
END; # request_data = {}; # for testing
is_amended_report = 0; # default
FOREACH d IN previous_diagnoses;
# if diagnosis change > auth date:
IF d.time.subtract_datetime(ref_time).delta_days > 0;
is_amended_report = 1;
is_updated_diagnosis = 1; # to flag on report
LAST;
END; END;
UNLESS is_amended_report;
IF report.comment.match('[Aa]dditional [Cc]omment'); is_amended_report = 1;
END; END;
UNLESS is_amended_report AND ref_time; # irrelevant if already set; need ref_time
FOREACH entry IN result_summaries; # PROCESS dumper.tt dump = entry.value.time;
NEXT UNLESS entry.value.time; # fatal in cmp if unset
# entry.value.time.datetime; ' ' ; ref_time.datetime;
# if result summary updated AFTER authorisation date:
IF entry.value.time.subtract_datetime(ref_time).delta_days > 0;
is_amended_report = 1; LAST;
END; END; END; # is_amended_report;
BLOCK debug_delta_days;
INCLUDE dumper.tt dump = [
ref_time.datetime, o.datetime, o.subtract_datetime(ref_time).delta_days
];
END;
-%]<!-- BEGIN [% component.name %] -->
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<base href="http://localhost">
<link rel="stylesheet" href="/css/bootstrap.min.css">
[% UNLESS is_print_request # wrecks span width formatting %]
<link rel="stylesheet" href="/css/bootstrap-responsive.min.css">
[% END %]
<link rel="stylesheet" href="/css/print_view.css" type="text/css">
<style type="text/css">
@media print {
.viewHide { display: block; }
.printHide { display: none; }
a[href]:after { /* override idiotic bootstrap css entry: */
content: none;
}
}
@media screen {
.viewHide { display: none; }
.error { color: #c44; }
}
</style>
<script src="/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js"></script>
</head>
<body>
<!-- container -->
<div class="container printHide">
<div class="row">
<img src="/images/lcc_logo.jpg"/>
</div>
[% UNLESS is_print_request; INCLUDE record/report/navbar.tt; END %]
<div class="row">
[% IF has_optional.clinical_trial;
trial_number = get_trial_number(patient.id, data.request_trial.trial_id) %]
<h3 class="text-warning text-center">
CLINICAL TRIAL: [% data.request_trial.trial.trial_name %]
[% IF trial_number %][ [% trial_number %] ][% END %]
</h3>
[% END %]
<div class="span2.5">
[% INCLUDE record/report/patient.tt %]
</div>
[% class = is_print_request ? 'span8' : 'span7 offset1' # need to adjust for PDF view %]
<div class="[% class %]">
<div id="main-div">
[% IF report; # PROCESS dumper.tt dump = report %]
<div class="diagnosis bright"><!-- style="white-space: nowrap" // doesn't scale with screen resolution -->
[% IF have_secondary_diagnosis %]1.[% END %]
[% # UNLESS special_formatting.skip_diagnosis # do we need to bother ? %]
<span class="[% is_updated_diagnosis ? 'warning' : 'normal' %]">
[% report.diagnosis.name %]
</span>
[% # END %]
[% IF want_icdo3 AND report.diagnosis.icdo3 # don't want it %]
[[% report.diagnosis.icdo3 %]]
[% END %]
[% UNLESS is_print_request %]
<sup>[% INCLUDE site/snippets/hmrn_info_link.tt %]</sup>
[% END %]
</div>
[% ELSE %]
<h2 class="bright">[ REPORT PENDING AUTHORISATION ]</h2>
[% END %]
[% IF have_secondary_diagnosis %]
<div class="diagnosis bright">2.
[% request_data.request_secondary_diagnosis.secondary_diagnosis.name %]
</div>
[% END %]
<p class="indent">
[% specimen = report.biopsy_site ||
specimen_map.item(data.id).description.join(' & ') %]
[% IF report %]reported on a [% END %][% specimen | html %]
[% UNLESS specimen.match('block$'); 'specimen'; END %]
[% external_ref = data.request_external_ref.external_reference;
IF external_ref %]
[[% IF NOT external_ref.match('ref'); 'ref: '; END; external_ref | html %]]
[% END %]
[% IF report %]of [% report.specimen_quality %] quality[% END %]
received on <span class="nowrap">
[% data.created_at.strftime('%a %d.%b.%Y @ %H:%M') %]
</span>
</p>
[% # report comment:
IF report.comment;
comment = [];
UNLESS special_formatting.no_comment;
formatted_comment = symbolise(report.comment).replace(
'[Aa]dditional [Cc]omment','ADDITIONAL COMMENT') | html_line_break;
# to split comment on full-stop:
# re = '\.\s+'; # for legacy comment; keep space to retain decimal numbers
# FOREACH line IN formatted_comment.split(re);
# comment.push(line);
# END;
comment.push(formatted_comment); # if not splitting on '.'
END;
IF outreach;
follow_opt_id = outreach.followup.followup_option_id;
option = outreach.menu_options.followup_options.item(follow_opt_id).option;
label = outreach.menu_options.followup_options.item(follow_opt_id).label;
IF option.match('clinic_return');
comment.push(text_str.clinic_return);
ELSIF option.match('zero');
str = text_str.pack_dispatch _ ' immediately.';
comment.push(str);
ELSIF option.match('month');
str = text_str.pack_dispatch _ ' in ' _ label _ '.';
comment.push(str);
END;
END %]
<p class="text-error">[% comment.join('<br />') %]</p>
[% END %]
[% # context warnings:
context_warnings = [];
context_warning_map = report_data_maps.context_warning_map;
IF report AND context_warning_map.size AND NOT outreach.size;
warning = context_warning_map.item(report.diagnosis.id);
IF warning; context_warnings.push(warning); END;
END;
IF specimen_map.item(data.id).description.grep('CSF').size
AND report AND NOT report.diagnosis.icdo3.match('/3'); # non-ICDO3 + CSF
context_warnings.push(text_str.csf);
END;
IF context_warnings.size;
%]
<ul>
[% FOREACH entry IN context_warnings %]
<li class="text-warning">[% entry %]</li>
[% END %]
[% FOREACH entry IN diagnosis_riders %]
<li class="text-error">[% entry %]</li>
[% END %]
</ul>
[% END %]
</div>
[% # additional comments:
additional_comments = [];
IF report AND NOT report.status.match('default');
str = 'this is a ' _ report.status.upper _ ' diagnosis';
additional_comments.push(str);
END;
IF outstanding_tests.size;
additional_comments.push(text_str.tests_pending);
END;
IF request_errors.size; # PROCESS dumper.tt dump = report_data_maps.report_error_codes;
FOREACH entry IN request_errors;
err_code = entry.error_code.code;
# only want reportable errs:
NEXT UNLESS report_data_maps.report_error_codes.item(err_code);
str = report_data_maps.report_error_codes.item(err_code).description
_ ' [' _ err_code.upper _ ']';
additional_comments.push(str);
END;
END;
specimen = specimen_map.item(data.id).sample_code;
IF specimen.grep('BMA').size AND NOT specimen.grep('PB').size
AND NOT request_data.request_trial;
additional_comments.push(text_str.pb_sample);
END;
IF is_amended_report;
additional_comments.push(text_str.amended_report);
END;
IF is_print_request; # print report or print run
additional_comments.push(text_str.service_url);
END;
IF additional_comments.size;
%]
<div id="comments">
<ul>
[% FOREACH entry IN additional_comments %]
<li class="text-info">[% entry %]</li>
[% END %]
</ul>
</div>
[% END %]
</div>
</div>
[% IF outreach.size; INCLUDE record/report/outreach.tt; END %]
[% IF report AND ( report.morphology OR result_summaries.size ) %]
<div class="row">
<div class="span2">
<span class="label label-info">Supporting information:</span>
</div>
</div>
[% accordion_class = ['accordion-body', 'collapse'];
# force collapsed section open if print request:
accordion_class.push('in') IF is_print_request;
%]
<div class="accordion" [% UNLESS is_print_request # prevent collapse %]
id="summaries"[% END %]>
[% IF report.morphology %]
<!-- morphology -->
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse"
data-parent="#summaries" href="#collapseOne">
MORPHOLOGY <i class="icon-fullscreen"></i>
</a>
</div>
<div id="collapseOne" class="[% accordion_class.join(' ') %]">
<div class="accordion-inner">
<div class="offset1">
[% symbolise(report.morphology) | html_line_break %]
</div>
</div>
</div>
</div>
[% END %]
[% FOREACH entry IN result_summaries;
section_name = entry.key ; # section_name %]
<!-- [% section_name %] -->
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#summaries"
href="#collapse[% section_name.replace(' ', '').lower %]">
[% label = special_formatting.section_name_map.item(section_name.lower)
|| section_name; label.upper %]
[% UNLESS is_print_request %]
<i class="icon-fullscreen"></i>
[% END %]
</a>
</div>
<div [% UNLESS is_print_request # prevent collapse %]
id="collapse[% section_name.replace(' ', '').lower %]"[% END %]
class="[% accordion_class.join(' ') %]">
<div class="accordion-inner">
<div class="indent">
<!-- make_chart // will draw chart if required: -->
[% PROCESS site/make_chart.tt format_info = special_formatting %]
[% class = entry.value.time AND ref_time # fatal if either unset:
AND ( entry.value.time.ymd('') > ref_time.ymd('') )
? 'text-error' : 'normal'; # INCLUDE debug_delta_days o = entry.value.time;
%]
<pre class="[% class %]">[%- symbolise(entry.value.results_summary)
# escapeHTML already done -%]</pre>
</div>
</div>
</div>
</div>
[% END %]
</div>
[% ELSE # spacer: %]
<p class="spacer"></p>
[% END %]
[% IF history.reported;
reporter = history.reported.user;
authoriser = history.authorised.user;
users = []; # to avoid repeat user-contact icons
BLOCK contact_user;
UNLESS is_print_request;
IF user.active.match('yes') AND NOT users.grep(user.username).size;
users.push(user.username) %]
<a href="[% app_url %]/resources/user_messages/[% user.id %]">
<span class="badge badge-bright"><i class="icon-user icon-white"></i></span>
</a>
[% END; END; END; %]
<div class="row">
<div class="row span7">
<span class="rich">Reported by:
<b>[% reporter.first_name | ucfirst %]</b>
<b>[% reporter.last_name | ucfirst %]</b>
</span>
on <b>[% history.reported.time.strftime('%a %d.%b.%Y @ %H:%M') %]</b>
[% INCLUDE contact_user user = reporter %]
</div>
[% IF authoriser; # in case pre-2004 %]
<div class="row span7">
<span class="rich">Authorised by:
<b>[% authoriser.first_name | ucfirst %]</b>
<b>[% authoriser.last_name | ucfirst %]</b>
</span>
on <b>[% history.authorised.time.strftime('%a %d.%b.%Y @ %H:%M') %]</b>
[% INCLUDE contact_user user = authoriser %]
</div>
[% END %]
</div>
[% END %]
[% IF previous_diagnoses.size; # PROCESS dumper.tt dump = previous_diagnoses;
BLOCK amended_report_update;
# PROCESS dumper.tt dump = entry.as_tree %]
<div class="row">
<div class="row span8">
<span class="rich">Amended report issued by:
<b>[% entry.user.first_name | ucfirst %]</b>
<b>[% entry.user.last_name | ucfirst %]</b>
</span>
on <b>[% entry.time.strftime('%a %d.%b.%Y') %]
@ [% entry.time.strftime('%T').match('00:00:00') # for legacy data
? '??:??' : entry.time.strftime('%H:%M') %]</b>
[% INCLUDE contact_user user = entry.user %]
</div>
</div>
[% END;
FOREACH entry IN previous_diagnoses; # INCLUDE debug_delta_days o = entry.time;
IF entry.time.subtract_datetime(ref_time).delta_days > 0;
PROCESS amended_report_update; # LAST; # only needed once - why ??
END;
END;
END;
%]
[% IF dispatch_log.size %]
<p class="spacer"></p>
<div class="row">
<div class="row span7">Report sent to:
<ul>
[% FOREACH report IN dispatch_log %]
<li>[% report.recipient %] on
[% report.time.strftime('%d.%b.%Y @ %H:%M') %]</li>
[% END %]
</ul>
</div>
</div>
[% END %]
</div>
<!-- /container -->
[% UNLESS is_print_request # printed as wkhtmltopdf footer %]
<div id="footer">
<p class="pull-right"><img src="/images/cpa_logo.png" /></p>
</div>
[% END %]
<div class="viewHide error">THIS PAGE IS NOT INTENDED TO BE PRINTED.
PLEASE USE THE "PRINT" LINK IN THE UPPER NAVIGATION SECTION.
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="/js/vendor/bootstrap.min.js"></script>
<script src="/js/main.js"></script>
</body>
</html>
<!-- END [% component.name %] -->