hospital-management/templates/emr/clinical_note_list.html
2025-08-12 13:33:25 +03:00

206 lines
12 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}Clinical Notes - {{ block.super }}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4 class="card-title mb-0">
<i class="fas fa-sticky-note me-2"></i>Clinical Notes Management
</h4>
</div>
<div class="card-body">
<!-- Filters -->
<div class="row mb-3">
<div class="col-md-2">
<select name="note_type" class="form-select">
<option value="">All Types</option>
{% for value, label in note_types %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="status" class="form-select">
<option value="">All Status</option>
{% for value, label in note_statuses %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
<select name="unsigned_only" class="form-select">
<option value="">All Notes</option>
<option value="true">Unsigned Only</option>
</select>
</div>
<div class="col-md-4">
<input type="text" name="search" class="form-control" placeholder="Search patients, notes, content...">
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary w-100">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<!-- Clinical Notes Table -->
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Patient</th>
<th>Note</th>
<th>Type</th>
<th>Author</th>
<th>Date/Time</th>
<th>Status</th>
<th>Signature</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for note in notes %}
<tr {% if not note.electronically_signed and note.status == 'COMPLETED' %}class="table-warning"{% endif %}>
<td>
<strong>{{ note.patient.get_full_name }}</strong><br>
<small class="text-muted">
MRN: {{ note.patient.mrn }}
{% if note.encounter %}
• Encounter: {{ note.encounter.id }}
{% endif %}
</small>
</td>
<td>
<strong>{{ note.title }}</strong>
{% if note.content %}
<br><small class="text-muted">{{ note.content|truncatechars:80|striptags }}</small>
{% endif %}
</td>
<td>{{ note.get_note_type_display }}</td>
<td>
{{ note.author.get_full_name }}
{% if note.co_signer and note.co_signer != note.author %}
<br><small class="text-muted">
Co-signer: {{ note.co_signer.get_full_name }}
</small>
{% endif %}
</td>
<td>{{ note.note_datetime|date:"M d, Y H:i" }}</td>
<td>
{% if note.status == 'DRAFT' %}
<span class="badge bg-secondary">Draft</span>
{% elif note.status == 'IN_PROGRESS' %}
<span class="badge bg-warning">In Progress</span>
{% elif note.status == 'COMPLETED' %}
<span class="badge bg-success">Completed</span>
{% elif note.status == 'REVIEWED' %}
<span class="badge bg-info">Reviewed</span>
{% elif note.status == 'AMENDED' %}
<span class="badge bg-primary">Amended</span>
{% elif note.status == 'CANCELLED' %}
<span class="badge bg-danger">Cancelled</span>
{% endif %}
</td>
<td>
{% if note.electronically_signed %}
<span class="badge bg-success">
<i class="fas fa-signature me-1"></i>Signed
</span>
{% if note.signature_datetime %}
<br><small class="text-muted">{{ note.signature_datetime|date:"M d H:i" }}</small>
{% endif %}
{% elif note.status == 'COMPLETED' %}
<span class="badge bg-warning">
<i class="fas fa-exclamation-triangle me-1"></i>Unsigned
</span>
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm">
<button class="btn btn-outline-primary" title="View Note">
<i class="fas fa-eye"></i>
</button>
{% if note.status == 'DRAFT' or note.status == 'IN_PROGRESS' %}
<button class="btn btn-outline-info" title="Edit Note">
<i class="fas fa-edit"></i>
</button>
{% endif %}
{% if note.status == 'COMPLETED' and not note.electronically_signed %}
<button class="btn btn-outline-success"
title="Sign Note"
hx-post="{% url 'emr:sign_note' note.id %}"
hx-confirm="Electronically sign this note?"
hx-swap="none">
<i class="fas fa-signature"></i>
</button>
{% endif %}
{% if note.electronically_signed %}
<button class="btn btn-outline-warning" title="Amend Note">
<i class="fas fa-plus"></i>
</button>
{% endif %}
<button class="btn btn-outline-secondary" title="Print">
<i class="fas fa-print"></i>
</button>
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="text-center py-4">
<i class="fas fa-sticky-note fa-3x text-muted mb-3"></i>
<h5 class="text-muted">No clinical notes found</h5>
<p class="text-muted">No clinical notes match your current filters.</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if is_paginated %}
<nav aria-label="Clinical notes pagination">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1">First</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a>
</li>
{% endif %}
<li class="page-item active">
<span class="page-link">
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
</span>
</li>
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}">Last</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}