@extends('layouts.app') @section('title', 'إدارة الأطباء') @section('page_title', 'إدارة الأطباء') @section('content')

{{ \App\Models\User::where('role', 'doctor')->count() }}

إجمالي الأطباء

{{ \App\Models\User::where('role', 'doctor')->where('created_at', '>=', now()->subMonth())->count() }}

أطباء جدد هذا الشهر

{{ \App\Models\Appointment::whereDate('appointment_date', today())->distinct('doctor_id')->count() }}

أطباء نشطون اليوم

@php $totalAppointments = \App\Models\Appointment::count(); $totalDoctors = \App\Models\User::where('role', 'doctor')->count(); $avgAppointments = $totalDoctors > 0 ? round($totalAppointments / $totalDoctors) : 0; @endphp

{{ $avgAppointments }}

متوسط المواعيد لكل طبيب

قائمة الأطباء
@foreach(\App\Models\User::where('role', 'doctor')->get() as $doctor) @endforeach
الاسم رقم الهاتف البريد الإلكتروني التخصص المواعيد المرضى السجلات الطبية تاريخ الانضمام الحالة سعر الكشف سعر المتابعة نسبة العمولة مستحقات الشهر الإجراءات
د. {{ $doctor->name }}
{{ $doctor->mobile }} {{ $doctor->email ?? '-' }} {{ $doctor->specialization ? $doctor->specialization : 'طب عام' }} {{ \App\Models\Appointment::where('doctor_id', $doctor->id)->count() }} {{ \App\Models\Appointment::where('doctor_id', $doctor->id)->distinct('patient_id')->count() }} {{ \App\Models\MedicalRecord::where('doctor_id', $doctor->id)->count() }} {{ $doctor->created_at->format('Y-m-d') }} نشط {{ isset($doctor->checkup_cost) ? number_format($doctor->checkup_cost, 2) . ' ج.م' : '-' }} {{ isset($doctor->followup_cost) ? number_format($doctor->followup_cost, 2) . ' ج.م' : '-' }} {{ $doctor->commission_percentage ? rtrim(rtrim(number_format($doctor->commission_percentage, 2, '.', ''), '0'), '.') . '%' : '-' }} @php $monthStart = now()->startOfMonth(); $monthEnd = now()->endOfMonth(); $paidSum = \App\Models\Appointment::where('doctor_id', $doctor->id) ->where('payment_status', 'paid') ->whereBetween('appointment_date', [$monthStart, $monthEnd]) ->sum('cost'); $commission = $doctor->commission_percentage ? ($paidSum * ($doctor->commission_percentage/100)) : 0; @endphp {{ number_format($commission, 2) }} ج.م
أداء الأطباء
الأطباء الأكثر نشاطاً
@php $topDoctors = \App\Models\User::where('role', 'doctor')->get()->map(function($doctor) { $doctor->appointments_count = \App\Models\Appointment::where('doctor_id', $doctor->id)->count(); return $doctor; })->sortByDesc('appointments_count')->take(5); @endphp @foreach($topDoctors as $doctor)
د. {{ $doctor->name }}
{{ $doctor->appointments_count }} موعد
@php $maxAppointments = $topDoctors->max('appointments_count'); $percentage = $maxAppointments > 0 ? ($doctor->appointments_count / $maxAppointments) * 100 : 0; @endphp
@endforeach
@endsection