update physician-department-view
This commit is contained in:
parent
1d7a4fa0ef
commit
7fc497ab70
@ -418,3 +418,191 @@ def ratings_list(request):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return render(request, 'physicians/ratings_list.html', context)
|
return render(request, 'physicians/ratings_list.html', context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def specialization_overview(request):
|
||||||
|
"""
|
||||||
|
Specialization overview - aggregated ratings by specialization.
|
||||||
|
|
||||||
|
Features:
|
||||||
|
- Average rating per specialization
|
||||||
|
- Total physicians per specialization
|
||||||
|
- Total surveys per specialization
|
||||||
|
- Drill-down to physicians in specialization
|
||||||
|
"""
|
||||||
|
# Get parameters
|
||||||
|
now = timezone.now()
|
||||||
|
year = int(request.GET.get('year', now.year))
|
||||||
|
month = int(request.GET.get('month', now.month))
|
||||||
|
hospital_filter = request.GET.get('hospital')
|
||||||
|
|
||||||
|
# Base queryset
|
||||||
|
queryset = PhysicianMonthlyRating.objects.filter(
|
||||||
|
year=year,
|
||||||
|
month=month
|
||||||
|
).select_related('physician', 'physician__hospital', 'physician__department')
|
||||||
|
|
||||||
|
# Apply RBAC filters
|
||||||
|
user = request.user
|
||||||
|
if not user.is_px_admin() and user.hospital:
|
||||||
|
queryset = queryset.filter(physician__hospital=user.hospital)
|
||||||
|
|
||||||
|
# Apply filters
|
||||||
|
if hospital_filter:
|
||||||
|
queryset = queryset.filter(physician__hospital_id=hospital_filter)
|
||||||
|
|
||||||
|
# Aggregate by specialization
|
||||||
|
from django.db.models import Avg, Count, Sum
|
||||||
|
|
||||||
|
specialization_data = {}
|
||||||
|
for rating in queryset:
|
||||||
|
spec = rating.physician.specialization
|
||||||
|
if spec not in specialization_data:
|
||||||
|
specialization_data[spec] = {
|
||||||
|
'specialization': spec,
|
||||||
|
'physicians': [],
|
||||||
|
'total_physicians': 0,
|
||||||
|
'total_surveys': 0,
|
||||||
|
'total_positive': 0,
|
||||||
|
'total_neutral': 0,
|
||||||
|
'total_negative': 0,
|
||||||
|
'ratings_sum': 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
specialization_data[spec]['physicians'].append(rating)
|
||||||
|
specialization_data[spec]['total_physicians'] += 1
|
||||||
|
specialization_data[spec]['total_surveys'] += rating.total_surveys
|
||||||
|
specialization_data[spec]['total_positive'] += rating.positive_count
|
||||||
|
specialization_data[spec]['total_neutral'] += rating.neutral_count
|
||||||
|
specialization_data[spec]['total_negative'] += rating.negative_count
|
||||||
|
specialization_data[spec]['ratings_sum'] += float(rating.average_rating)
|
||||||
|
|
||||||
|
# Calculate averages
|
||||||
|
specializations = []
|
||||||
|
for spec, data in specialization_data.items():
|
||||||
|
avg_rating = data['ratings_sum'] / data['total_physicians'] if data['total_physicians'] > 0 else 0
|
||||||
|
specializations.append({
|
||||||
|
'specialization': spec,
|
||||||
|
'total_physicians': data['total_physicians'],
|
||||||
|
'average_rating': round(avg_rating, 2),
|
||||||
|
'total_surveys': data['total_surveys'],
|
||||||
|
'positive_count': data['total_positive'],
|
||||||
|
'neutral_count': data['total_neutral'],
|
||||||
|
'negative_count': data['total_negative'],
|
||||||
|
'physicians': sorted(data['physicians'], key=lambda x: x.average_rating, reverse=True)
|
||||||
|
})
|
||||||
|
|
||||||
|
# Sort by average rating
|
||||||
|
specializations.sort(key=lambda x: x['average_rating'], reverse=True)
|
||||||
|
|
||||||
|
# Get filter options
|
||||||
|
hospitals = Hospital.objects.filter(status='active')
|
||||||
|
if not user.is_px_admin() and user.hospital:
|
||||||
|
hospitals = hospitals.filter(id=user.hospital.id)
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'specializations': specializations,
|
||||||
|
'year': year,
|
||||||
|
'month': month,
|
||||||
|
'hospitals': hospitals,
|
||||||
|
'filters': request.GET,
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(request, 'physicians/specialization_overview.html', context)
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def department_overview(request):
|
||||||
|
"""
|
||||||
|
Department overview - aggregated ratings by department.
|
||||||
|
|
||||||
|
Features:
|
||||||
|
- Average rating per department
|
||||||
|
- Total physicians per department
|
||||||
|
- Total surveys per department
|
||||||
|
- Drill-down to physicians in department
|
||||||
|
"""
|
||||||
|
# Get parameters
|
||||||
|
now = timezone.now()
|
||||||
|
year = int(request.GET.get('year', now.year))
|
||||||
|
month = int(request.GET.get('month', now.month))
|
||||||
|
hospital_filter = request.GET.get('hospital')
|
||||||
|
|
||||||
|
# Base queryset
|
||||||
|
queryset = PhysicianMonthlyRating.objects.filter(
|
||||||
|
year=year,
|
||||||
|
month=month
|
||||||
|
).select_related('physician', 'physician__hospital', 'physician__department')
|
||||||
|
|
||||||
|
# Apply RBAC filters
|
||||||
|
user = request.user
|
||||||
|
if not user.is_px_admin() and user.hospital:
|
||||||
|
queryset = queryset.filter(physician__hospital=user.hospital)
|
||||||
|
|
||||||
|
# Apply filters
|
||||||
|
if hospital_filter:
|
||||||
|
queryset = queryset.filter(physician__hospital_id=hospital_filter)
|
||||||
|
|
||||||
|
# Aggregate by department
|
||||||
|
from django.db.models import Avg, Count, Sum
|
||||||
|
|
||||||
|
department_data = {}
|
||||||
|
for rating in queryset:
|
||||||
|
dept = rating.physician.department
|
||||||
|
if not dept:
|
||||||
|
continue
|
||||||
|
|
||||||
|
dept_key = str(dept.id)
|
||||||
|
if dept_key not in department_data:
|
||||||
|
department_data[dept_key] = {
|
||||||
|
'department': dept,
|
||||||
|
'physicians': [],
|
||||||
|
'total_physicians': 0,
|
||||||
|
'total_surveys': 0,
|
||||||
|
'total_positive': 0,
|
||||||
|
'total_neutral': 0,
|
||||||
|
'total_negative': 0,
|
||||||
|
'ratings_sum': 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
department_data[dept_key]['physicians'].append(rating)
|
||||||
|
department_data[dept_key]['total_physicians'] += 1
|
||||||
|
department_data[dept_key]['total_surveys'] += rating.total_surveys
|
||||||
|
department_data[dept_key]['total_positive'] += rating.positive_count
|
||||||
|
department_data[dept_key]['total_neutral'] += rating.neutral_count
|
||||||
|
department_data[dept_key]['total_negative'] += rating.negative_count
|
||||||
|
department_data[dept_key]['ratings_sum'] += float(rating.average_rating)
|
||||||
|
|
||||||
|
# Calculate averages
|
||||||
|
departments = []
|
||||||
|
for dept_key, data in department_data.items():
|
||||||
|
avg_rating = data['ratings_sum'] / data['total_physicians'] if data['total_physicians'] > 0 else 0
|
||||||
|
departments.append({
|
||||||
|
'department': data['department'],
|
||||||
|
'total_physicians': data['total_physicians'],
|
||||||
|
'average_rating': round(avg_rating, 2),
|
||||||
|
'total_surveys': data['total_surveys'],
|
||||||
|
'positive_count': data['total_positive'],
|
||||||
|
'neutral_count': data['total_neutral'],
|
||||||
|
'negative_count': data['total_negative'],
|
||||||
|
'physicians': sorted(data['physicians'], key=lambda x: x.average_rating, reverse=True)
|
||||||
|
})
|
||||||
|
|
||||||
|
# Sort by average rating
|
||||||
|
departments.sort(key=lambda x: x['average_rating'], reverse=True)
|
||||||
|
|
||||||
|
# Get filter options
|
||||||
|
hospitals = Hospital.objects.filter(status='active')
|
||||||
|
if not user.is_px_admin() and user.hospital:
|
||||||
|
hospitals = hospitals.filter(id=user.hospital.id)
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'departments': departments,
|
||||||
|
'year': year,
|
||||||
|
'month': month,
|
||||||
|
'hospitals': hospitals,
|
||||||
|
'filters': request.GET,
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(request, 'physicians/department_overview.html', context)
|
||||||
|
|||||||
@ -15,6 +15,10 @@ router.register(r'api/physicians/ratings', views.PhysicianMonthlyRatingViewSet,
|
|||||||
|
|
||||||
# UI URL patterns
|
# UI URL patterns
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
# Overview pages
|
||||||
|
path('overview/specialization/', ui_views.specialization_overview, name='specialization_overview'),
|
||||||
|
path('overview/department/', ui_views.department_overview, name='department_overview'),
|
||||||
|
|
||||||
# Physician management
|
# Physician management
|
||||||
path('', ui_views.physician_list, name='physician_list'),
|
path('', ui_views.physician_list, name='physician_list'),
|
||||||
path('<uuid:pk>/', ui_views.physician_detail, name='physician_detail'),
|
path('<uuid:pk>/', ui_views.physician_detail, name='physician_detail'),
|
||||||
|
|||||||
177
templates/physicians/department_overview.html
Normal file
177
templates/physicians/department_overview.html
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
{% extends "layouts/base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "Department Overview" %} - {% trans "Physicians" %} - PX360{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<div>
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="{% url 'physicians:physician_list' %}">{% trans "Physicians" %}</a></li>
|
||||||
|
<li class="breadcrumb-item active">{% trans "Department Overview" %}</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
<h2 class="mb-1">
|
||||||
|
<i class="bi bi-building text-primary me-2"></i>
|
||||||
|
{% trans "Department Overview" %}
|
||||||
|
</h2>
|
||||||
|
<p class="text-muted mb-0">{% trans "Performance by department for" %} {{ year }}-{{ month|stringformat:"02d" }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="{% url 'physicians:specialization_overview' %}" class="btn btn-outline-secondary me-2">
|
||||||
|
<i class="bi bi-diagram-3 me-2"></i>{% trans "Specialization View" %}
|
||||||
|
</a>
|
||||||
|
<a href="{% url 'physicians:physician_list' %}" class="btn btn-outline-primary">
|
||||||
|
<i class="bi bi-arrow-left me-2"></i>{% trans "Back to Physicians" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Filters -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="get" class="row g-3">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label class="form-label">{% trans "Year" %}</label>
|
||||||
|
<input type="number" name="year" class="form-control"
|
||||||
|
value="{{ year }}" min="2020" max="2030">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label class="form-label">{% trans "Month" %}</label>
|
||||||
|
<select name="month" class="form-select">
|
||||||
|
{% for m in "123456789012"|make_list %}
|
||||||
|
<option value="{{ forloop.counter }}" {% if month == forloop.counter %}selected{% endif %}>
|
||||||
|
{{ forloop.counter|stringformat:"02d" }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label">{% trans "Hospital" %}</label>
|
||||||
|
<select name="hospital" class="form-select">
|
||||||
|
<option value="">{% trans "All Hospitals" %}</option>
|
||||||
|
{% for hospital in hospitals %}
|
||||||
|
<option value="{{ hospital.id }}" {% if filters.hospital == hospital.id|stringformat:"s" %}selected{% endif %}>
|
||||||
|
{{ hospital.name }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 d-flex align-items-end">
|
||||||
|
<button type="submit" class="btn btn-primary w-100">
|
||||||
|
<i class="bi bi-search me-2"></i>{% trans "Filter" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Departments -->
|
||||||
|
{% if departments %}
|
||||||
|
{% for dept_data in departments %}
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header bg-light">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5 class="mb-0">
|
||||||
|
<i class="bi bi-building text-primary me-2"></i>
|
||||||
|
{{ dept_data.department.name }}
|
||||||
|
</h5>
|
||||||
|
<small class="text-muted">{{ dept_data.department.hospital.name }}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-3">
|
||||||
|
<strong class="text-success fs-4">{{ dept_data.average_rating|floatformat:2 }}</strong>
|
||||||
|
<br><small class="text-muted">{% trans "Avg Rating" %}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<strong class="fs-4">{{ dept_data.total_physicians }}</strong>
|
||||||
|
<br><small class="text-muted">{% trans "Physicians" %}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<strong class="fs-4">{{ dept_data.total_surveys }}</strong>
|
||||||
|
<br><small class="text-muted">{% trans "Surveys" %}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="d-flex gap-1 justify-content-center">
|
||||||
|
<span class="badge bg-success">{{ dept_data.positive_count }}</span>
|
||||||
|
<span class="badge bg-warning">{{ dept_data.neutral_count }}</span>
|
||||||
|
<span class="badge bg-danger">{{ dept_data.negative_count }}</span>
|
||||||
|
</div>
|
||||||
|
<small class="text-muted">{% trans "Sentiment" %}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover table-sm mb-0">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Rank" %}</th>
|
||||||
|
<th>{% trans "Physician" %}</th>
|
||||||
|
<th>{% trans "Specialization" %}</th>
|
||||||
|
<th>{% trans "Rating" %}</th>
|
||||||
|
<th>{% trans "Surveys" %}</th>
|
||||||
|
<th>{% trans "Dept Rank" %}</th>
|
||||||
|
<th>{% trans "Actions" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for rating in dept_data.physicians %}
|
||||||
|
<tr onclick="window.location='{% url 'physicians:physician_detail' rating.physician.id %}'" style="cursor: pointer;">
|
||||||
|
<td>
|
||||||
|
{% if forloop.counter <= 3 %}
|
||||||
|
<strong class="text-primary">#{{ forloop.counter }}</strong>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">#{{ forloop.counter }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{{ rating.physician.get_full_name }}</strong><br>
|
||||||
|
<small class="text-muted">{{ rating.physician.license_number }}</small>
|
||||||
|
</td>
|
||||||
|
<td>{{ rating.physician.specialization }}</td>
|
||||||
|
<td>
|
||||||
|
<strong class="text-success">{{ rating.average_rating|floatformat:2 }}</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge bg-light text-dark">{{ rating.total_surveys }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if rating.department_rank %}
|
||||||
|
<span class="badge bg-info">#{{ rating.department_rank }}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td onclick="event.stopPropagation();">
|
||||||
|
<a href="{% url 'physicians:physician_detail' rating.physician.id %}"
|
||||||
|
class="btn btn-sm btn-outline-primary">
|
||||||
|
<i class="bi bi-eye"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body text-center py-5">
|
||||||
|
<i class="bi bi-inbox" style="font-size: 3rem; color: #ccc;"></i>
|
||||||
|
<p class="text-muted mt-3">{% trans "No department data available for this period" %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -15,6 +15,14 @@
|
|||||||
<p class="text-muted mb-0">{% trans "Manage physician profiles and performance" %}</p>
|
<p class="text-muted mb-0">{% trans "Manage physician profiles and performance" %}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
<div class="btn-group me-2">
|
||||||
|
<a href="{% url 'physicians:specialization_overview' %}" class="btn btn-outline-secondary">
|
||||||
|
<i class="bi bi-diagram-3 me-2"></i>{% trans "By Specialization" %}
|
||||||
|
</a>
|
||||||
|
<a href="{% url 'physicians:department_overview' %}" class="btn btn-outline-secondary">
|
||||||
|
<i class="bi bi-building me-2"></i>{% trans "By Department" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
<a href="{% url 'physicians:leaderboard' %}" class="btn btn-outline-primary">
|
<a href="{% url 'physicians:leaderboard' %}" class="btn btn-outline-primary">
|
||||||
<i class="bi bi-trophy me-2"></i>{% trans "Leaderboard" %}
|
<i class="bi bi-trophy me-2"></i>{% trans "Leaderboard" %}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
176
templates/physicians/specialization_overview.html
Normal file
176
templates/physicians/specialization_overview.html
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
{% extends "layouts/base.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "Specialization Overview" %} - {% trans "Physicians" %} - PX360{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<div>
|
||||||
|
<nav aria-label="breadcrumb">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="{% url 'physicians:physician_list' %}">{% trans "Physicians" %}</a></li>
|
||||||
|
<li class="breadcrumb-item active">{% trans "Specialization Overview" %}</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
<h2 class="mb-1">
|
||||||
|
<i class="bi bi-diagram-3 text-primary me-2"></i>
|
||||||
|
{% trans "Specialization Overview" %}
|
||||||
|
</h2>
|
||||||
|
<p class="text-muted mb-0">{% trans "Performance by medical specialization for" %} {{ year }}-{{ month|stringformat:"02d" }}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="{% url 'physicians:department_overview' %}" class="btn btn-outline-secondary me-2">
|
||||||
|
<i class="bi bi-building me-2"></i>{% trans "Department View" %}
|
||||||
|
</a>
|
||||||
|
<a href="{% url 'physicians:physician_list' %}" class="btn btn-outline-primary">
|
||||||
|
<i class="bi bi-arrow-left me-2"></i>{% trans "Back to Physicians" %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Filters -->
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="get" class="row g-3">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label class="form-label">{% trans "Year" %}</label>
|
||||||
|
<input type="number" name="year" class="form-control"
|
||||||
|
value="{{ year }}" min="2020" max="2030">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label class="form-label">{% trans "Month" %}</label>
|
||||||
|
<select name="month" class="form-select">
|
||||||
|
{% for m in "123456789012"|make_list %}
|
||||||
|
<option value="{{ forloop.counter }}" {% if month == forloop.counter %}selected{% endif %}>
|
||||||
|
{{ forloop.counter|stringformat:"02d" }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label">{% trans "Hospital" %}</label>
|
||||||
|
<select name="hospital" class="form-select">
|
||||||
|
<option value="">{% trans "All Hospitals" %}</option>
|
||||||
|
{% for hospital in hospitals %}
|
||||||
|
<option value="{{ hospital.id }}" {% if filters.hospital == hospital.id|stringformat:"s" %}selected{% endif %}>
|
||||||
|
{{ hospital.name }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 d-flex align-items-end">
|
||||||
|
<button type="submit" class="btn btn-primary w-100">
|
||||||
|
<i class="bi bi-search me-2"></i>{% trans "Filter" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Specializations -->
|
||||||
|
{% if specializations %}
|
||||||
|
{% for spec_data in specializations %}
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-header bg-light">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<h5 class="mb-0">
|
||||||
|
<i class="bi bi-stethoscope text-primary me-2"></i>
|
||||||
|
{{ spec_data.specialization }}
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-3">
|
||||||
|
<strong class="text-success fs-4">{{ spec_data.average_rating|floatformat:2 }}</strong>
|
||||||
|
<br><small class="text-muted">{% trans "Avg Rating" %}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<strong class="fs-4">{{ spec_data.total_physicians }}</strong>
|
||||||
|
<br><small class="text-muted">{% trans "Physicians" %}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<strong class="fs-4">{{ spec_data.total_surveys }}</strong>
|
||||||
|
<br><small class="text-muted">{% trans "Surveys" %}</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="d-flex gap-1 justify-content-center">
|
||||||
|
<span class="badge bg-success">{{ spec_data.positive_count }}</span>
|
||||||
|
<span class="badge bg-warning">{{ spec_data.neutral_count }}</span>
|
||||||
|
<span class="badge bg-danger">{{ spec_data.negative_count }}</span>
|
||||||
|
</div>
|
||||||
|
<small class="text-muted">{% trans "Sentiment" %}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover table-sm mb-0">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Rank" %}</th>
|
||||||
|
<th>{% trans "Physician" %}</th>
|
||||||
|
<th>{% trans "Department" %}</th>
|
||||||
|
<th>{% trans "Hospital" %}</th>
|
||||||
|
<th>{% trans "Rating" %}</th>
|
||||||
|
<th>{% trans "Surveys" %}</th>
|
||||||
|
<th>{% trans "Actions" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for rating in spec_data.physicians %}
|
||||||
|
<tr onclick="window.location='{% url 'physicians:physician_detail' rating.physician.id %}'" style="cursor: pointer;">
|
||||||
|
<td>
|
||||||
|
{% if forloop.counter <= 3 %}
|
||||||
|
<strong class="text-primary">#{{ forloop.counter }}</strong>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">#{{ forloop.counter }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{{ rating.physician.get_full_name }}</strong><br>
|
||||||
|
<small class="text-muted">{{ rating.physician.license_number }}</small>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if rating.physician.department %}
|
||||||
|
{{ rating.physician.department.name }}
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>{{ rating.physician.hospital.name }}</td>
|
||||||
|
<td>
|
||||||
|
<strong class="text-success">{{ rating.average_rating|floatformat:2 }}</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge bg-light text-dark">{{ rating.total_surveys }}</span>
|
||||||
|
</td>
|
||||||
|
<td onclick="event.stopPropagation();">
|
||||||
|
<a href="{% url 'physicians:physician_detail' rating.physician.id %}"
|
||||||
|
class="btn btn-sm btn-outline-primary">
|
||||||
|
<i class="bi bi-eye"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body text-center py-5">
|
||||||
|
<i class="bi bi-inbox" style="font-size: 3rem; color: #ccc;"></i>
|
||||||
|
<p class="text-muted mt-3">{% trans "No specialization data available for this period" %}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Loading…
x
Reference in New Issue
Block a user