{% load calculate_age %}
{% load stack %}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta content="text/html; charset=utf-8"
 http-equiv="content-type">
  <title>Brief History</title>
</head>
<body>
<br>
{{treatment.patient.medical_records}} {{treatment.patient.name}} {{treatment.patient.birthday}}
<table style="text-align: left; width: 100%;" border="0"
 cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td><b>Age:</b> {{treatment.patient.birthday|age}}</td>
      <td><b>Birthday ( y / m / d ):</b> {{treatment.patient.birthday}}</td>
      <td><b>Sex:</b> {{treatment.patient.get_gender_display}}</td>
      <td><b>Native</b></td>
      <td><b>Date:</b> {% now "Y-m-d" %}</td>
    </tr>
  </tbody>
</table>
<b>Address:</b> {{treatment.patient.address}}<br>
<b>Telephone number:</b> {{treatment.patient.phone}}<br>
<b>Referral:</b> {{treatment.surgeon}} {{treatment.referral}}<br>
<br>
<b>Diagnosis:</b> {{treatment.icd9}}, {{treatment.other_diagnosis}}<br>
<br>
<b>Past and family history</b><br>
<br>
<b>Pathology / cytology exam</b><br>
<table border="1" cellpadding="0" cellspacing="0">
  <thead>
    <td>病理號</td>
    <td>報告日</td>
    <td>報告</td>
  </thead>
  <tbody>
    {% for path in treatment.patient.pathexam_set.all|dictsort:"path_code" %}
    <tr>
        <td>{{ path.path_code }}</td>
        <td>{{ path.report_date }}</td>
        <td>{{ path.report }}</td>
    </tr>
    {% endfor %}
    <tr>
        <td>　</td>
        <td>　</td>
        <td>　</td>
    </tr>
  </tbody>
</table>
<br>
<b>Chief complaint and history</b><br>
{{treatment.chief_complaint}}
<br>
<b>Laboratory data</b><br>
<br>
<b>Image</b><br>
<br>
<b>Prognostic factor(s)</b><br>
<br>
<table style="text-align: left; width: 100%;" border="0"
 cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td><b>Stage</b></td>
      <td><b>(T</b></td>
      <td><b>N</b></td>
      <td><b>M</b></td>
      <td><b>)</b></td>
    </tr>
  </tbody>
</table>
<table style="text-align: left; width: 100%;" border="0"
 cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td><b>BSA:</b> {{ treatment.patient.height|stnew|stpush:treatment.patient.height|stpush:treatment.patient.weight|stmult|stpush:3600|stdiv|stsqrt|stget|floatformat:3 }}</td>
      <td><b>BH</b></td>
      <td>{{treatment.patient.height}} <b>cm</b></td>
      <td><b>BW</b></td>
      <td>{{treatment.patient.weight}} <b>Kg</b></td>
    </tr>
  </tbody>
</table>
<table style="text-align: left; width: 100%;" border="0"
 cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td><b>Performance</b></td>
      <td><b>Karnofsky</b></td>
      <td>{{treatment.karnofsky_score}}<b>%</b></td>
      <td><b>ECOG</b></td>
    </tr>
  </tbody>
</table>
<br>
<b>Past radiotherapy &amp; chemotherapy history</b><br>
<table border="1" cellpadding="0" cellspacing="0">
  <thead>
    <td>Date</td>
    <td>Treatment</td>
    <td>Dose(cGy)</td>
    <td>Memo</td>
  </thead>
  <tbody>
    {% for prior in treatment.patient.priortreatment_set.all|dictsort:"date" %}
    <tr>
        <td>{{ prior.date }}</td>
        <td>{{ prior.get_treatment_display }}</td>
        <td>{{ prior.dose }}</td>
        <td>{{ prior.memo }}</td>
    </tr>
    {% endfor %}
    <tr>
        <td>　</td>
        <td>　</td>
        <td>　</td>
        <td>　</td>
    </tr>
  </tbody>
</table>
<br>
<b>Treatment plan ( curative / palliative )</b><br>
<br>
</body>
</html>

