[% content_only = 1 # no html wrappers %]

  [% # PROCESS dumper.tt dump = cases %]

<!-- BEGIN [% template.name %] -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <title>HMRN Data Collection Templates</title>
    <link type="text/css" rel="stylesheet" href="/css/hmrn.css" />
</head>

<body>
    [% FOREACH case IN cases; # PROCESS dumper.tt dump = case.as_tree;
        authorisation_date = case.request_history.0 # for duplicate actions
            ? case.request_history.0.time : case.request_history.time;
        age = calculate_age(case.patient_case.patient.dob, authorisation_date);
        # NEXT IF age < 18; # skip under-18's # don't !!
        
        INCLUDE 'hmrn/data/collection/common.tt'; # common fields

        category = case.request_report.diagnosis.diagnostic_category.description;

        IF category.match('[BT]-lymphoproliferative'); # B- or T-
            INCLUDE 'hmrn/data/collection/lymphoproliferative.tt';
        ELSIF category.match('Myeloproliferative');
            INCLUDE 'hmrn/data/collection/myeloproliferative.tt';
        ELSIF category.match('Myelodysplastic');
            INCLUDE 'hmrn/data/collection/myelodysplastic.tt';
        ELSIF category.match('Plasma cell');
            INCLUDE 'hmrn/data/collection/plasmacell.tt';
        ELSIF category.match('Precursor cell');
            INCLUDE 'hmrn/data/collection/precursor.tt';
        ELSE; %]
            <p class="error">
                Error - could not assign a disease category to
                '[% case.request_report.diagnosis.name %]'.
                Please alert admin.
            </p>
        [% END %]
        
        <h4>Comments:</h4>
    [% END %]
</body>

</html>
