@extends(request()->query('fragment') === 'verification' ? 'layouts.fragment' : 'layouts.app') @section('title', 'Verifikasi Terpusat - MCU Klinik Mustika') @section('breadcrumb')
| No. | No. Registrasi & MR | Nama Pasien | Jenis Kelamin | Umur | Tanggal MCU | MCU Ke | @if ($canSummarize) Progress Pemeriksaan @else Status Verifikasi @endif | Aksi |
|---|---|---|---|---|---|---|---|---|
| {{ $appointments->firstItem() + $loop->index }} |
{{ $appointment->registration_number ?? '-' }}
{{ $appointment->patient->medical_record_number ?? '-' }}
|
{{ $appointment->patient->name }}
@php
$companyRel = $appointment->company ?? ($appointment->patient?->company ?? $appointment->mcuResult?->company);
$companyName = $companyRel->name ?? null;
$jobTitle =
$appointment->patient->job_position ?? ($appointment->patient->occupation ?? $appointment->getJobPosition());
@endphp
@if ($companyName)
{{ $companyName }}
@if ($jobTitle)
{{ $jobTitle }}
@endif
@else
Individu
@endif
|
{{ $appointment->patient->gender == 'male' ? 'Laki-laki' : 'Perempuan' }} | {{ $appointment->patient->detailed_age ?: '-' }} |
{{
\App\Helpers\DateHelper::formatFull(
$appointment->appointment_date,
)
}}
{{ $appointment->appointment_time ?? '08:00' }}
|
@php
// Hitung urutan MCU berdasarkan kronologis (tanggal + ID untuk handle tanggal sama)
$mcuOrder = $appointment->patient->appointments
->filter(function ($apt) use ($appointment) {
return $apt->status !== 'cancelled' &&
($apt->appointment_date < $appointment->appointment_date ||
($apt->appointment_date->eq($appointment->appointment_date) && $apt->id <= $appointment->id));
})
->count();
$previousMcu = $appointment->patient->appointments
->filter(function ($apt) use ($appointment) {
return $apt->status !== 'cancelled' &&
($apt->appointment_date < $appointment->appointment_date ||
($apt->appointment_date->eq($appointment->appointment_date) && $apt->id < $appointment->id));
})
->sortByDesc('appointment_date')
->first();
@endphp
MCU ke-{{ $mcuOrder }}
@if ($previousMcu)
MCU Terakhir: {{ \App\Helpers\DateHelper::formatFull($previousMcu->appointment_date) }}
@else
Pertama kali
@endif
|
Progress:
{{ $completedStations }}/{{ $totalStations }}
@foreach ($allStages as $stageName => $stageData)
@php
// Skip DASS21 if company doesn't use it
if ($stageName === 'dass21' && !$appointment->shouldHaveDass21()) {
continue;
}
$statusClass = 'bg-secondary';
$tooltip = 'Menunggu';
if ($stageData['type'] === 'registration') {
// Use the same logic as in AppointmentController for consistency
$isDataComplete = true;
$patient = $appointment->patient;
// For quick registration patients, check registration_status first
if ($appointment->is_quick_registration && $appointment->registration_status === 'temporary') {
$isDataComplete = false;
}
// Check basic required data
if (!$patient->name || !$patient->gender || !$patient->birth_date || !$patient->phone_number) {
$isDataComplete = false;
}
// Check photo
if (!$patient->photo) {
$isDataComplete = false;
}
// Check company data if patient has company
if ($patient->company_id && !$patient->job_position) {
$isDataComplete = false;
}
// Check additional health data (these are filled once and reused)
$hasHealthData = $patient->healthQuestionnaires()->exists();
$hasWorkData = $patient->workActivities()->exists();
$hasFamilyData = $patient->familyHealthHistories()->exists();
$hasLifestyleData = $patient->lifestyleData()->exists();
if (!$hasHealthData || !$hasWorkData || !$hasFamilyData || !$hasLifestyleData) {
$isDataComplete = false;
}
// Check signature
if (!$patient->signature_path) {
$isDataComplete = false;
}
// Check vital signs for this specific appointment
$hasVitalSigns = false;
if ($appointment->physicalExamResult) {
$vitalSigns = $appointment->physicalExamResult;
if (
$vitalSigns->blood_pressure_systolic ||
$vitalSigns->blood_pressure_diastolic ||
$vitalSigns->heart_rate ||
$vitalSigns->respiratory_rate ||
$vitalSigns->body_temperature ||
$vitalSigns->height ||
$vitalSigns->weight ||
$vitalSigns->waist_circumference
) {
$hasVitalSigns = true;
}
}
if (!$hasVitalSigns) {
$isDataComplete = false;
}
if ($isDataComplete) {
// Check if registration has been verified
$isVerified = false;
if ($appointment->mcuResult && in_array($appointment->mcuResult->status ?? '', ['verified', 'finalized'])) {
$isVerified = true;
}
if ($isVerified) {
$statusClass = 'bg-success';
$tooltip = 'Selesai & Diverifikasi';
} else {
$statusClass = 'bg-success';
$tooltip = 'Selesai - Menunggu Verifikasi';
}
} else {
$statusClass = 'bg-warning';
$tooltip = 'Menunggu Data Tambahan';
}
} elseif ($stageData['type'] === 'finalization') {
if ($stageData['result'] && in_array($stageData['result']->status ?? '', ['finalized'])) {
$statusClass = 'bg-success';
$tooltip = 'Selesai';
} elseif ($appointment->status === 'completed') {
$statusClass = 'bg-info';
$tooltip = 'Menunggu Finalisasi';
}
} else {
// For workstation stages, check if they have actual workstation results
if ($stageData['result']) {
$status = $stageData['result']->status ?? '';
if (in_array($status, ['verified', 'finalized'])) {
$statusClass = 'bg-success';
$tooltip = $stageData['name'] . ' - Selesai & Diverifikasi';
} elseif ($status === 'completed') {
// Check if it has been verified before (for cancelled MCU cases)
// Also check if MCU was cancelled (indicated by mcuResult having cancellation_reason)
$isMcuCancelled = $appointment->mcuResult && $appointment->mcuResult->cancellation_reason;
if ($stageData['result']->verified_at || $isMcuCancelled) {
$statusClass = 'bg-success';
if ($stageData['result']->verified_at) {
$tooltip =
$stageData['name'] .
' - Selesai & Diverifikasi (verified_at: ' .
\App\Helpers\DateHelper::formatShort($stageData['result']->verified_at) .
' ' .
$stageData['result']->verified_at->format('H:i') .
')';
} else {
$tooltip =
$stageData['name'] . ' - Selesai & Diverifikasi (MCU dibatalkan, siap untuk verifikasi ulang)';
}
} else {
$statusClass = 'bg-warning';
$tooltip = $stageData['name'] . ' - Menunggu Verifikasi';
}
} elseif (in_array($status, ['pending_verification'])) {
$statusClass = 'bg-info';
$tooltip = $stageData['name'] . ' - Menunggu Verifikasi';
} elseif ($status === 'draft') {
$statusClass = 'bg-secondary';
$tooltip = $stageData['name'] . ' - Data Tersimpan (Belum Pemeriksaan)';
} elseif ($status === 'in_progress') {
$statusClass = 'bg-warning';
$tooltip = $stageData['name'] . ' - Sedang Diproses';
} else {
$statusClass = 'bg-secondary';
$tooltip = $stageData['name'] . ' - Belum Dimulai';
}
} else {
// No workstation result yet - should be gray (not started)
$statusClass = 'bg-secondary';
$tooltip = $stageData['name'] . ' - Belum Dimulai';
}
}
@endphp
{{ $stageData['short'] }}
@endforeach
@if ($pendingVerification > 0)
{{ $pendingVerification }} Menunggu Verifikasi
@endif
|
|
| Tidak ada data yang cocok dengan pencarian. | ||||||||