286 lines
18 KiB
HTML
286 lines
18 KiB
HTML
{% extends 'base.html' %}
|
|
{% load static %}
|
|
|
|
{% block title %}Insurance Claims - Billing{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3 mb-0">Insurance Claims</h1>
|
|
<a href="{% url 'billing:bill_list' %}" class="btn btn-outline-primary">
|
|
<i class="fas fa-file-invoice"></i> View Bills
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Statistics Cards -->
|
|
<div class="row mb-4">
|
|
<div class="col-md-3">
|
|
<div class="card bg-primary text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<h6 class="card-title">Total Claims</h6>
|
|
<h4 class="mb-0">{{ stats.total_claims }}</h4>
|
|
</div>
|
|
<i class="fas fa-file-medical fa-2x opacity-75"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="card bg-info text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<h6 class="card-title">Total Billed</h6>
|
|
<h4 class="mb-0">${{ stats.total_billed|floatformat:2 }}</h4>
|
|
</div>
|
|
<i class="fas fa-dollar-sign fa-2x opacity-75"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="card bg-success text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<h6 class="card-title">Total Paid</h6>
|
|
<h4 class="mb-0">${{ stats.total_paid|floatformat:2 }}</h4>
|
|
</div>
|
|
<i class="fas fa-check-circle fa-2x opacity-75"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<div class="card bg-warning text-white">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between">
|
|
<div>
|
|
<h6 class="card-title">Patient Responsibility</h6>
|
|
<h4 class="mb-0">${{ stats.total_patient_responsibility|floatformat:2 }}</h4>
|
|
</div>
|
|
<i class="fas fa-user-circle fa-2x opacity-75"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="card mb-4">
|
|
<div class="card-body">
|
|
<form method="get" class="row g-3">
|
|
<div class="col-md-2">
|
|
<label for="status" class="form-label">Status</label>
|
|
<select name="status" id="status" class="form-select">
|
|
<option value="">All Statuses</option>
|
|
<option value="DRAFT" {% if status == 'DRAFT' %}selected{% endif %}>Draft</option>
|
|
<option value="SUBMITTED" {% if status == 'SUBMITTED' %}selected{% endif %}>Submitted</option>
|
|
<option value="PENDING" {% if status == 'PENDING' %}selected{% endif %}>Pending</option>
|
|
<option value="PROCESSING" {% if status == 'PROCESSING' %}selected{% endif %}>Processing</option>
|
|
<option value="PAID" {% if status == 'PAID' %}selected{% endif %}>Paid</option>
|
|
<option value="DENIED" {% if status == 'DENIED' %}selected{% endif %}>Denied</option>
|
|
<option value="REJECTED" {% if status == 'REJECTED' %}selected{% endif %}>Rejected</option>
|
|
<option value="APPEALED" {% if status == 'APPEALED' %}selected{% endif %}>Appealed</option>
|
|
<option value="VOIDED" {% if status == 'VOIDED' %}selected{% endif %}>Voided</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label for="claim_type" class="form-label">Claim Type</label>
|
|
<select name="claim_type" id="claim_type" class="form-select">
|
|
<option value="">All Types</option>
|
|
<option value="PRIMARY" {% if claim_type == 'PRIMARY' %}selected{% endif %}>Primary</option>
|
|
<option value="SECONDARY" {% if claim_type == 'SECONDARY' %}selected{% endif %}>Secondary</option>
|
|
<option value="TERTIARY" {% if claim_type == 'TERTIARY' %}selected{% endif %}>Tertiary</option>
|
|
<option value="CORRECTED" {% if claim_type == 'CORRECTED' %}selected{% endif %}>Corrected</option>
|
|
<option value="VOID" {% if claim_type == 'VOID' %}selected{% endif %}>Void</option>
|
|
<option value="REPLACEMENT" {% if claim_type == 'REPLACEMENT' %}selected{% endif %}>Replacement</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label for="date_from" class="form-label">Date From</label>
|
|
<input type="date" name="date_from" id="date_from" class="form-control" value="{{ date_from }}">
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label for="date_to" class="form-label">Date To</label>
|
|
<input type="date" name="date_to" id="date_to" class="form-control" value="{{ date_to }}">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label for="search" class="form-label">Search</label>
|
|
<input type="text" name="search" id="search" class="form-control"
|
|
placeholder="Claim number, bill number, patient name..." value="{{ search }}">
|
|
</div>
|
|
<div class="col-md-1">
|
|
<label class="form-label"> </label>
|
|
<button type="submit" class="btn btn-primary d-block">Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Claims Table -->
|
|
<div class="card">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0">Insurance Claims</h5>
|
|
<div class="btn-group btn-group-sm">
|
|
<button class="btn btn-outline-secondary" onclick="refreshClaims()">
|
|
<i class="fas fa-sync-alt"></i> Refresh
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Claim Number</th>
|
|
<th>Bill Number</th>
|
|
<th>Patient</th>
|
|
<th>Type</th>
|
|
<th>Insurance</th>
|
|
<th>Submission Date</th>
|
|
<th>Billed Amount</th>
|
|
<th>Paid Amount</th>
|
|
<th>Patient Responsibility</th>
|
|
<th>Status</th>
|
|
<th>Days Pending</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for claim in claims %}
|
|
<tr>
|
|
<td>
|
|
<strong>{{ claim.claim_number }}</strong>
|
|
{% if claim.prior_auth_number %}
|
|
<br><small class="text-muted">Auth: {{ claim.prior_auth_number }}</small>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<a href="{% url 'billing:bill_detail' claim.medical_bill.bill_id %}" class="text-decoration-none">
|
|
{{ claim.medical_bill.bill_number }}
|
|
</a>
|
|
</td>
|
|
<td>
|
|
<div>
|
|
<strong>{{ claim.medical_bill.patient.get_full_name }}</strong><br>
|
|
<small class="text-muted">MRN: {{ claim.medical_bill.patient.mrn }}</small>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<span class="badge bg-secondary">{{ claim.get_claim_type_display }}</span>
|
|
</td>
|
|
<td>
|
|
<div>
|
|
<strong>{{ claim.insurance_info.insurance_company }}</strong><br>
|
|
<small class="text-muted">{{ claim.insurance_info.policy_number }}</small>
|
|
</div>
|
|
</td>
|
|
<td>{{ claim.submission_date|date:"M d, Y" }}</td>
|
|
<td>${{ claim.billed_amount|floatformat:2 }}</td>
|
|
<td>
|
|
<strong class="text-success">${{ claim.paid_amount|floatformat:2 }}</strong>
|
|
{% if claim.allowed_amount %}
|
|
<br><small class="text-muted">Allowed: ${{ claim.allowed_amount|floatformat:2 }}</small>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<strong class="text-warning">${{ claim.patient_responsibility|floatformat:2 }}</strong>
|
|
{% if claim.deductible_amount %}
|
|
<br><small class="text-muted">Deductible: ${{ claim.deductible_amount|floatformat:2 }}</small>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
{% if claim.status == 'DRAFT' %}
|
|
<span class="badge bg-secondary">Draft</span>
|
|
{% elif claim.status == 'SUBMITTED' %}
|
|
<span class="badge bg-info">Submitted</span>
|
|
{% elif claim.status == 'PENDING' %}
|
|
<span class="badge bg-warning">Pending</span>
|
|
{% elif claim.status == 'PROCESSING' %}
|
|
<span class="badge bg-primary">Processing</span>
|
|
{% elif claim.status == 'PAID' %}
|
|
<span class="badge bg-success">Paid</span>
|
|
{% elif claim.status == 'DENIED' %}
|
|
<span class="badge bg-danger">Denied</span>
|
|
{% elif claim.status == 'REJECTED' %}
|
|
<span class="badge bg-danger">Rejected</span>
|
|
{% elif claim.status == 'APPEALED' %}
|
|
<span class="badge bg-warning">Appealed</span>
|
|
{% elif claim.status == 'VOIDED' %}
|
|
<span class="badge bg-secondary">Voided</span>
|
|
{% endif %}
|
|
{% if claim.denial_reason %}
|
|
<br><small class="text-danger">{{ claim.denial_reason|truncatechars:30 }}</small>
|
|
{% endif %}
|
|
</td>
|
|
<td>
|
|
<span class="{% if claim.days_pending > 30 %}text-warning{% elif claim.days_pending > 60 %}text-danger{% endif %}">
|
|
{{ claim.days_pending }} days
|
|
</span>
|
|
{% if claim.response_date %}
|
|
<br><small class="text-muted">Response: {{ claim.response_date|date:"M d" }}</small>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td colspan="11" class="text-center py-4">
|
|
<div class="text-muted">
|
|
<i class="fas fa-file-medical fa-3x mb-3"></i>
|
|
<p>No insurance claims found.</p>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
{% if page_obj.has_other_pages %}
|
|
<nav aria-label="Claims pagination" class="mt-4">
|
|
<ul class="pagination justify-content-center">
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page=1{% if request.GET.status %}&status={{ request.GET.status }}{% endif %}{% if request.GET.claim_type %}&claim_type={{ request.GET.claim_type }}{% endif %}{% if request.GET.date_from %}&date_from={{ request.GET.date_from }}{% endif %}{% if request.GET.date_to %}&date_to={{ request.GET.date_to }}{% endif %}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}">First</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if request.GET.status %}&status={{ request.GET.status }}{% endif %}{% if request.GET.claim_type %}&claim_type={{ request.GET.claim_type }}{% endif %}{% if request.GET.date_from %}&date_from={{ request.GET.date_from }}{% endif %}{% if request.GET.date_to %}&date_to={{ request.GET.date_to }}{% endif %}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}">Previous</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
<li class="page-item active">
|
|
<span class="page-link">
|
|
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
|
|
</span>
|
|
</li>
|
|
|
|
{% if page_obj.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% if request.GET.status %}&status={{ request.GET.status }}{% endif %}{% if request.GET.claim_type %}&claim_type={{ request.GET.claim_type }}{% endif %}{% if request.GET.date_from %}&date_from={{ request.GET.date_from }}{% endif %}{% if request.GET.date_to %}&date_to={{ request.GET.date_to }}{% endif %}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}">Next</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if request.GET.status %}&status={{ request.GET.status }}{% endif %}{% if request.GET.claim_type %}&claim_type={{ request.GET.claim_type }}{% endif %}{% if request.GET.date_from %}&date_from={{ request.GET.date_from }}{% endif %}{% if request.GET.date_to %}&date_to={{ request.GET.date_to }}{% endif %}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}">Last</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function refreshClaims() {
|
|
location.reload();
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|