<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
	"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
    <title></title>
    <style type="text/css">
        <!--/* <![CDATA[ */
            table { border-collapse: collapse; margin-left: 1em; }
            thead tr { background-color: ActiveCaption; color: CaptionText; }
            th, td { vertical-align: top; font-size: 8pt; padding: 3px;
                font-family: "Tahoma", Arial, Helvetica, sans-serif; }
            td { border: 1px solid #c0c0c0; } /* silver */
            thead .col2 { width: 200px; }
            h4 {  margin-left: 1em; }
            tr.a1 td { background: #f0f0f0; font-weight: bold }
            tr.a2 td { background: #c0c0c0 }
            td.a3 { color: #808080 }
        /* ]]> */-->
    </style>
</head>
    [% BLOCK url %]
        <a href="http://nww.leedsth.nhs.uk/hilis4/search/=/[% ref.id %]">
    		[% ref.request_number %]/[% ref.year - 2000 %]</a>        
    [% END %]
<body>
    <h3>Diagnoses [% date.strftime('%b  %Y') %] Requiring Follow-up [[% data.size %]]</h3>
    
    <h4>a) requests with follow-up sample:</h4>
        [% i = 0 %]
    <table>
        <thead>
            <tr>
                <th colspan="2">name</th>
                <th>nhs no</th>
                <th>lab no</th>
                <th>specimen</th>
                <th>presentation</th>
                <th>source</th>
                <th>diagnosis</th>
                <th>date</th>
            </tr>
        </thead>
        [% FOREACH ref IN data;
            NEXT UNLESS ref.followup.size;
        %]
        <tr class="a1">
            <td>[% i = i + 1; i %]</td>
            <td>[% ref.last_name.upper %], [% ref.first_name.ucfirst %]</td>
            <td>[% ref.nhs_number %]</th>
            <td>[% INCLUDE url %]</td>
            <td>[% ref.specimen %]</td>
            <td>[% ref.presentation %]</td>
            <td>[% ref.location %]</td>
            <td>[% ref.diagnosis %]</td>
            <td>[% ref.authorised %]</td>
        </tr>
            [% FOREACH f IN ref.followup %]
                <tr>
                    <td colspan="3" align="center" class="a3">
                        { follow-up +[% f.delta %]d }</td>
                    <td>[% INCLUDE url ref = f %]</td>
                    <td>[% f.specimen %]</td>
                    <td>[% f.presentation %]</td>
                    <td>[% f.location %]</td>
                    <td>[% f.diagnosis %]</td>
                    <td>[% f.registered %]</td>
                </tr>
            [% END %]
        [% END %]
    </table>
    
    <h4>b) requests without follow-up sample:</h4>
        [% i = 0 %]
    <table>
        <thead>
            <tr>
                <th colspan="2">name</th>
                <th>nhs no</th>
                <th>lab no</th>
                <th>specimen</th>
                <th>presentation</th>
                <th>source</th>
                <th>diagnosis</th>
                <th>date</th>
            </tr>
        </thead>
        [% FOREACH ref IN data;
            NEXT IF ref.followup.size;
        %]
        <tr>
            <td>[% i = i + 1; i %]</td>
            <td>[% ref.last_name.upper %], [% ref.first_name.ucfirst %]</td>
            <td>[% ref.nhs_number %]</td>
            <td>[% INCLUDE url %]</td>
            <td>[% ref.specimen %]</td>
            <td>[% ref.presentation %]</td>
            <td>[% ref.location %]</td>
            <td>[% ref.diagnosis %]</td>
            <td>[% ref.authorised %]</td>
        </tr>
        [% END %]
    </table>
</body>
</html>
