{% load static %}
{% if timeline_events %}
Clinical Timeline
{% for event in timeline_events %}
{{ event.date|date:"M d" }}
{{ event.date|time:"H:i" }}
{{ event.title }}
{{ event.type_display }} {% if event.provider %} by {{ event.provider.get_full_name }} {% endif %} {% if event.location %} • {{ event.location }} {% endif %}
{% if event.can_view %} {% endif %} {% if event.can_edit %} {% endif %}
{% if event.type == 'encounter' %}
Type: {{ event.encounter_type_display }}
Status: {{ event.status_display }}
{% if event.chief_complaint %} Chief Complaint: {{ event.chief_complaint|truncatechars:50 }} {% endif %}
{% elif event.type == 'vital_signs' %}
{% if event.temperature %} {{ event.temperature }}°F {% endif %} {% if event.blood_pressure %} {{ event.blood_pressure }} {% endif %} {% if event.heart_rate %} {{ event.heart_rate }} bpm {% endif %} {% if event.oxygen_saturation %} {{ event.oxygen_saturation }}% {% endif %} {% if event.has_critical_values %} Critical Values {% endif %}
{% elif event.type == 'clinical_note' %}
Note Type: {{ event.note_type_display }} {% if event.electronically_signed %} {% endif %}
{{ event.content|truncatewords:20 }} {% if event.content|wordcount > 20 %} ...read more {% endif %}
{% elif event.type == 'problem' %}
{{ event.problem_name }} {% if event.problem_code %} {{ event.problem_code }} {% endif %}
{{ event.severity_display }} {{ event.status_display }}
{% if event.clinical_notes %}
{{ event.clinical_notes|truncatechars:100 }}
{% endif %}
{% elif event.type == 'care_plan' %}
{{ event.title }}
{{ event.plan_type_display }}
{{ event.completion_percentage }}%
{% elif event.type == 'medication' %}
{{ event.medication_name }}
{{ event.dosage }} {{ event.frequency }}
{{ event.action_display }}
{% elif event.type == 'lab_result' %}
{{ event.test_name }}
{{ event.result_value }} {{ event.unit }}
{% if event.is_abnormal %} Abnormal {% else %} Normal {% endif %}
{% else %}
{% if event.description %}

{{ event.description|truncatechars:150 }}

{% endif %}
{% endif %}
{% if event.tags or event.priority %} {% endif %}
{% endfor %}
{% if has_more_events %}
{% endif %}
{{ event_counts.encounters }}
Encounters
{{ event_counts.vital_signs }}
Vital Signs
{{ event_counts.clinical_notes }}
Notes
{{ event_counts.problems }}
Problems
{{ event_counts.care_plans }}
Care Plans
{{ event_counts.total }}
Total Events
{% else %}
No Clinical Events

No clinical events have been recorded for this patient yet.
Events will appear here as encounters, vital signs, and notes are documented.

{% endif %}