@extends('layouts.app') @section('title', 'Detail Verifikasi Pasien - MCU Klinik Mustika') @section('breadcrumb')

Detail Verifikasi Pasien

@endsection @section('content')
Informasi Pasien
{{ $appointment->registration_number }} {{ $appointment->patient->medical_record_number }}
@if ($appointment->patient->photo) Foto {{ $appointment->patient->name }} @else
@endif
{{ $appointment->patient->name }}
{{ $appointment->patient->gender == 'male' ? 'Laki-laki' : 'Perempuan' }}
{{ $appointment->patient->detailed_age ?: '-' }}
@php $companyRel = $appointment->company ?? ($appointment->patient?->company ?? $appointment->mcuResult?->company); $companyName = $companyRel->name ?? null; @endphp @if ($companyName) {{ $companyName }} @else Pribadi @endif
{{ $appointment->patient->job_position ?? ($appointment->patient->occupation ?? '-') }}
{{ \App\Helpers\DateHelper::formatFull( $appointment->appointment_date, ) }}
{{ $appointment->appointment_time ?? '08:00' }}
@php $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
{{ $appointment->mcuPackage->name ?? 'Paket tidak tersedia' }}
Status Verifikasi Workstation
@if (count($workstations) > 0)
@foreach ($workstations as $workstation)
{{ $workstation['name'] }}
Workstation
{{ $workstation['status_text'] }} @if (!empty($workstation['is_pregnancy_exempt'])) Kehamilan @endif
@if (!empty($workstation['is_pregnancy_exempt']))
Pemeriksaan ini dilewati karena pasien terkonfirmasi hamil.
@elseif ($workstation['result'] && in_array($workstation['result']->status, ['verified', 'completed', 'finalized']))
Waktu Selesai:
@php $completedAt = $workstation['result']->completed_at ?? ($workstation['result']->verified_at ?? ($workstation['result']->updated_at ?? $workstation['result']->created_at)); @endphp {{ \App\Helpers\DateHelper::formatShort($completedAt) }} {{ \Carbon\Carbon::parse($completedAt)->format('H:i') }}
{{ \Carbon\Carbon::parse($completedAt)->diffForHumans() }}
@endif
@if (!empty($workstation['is_pregnancy_exempt'])) @elseif ($workstation['can_verify']) Verifikasi @elseif ($workstation['status'] === 'verified' || $workstation['status'] === 'finalized') @else @endif @if ($workstation['result'] && in_array($workstation['result']->status, ['verified', 'finalized'])) @canRoute ($workstation['result_route']) @endcanRoute @endif
@endforeach
@else
Tidak Ada Workstation yang Tersedia

Berdasarkan role Anda, tidak ada workstation yang dapat diverifikasi untuk pasien ini.

@endif
@canRoute ('verification.index') Kembali ke Daftar @endcanRoute @php $verifiedStatuses = ['verified', 'finalized', 'terverifikasi', 'sudah_diverifikasi']; // $isPregnant dikirim dari controller (VerificationController@showPatientDetail) $pregnancyExemptModules = $isPregnant ? ['radiology'] : []; $resultsToCheck = [ 'physical_exam' => $appointment->physicalExamResult ?? null, 'lab' => $appointment->labResult ?? null, 'radiology' => $appointment->radiologyResult ?? null, 'spirometry' => $appointment->spirometryResult ?? null, 'audiometry' => $appointment->audiometryResult ?? null, 'visus' => $appointment->visusResult ?? null, 'ekg' => $appointment->ekgResult ?? null, 'dass21' => $appointment->dass21Result ?? null, ]; $allVerified = collect($resultsToCheck)->every(function ($result, $module) use ( $verifiedStatuses, $pregnancyExemptModules, $appointment, ) { if (in_array($module, $pregnancyExemptModules, true)) { return true; // dikecualikan karena pasien hamil } // Check if module is DASS21 dan appointment tidak seharusnya memiliki DASS21 if ($module === 'dass21' && !$appointment->shouldHaveDass21()) { return true; // Skip DASS21 jika tidak diwajibkan } return $result && in_array($result->status, $verifiedStatuses); }); // Check which specific modules are not verified yet $unverifiedModules = []; foreach ($resultsToCheck as $module => $result) { if (in_array($module, $pregnancyExemptModules, true)) { continue; // Lewati modul yang memang dibebaskan karena kehamilan } // Skip DASS21 jika appointment tidak seharusnya memiliki DASS21 if ($module === 'dass21' && !$appointment->shouldHaveDass21()) { continue; } if (!$result || !in_array($result->status, $verifiedStatuses)) { $unverifiedModules[] = $module; } } // Get module names in Indonesian $moduleNames = [ 'physical_exam' => 'Pemeriksaan Fisik', 'lab' => 'Laboratorium', 'radiology' => 'Radiologi', 'spirometry' => 'Spirometri', 'audiometry' => 'Audiometri', 'visus' => 'Pemeriksaan Mata', 'ekg' => 'EKG', 'dass21' => 'DASS21', ]; @endphp @if ($canSummarize)
@if ($allVerified) @canRoute ('monitoring.summary') Summary & Verifikasi MCU @endcanRoute @else Belum dapat melakukan summary karena modul berikut belum diverifikasi:
@foreach ($unverifiedModules as $module) {{ $moduleNames[$module] ?? ucfirst($module) }} @endforeach @if ($isPregnant)
Radiologi dilewati karena kehamilan pasien @endif
@endif
@endif
@endsection @push('scripts') @endpush