Skip to content

Commit

Permalink
fixes the letters to use the new model fields and to better represent…
Browse files Browse the repository at this point in the history
… the letter template we have
  • Loading branch information
fredkingham committed Mar 11, 2019
1 parent 41ab5c7 commit 71b0042
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ <h2>
<div class="row content-offset-below-10">
<div class="col-md-12">
<b>Progress:</b><br />
{{ object.progress }}
</div>
</div>
<div class="row content-offset-below-10">
Expand All @@ -94,13 +95,10 @@ <h2>
<div class="row content-offset-below-10">
<div class="col-md-12"><b>Clinical assessment:</b><br />{{ object.assessment }}</div>
</div>
<div class="row content-offset-below-10">
<div class="col-md-12"><b>Recent investigations:</b><br /></div>
</div>
{% if results %}
<div class="row content-offset-below-10">
<div class="col-md-12">
<b>Results: </b><br />
<b>Recent Investigations: </b><br />
<ul>
{% for obs_name, summary in results.items %}
<li>
Expand All @@ -112,9 +110,6 @@ <h2>
</div>
</div>
{% endif %}
<div class="row content-offset-below-10">
<div class="col-md-12"><b>Impression:</b><br /></div>
</div>
<div class="row content-offset-below-10">
<div class="col-md-12"><b>Plan:</b><br />{{ object.plan }}</div>
</div>
Expand Down
87 changes: 51 additions & 36 deletions apps/tb/templates/tb/letters/latent_new_patient_assessment.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,43 @@ <h2>

<div class="row content-offset-below-10">
<div class="col-md-12">
<b>Previous TB Diagnosis: </b><br />
{{ tb_history.tb_type }}
<b>Exposure:</b><br />
<ul>
{% for travel in travel_list %}
<li>
Travel: {{ travel.country }}
</li>
{% endfor %}
<li>
Previous TB Diagnosis: {{ tb_history.tb_type }}
</li>
<li>
Previous TB Contact: {{ tb_history.contact_details }}
</li>
{% if demographics.birth_place %}
{% if not demographics.birth_place == 'United Kingdom' %}
<li>
Place Of Birth: {{ demographics.birth_place }}
</li>
{% endif %}
{% endif %}
</ul>
</div>
</div>

<div class="row content-offset-below-10">
<div class="col-md-12">
<b>Previous TB Contact: </b><br />
{% if tb_history.previous_tb_contact %} Previous TB contact recorded. {% endif %}
{% if tb_history.contact_details %} &nbsp;
{{ tb_history.contact_details }}
{% endif %}
</div>
</div>

<div class="row content-offset-below-10">
<div class="col-md-12">
<b>Past medical history: </b><br />
<b>History: </b><br />
{% for symptom_complex in symptom_complex_list %}
<ul>
{% for pmh in past_medical_history_list %}
{% for symptom in symptom_complex.symptoms.all %}
<li>
{{ pmh.condition }}{% if pmh.year %}({{ pmh.year }}) {% endif %} &nbsp;
{{ pmh.details }}
{{ symptom.name }}
</li>
{% endfor %}
</ul>
{% endfor %}
</div>
</div>

Expand Down Expand Up @@ -115,7 +126,9 @@ <h2>
<div class="col-md-12">
<p>
<b>Social history:</b><br />
{{ social_history.notes }}
{% if social_history.notes %}
{{ social_history.notes }}
{% endif %}
</p>
</div>
</div>
Expand Down Expand Up @@ -149,17 +162,17 @@ <h2>
</div>
</div>

<div class="row content-offset-below-10">
<div class="col-md-12"><b>IGRA:</b><br /></div>
</div>

<div class="row content-offset-below-10">
<div class="col-md-12"><b>Chest radiograph:</b><br /></div>
</div>
{% for imaging in imaging_list %}
<div class="row content-offset-below-10">
<div class="col-md-12"><b>{{ imaging.imaging_type }}:</b><br /> {{ imaging.details }}<br /></div>
</div>
{% endfor %}

{% for other_investigation in other_investigation_list %}
<div class="row content-offset-below-10">
<div class="col-md-12"><b>Other Investigations:</b><br /></div>
</div>
<div class="col-md-12"><b>{{ other_investigation.name }}:</b><br /> {{ other_investigation.details }}</div>
</div>
{% endfor %}

{% if results %}
<div class="row content-offset-below-10">
Expand Down Expand Up @@ -187,17 +200,19 @@ <h2>
{% if diagnosis_list.exists %}
<ul>
{% for diagnosis in diagnosis_list %}
<li>
<div class="row">
<div class="col-sm-12">
{{ diagnosis.drug }}
{% if diagnosis.provisional %}?{% endif %} date_of_diagnosis
{{ diagnosis.date_of_diagnosis }}
&nbsp;
{{ diagnosis.details }}
</div>
</div>
</li>
{% if diagnosis.drug %}
<li>
<div class="row">
<div class="col-sm-12">
{{ diagnosis.drug }}
{% if diagnosis.provisional %}?{% endif %} date_of_diagnosis
{{ diagnosis.date_of_diagnosis }}
&nbsp;
{{ diagnosis.details }}
</div>
</div>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions apps/tb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ def get_context_data(self, *args, **kwargs):
ctx["communication_considerations"] = patient.communinicationconsiderations_set.get()
ctx["social_history"] = episode.socialhistory_set.get()
ctx["past_medical_history_list"] = episode.pastmedicalhistory_set.all()
ctx["travel_list"] = episode.travel_set.all()

ctx["symptom_complex_list"] = episode.symptomcomplex_set.all()
# TODO this has to change
ctx["past_medication_list"] = episode.antimicrobial_set.all()
ctx["allergies_list"] = patient.allergies_set.all()
ctx["diagnosis_list"] = episode.diagnosis_set.order_by("-date_of_diagnosis")
ctx["imaging_list"] = episode.imaging_set.all()
ctx["other_investigation_list"] = episode.otherinvestigation_set.all()
obs = episode.observation_set.order_by("-datetime").last()
if obs:
ctx["weight"] = obs.weight
Expand All @@ -50,6 +54,7 @@ def get_context_data(self, *args, **kwargs):
ctx["demographics"] = patient.demographics()
ctx["current_teatment_list"] = episode.treatment_set.all()
ctx["diagnosis_list"] = episode.diagnosis_set.order_by("-date_of_diagnosis")
ctx["adverse_reaction_list"] = episode.adversereaction_set.all()
ctx["past_medical_history_list"] = episode.pastmedicalhistory_set.all()
ctx["results"] = get_tb_summary_information(patient)

Expand Down

0 comments on commit 71b0042

Please sign in to comment.