581 lines
26 KiB
HTML
581 lines
26 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Imaging Order - {{ object.order_number }}{% 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 'radiology:dashboard' %}">Radiology</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'radiology:imaging_order_list' %}">Imaging Orders</a></li>
|
|
<li class="breadcrumb-item"><a href="{% url 'radiology:imaging_order_detail' object.pk %}">{{ object.order_number }}</a></li>
|
|
<li class="breadcrumb-item active">Delete</li>
|
|
</ol>
|
|
<!-- END breadcrumb -->
|
|
|
|
<!-- BEGIN page-header -->
|
|
<h1 class="page-header">
|
|
Delete Imaging Order
|
|
<small>{{ object.order_number }} - {{ object.patient.get_full_name }}</small>
|
|
</h1>
|
|
<!-- END page-header -->
|
|
|
|
<!-- BEGIN row -->
|
|
<div class="row">
|
|
<div class="col-xl-8">
|
|
<!-- Deletion Warning -->
|
|
<div class="alert alert-danger">
|
|
<h4 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>Confirm Order Deletion
|
|
</h4>
|
|
<p class="mb-3">You are about to permanently delete this imaging order. This action cannot be undone.</p>
|
|
<hr>
|
|
<p class="mb-0">
|
|
<strong>Order:</strong> {{ object.order_number }}<br>
|
|
<strong>Patient:</strong> {{ object.patient.get_full_name }}<br>
|
|
<strong>Study:</strong> {{ object.study_type }} - {{ object.body_part }}<br>
|
|
<strong>Status:</strong>
|
|
{% if object.status == 'pending' %}
|
|
<span class="badge bg-secondary">Pending</span>
|
|
{% elif object.status == 'scheduled' %}
|
|
<span class="badge bg-info">Scheduled</span>
|
|
{% elif object.status == 'in_progress' %}
|
|
<span class="badge bg-warning text-dark">In Progress</span>
|
|
{% elif object.status == 'completed' %}
|
|
<span class="badge bg-success">Completed</span>
|
|
{% elif object.status == 'cancelled' %}
|
|
<span class="badge bg-danger">Cancelled</span>
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Status-Specific Warnings -->
|
|
{% if object.status == 'in_progress' %}
|
|
<div class="alert alert-warning">
|
|
<h5 class="alert-heading">
|
|
<i class="fa fa-exclamation-circle me-2"></i>Active Study Warning
|
|
</h5>
|
|
<p class="mb-2">This order has an active imaging study in progress.</p>
|
|
<ul class="mb-0">
|
|
<li>Study started: {{ object.imaging_studies.first.start_time|date:"M d, Y g:i A" }}</li>
|
|
<li>Technologist: {{ object.technologist.get_full_name|default:"Not assigned" }}</li>
|
|
<li>Equipment: {{ object.equipment.name|default:"Not assigned" }}</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.status == 'completed' %}
|
|
<div class="alert alert-info">
|
|
<h5 class="alert-heading">
|
|
<i class="fa fa-info-circle me-2"></i>Completed Study Notice
|
|
</h5>
|
|
<p class="mb-2">This order has been completed and may have associated reports and images.</p>
|
|
<ul class="mb-0">
|
|
{% if object.imaging_studies.exists %}
|
|
<li>{{ object.imaging_studies.count }} imaging stud{{ object.imaging_studies.count|pluralize:"y,ies" }} completed</li>
|
|
{% endif %}
|
|
{% if object.radiology_reports.exists %}
|
|
<li>{{ object.radiology_reports.count }} radiology report{{ object.radiology_reports.count|pluralize }} generated</li>
|
|
{% endif %}
|
|
{% if object.dicom_files.exists %}
|
|
<li>{{ object.dicom_files.count }} DICOM file{{ object.dicom_files.count|pluralize }} stored</li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.priority == 'stat' or object.priority == 'urgent' %}
|
|
<div class="alert alert-warning">
|
|
<h5 class="alert-heading">
|
|
<i class="fa fa-bolt me-2"></i>High Priority Order
|
|
</h5>
|
|
<p class="mb-0">
|
|
This is a {{ object.priority|upper }} priority order. Deletion may impact patient care.
|
|
Please ensure this action is appropriate and consider contacting the ordering provider.
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Impact Assessment -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Impact Assessment</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<h6 class="fw-bold text-danger">Will be deleted:</h6>
|
|
<ul class="list-unstyled">
|
|
<li><i class="fa fa-times text-danger me-2"></i>Order record and metadata</li>
|
|
<li><i class="fa fa-times text-danger me-2"></i>Scheduling information</li>
|
|
<li><i class="fa fa-times text-danger me-2"></i>Order notes and comments</li>
|
|
{% if object.imaging_studies.exists %}
|
|
<li><i class="fa fa-times text-danger me-2"></i>{{ object.imaging_studies.count }} imaging stud{{ object.imaging_studies.count|pluralize:"y,ies" }}</li>
|
|
{% endif %}
|
|
{% if object.radiology_reports.exists %}
|
|
<li><i class="fa fa-times text-danger me-2"></i>{{ object.radiology_reports.count }} radiology report{{ object.radiology_reports.count|pluralize }}</li>
|
|
{% endif %}
|
|
{% if object.dicom_files.exists %}
|
|
<li><i class="fa fa-times text-danger me-2"></i>{{ object.dicom_files.count }} DICOM file{{ object.dicom_files.count|pluralize }}</li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6 class="fw-bold text-success">Will be preserved:</h6>
|
|
<ul class="list-unstyled">
|
|
<li><i class="fa fa-check text-success me-2"></i>Patient medical record</li>
|
|
<li><i class="fa fa-check text-success me-2"></i>Provider information</li>
|
|
<li><i class="fa fa-check text-success me-2"></i>Audit trail entries</li>
|
|
<li><i class="fa fa-check text-success me-2"></i>Billing records (if generated)</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
{% if object.status == 'scheduled' %}
|
|
<div class="mt-3">
|
|
<div class="alert alert-info">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-calendar me-2"></i>Scheduling Impact
|
|
</h6>
|
|
<p class="mb-2">Deleting this order will:</p>
|
|
<ul class="mb-0">
|
|
<li>Free up the scheduled time slot: {{ object.scheduled_date|date:"M d, Y g:i A" }}</li>
|
|
<li>Release assigned equipment: {{ object.equipment.name|default:"None assigned" }}</li>
|
|
<li>Cancel technologist assignment: {{ object.technologist.get_full_name|default:"None assigned" }}</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Alternative Actions -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Alternative Actions</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<p class="mb-3">Consider these alternatives before deleting the order:</p>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="card border-warning">
|
|
<div class="card-header bg-warning bg-opacity-10">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-ban me-2"></i>Cancel Order
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text small">
|
|
Mark the order as cancelled instead of deleting. This preserves the record for audit purposes.
|
|
</p>
|
|
<a href="{% url 'radiology:cancel_order' object.pk %}" class="btn btn-warning btn-sm">
|
|
<i class="fa fa-ban me-1"></i>Cancel Order
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="card border-info">
|
|
<div class="card-header bg-info bg-opacity-10">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-edit me-2"></i>Modify Order
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text small">
|
|
Edit the order details, change priority, or reschedule instead of deleting.
|
|
</p>
|
|
<a href="{% url 'radiology:imaging_order_edit' object.pk %}" class="btn btn-info btn-sm">
|
|
<i class="fa fa-edit me-1"></i>Edit Order
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if object.status == 'scheduled' %}
|
|
<div class="row mt-3">
|
|
<div class="col-md-6">
|
|
<div class="card border-secondary">
|
|
<div class="card-header bg-secondary bg-opacity-10">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-calendar me-2"></i>Reschedule
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text small">
|
|
Change the scheduled date and time while keeping the order active.
|
|
</p>
|
|
<button type="button" class="btn btn-secondary btn-sm" onclick="rescheduleOrder()">
|
|
<i class="fa fa-calendar me-1"></i>Reschedule
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="card border-primary">
|
|
<div class="card-header bg-primary bg-opacity-10">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-phone me-2"></i>Contact Provider
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text small">
|
|
Contact the ordering provider to discuss the order before deletion.
|
|
</p>
|
|
<button type="button" class="btn btn-primary btn-sm" onclick="contactProvider()">
|
|
<i class="fa fa-phone me-1"></i>Contact
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Deletion Confirmation -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Deletion Confirmation</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<form method="post" id="deleteForm">
|
|
{% csrf_token %}
|
|
|
|
<div class="mb-3">
|
|
<label for="deletion_reason" class="form-label required">Reason for Deletion</label>
|
|
<select class="form-select" id="deletion_reason" name="deletion_reason" required>
|
|
<option value="">Select a reason...</option>
|
|
<option value="duplicate_order">Duplicate order</option>
|
|
<option value="wrong_patient">Wrong patient</option>
|
|
<option value="wrong_study">Wrong study type</option>
|
|
<option value="provider_request">Provider request</option>
|
|
<option value="patient_request">Patient request</option>
|
|
<option value="administrative_error">Administrative error</option>
|
|
<option value="other">Other (specify below)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3" id="otherReasonDiv" style="display: none;">
|
|
<label for="other_reason" class="form-label">Specify Other Reason</label>
|
|
<textarea class="form-control" id="other_reason" name="other_reason" rows="3"
|
|
placeholder="Please provide detailed explanation..."></textarea>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="deletion_notes" class="form-label">Additional Notes</label>
|
|
<textarea class="form-control" id="deletion_notes" name="deletion_notes" rows="3"
|
|
placeholder="Any additional information about this deletion..."></textarea>
|
|
</div>
|
|
|
|
{% if object.status == 'in_progress' or object.status == 'completed' %}
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="confirm_data_loss" name="confirm_data_loss" required>
|
|
<label class="form-check-label" for="confirm_data_loss">
|
|
I understand that deleting this order will permanently remove all associated studies, reports, and DICOM images
|
|
</label>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.priority == 'stat' or object.priority == 'urgent' %}
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="confirm_priority" name="confirm_priority" required>
|
|
<label class="form-check-label" for="confirm_priority">
|
|
I understand this is a {{ object.priority|upper }} priority order and confirm deletion is appropriate
|
|
</label>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="mb-3">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="confirm_deletion" name="confirm_deletion" required>
|
|
<label class="form-check-label" for="confirm_deletion">
|
|
I confirm that I want to permanently delete this imaging order
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<a href="{% url 'radiology:imaging_order_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fa fa-arrow-left me-1"></i>Cancel
|
|
</a>
|
|
</div>
|
|
<div>
|
|
<button type="submit" class="btn btn-danger" id="deleteButton" disabled>
|
|
<i class="fa fa-trash me-1"></i>Delete Order Permanently
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-xl-4">
|
|
<!-- Order Summary -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Order Summary</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<table class="table table-borderless table-sm">
|
|
<tr>
|
|
<td class="fw-bold" width="120">Order #:</td>
|
|
<td>{{ object.order_number }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Patient:</td>
|
|
<td>{{ object.patient.get_full_name }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">MRN:</td>
|
|
<td>{{ object.patient.medical_record_number }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Study:</td>
|
|
<td>{{ object.study_type }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Body Part:</td>
|
|
<td>{{ object.body_part }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Modality:</td>
|
|
<td>{{ object.modality }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Priority:</td>
|
|
<td>
|
|
{% if object.priority == 'stat' %}
|
|
<span class="badge bg-danger">STAT</span>
|
|
{% elif object.priority == 'urgent' %}
|
|
<span class="badge bg-warning text-dark">Urgent</span>
|
|
{% elif object.priority == 'routine' %}
|
|
<span class="badge bg-success">Routine</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Provider:</td>
|
|
<td>{{ object.ordering_provider.get_full_name }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Order Date:</td>
|
|
<td>{{ object.order_date|date:"M d, Y" }}</td>
|
|
</tr>
|
|
{% if object.scheduled_date %}
|
|
<tr>
|
|
<td class="fw-bold">Scheduled:</td>
|
|
<td>{{ object.scheduled_date|date:"M d, Y g:i A" }}</td>
|
|
</tr>
|
|
{% endif %}
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Deletion Guidelines -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Deletion Guidelines</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="alert alert-info">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-info-circle me-2"></i>When to Delete Orders
|
|
</h6>
|
|
<ul class="mb-0 small">
|
|
<li>Duplicate orders entered in error</li>
|
|
<li>Orders for wrong patient</li>
|
|
<li>Incorrect study type ordered</li>
|
|
<li>Administrative data entry errors</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>Consider Cancellation Instead
|
|
</h6>
|
|
<ul class="mb-0 small">
|
|
<li>Provider changes mind about study</li>
|
|
<li>Patient declines procedure</li>
|
|
<li>Clinical condition changes</li>
|
|
<li>Insurance authorization denied</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="alert alert-danger">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-ban me-2"></i>Avoid Deletion When
|
|
</h6>
|
|
<ul class="mb-0 small">
|
|
<li>Study has been completed</li>
|
|
<li>Reports have been generated</li>
|
|
<li>Images have been acquired</li>
|
|
<li>Billing has been processed</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Contact Information -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">Need Help?</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="text-center">
|
|
<div class="mb-2">
|
|
<i class="fa fa-phone me-2"></i>
|
|
<strong>Radiology Supervisor</strong><br>
|
|
<small>(555) 123-4567 ext. 1001</small>
|
|
</div>
|
|
<div class="mb-3">
|
|
<i class="fa fa-envelope me-2"></i>
|
|
<strong>radiology.supervisor@hospital.com</strong>
|
|
</div>
|
|
<div class="d-grid">
|
|
<a href="tel:+15551234567" class="btn btn-outline-primary btn-sm">
|
|
<i class="fa fa-phone me-1"></i>Call for Guidance
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- END row -->
|
|
|
|
<!-- Reschedule Modal -->
|
|
<div class="modal fade" id="rescheduleModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Reschedule Order</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<!-- Reschedule form content -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Contact Provider Modal -->
|
|
<div class="modal fade" id="contactModal" tabindex="-1">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Contact Provider</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="text-center">
|
|
<h6>{{ object.ordering_provider.get_full_name }}</h6>
|
|
<p class="mb-2">{{ object.ordering_provider.department|default:"Department not specified" }}</p>
|
|
{% if object.ordering_provider.phone %}
|
|
<div class="mb-2">
|
|
<i class="fa fa-phone me-2"></i>{{ object.ordering_provider.phone }}
|
|
</div>
|
|
{% endif %}
|
|
{% if object.ordering_provider.email %}
|
|
<div class="mb-3">
|
|
<i class="fa fa-envelope me-2"></i>{{ object.ordering_provider.email }}
|
|
</div>
|
|
{% endif %}
|
|
<div class="d-grid gap-2">
|
|
{% if object.ordering_provider.phone %}
|
|
<a href="tel:{{ object.ordering_provider.phone }}" class="btn btn-primary">
|
|
<i class="fa fa-phone me-1"></i>Call Provider
|
|
</a>
|
|
{% endif %}
|
|
{% if object.ordering_provider.email %}
|
|
<a href="mailto:{{ object.ordering_provider.email }}" class="btn btn-outline-primary">
|
|
<i class="fa fa-envelope me-1"></i>Send Email
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Handle deletion reason change
|
|
$('#deletion_reason').change(function() {
|
|
if ($(this).val() === 'other') {
|
|
$('#otherReasonDiv').show();
|
|
$('#other_reason').prop('required', true);
|
|
} else {
|
|
$('#otherReasonDiv').hide();
|
|
$('#other_reason').prop('required', false);
|
|
}
|
|
checkFormValidity();
|
|
});
|
|
|
|
// Handle checkbox changes
|
|
$('input[type="checkbox"]').change(function() {
|
|
checkFormValidity();
|
|
});
|
|
|
|
// Handle form submission
|
|
$('#deleteForm').on('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
if (confirm('Are you absolutely sure you want to delete this imaging order? This action cannot be undone.')) {
|
|
// Show loading state
|
|
$('#deleteButton').prop('disabled', true).html('<i class="fa fa-spinner fa-spin me-1"></i>Deleting...');
|
|
|
|
// Submit form
|
|
this.submit();
|
|
}
|
|
});
|
|
});
|
|
|
|
function checkFormValidity() {
|
|
var isValid = true;
|
|
|
|
// Check required fields
|
|
if (!$('#deletion_reason').val()) {
|
|
isValid = false;
|
|
}
|
|
|
|
if ($('#deletion_reason').val() === 'other' && !$('#other_reason').val().trim()) {
|
|
isValid = false;
|
|
}
|
|
|
|
// Check required checkboxes
|
|
$('input[type="checkbox"][required]').each(function() {
|
|
if (!$(this).is(':checked')) {
|
|
isValid = false;
|
|
}
|
|
});
|
|
|
|
$('#deleteButton').prop('disabled', !isValid);
|
|
}
|
|
|
|
function rescheduleOrder() {
|
|
$('#rescheduleModal').modal('show');
|
|
// Load reschedule form via AJAX
|
|
}
|
|
|
|
function contactProvider() {
|
|
$('#contactModal').modal('show');
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|