315 lines
15 KiB
HTML
315 lines
15 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Radiology Report - {{ object.report_id }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="d-flex align-items-center mb-3">
|
|
<div>
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{% url 'radiology:dashboard' %}">Radiology</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'radiology:radiology_report_list' %}">Reports</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'radiology:radiology_report_detail' object.pk %}">{{ object.report_id }}</a></li>
|
|
<li class="breadcrumb-item active">Delete</li>
|
|
</ol>
|
|
<h1 class="page-header mb-0">Delete Radiology Report</h1>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-xl-8">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="card-title">
|
|
<i class="fas fa-exclamation-triangle text-danger me-2"></i>
|
|
Confirm Deletion
|
|
</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="alert alert-danger">
|
|
<h5><i class="fas fa-exclamation-triangle me-2"></i>Critical Warning</h5>
|
|
<p class="mb-0">You are about to permanently delete this radiology report. This action cannot be undone and may have serious legal and clinical implications.</p>
|
|
</div>
|
|
|
|
<!-- Report Information -->
|
|
<div class="row mb-4">
|
|
<div class="col-md-6">
|
|
<h6 class="text-muted mb-2">Report Information</h6>
|
|
<table class="table table-sm">
|
|
<tr>
|
|
<td class="fw-bold">Report ID:</td>
|
|
<td>{{ object.report_id }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Patient:</td>
|
|
<td>{{ object.study.patient.get_full_name }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Study:</td>
|
|
<td>{{ object.study.get_study_type_display }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Study Date:</td>
|
|
<td>{{ object.study.study_date|date:"M d, Y" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Status:</td>
|
|
<td>
|
|
<span class="badge bg-{% if object.status == 'finalized' %}success{% elif object.status == 'pending' %}warning{% elif object.status == 'draft' %}secondary{% else %}primary{% endif %}">
|
|
{{ object.get_status_display }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="text-muted mb-2">Clinical Details</h6>
|
|
<table class="table table-sm">
|
|
<tr>
|
|
<td class="fw-bold">Radiologist:</td>
|
|
<td>{{ object.radiologist.get_full_name|default:"Not assigned" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Priority:</td>
|
|
<td>
|
|
<span class="badge bg-{% if object.priority == 'urgent' %}danger{% elif object.priority == 'high' %}warning{% else %}success{% endif %}">
|
|
{{ object.get_priority_display }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Critical Findings:</td>
|
|
<td>
|
|
{% if object.has_critical_findings %}
|
|
<span class="badge bg-danger">Yes</span>
|
|
{% else %}
|
|
<span class="badge bg-success">No</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Created:</td>
|
|
<td>{{ object.created_at|date:"M d, Y g:i A" }}</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Critical Findings Warning -->
|
|
{% if object.has_critical_findings %}
|
|
<div class="alert alert-danger">
|
|
<h6><i class="fas fa-exclamation-triangle me-2"></i>Critical Findings Alert</h6>
|
|
<p class="mb-0">This report contains critical findings that may be essential for patient care. Deletion could impact patient safety and legal compliance.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Finalized Report Warning -->
|
|
{% if object.status == 'finalized' %}
|
|
<div class="alert alert-danger">
|
|
<h6><i class="fas fa-shield-alt me-2"></i>Finalized Report Warning</h6>
|
|
<p class="mb-0">This is a finalized report that may be part of the official medical record. Deletion may violate record retention policies and legal requirements.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Impact Assessment -->
|
|
<div class="alert alert-warning">
|
|
<h6><i class="fas fa-info-circle me-2"></i>Deletion Impact</h6>
|
|
<ul class="mb-0">
|
|
<li><strong>Medical Record:</strong> Report will be permanently removed from patient's medical record</li>
|
|
<li><strong>Billing:</strong> Associated billing codes and charges may be affected</li>
|
|
<li><strong>Quality Metrics:</strong> Turnaround time and quality statistics will be impacted</li>
|
|
<li><strong>Legal Compliance:</strong> May affect regulatory compliance and audit trails</li>
|
|
<li><strong>Clinical Care:</strong> Future care decisions may be impacted by missing information</li>
|
|
<li><strong>Peer Review:</strong> Any peer review data will be lost</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Alternative Actions -->
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h6 class="card-title">Alternative Actions</h6>
|
|
<p class="card-text">Consider these alternatives to deletion:</p>
|
|
<div class="btn-group-vertical w-100" role="group">
|
|
<a href="{% url 'radiology:radiology_report_update' object.pk %}" class="btn btn-outline-primary btn-sm">
|
|
<i class="fas fa-edit me-2"></i>Edit Report Content
|
|
</a>
|
|
<button type="button" class="btn btn-outline-warning btn-sm" onclick="amendReport()">
|
|
<i class="fas fa-file-medical me-2"></i>Create Amendment
|
|
</button>
|
|
<button type="button" class="btn btn-outline-info btn-sm" onclick="archiveReport()">
|
|
<i class="fas fa-archive me-2"></i>Archive Report (Recommended)
|
|
</button>
|
|
<button type="button" class="btn btn-outline-secondary btn-sm" onclick="addendum()">
|
|
<i class="fas fa-plus me-2"></i>Add Addendum
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xl-4">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="card-title">Deletion Authorization</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Reason for Deletion <span class="text-danger">*</span></label>
|
|
<select class="form-select" name="deletion_reason" required>
|
|
<option value="">Select reason...</option>
|
|
<option value="duplicate">Duplicate Report</option>
|
|
<option value="error">Report Error</option>
|
|
<option value="wrong_patient">Wrong Patient</option>
|
|
<option value="wrong_study">Wrong Study</option>
|
|
<option value="data_corruption">Data Corruption</option>
|
|
<option value="legal_request">Legal Request</option>
|
|
<option value="administrative">Administrative</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Supervisor Authorization <span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="supervisor_name" placeholder="Supervisor name" required>
|
|
<div class="form-text">Department supervisor must authorize this deletion</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Authorization Code <span class="text-danger">*</span></label>
|
|
<input type="password" class="form-control" name="auth_code" placeholder="Enter authorization code" required>
|
|
<div class="form-text">Contact IT for authorization code</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Detailed Justification <span class="text-danger">*</span></label>
|
|
<textarea class="form-control" name="deletion_justification" rows="4" placeholder="Provide detailed justification for this deletion..." required></textarea>
|
|
<div class="form-text">This will be logged for audit purposes</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="confirmLegal" required>
|
|
<label class="form-check-label" for="confirmLegal">
|
|
I confirm this deletion complies with legal and regulatory requirements
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="confirmBackup" required>
|
|
<label class="form-check-label" for="confirmBackup">
|
|
I confirm proper backup and archival procedures have been followed
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="confirmUnderstand" required>
|
|
<label class="form-check-label" for="confirmUnderstand">
|
|
I understand this action cannot be undone and accept full responsibility
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-grid gap-2">
|
|
<button type="submit" class="btn btn-danger" id="deleteBtn" disabled>
|
|
<i class="fas fa-trash me-2"></i>Delete Report
|
|
</button>
|
|
<a href="{% url 'radiology:radiology_report_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fas fa-times me-2"></i>Cancel
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Emergency Contact -->
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4 class="card-title">Emergency Contact</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text">For urgent deletion requests or questions:</p>
|
|
<ul class="list-unstyled">
|
|
<li><i class="fas fa-user-md me-2"></i><strong>Chief Radiologist:</strong> ext. 2100</li>
|
|
<li><i class="fas fa-gavel me-2"></i><strong>Legal Department:</strong> ext. 2300</li>
|
|
<li><i class="fas fa-shield-alt me-2"></i><strong>Compliance Officer:</strong> ext. 2200</li>
|
|
<li><i class="fas fa-cog me-2"></i><strong>IT Security:</strong> ext. 3001</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const form = document.querySelector('form');
|
|
const deleteBtn = document.getElementById('deleteBtn');
|
|
const requiredFields = form.querySelectorAll('input[required], select[required], textarea[required]');
|
|
const checkboxes = form.querySelectorAll('input[type="checkbox"][required]');
|
|
|
|
function updateDeleteButton() {
|
|
let allValid = true;
|
|
|
|
// Check required fields
|
|
requiredFields.forEach(field => {
|
|
if (!field.value.trim()) {
|
|
allValid = false;
|
|
}
|
|
});
|
|
|
|
// Check required checkboxes
|
|
checkboxes.forEach(checkbox => {
|
|
if (!checkbox.checked) {
|
|
allValid = false;
|
|
}
|
|
});
|
|
|
|
deleteBtn.disabled = !allValid;
|
|
}
|
|
|
|
// Add event listeners
|
|
requiredFields.forEach(field => {
|
|
field.addEventListener('input', updateDeleteButton);
|
|
field.addEventListener('change', updateDeleteButton);
|
|
});
|
|
|
|
checkboxes.forEach(checkbox => {
|
|
checkbox.addEventListener('change', updateDeleteButton);
|
|
});
|
|
|
|
// Form submission confirmation
|
|
form.addEventListener('submit', function(e) {
|
|
if (!confirm('Are you absolutely certain you want to delete this radiology report? This action cannot be undone.')) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
|
|
function amendReport() {
|
|
if (confirm('Create an amendment to this report instead of deleting it?')) {
|
|
window.location.href = '{% url "radiology:radiology_report_detail" object.pk %}?action=amend';
|
|
}
|
|
}
|
|
|
|
function archiveReport() {
|
|
if (confirm('Archive this report instead of deleting it? This is the recommended action.')) {
|
|
window.location.href = '{% url "radiology:radiology_report_detail" object.pk %}?action=archive';
|
|
}
|
|
}
|
|
|
|
function addendum() {
|
|
if (confirm('Add an addendum to this report instead of deleting it?')) {
|
|
window.location.href = '{% url "radiology:radiology_report_detail" object.pk %}?action=addendum';
|
|
}
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|