@extends('layouts.app') @section('title', 'Worklist Spirometry - MCU Klinik Mustika') @section('breadcrumb')
Antrian Menunggu
Sampel Terkumpul
Sedang Diproses
Menunggu Verifikasi
Selesai
{{ $inputOnly ? 'Total antrean' : 'Total Aktif' }}
| No. | No. Registrasi & MR | @include('partials.tables.sort_link', ['column' => 'name', 'label' => 'Nama Pasien']) | @include('partials.tables.sort_link', ['column' => 'gender', 'label' => 'Jenis Kelamin']) | Umur | @include('partials.tables.sort_link', ['column' => 'appointment_date', 'label' => 'Tanggal MCU']) | Status | Petugas Spirometri | Waktu Diarahkan | MCU Ke | Aksi |
|---|---|---|---|---|---|---|---|---|---|---|
| {{ $pendingAppointments->firstItem() + $loop->index }} |
{{ $appointment->registration_number ?? '-' }}
{{ $appointment->patient->medical_record_number ?? '-' }}
|
{{ $appointment->patient->name }}
@php
$companyFromPatient = $appointment->patient && $appointment->patient->company ? $appointment->patient->company : null;
$company = $companyFromPatient ?: $appointment->company ?? null;
@endphp
@if ($company)
{{ $company->name }}
@if ($appointment->patient->job_position)
{{ $appointment->patient->job_position }}
@endif
@else
Individu
@endif
|
{{ $appointment->patient->gender == 'male' ? 'Laki-laki' : 'Perempuan' }} | {{ $appointment->patient->detailed_age ?: '-' }} | {{ $appointment->appointment_date ? $appointment->appointment_date->format('d/m/Y') : '-' }} | @php $spirometryItems = $appointment->appointmentMcuItems->filter(function ($item) { return $item->mcuItem && $item->mcuItem->department === 'spirometry' && in_array($item->status, [ 'menunggu', 'antrian', 'sedang_diproses', 'menunggu_verifikasi', 'sample_collected', 'selesai', ]) && $item->assigned_at !== null; // Only show assigned items }); $hasAssignedItems = $spirometryItems ->whereIn('status', ['antrian', 'sedang_diproses', 'menunggu_verifikasi', 'sample_collected', 'selesai']) ->count() > 0; $hasWaitingItems = $spirometryItems->where('status', 'menunggu')->count() > 0; $spirometryItem = $spirometryItems ->whereIn('status', ['antrian', 'sedang_diproses', 'menunggu_verifikasi', 'sample_collected', 'selesai']) ->first() ?: $spirometryItems->where('status', 'menunggu')->first(); @endphp @if ($spirometryItem) @if ($spirometryItem->status === 'menunggu') Menunggu Pemeriksaan @elseif ($spirometryItem->status === 'antrian') Siap Diperiksa @elseif ($spirometryItem->status === 'sedang_diproses') @php $spirometryResult = \App\Models\SpirometryResult::where('appointment_id', $appointment->id)->first(); @endphp @if ($spirometryResult && $spirometryResult->status === 'rejected') Ditolak - Perlu Perbaikan @elseif ($spirometryResult && $spirometryResult->cancelled_at) Verifikasi Dibatalkan @else Sedang Diproses @endif @elseif ($spirometryItem->status === 'menunggu_verifikasi') @php $spirometryResult = \App\Models\SpirometryResult::where('appointment_id', $appointment->id)->first(); @endphp @if ($spirometryResult && $spirometryResult->status === 'rejected') Ditolak - Perlu Perbaikan @elseif ($spirometryResult && $spirometryResult->cancelled_at) Verifikasi Dibatalkan @else Menunggu Verifikasi @endif @elseif ($spirometryItem->status === 'sample_collected') Perlu Diperbaiki @elseif ($spirometryItem->status === 'selesai') Selesai @endif @elseif (!$spirometryItem && $hasCancelledOrRejected) @php $spirometryResult = \App\Models\SpirometryResult::where('appointment_id', $appointment->id)->first(); @endphp @if ($spirometryResult && $spirometryResult->status === 'rejected') Ditolak - Perlu Perbaikan @elseif ($spirometryResult && $spirometryResult->cancelled_at) Verifikasi Dibatalkan @endif @endif | {{ $appointment->spirometryResult ? $appointment->spirometryResult->technicianDisplayName($defaultTechnician) ?? '-' : '-' }} |
@php
$assignedTime =
$spirometryItem && $spirometryItem->assigned_at ? $spirometryItem->assigned_at->format('d/m/Y H:i') : '';
$assignedBy = $spirometryItem && $spirometryItem->assignedBy ? $spirometryItem->assignedBy->name : '';
@endphp
@if ($assignedTime)
{{ $assignedTime }}
@if ($assignedBy)
oleh: {{ $assignedBy }}
@endif
@else
-
@endif
|
@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
|
@if ($spirometryItem && in_array($spirometryItem->status, ['menunggu', 'antrian']))
@canRoute ('spirometry.process')
Proses
@endcanRoute
@elseif ($spirometryItem && $spirometryItem->status === 'sedang_diproses')
@php
$spirometryResult = \App\Models\SpirometryResult::where('appointment_id', $appointment->id)->first();
@endphp
@if ($spirometryResult && $spirometryResult->status === 'rejected')
@elseif ($spirometryResult && $spirometryResult->cancelled_at)
@else
@canRoute ('spirometry.process')
Lanjutkan
@endcanRoute
@endif
@elseif ($spirometryItem && $spirometryItem->status === 'sample_collected')
@php
$spirometryResult = \App\Models\SpirometryResult::where('appointment_id', $appointment->id)->first();
@endphp
@if ($spirometryResult)
@else
@canRoute ('spirometry.process')
Proses
@endcanRoute
@endif
@elseif ($spirometryItem && $spirometryItem->status === 'menunggu_verifikasi')
@php
$spirometryResult = \App\Models\SpirometryResult::where('appointment_id', $appointment->id)->first();
@endphp
@if ($spirometryResult)
@canRoute ('spirometry.edit')
@endcanRoute
@if ($spirometryResult->status === 'rejected')
Ditolak - Perlu Perbaikan
@elseif ($spirometryResult->cancelled_at)
Verifikasi Dibatalkan
@else
Menunggu Verifikasi
@endif
@else
Menunggu Verifikasi
@endif
@elseif ($spirometryItem && $spirometryItem->status === 'selesai')
|
| Tidak ada data yang cocok dengan pencarian. | ||||||||||