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

410 lines
20 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}Delete Clinical Note: {{ clinical_note.title }}{% endblock %}
{% block css %}
<style>
.delete-warning {
background-color: rgba(var(--bs-danger-rgb), 0.1);
border-left: 4px solid var(--bs-danger);
padding: 1.5rem;
margin-bottom: 1.5rem;
border-radius: 0.5rem;
}
.impact-assessment {
background-color: rgba(var(--bs-warning-rgb), 0.1);
border-left: 4px solid var(--bs-warning);
padding: 1.5rem;
margin-bottom: 1.5rem;
border-radius: 0.5rem;
}
.alternative-actions {
background-color: rgba(var(--bs-info-rgb), 0.1);
border-left: 4px solid var(--bs-info);
padding: 1.5rem;
margin-bottom: 1.5rem;
border-radius: 0.5rem;
}
.note-badge {
font-size: 0.85rem;
padding: 0.35em 0.65em;
}
.note-status-signed {
background-color: var(--bs-success);
color: white;
}
.note-status-draft {
background-color: var(--bs-warning);
color: white;
}
.note-status-amended {
background-color: var(--bs-info);
color: white;
}
.note-status-addendum {
background-color: var(--bs-purple);
color: white;
}
.note-type-progress {
background-color: var(--bs-primary);
color: white;
}
.note-type-admission {
background-color: var(--bs-danger);
color: white;
}
.note-type-discharge {
background-color: var(--bs-success);
color: white;
}
.note-type-procedure {
background-color: var(--bs-warning);
color: white;
}
.note-type-consultation {
background-color: var(--bs-info);
color: white;
}
</style>
{% endblock %}
{% block content %}
<!-- begin breadcrumb -->
<ol class="breadcrumb float-xl-end">
<li class="breadcrumb-item"><a href="{% url 'dashboard' %}">Home</a></li>
<li class="breadcrumb-item"><a href="{% url 'emr:dashboard' %}">EMR</a></li>
<li class="breadcrumb-item"><a href="{% url 'emr:clinical_note_list' %}">Clinical Notes</a></li>
<li class="breadcrumb-item"><a href="{% url 'emr:clinical_note_detail' clinical_note.id %}">{{ clinical_note.title }}</a></li>
<li class="breadcrumb-item active">Delete</li>
</ol>
<!-- end breadcrumb -->
<!-- begin page-header -->
<h1 class="page-header">Delete Clinical Note <small>Confirm clinical note deletion</small></h1>
<!-- end page-header -->
<!-- begin row -->
<div class="row">
<!-- begin col-12 -->
<div class="col-xl-12">
<!-- begin panel -->
<div class="panel panel-inverse">
<div class="panel-heading">
<h4 class="panel-title">Confirm Deletion</h4>
<div class="panel-heading-btn">
<a href="javascript:;" class="btn btn-xs btn-icon btn-default" data-toggle="panel-expand"><i class="fa fa-expand"></i></a>
<a href="javascript:;" class="btn btn-xs btn-icon btn-success" data-toggle="panel-reload"><i class="fa fa-redo"></i></a>
<a href="javascript:;" class="btn btn-xs btn-icon btn-warning" data-toggle="panel-collapse"><i class="fa fa-minus"></i></a>
</div>
</div>
<div class="panel-body">
<!-- begin delete warning -->
<div class="delete-warning">
<h4 class="text-danger">
<i class="fa fa-exclamation-triangle me-2"></i> Warning: You are about to delete a clinical note
</h4>
<p>
You are about to permanently delete the clinical note <strong>"{{ clinical_note.title }}"</strong>
for patient <strong>{{ clinical_note.patient.get_full_name }}</strong>. This action cannot be undone.
</p>
<p>
Deleting this clinical note will remove it from the patient's medical record and may affect
related records, care plans, and other clinical documentation.
</p>
{% if clinical_note.status == 'SIGNED' %}
<div class="alert alert-danger">
<strong>Warning:</strong> This note has been signed and is part of the official medical record.
Deleting signed notes may violate regulatory requirements and documentation standards.
</div>
{% endif %}
</div>
<!-- end delete warning -->
<!-- begin note summary -->
<h5 class="mb-3">Note Summary</h5>
<div class="table-responsive">
<table class="table table-bordered">
<tbody>
<tr>
<th width="25%">Note ID</th>
<td>{{ clinical_note.note_id }}</td>
</tr>
<tr>
<th>Title</th>
<td>{{ clinical_note.title }}</td>
</tr>
<tr>
<th>Patient</th>
<td>{{ clinical_note.patient.get_full_name }}</td>
</tr>
<tr>
<th>Note Type</th>
<td>
<span class="badge note-type-{{ clinical_note.note_type|lower }}">
{{ clinical_note.get_note_type_display }}
</span>
</td>
</tr>
<tr>
<th>Status</th>
<td>
<span class="badge note-status-{{ clinical_note.status|lower }}">
{{ clinical_note.get_status_display }}
</span>
</td>
</tr>
<tr>
<th>Author</th>
<td>{{ clinical_note.author.get_full_name }}</td>
</tr>
<tr>
<th>Note Date/Time</th>
<td>{{ clinical_note.note_datetime }}</td>
</tr>
<tr>
<th>Created</th>
<td>{{ clinical_note.created_at }}</td>
</tr>
{% if clinical_note.signed_datetime %}
<tr>
<th>Signed Date/Time</th>
<td>{{ clinical_note.signed_datetime }}</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
<!-- end note summary -->
<!-- begin impact assessment -->
<div class="impact-assessment mt-4">
<h5>
<i class="fa fa-exclamation-circle me-2"></i> Impact Assessment
</h5>
<p>Deleting this clinical note will affect the following:</p>
<div class="row">
<div class="col-md-6">
<div class="card mb-3">
<div class="card-header bg-light">
<h6 class="card-title mb-0">Related Problems</h6>
</div>
<div class="card-body">
{% if clinical_note.related_problems.all %}
<ul class="mb-0">
{% for problem in clinical_note.related_problems.all %}
<li>{{ problem.problem_name }} ({{ problem.get_status_display }})</li>
{% endfor %}
</ul>
{% else %}
<p class="mb-0">No problems associated with this clinical note.</p>
{% endif %}
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-3">
<div class="card-header bg-light">
<h6 class="card-title mb-0">Related Care Plans</h6>
</div>
<div class="card-body">
{% if clinical_note.related_care_plans.all %}
<ul class="mb-0">
{% for care_plan in clinical_note.related_care_plans.all %}
<li>{{ care_plan.title }} ({{ care_plan.get_status_display }})</li>
{% endfor %}
</ul>
{% else %}
<p class="mb-0">No care plans associated with this clinical note.</p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card mb-3">
<div class="card-header bg-light">
<h6 class="card-title mb-0">Related Encounter</h6>
</div>
<div class="card-body">
{% if clinical_note.related_encounter %}
<p class="mb-0">
This note is associated with encounter:
<strong>{{ clinical_note.related_encounter.encounter_type }}</strong> on
<strong>{{ clinical_note.related_encounter.start_time|date:"M d, Y" }}</strong>
with provider <strong>{{ clinical_note.related_encounter.provider.get_full_name }}</strong>.
</p>
{% else %}
<p class="mb-0">No encounter associated with this clinical note.</p>
{% endif %}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card mb-3">
<div class="card-header bg-light">
<h6 class="card-title mb-0">Addendums & Amendments</h6>
</div>
<div class="card-body">
{% if clinical_note.addendums.all %}
<p>This note has <strong>{{ clinical_note.addendums.count }}</strong> addendum(s):</p>
<ul class="mb-0">
{% for addendum in clinical_note.addendums.all %}
<li>
Addendum by {{ addendum.author.get_full_name }} on
{{ addendum.created_at|date:"M d, Y" }}
</li>
{% endfor %}
</ul>
{% elif clinical_note.status == 'AMENDED' %}
<p class="mb-0">
This note has been amended by {{ clinical_note.amended_by.get_full_name }} on
{{ clinical_note.amended_datetime|date:"M d, Y" }}.
</p>
{% else %}
<p class="mb-0">No addendums or amendments associated with this clinical note.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<!-- end impact assessment -->
<!-- begin alternative actions -->
<div class="alternative-actions">
<h5>
<i class="fa fa-lightbulb me-2"></i> Alternative Actions
</h5>
<p>Instead of deleting this clinical note, consider these alternatives:</p>
<div class="row">
{% if clinical_note.status == 'DRAFT' %}
<div class="col-md-4">
<div class="card mb-3">
<div class="card-body">
<h6 class="card-title">Continue Editing</h6>
<p class="card-text">If the note is incomplete, you can continue editing it instead of deleting it.</p>
<a href="{% url 'emr:clinical_note_update' clinical_note.id %}" class="btn btn-sm btn-primary">
<i class="fa fa-edit me-1"></i> Edit Note
</a>
</div>
</div>
</div>
{% endif %}
{% if clinical_note.status == 'SIGNED' %}
<div class="col-md-4">
<div class="card mb-3">
<div class="card-body">
<h6 class="card-title">Add Amendment</h6>
<p class="card-text">If the note contains errors, add an amendment to correct the information.</p>
<a href="{% url 'emr:clinical_note_detail' clinical_note.id %}" class="btn btn-sm btn-info">
<i class="fa fa-pencil-alt me-1"></i> Add Amendment
</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mb-3">
<div class="card-body">
<h6 class="card-title">Add Addendum</h6>
<p class="card-text">If additional information is needed, add an addendum to the note.</p>
<a href="{% url 'emr:clinical_note_detail' clinical_note.id %}" class="btn btn-sm btn-purple">
<i class="fa fa-plus me-1"></i> Add Addendum
</a>
</div>
</div>
</div>
{% endif %}
<div class="col-md-4">
<div class="card mb-3">
<div class="card-body">
<h6 class="card-title">Mark as Error</h6>
<p class="card-text">If the note was created in error, mark it as an error note instead of deleting it.</p>
<a href="{% url 'emr:clinical_note_mark_error' clinical_note.id %}" class="btn btn-sm btn-warning">
<i class="fa fa-exclamation-triangle me-1"></i> Mark as Error
</a>
</div>
</div>
</div>
</div>
</div>
<!-- end alternative actions -->
<!-- begin delete confirmation -->
<form method="post" class="mt-4">
{% csrf_token %}
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" id="confirmDelete" required>
<label class="form-check-label" for="confirmDelete">
I understand that this action cannot be undone and confirm that I want to permanently delete this clinical note.
</label>
</div>
{% if clinical_note.status == 'SIGNED' %}
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" id="confirmSignedDelete" required>
<label class="form-check-label" for="confirmSignedDelete">
I understand that this note has been signed and is part of the official medical record, and I confirm that I have the authority to delete it.
</label>
</div>
<div class="mb-3">
<label for="deleteReason" class="form-label">Reason for Deletion</label>
<textarea class="form-control" id="deleteReason" name="delete_reason" rows="3" required></textarea>
<div class="form-text">Please provide a detailed reason for deleting this signed clinical note.</div>
</div>
{% endif %}
<div class="d-flex justify-content-between">
<a href="{% url 'emr:clinical_note_detail' clinical_note.id %}" class="btn btn-secondary">
<i class="fa fa-arrow-left me-1"></i> Cancel
</a>
<button type="submit" class="btn btn-danger" id="deleteButton" disabled>
<i class="fa fa-trash me-1"></i> Delete Clinical Note
</button>
</div>
</form>
<!-- end delete confirmation -->
</div>
</div>
<!-- end panel -->
</div>
<!-- end col-12 -->
</div>
<!-- end row -->
{% endblock %}
{% block js %}
<script>
$(document).ready(function() {
// Enable delete button only when confirmation checkbox is checked
function updateDeleteButton() {
const confirmDeleteChecked = $('#confirmDelete').is(':checked');
const confirmSignedDeleteChecked = $('#confirmSignedDelete').length ? $('#confirmSignedDelete').is(':checked') : true;
const deleteReasonFilled = $('#deleteReason').length ? $('#deleteReason').val().trim() !== '' : true;
if (confirmDeleteChecked && confirmSignedDeleteChecked && deleteReasonFilled) {
$('#deleteButton').prop('disabled', false);
} else {
$('#deleteButton').prop('disabled', true);
}
}
$('#confirmDelete, #confirmSignedDelete, #deleteReason').on('change keyup', updateDeleteButton);
});
</script>
{% endblock %}