497 lines
27 KiB
HTML
497 lines
27 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Delete Insurance - Patients{% 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:insurance_detail' object.pk %}">{{ object.insurance_provider }}</a></li>
|
|
<li class="breadcrumb-item active">Delete Confirmation</li>
|
|
</ol>
|
|
<!-- END breadcrumb -->
|
|
|
|
<!-- BEGIN page-header -->
|
|
<h1 class="page-header">
|
|
Delete Insurance Policy
|
|
<small>Confirmation Required</small>
|
|
</h1>
|
|
<!-- END page-header -->
|
|
|
|
<div class="row justify-content-center">
|
|
<div class="col-xl-8">
|
|
<!-- BEGIN panel -->
|
|
<div class="panel panel-inverse">
|
|
<div class="panel-heading">
|
|
<h4 class="panel-title">
|
|
<i class="fa fa-exclamation-triangle text-warning me-2"></i>
|
|
Confirm Insurance Deletion
|
|
</h4>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="alert alert-warning">
|
|
<h6 class="alert-heading">Warning</h6>
|
|
<p class="mb-0">You are about to delete this insurance policy. This action cannot be undone and may impact billing, claims processing, and patient care.</p>
|
|
</div>
|
|
|
|
<div class="row mb-4">
|
|
<div class="col-md-6">
|
|
<h6>Insurance Details:</h6>
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td class="fw-bold" width="150">Provider:</td>
|
|
<td>{{ object.insurance_provider }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Policy Number:</td>
|
|
<td><code>{{ object.policy_number }}</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Member ID:</td>
|
|
<td>
|
|
{% if object.member_id %}
|
|
<code>{{ object.member_id }}</code>
|
|
{% else %}
|
|
<span class="text-muted">Not provided</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Type:</td>
|
|
<td>
|
|
<span class="badge bg-{% if object.insurance_type == 'PRIMARY' %}primary{% elif object.insurance_type == 'SECONDARY' %}info{% else %}secondary{% endif %}">
|
|
{{ object.get_insurance_type_display }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Status:</td>
|
|
<td>
|
|
<span class="badge bg-{% if object.status == 'ACTIVE' %}success{% elif object.status == 'EXPIRED' %}danger{% elif object.status == 'PENDING' %}warning{% else %}secondary{% endif %}">
|
|
{{ object.get_status_display }}
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Effective Date:</td>
|
|
<td>
|
|
{% if object.effective_date %}
|
|
{{ object.effective_date|date:"M d, Y" }}
|
|
{% else %}
|
|
<span class="text-muted">Not set</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<h6>Patient Information:</h6>
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td class="fw-bold" width="150">Patient:</td>
|
|
<td>{{ object.patient.get_full_name }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Patient ID:</td>
|
|
<td><code>{{ object.patient.patient_id }}</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">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">Insurance Added:</td>
|
|
<td>{{ object.created_at|date:"M d, Y H:i" }}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold">Last Updated:</td>
|
|
<td>{{ object.updated_at|date:"M d, Y H:i" }}</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Impact Assessment -->
|
|
<div class="alert alert-info mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-info-circle me-2"></i>Impact Assessment
|
|
</h6>
|
|
<ul class="mb-0">
|
|
<li><strong>Billing:</strong> Insurance information will be removed from patient billing records</li>
|
|
<li><strong>Claims Processing:</strong> Future claims cannot be submitted to this insurance</li>
|
|
<li><strong>Coverage Verification:</strong> Coverage verification history will be preserved</li>
|
|
<li><strong>Financial Records:</strong> Past billing and payment records will remain intact</li>
|
|
<li><strong>Patient Care:</strong> May impact authorization for future services</li>
|
|
<li><strong>Audit Trail:</strong> Insurance history and transaction logs will be preserved</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Primary Insurance Warning -->
|
|
{% if object.insurance_type == 'PRIMARY' %}
|
|
<div class="alert alert-danger mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-star me-2"></i>Primary Insurance Warning
|
|
</h6>
|
|
<p class="mb-2">This is the patient's primary insurance. Deleting it will:</p>
|
|
<ul class="mb-0">
|
|
<li>Remove the primary billing insurance for the patient</li>
|
|
<li>Require designation of a new primary insurance if available</li>
|
|
<li>Impact billing workflows and claim submissions</li>
|
|
<li>Potentially delay future billing processes</li>
|
|
<li>Affect insurance verification for scheduled appointments</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Active Insurance Warning -->
|
|
{% if object.status == 'ACTIVE' %}
|
|
<div class="alert alert-danger mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-check-circle me-2"></i>Active Insurance Warning
|
|
</h6>
|
|
<p class="mb-2">This insurance is currently active. Deleting it will:</p>
|
|
<ul class="mb-0">
|
|
<li>Remove active coverage for the patient</li>
|
|
<li>Impact ongoing treatment authorizations</li>
|
|
<li>Affect billing for current and future services</li>
|
|
<li>Require alternative payment arrangements</li>
|
|
<li>Potentially interrupt continuity of care</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Only Insurance Warning -->
|
|
{% if object.patient.insurance_information.count == 1 %}
|
|
<div class="alert alert-danger mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-exclamation-triangle me-2"></i>Only Insurance Warning
|
|
</h6>
|
|
<p class="mb-2">This is the patient's only insurance policy. Deleting it will:</p>
|
|
<ul class="mb-0">
|
|
<li>Leave the patient without any insurance coverage</li>
|
|
<li>Create a critical gap in billing and payment processes</li>
|
|
<li>Require immediate alternative payment arrangements</li>
|
|
<li>Impact authorization for future medical services</li>
|
|
<li>Potentially delay or complicate patient care</li>
|
|
<li>Require immediate addition of replacement insurance</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Pending Claims Warning -->
|
|
{% if object.has_pending_claims %}
|
|
<div class="alert alert-warning mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-clock me-2"></i>Pending Claims Warning
|
|
</h6>
|
|
<p class="mb-2">This insurance has pending claims. Deleting it may:</p>
|
|
<ul class="mb-0">
|
|
<li>Complicate processing of pending claims</li>
|
|
<li>Require manual intervention for claim resolution</li>
|
|
<li>Impact reimbursement tracking and follow-up</li>
|
|
<li>Create billing reconciliation issues</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Recent Claims Warning -->
|
|
{% if object.has_recent_claims %}
|
|
<div class="alert alert-info mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-history me-2"></i>Recent Claims Information
|
|
</h6>
|
|
<p class="mb-0">This insurance has recent claims within the last 90 days. Historical claim data will be preserved for audit and reconciliation purposes.</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Other Insurance Policies -->
|
|
{% if object.patient.insurance_information.count > 1 %}
|
|
<div class="alert alert-info mb-4">
|
|
<h6 class="alert-heading">
|
|
<i class="fa fa-shield me-2"></i>Other Insurance Policies
|
|
</h6>
|
|
<p class="mb-2">Patient has {{ object.patient.insurance_information.count|add:"-1" }} other insurance polic{{ object.patient.insurance_information.count|add:"-1"|pluralize:"y,ies" }}:</p>
|
|
<ul class="mb-0">
|
|
{% for insurance in object.patient.insurance_information.all %}
|
|
{% if insurance.pk != object.pk %}
|
|
<li>
|
|
{{ insurance.insurance_provider }} ({{ insurance.get_insurance_type_display }})
|
|
{% if insurance.status == 'ACTIVE' %} - <strong>Active</strong>{% endif %}
|
|
{% if insurance.insurance_type == 'PRIMARY' %} - <strong>Primary</strong>{% endif %}
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Related Data Summary -->
|
|
<div class="row mb-4">
|
|
<div class="col-md-3">
|
|
<div class="text-center p-3 border rounded">
|
|
<div class="fs-24px fw-bold text-primary">{{ object.patient.insurance_information.count|add:"-1" }}</div>
|
|
<div class="small text-muted">Remaining Policies</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="text-center p-3 border rounded">
|
|
<div class="fs-24px fw-bold text-warning">{% if object.insurance_type == 'PRIMARY' %}1{% else %}0{% endif %}</div>
|
|
<div class="small text-muted">Primary Status</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="text-center p-3 border rounded">
|
|
<div class="fs-24px fw-bold text-info">{% if object.status == 'ACTIVE' %}1{% else %}0{% endif %}</div>
|
|
<div class="small text-muted">Active Status</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="text-center p-3 border rounded">
|
|
<div class="fs-24px fw-bold text-success">{{ object.claims_count|default:0 }}</div>
|
|
<div class="small text-muted">Total Claims</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Alternative Actions -->
|
|
<div class="card border-secondary mb-4">
|
|
<div class="card-header bg-light">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-lightbulb me-2"></i>Alternative Actions
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<p class="card-text">Consider these alternatives instead of deletion:</p>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<ul class="list-unstyled">
|
|
<li class="mb-2">
|
|
<i class="fa fa-edit text-primary me-2"></i>
|
|
<a href="{% url 'patients:insurance_update' object.pk %}" class="text-decoration-none">
|
|
Update insurance information
|
|
</a>
|
|
</li>
|
|
<li class="mb-2">
|
|
<i class="fa fa-pause text-warning me-2"></i>
|
|
Change status to inactive
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<ul class="list-unstyled">
|
|
<li class="mb-2">
|
|
<i class="fa fa-plus text-success me-2"></i>
|
|
<a href="{% url 'patients:insurance_create' %}?patient={{ object.patient.pk }}" class="text-decoration-none">
|
|
Add replacement insurance first
|
|
</a>
|
|
</li>
|
|
<li class="mb-2">
|
|
<i class="fa fa-calendar text-info me-2"></i>
|
|
Set expiration date instead
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Deletion Form -->
|
|
<form method="post" id="delete-form">
|
|
{% csrf_token %}
|
|
|
|
<div class="card border-danger">
|
|
<div class="card-header bg-danger text-white">
|
|
<h6 class="card-title mb-0">
|
|
<i class="fa fa-trash me-2"></i>Deletion Confirmation
|
|
</h6>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" id="confirm-understanding" required>
|
|
<label class="form-check-label" for="confirm-understanding">
|
|
I understand that this action will permanently delete the insurance policy and cannot be undone
|
|
</label>
|
|
</div>
|
|
|
|
{% if object.insurance_type == 'PRIMARY' %}
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" id="confirm-primary" required>
|
|
<label class="form-check-label" for="confirm-primary">
|
|
I acknowledge that this is the primary insurance and deleting it will impact billing processes
|
|
</label>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.status == 'ACTIVE' %}
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" id="confirm-active" required>
|
|
<label class="form-check-label" for="confirm-active">
|
|
I acknowledge that this is an active insurance policy and deleting it will impact patient coverage
|
|
</label>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if object.patient.insurance_information.count == 1 %}
|
|
<div class="form-check mb-3">
|
|
<input class="form-check-input" type="checkbox" id="confirm-only" required>
|
|
<label class="form-check-label" for="confirm-only">
|
|
I acknowledge that this is the patient's only insurance policy and deleting it will leave them without coverage
|
|
</label>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<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_POLICY">Duplicate policy</option>
|
|
<option value="INCORRECT_INFORMATION">Incorrect information</option>
|
|
<option value="POLICY_CANCELLED">Policy cancelled by provider</option>
|
|
<option value="PATIENT_REQUEST">Patient request</option>
|
|
<option value="COVERAGE_ENDED">Coverage ended</option>
|
|
<option value="REPLACED_BY_OTHER">Replaced by another policy</option>
|
|
<option value="BILLING_ISSUES">Billing issues</option>
|
|
<option value="ADMINISTRATIVE_ERROR">Administrative error</option>
|
|
<option value="FRAUD_SUSPECTED">Fraud suspected</option>
|
|
<option value="OTHER">Other</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label class="form-label">Additional Notes <span class="text-danger">*</span></label>
|
|
<textarea class="form-control" name="deletion_notes" rows="3" required
|
|
placeholder="Provide detailed explanation for why this insurance policy is being deleted..."></textarea>
|
|
</div>
|
|
|
|
{% if object.insurance_type == 'PRIMARY' and object.patient.insurance_information.count > 1 %}
|
|
<div class="mb-3">
|
|
<label class="form-label">New Primary Insurance</label>
|
|
<select class="form-select" name="new_primary_insurance">
|
|
<option value="">Select new primary insurance...</option>
|
|
{% for insurance in object.patient.insurance_information.all %}
|
|
{% if insurance.pk != object.pk %}
|
|
<option value="{{ insurance.pk }}">{{ insurance.insurance_provider }} ({{ insurance.get_insurance_type_display }})</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
<div class="form-text">If this is the primary insurance, select a replacement primary insurance.</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="backup_policy" id="backup-policy" checked>
|
|
<label class="form-check-label" for="backup-policy">
|
|
Backup policy information before deletion
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="notify_patient" id="notify-patient">
|
|
<label class="form-check-label" for="notify-patient">
|
|
Notify patient of insurance removal
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mt-2">
|
|
<div class="col-md-6">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="update_billing" id="update-billing" checked>
|
|
<label class="form-check-label" for="update-billing">
|
|
Update billing system
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" name="preserve_claims" id="preserve-claims" checked>
|
|
<label class="form-check-label" for="preserve-claims">
|
|
Preserve claims history
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Action Buttons -->
|
|
<div class="d-flex justify-content-between mt-4">
|
|
<div>
|
|
<a href="{% url 'patients:insurance_detail' object.pk %}" class="btn btn-secondary">
|
|
<i class="fa fa-arrow-left me-2"></i>Cancel
|
|
</a>
|
|
<a href="{% url 'patients:insurance_update' object.pk %}" class="btn btn-primary ms-2">
|
|
<i class="fa fa-edit me-2"></i>Edit Instead
|
|
</a>
|
|
</div>
|
|
<button type="submit" class="btn btn-danger" id="delete-btn" disabled>
|
|
<i class="fa fa-trash me-2"></i>Delete Insurance Policy
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<!-- END panel -->
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Enable/disable delete button based on checkboxes
|
|
function updateDeleteButton() {
|
|
var allChecked = true;
|
|
$('input[type="checkbox"][required]').each(function() {
|
|
if (!$(this).is(':checked')) {
|
|
allChecked = false;
|
|
return false;
|
|
}
|
|
});
|
|
|
|
var reasonSelected = $('select[name="deletion_reason"]').val() !== '';
|
|
var notesProvided = $('textarea[name="deletion_notes"]').val().trim() !== '';
|
|
|
|
$('#delete-btn').prop('disabled', !(allChecked && reasonSelected && notesProvided));
|
|
}
|
|
|
|
// Check on checkbox change
|
|
$('input[type="checkbox"], select[name="deletion_reason"], textarea[name="deletion_notes"]').on('change input', updateDeleteButton);
|
|
|
|
// Form submission confirmation
|
|
$('#delete-form').on('submit', function(e) {
|
|
var confirmText = 'Are you absolutely sure you want to delete the insurance policy?';
|
|
confirmText += '\n\nProvider: {{ object.insurance_provider }}';
|
|
confirmText += '\nPolicy: {{ object.policy_number }}';
|
|
confirmText += '\nPatient: {{ object.patient.get_full_name }}';
|
|
{% if object.insurance_type == 'PRIMARY' %}
|
|
confirmText += '\n\nWARNING: This is the PRIMARY insurance!';
|
|
{% endif %}
|
|
{% if object.status == 'ACTIVE' %}
|
|
confirmText += '\n\nWARNING: This insurance is currently ACTIVE!';
|
|
{% endif %}
|
|
{% if object.patient.insurance_information.count == 1 %}
|
|
confirmText += '\n\nWARNING: This is the patient\'s ONLY insurance policy!';
|
|
{% endif %}
|
|
confirmText += '\n\nThis action cannot be undone and may impact billing and patient care.';
|
|
|
|
if (!confirm(confirmText)) {
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
|