@extends('layouts.app') @php $source = $source ?? 'all'; $showMcuWorklist = $source !== 'regular'; $showRegularWorklist = $source !== 'mcu'; $worklistTitle = match ($source) { 'mcu' => 'Antrian Lab MCU', 'regular' => 'Antrian Lab Reguler', default => 'Worklist Laboratorium', }; @endphp @section('title', $worklistTitle . ' - MCU Klinik Mustika') @section('breadcrumb')

{{ $worklistTitle }}

@if ($source !== 'regular') @endif
@endsection @section('content')
{{ $worklistTitle }}
@if ($source === 'mcu') Daftar ini menampilkan pasien MCU yang diarahkan ke workstation laboratorium. @elseif ($source === 'regular') Daftar ini menampilkan permintaan pemeriksaan yang dikirim dokter dari Klinik Reguler. Permintaan ini tidak membentuk appointment atau progres MCU. @else Daftar ini menampilkan antrean MCU dan permintaan pemeriksaan yang dikirim dokter dari Klinik Reguler. Permintaan Klinik Reguler tidak membentuk appointment atau progres MCU. @endif
@if ($workstationData['stats']['is_empty'])
{{ $source === 'regular' ? 'Tidak Ada Permintaan Lab Reguler' : ($source === 'mcu' ? 'Tidak Ada Pasien MCU di Workstation Lab' : 'Tidak Ada Pasien di Workstation Lab') }}
@if ($source === 'mcu') Saat ini tidak ada pasien MCU yang diarahkan ke laboratorium. Silakan cek tanggal lain atau pastikan pasien telah diarahkan dari registrasi. @elseif ($source === 'regular') Saat ini tidak ada permintaan dari Klinik Reguler. Silakan cek tanggal lain atau pastikan dokter telah mengirim permintaan ke laboratorium. @else Saat ini tidak ada antrean MCU maupun permintaan Klinik Reguler. Silakan cek tanggal lain atau pastikan permintaan telah dikirim ke laboratorium. @endif
@endif
@if ($showRegularWorklist)

Permintaan Klinik

{{ $workstationData['stats']['clinic_requests'] }}

@endif

{{ $source === 'regular' ? 'Menunggu Sampel' : 'Antrian Menunggu' }}

{{ $workstationData['stats']['waiting'] }}

Sedang Diproses

{{ $workstationData['stats']['in_progress'] }}

@if ($showMcuWorklist)

Sampel Diambil

{{ $workstationData['stats']['sample_collected'] ?? 0 }}

@endif

Menunggu Verifikasi

{{ $workstationData['stats']['pending_verification'] }}

Total Aktif

{{ $workstationData['stats']['total_active'] }}

@if ($showRegularWorklist)
Permintaan Lab Klinik Reguler
Item dipilih dokter dan memakai snapshot nilai rujukan serta tarif klinik.
@if ($source === 'regular') @endif {{ $regularStats['total'] }} Permintaan
@include('partials.tables.filters', ['paginator' => $regularLabOrders, 'tableFilters' => ['source', 'date', 'sort', 'direction']]) @forelse ($regularLabOrders as $labOrder) @empty @endforelse
No. @include('partials.tables.sort_link', ['column' => 'order_number', 'label' => 'Nomor']) @include('partials.tables.sort_link', ['column' => 'name', 'label' => 'Pasien']) Jenis Kelamin Umur Tanggal Kunjungan Dokter Pemeriksaan Total Snapshot Status @include('partials.tables.sort_link', ['column' => 'ordered_at', 'label' => 'Waktu Dikirim']) Aksi
{{ $regularLabOrders->firstItem() + $loop->index }} {{ $labOrder->order_number }}
{{ $labOrder->regularCheckup?->checkup_number }}
{{ $labOrder->patient?->name ?? '-' }}
{{ $labOrder->patient?->medical_record_number ?: '-' }}
{{ ['male' => 'Laki-laki', 'female' => 'Perempuan'][$labOrder->patient?->gender] ?? '-' }} {{ $labOrder->patient?->formatAgeAt($labOrder->regularCheckup->checkup_date) ?? '-' }} {{ \App\Helpers\DateHelper::formatShort( $labOrder->regularCheckup->checkup_date, ) }} {{ $labOrder->orderedBy?->name ?? '-' }}
@foreach ($labOrder->displayItems() as $item) {{ $item->test_name }} @endforeach
{{ $labOrder->displayItems()->count() }} item
Rp {{ number_format((float) $labOrder->total_amount, 0, ',', '.') }} {{ $labOrder->statusLabel() }} {{ $labOrder->ordered_at?->format('d/m/Y H:i') ?? '-' }}
@if ($labOrder->status === \App\Models\LabOrder::STATUS_REQUESTED) @can ('process-lab-exam') Ambil Sampel @endcan @elseif ($labOrder->status === \App\Models\LabOrder::STATUS_SAMPLE_FAILED) @can ('process-lab-exam') Ambil Ulang Sampel @endcan @elseif ($labOrder->status === \App\Models\LabOrder::STATUS_IN_PROGRESS) @can ('process-lab-exam') Input Hasil @endcan @elseif ($labOrder->status === \App\Models\LabOrder::STATUS_REJECTED) @can ('process-lab-exam') Edit Hasil @endcan @elseif ($labOrder->status === \App\Models\LabOrder::STATUS_PENDING_VERIFICATION) Menunggu Dokter @endif @if ($labOrder->canBeCancelled()) @can ('process-lab-exam') @endcan @endif
Belum ada permintaan laboratorium dari Klinik Reguler pada tanggal ini.
{{ $regularLabOrders->links('partials.tables.pagination') }}
@can ('process-lab-exam') @foreach ($regularLabOrders as $labOrder) @if ($labOrder->canBeCancelled()) @endif @endforeach @endcan @endif @if ($showMcuWorklist)
Pasien yang Diarahkan ke Laboratorium
{{ $pendingAppointments->total() }} Pasien {{ \App\Helpers\DateHelper::formatDate(now()) }}
@include('partials.tables.filters', ['paginator' => $pendingAppointments, 'tableFilters' => ['source', 'date', 'sort', 'direction']]) @forelse ($pendingAppointments as $appointment) @php $hasActiveLabWorkflowItems = $appointment->appointmentMcuItems ->filter(function ($item) { return $item->mcuItem && $item->mcuItem->department === 'lab' && in_array($item->status, [ 'menunggu', 'antrian', 'sedang_diproses', 'menunggu_verifikasi', 'sample_collected', ]); }) ->count() > 0; $hasSampleCollected = $appointment->labResults->whereIn('status', ['sample_collected', 'completed'])->count() > 0; $hasCancelledOrRejected = $appointment->labResults ->filter(function ($res) { return !empty($res->cancelled_at) || $res->status === 'rejected'; }) ->count() > 0; $shouldShow = $hasActiveLabWorkflowItems || $hasSampleCollected || $hasCancelledOrRejected; @endphp @if ($shouldShow) @php $labItemsForRow = $appointment->appointmentMcuItems->filter(function ($item) { return $item->mcuItem && $item->mcuItem->department === 'lab' && in_array($item->status, ['menunggu', 'antrian', 'sedang_diproses', 'menunggu_verifikasi', 'sample_collected']); }); $labItem = $labItemsForRow ->whereIn('status', ['antrian', 'sedang_diproses', 'menunggu_verifikasi', 'sample_collected']) ->first() ?: $labItemsForRow->where('status', 'menunggu')->first(); $workflowLabResult = $appointment->labResults ->filter(fn($r) => in_array($r->status, ['sample_collected', 'completed', 'rejected'])) ->sortByDesc( fn($r) => match ($r->status) { 'completed' => 3, 'sample_collected' => 2, 'rejected' => 1, default => 0, }, ) ->first(); $labResultSampleCollected = $appointment->labResults->where('status', 'sample_collected')->first(); @endphp @endif @empty @endforelse
Sumber No. No. Registrasi & MR @include('partials.tables.sort_link', ['column' => 'name', 'label' => 'Nama Pasien']) @include('partials.tables.sort_link', ['column' => 'gender', 'label' => 'Jenis Kelamin']) @include('partials.tables.sort_link', ['column' => 'age', 'label' => 'Umur']) @include('partials.tables.sort_link', ['column' => 'appointment_date', 'label' => 'Tanggal MCU']) Status Pemeriksa Waktu Diarahkan MCU Ke Aksi
MCU {{ $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') : '-' }} @if ($labItem) @if ($labItem->status === 'menunggu') Menunggu Pemeriksaan @elseif ($labItem->status === 'antrian') Siap Diperiksa @elseif ($labItem->status === 'sedang_diproses') @if ($workflowLabResult && $workflowLabResult->cancelled_at && $workflowLabResult->status !== 'rejected') Verifikasi Dibatalkan @elseif ($workflowLabResult && $workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @else Sedang Diproses @endif @elseif ($labItem->status === 'menunggu_verifikasi') @if ($workflowLabResult && $workflowLabResult->cancelled_at && $workflowLabResult->status !== 'rejected') Verifikasi Dibatalkan @elseif ($workflowLabResult && $workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @else Menunggu Verifikasi @endif @elseif ($labItem->status === 'sample_collected') @if ($workflowLabResult && $workflowLabResult->cancelled_at && $workflowLabResult->status !== 'rejected') Verifikasi Dibatalkan @elseif ($workflowLabResult && $workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @else Sampel Diambil @endif @endif @elseif ($workflowLabResult && $workflowLabResult->status === 'completed' && !$labItem) Menunggu Verifikasi @elseif ($labResultSampleCollected) @php $labResult = $labResultSampleCollected; @endphp @if ($labResult->isCancelledResult ?? false) Perlu Perbaikan
Verifikasi dibatalkan @else Sampel Diambil @endif @elseif (!$labItem && $hasCancelledOrRejected) @if ($workflowLabResult && $workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @elseif ($workflowLabResult && $workflowLabResult->cancelled_at && $workflowLabResult->status !== 'rejected') Verifikasi Dibatalkan @endif @endif
{{ $workflowLabResult->technician->name ?? ($workflowLabResult->selectedTechnicianStaff->employee->full_name ?? '-') }} @php $assignedTime = $labItem && $labItem->assigned_at ? $labItem->assigned_at->format('d/m/Y H:i') : ''; $assignedBy = $labItem && $labItem->assignedBy ? $labItem->assignedBy->name : ''; if ($assignedTime === '' && $workflowLabResult && $workflowLabResult->created_at) { $assignedTime = $workflowLabResult->created_at->format('d/m/Y H:i'); if ($workflowLabResult->relationLoaded('technician') && $workflowLabResult->technician) { $assignedBy = $workflowLabResult->technician->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 ($labItem && $labItem->status === 'menunggu_verifikasi') @if ($workflowLabResult)
@canRoute ('lab.results.edit') @endcanRoute @if ($workflowLabResult->cancelled_at) Verifikasi Dibatalkan @elseif ($workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @else Menunggu Dokter @endif
@else Menunggu Dokter @endif @elseif ($labItem && in_array($labItem->status, ['menunggu', 'antrian', 'sedang_diproses'])) @if ($workflowLabResult && in_array($workflowLabResult->status, ['sample_collected', 'completed'])) @if ($workflowLabResult->cancelled_at)
@canRoute ('lab.results.edit') @endcanRoute Verifikasi Dibatalkan
@elseif ($workflowLabResult->status === 'completed')
@canRoute ('lab.results.edit') @endcanRoute Menunggu Dokter
@else
@canRoute ('lab.input_results') Input Hasil @endcanRoute
@endif @elseif ($workflowLabResult && $workflowLabResult->cancelled_at && $workflowLabResult->status !== 'rejected')
@canRoute ('lab.results.edit') @endcanRoute Verifikasi Dibatalkan
@elseif ($workflowLabResult && $workflowLabResult->status === 'rejected')
@canRoute ('lab.input_results') @endcanRoute Ditolak - Perlu Perbaikan
@else @php $buttonText = $labItem->status === 'sedang_diproses' ? 'Lanjutkan' : 'Ambil Sampel'; $buttonClass = $labItem->status === 'sedang_diproses' ? 'btn-warning' : 'btn-danger'; @endphp
@canRoute ('lab.process') {{ $buttonText }} @endcanRoute
@endif @elseif ($labItem && $labItem->status === 'sample_collected') @if ($workflowLabResult && $workflowLabResult->cancelled_at && $workflowLabResult->status !== 'rejected')
@canRoute ('lab.results.edit') @endcanRoute Verifikasi Dibatalkan
@elseif ($workflowLabResult && $workflowLabResult->status === 'rejected')
@canRoute ('lab.input_results') @endcanRoute Ditolak - Perlu Perbaikan
@else
@canRoute ('lab.input_results') Input Hasil @endcanRoute
@endif @elseif (!$labItem && $labResultSampleCollected) @php $labResult = $labResultSampleCollected; @endphp
@if ($labResult->isCancelledResult ?? false) @canRoute ('lab.results.edit') @endcanRoute Verifikasi dibatalkan @if ($labResult->cancelledBy && $labResult->cancelled_at)
oleh: {{ $labResult->cancelledBy->name }} @endif @else @canRoute ('lab.input_results') Input Hasil @endcanRoute @endif
@elseif (!$labItem && $workflowLabResult && $workflowLabResult->status === 'completed')
@canRoute ('lab.results.edit') @endcanRoute @if ($workflowLabResult->cancelled_at) Verifikasi Dibatalkan @elseif ($workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @else Menunggu Dokter @endif
@elseif (!$labItem && $hasCancelledOrRejected) @if ($workflowLabResult)
@canRoute ('lab.results.edit') @endcanRoute @if ($workflowLabResult->status === 'rejected') Ditolak - Perlu Perbaikan @elseif ($workflowLabResult->cancelled_at) Verifikasi Dibatalkan @endif
@endif @else @if ($workflowLabResult && in_array($workflowLabResult->status, ['sample_collected', 'completed'])) Hasil lab sudah tersedia @else @canRoute ('appointments.assign-workstation') @endcanRoute @endif @endif
Tidak ada data yang cocok dengan pencarian.
{{ $pendingAppointments->links( 'partials.tables.pagination', ) }}
@endif @push('scripts') @endpush @endsection @push('styles') @endpush