568 lines
24 KiB
HTML
568 lines
24 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}{{ object.title }} - Patient Notes{% endblock %}
|
|
|
|
{% block content %}
|
|
<!-- BEGIN breadcrumb -->
|
|
<ol class="breadcrumb float-xl-end">
|
|
<li class="breadcrumb-item"><a href="{% url 'core:dashboard' %}">Dashboard</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'patients:patient_list' %}">Patients</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'patients:patient_detail' object.patient.pk %}">{{ object.patient.get_full_name }}</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'patients:patient_note_list' %}">Notes</a></li>
|
|
<li class="breadcrumb-item active">{{ object.title|truncatechars:30 }}</li>
|
|
</ol>
|
|
<!-- END breadcrumb -->
|
|
|
|
<!-- BEGIN page-header -->
|
|
<h1 class="page-header">
|
|
Patient Note
|
|
<small>{{ object.title }}</small>
|
|
</h1>
|
|
<!-- END page-header -->
|
|
|
|
<div class="row">
|
|
<div class="col-xl-8">
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Note Details</h4>
|
|
<div class="panel-heading-btn">
|
|
<a href="{% url 'patients:patient_note_update' object.pk %}" class="btn btn-xs btn-warning me-2">
|
|
<i class="fa fa-edit"></i> Edit
|
|
</a>
|
|
<button type="button" class="btn btn-xs btn-info me-2" onclick="printNote()">
|
|
<i class="fa fa-print"></i> Print
|
|
</button>
|
|
<a href="javascript:;" class="btn btn-xs btn-icon btn-default" data-toggle="panel-expand"><i class="fa fa-expand"></i></a>
|
|
</div>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="row mb-4">
|
|
<div class="col-md-6">
|
|
<h5 class="mb-3">{{ object.title }}</h5>
|
|
<div class="mb-3">
|
|
<span class="badge bg-{% if object.priority == 'URGENT' %}danger{% elif object.priority == 'HIGH' %}warning{% elif object.priority == 'NORMAL' %}success{% else %}secondary{% endif %} me-2">
|
|
{{ object.get_priority_display }}
|
|
</span>
|
|
<span class="badge bg-{% if object.category == 'CLINICAL' %}primary{% elif object.category == 'URGENT' %}danger{% elif object.category == 'FOLLOW_UP' %}warning{% else %}secondary{% endif %}">
|
|
{{ object.get_category_display }}
|
|
</span>
|
|
{% if object.is_confidential %}
|
|
<span class="badge bg-danger ms-2">
|
|
<i class="fa fa-lock me-1"></i>Confidential
|
|
</span>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6 text-end">
|
|
{% if object.priority == 'URGENT' %}
|
|
<div class="alert alert-danger mb-3">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>
|
|
<strong>URGENT NOTE</strong> - Requires immediate attention
|
|
</div>
|
|
{% endif %}
|
|
{% if object.follow_up_date %}
|
|
<div class="alert alert-{% if object.is_follow_up_overdue %}danger{% elif object.is_follow_up_due_soon %}warning{% else %}info{% endif %} mb-3">
|
|
<i class="fa fa-calendar me-2"></i>
|
|
<strong>Follow-up:</strong> {{ object.follow_up_date|date:"M d, Y" }}
|
|
{% if object.is_follow_up_overdue %}
|
|
<br><small>Overdue by {{ object.days_overdue }} days</small>
|
|
{% elif object.is_follow_up_due_soon %}
|
|
<br><small>Due in {{ object.days_until_due }} days</small>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
<h6 class="card-title mb-0">Note Content</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="note-content">
|
|
{{ object.content|linebreaks }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if object.follow_up_notes %}
|
|
<div class="card mb-4">
|
|
<div class="card-header bg-warning text-dark">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-calendar me-2"></i>Follow-up Instructions
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
{{ object.follow_up_notes|linebreaks }}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.attachments.exists %}
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-paperclip me-2"></i>Attachments
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
{% for attachment in object.attachments.all %}
|
|
<div class="col-md-6 mb-3">
|
|
<div class="d-flex align-items-center p-3 border rounded">
|
|
<div class="me-3">
|
|
<i class="fa fa-file fa-2x text-primary"></i>
|
|
</div>
|
|
<div class="flex-grow-1">
|
|
<div class="fw-bold">{{ attachment.name }}</div>
|
|
<small class="text-muted">{{ attachment.file_size|filesizeformat }}</small>
|
|
</div>
|
|
<div>
|
|
<a href="{{ attachment.file.url }}" class="btn btn-sm btn-outline-primary" target="_blank">
|
|
<i class="fa fa-download"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Note History -->
|
|
{% if object.note_history.exists %}
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-history me-2"></i>Note History
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="timeline">
|
|
{% for history in object.note_history.all %}
|
|
<div class="timeline-item">
|
|
<div class="timeline-marker bg-{% if history.action == 'CREATED' %}success{% elif history.action == 'UPDATED' %}warning{% elif history.action == 'PRIORITY_CHANGED' %}info{% else %}secondary{% endif %}"></div>
|
|
<div class="timeline-content">
|
|
<div class="d-flex justify-content-between">
|
|
<div class="fw-bold">{{ history.get_action_display }}</div>
|
|
<small class="text-muted">{{ history.created_at|date:"M d, Y H:i" }}</small>
|
|
</div>
|
|
<div class="text-muted">{{ history.description }}</div>
|
|
<small class="text-muted">by {{ history.user.get_full_name }}</small>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Related Notes -->
|
|
{% if related_notes %}
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-link me-2"></i>Related Notes
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
{% for note in related_notes %}
|
|
<div class="d-flex align-items-center mb-3 p-3 border rounded">
|
|
<div class="me-3">
|
|
<span class="badge bg-{% if note.priority == 'URGENT' %}danger{% elif note.priority == 'HIGH' %}warning{% else %}secondary{% endif %}">
|
|
{{ note.get_priority_display }}
|
|
</span>
|
|
</div>
|
|
<div class="flex-grow-1">
|
|
<div class="fw-bold">
|
|
<a href="{% url 'patients:patient_note_detail' note.pk %}" class="text-decoration-none">
|
|
{{ note.title }}
|
|
</a>
|
|
</div>
|
|
<small class="text-muted">{{ note.created_at|date:"M d, Y" }} by {{ note.created_by.get_full_name }}</small>
|
|
</div>
|
|
<div>
|
|
<a href="{% url 'patients:patient_note_detail' note.pk %}" class="btn btn-sm btn-outline-primary">
|
|
<i class="fa fa-eye"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
</div>
|
|
|
|
<div class="col-xl-4">
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Patient Information</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="text-center mb-3">
|
|
<div class="w-80px h-80px bg-primary rounded-circle d-flex align-items-center justify-content-center mx-auto mb-3">
|
|
<i class="fa fa-user text-white fa-2x"></i>
|
|
</div>
|
|
<h5 class="mb-1">{{ object.patient.get_full_name }}</h5>
|
|
<small class="text-muted">{{ object.patient.patient_id }}</small>
|
|
</div>
|
|
|
|
<table class="table table-borderless table-sm">
|
|
<tr>
|
|
<td class="fw-bold" width="80">DOB:</td>
|
|
<td>{{ object.patient.date_of_birth|date:"M d, Y" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Age:</td>
|
|
<td>{{ object.patient.age }} years</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Gender:</td>
|
|
<td>{{ object.patient.get_gender_display }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Phone:</td>
|
|
<td>
|
|
{% if object.patient.phone %}
|
|
<a href="tel:{{ object.patient.phone }}" class="text-decoration-none">
|
|
{{ object.patient.phone }}
|
|
</a>
|
|
{% else %}
|
|
<span class="text-muted">Not provided</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Email:</td>
|
|
<td>
|
|
{% if object.patient.email %}
|
|
<a href="mailto:{{ object.patient.email }}" class="text-decoration-none">
|
|
{{ object.patient.email }}
|
|
</a>
|
|
{% else %}
|
|
<span class="text-muted">Not provided</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div class="d-grid gap-2">
|
|
<a href="{% url 'patients:patient_detail' object.patient.pk %}" class="btn btn-outline-primary">
|
|
<i class="fa fa-user me-2"></i>View Patient Profile
|
|
</a>
|
|
<a href="{% url 'patients:patient_note_create' %}?patient={{ object.patient.pk }}" class="btn btn-outline-success">
|
|
<i class="fa fa-plus me-2"></i>Add New Note
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Note Information</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<table class="table table-borderless table-sm">
|
|
<tr>
|
|
<td class="fw-bold" width="100">Created:</td>
|
|
<td>{{ object.created_at|date:"M d, Y H:i" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Created By:</td>
|
|
<td>{{ object.created_by.get_full_name }}</td>
|
|
</tr>
|
|
{% if object.updated_at != object.created_at %}
|
|
<tr>
|
|
<td class="fw-bold">Updated:</td>
|
|
<td>{{ object.updated_at|date:"M d, Y H:i" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Updated By:</td>
|
|
<td>{{ object.updated_by.get_full_name|default:"System" }}</td>
|
|
</tr>
|
|
{% endif %}
|
|
<tr>
|
|
<td class="fw-bold">Category:</td>
|
|
<td>
|
|
<span class="badge bg-{% if object.category == 'CLINICAL' %}primary{% elif object.category == 'URGENT' %}danger{% elif object.category == 'FOLLOW_UP' %}warning{% else %}secondary{% endif %}">
|
|
{{ object.get_category_display }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Priority:</td>
|
|
<td>
|
|
<span class="badge bg-{% if object.priority == 'URGENT' %}danger{% elif object.priority == 'HIGH' %}warning{% elif object.priority == 'NORMAL' %}success{% else %}secondary{% endif %}">
|
|
{{ object.get_priority_display }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
{% if object.follow_up_date %}
|
|
<tr>
|
|
<td class="fw-bold">Follow-up:</td>
|
|
<td>
|
|
{{ object.follow_up_date|date:"M d, Y" }}
|
|
{% if object.is_follow_up_overdue %}
|
|
<br><small class="text-danger">Overdue</small>
|
|
{% elif object.is_follow_up_due_soon %}
|
|
<br><small class="text-warning">Due Soon</small>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endif %}
|
|
<tr>
|
|
<td class="fw-bold">Confidential:</td>
|
|
<td>
|
|
{% if object.is_confidential %}
|
|
<span class="badge bg-danger">
|
|
<i class="fa fa-lock me-1"></i>Yes
|
|
</span>
|
|
{% else %}
|
|
<span class="badge bg-success">No</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Quick Actions</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="d-grid gap-2">
|
|
<a href="{% url 'patients:patient_note_update' object.pk %}" class="btn btn-warning">
|
|
<i class="fa fa-edit me-2"></i>Edit Note
|
|
</a>
|
|
{% if not object.follow_up_date %}
|
|
<button type="button" class="btn btn-info" onclick="addFollowUp()">
|
|
<i class="fa fa-calendar me-2"></i>Add Follow-up
|
|
</button>
|
|
{% endif %}
|
|
{% if object.priority != 'URGENT' %}
|
|
<button type="button" class="btn btn-warning" onclick="markUrgent()">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>Mark Urgent
|
|
</button>
|
|
{% endif %}
|
|
<button type="button" class="btn btn-primary" onclick="shareNote()">
|
|
<i class="fa fa-share me-2"></i>Share Note
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" onclick="printNote()">
|
|
<i class="fa fa-print me-2"></i>Print Note
|
|
</button>
|
|
<a href="{% url 'patients:patient_note_delete' object.pk %}" class="btn btn-danger">
|
|
<i class="fa fa-trash me-2"></i>Delete Note
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Recent Patient Notes</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
{% for note in recent_notes %}
|
|
<div class="d-flex align-items-center mb-3 p-2 border rounded">
|
|
<div class="me-2">
|
|
<span class="badge bg-{% if note.priority == 'URGENT' %}danger{% elif note.priority == 'HIGH' %}warning{% else %}secondary{% endif %}">
|
|
{{ note.get_priority_display|slice:":1" }}
|
|
</span>
|
|
</div>
|
|
<div class="flex-grow-1">
|
|
<div class="fw-bold small">
|
|
<a href="{% url 'patients:patient_note_detail' note.pk %}" class="text-decoration-none">
|
|
{{ note.title|truncatechars:30 }}
|
|
</a>
|
|
</div>
|
|
<small class="text-muted">{{ note.created_at|date:"M d" }}</small>
|
|
</div>
|
|
</div>
|
|
{% empty %}
|
|
<div class="text-center text-muted">
|
|
<i class="fa fa-sticky-note fa-2x mb-2"></i>
|
|
<div>No other notes</div>
|
|
</div>
|
|
{% endfor %}
|
|
|
|
{% if recent_notes %}
|
|
<div class="d-grid mt-3">
|
|
<a href="{% url 'patients:patient_note_list' %}?patient={{ object.patient.pk }}" class="btn btn-outline-primary btn-sm">
|
|
<i class="fa fa-list me-2"></i>View All Notes
|
|
</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Follow-up Modal -->
|
|
<div class="modal fade" id="followUpModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Add Follow-up</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="followup-form">
|
|
<div class="mb-3">
|
|
<label class="form-label">Follow-up Date</label>
|
|
<input type="date" class="form-control" name="follow_up_date" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Follow-up Notes</label>
|
|
<textarea class="form-control" name="follow_up_notes" rows="3" placeholder="Enter follow-up instructions..."></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="send_reminder" id="send-reminder" checked>
|
|
<label class="form-check-label" for="send-reminder">
|
|
Send reminder notification
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-primary" onclick="saveFollowUp()">
|
|
<i class="fa fa-calendar me-2"></i>Add Follow-up
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
function addFollowUp() {
|
|
$('#followUpModal').modal('show');
|
|
}
|
|
|
|
function saveFollowUp() {
|
|
var followUpDate = $('input[name="follow_up_date"]').val();
|
|
var followUpNotes = $('textarea[name="follow_up_notes"]').val();
|
|
var sendReminder = $('input[name="send_reminder"]').is(':checked');
|
|
|
|
if (!followUpDate) {
|
|
toastr.error('Please select a follow-up date');
|
|
return;
|
|
}
|
|
|
|
$.ajax({
|
|
url: '{% url "patients:add_note_followup" object.pk %}',
|
|
method: 'POST',
|
|
data: {
|
|
'csrfmiddlewaretoken': '{{ csrf_token }}',
|
|
'follow_up_date': followUpDate,
|
|
'follow_up_notes': followUpNotes,
|
|
'send_reminder': sendReminder
|
|
},
|
|
success: function(response) {
|
|
toastr.success('Follow-up added successfully');
|
|
$('#followUpModal').modal('hide');
|
|
location.reload();
|
|
},
|
|
error: function() {
|
|
toastr.error('Failed to add follow-up');
|
|
}
|
|
});
|
|
}
|
|
|
|
function markUrgent() {
|
|
if (confirm('Mark this note as urgent? This will notify relevant staff members.')) {
|
|
$.ajax({
|
|
url: '{% url "patients:mark_note_urgent" object.pk %}',
|
|
method: 'POST',
|
|
data: {
|
|
'csrfmiddlewaretoken': '{{ csrf_token }}'
|
|
},
|
|
success: function(response) {
|
|
toastr.success('Note marked as urgent');
|
|
location.reload();
|
|
},
|
|
error: function() {
|
|
toastr.error('Failed to mark note as urgent');
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function shareNote() {
|
|
toastr.info('Note sharing feature coming soon!');
|
|
}
|
|
|
|
function printNote() {
|
|
window.print();
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
@media print {
|
|
.panel-heading-btn,
|
|
.breadcrumb,
|
|
.btn,
|
|
.col-xl-4 {
|
|
display: none !important;
|
|
}
|
|
|
|
.col-xl-8 {
|
|
width: 100% !important;
|
|
}
|
|
|
|
.note-content {
|
|
font-size: 14px;
|
|
line-height: 1.6;
|
|
}
|
|
}
|
|
|
|
.timeline {
|
|
position: relative;
|
|
padding-left: 30px;
|
|
}
|
|
|
|
.timeline-item {
|
|
position: relative;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.timeline-marker {
|
|
position: absolute;
|
|
left: -35px;
|
|
top: 5px;
|
|
width: 10px;
|
|
height: 10px;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.timeline-item:not(:last-child)::before {
|
|
content: '';
|
|
position: absolute;
|
|
left: -31px;
|
|
top: 15px;
|
|
width: 2px;
|
|
height: calc(100% + 10px);
|
|
background-color: #dee2e6;
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|