diff --git a/Modules/Internal/Http/Controllers/Api/AppointmentController.php b/Modules/Internal/Http/Controllers/Api/AppointmentController.php index 69dc8ab0..e8aa6994 100644 --- a/Modules/Internal/Http/Controllers/Api/AppointmentController.php +++ b/Modules/Internal/Http/Controllers/Api/AppointmentController.php @@ -18,7 +18,7 @@ class AppointmentController extends Controller public function index() { $appointments = Appointment::query() - ->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare') + ->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare', 'user') ->latest() ->paginate(15); return response()->json(Helper::paginateResources(AppointmentResource::collection($appointments))); diff --git a/Modules/Internal/Transformers/AppointmentResource.php b/Modules/Internal/Transformers/AppointmentResource.php index 180fd56c..c601067f 100644 --- a/Modules/Internal/Transformers/AppointmentResource.php +++ b/Modules/Internal/Transformers/AppointmentResource.php @@ -17,7 +17,8 @@ class AppointmentResource extends JsonResource { $appointment = [ 'id' => $this->nID, - 'doctor_name' => isset($this->doctor->user->sFirstName) ? $this->doctor->user->sFirstName . ' ' . $this->doctor->user->sLastName : null, + 'patient_name' => $this->user ? $this->user->full_name : '', + 'doctor_name' => $this->doctor ? $this->doctor->user?->full_name : '', 'speciality' => $this->doctor->speciality->sKeterangan, 'date_appointment' => Carbon::parse($this->appointmentDetail->dTanggalAppointment)->format('d-m-Y') . ' ' . $this->appointmentDetail->tTimeAppointment, 'date_created' => Carbon::parse($this->dCreateOn)->format('d-m-Y H:i:s') ?? null, @@ -25,6 +26,12 @@ class AppointmentResource extends JsonResource 'status' => $this->status_name, 'health_care' => $this->healthCare->sHealthCare ?? null, 'payment_method' => $this->payment_method ?? null, + 'patient' => $this->user, + 'booking_code' => $this->sBookingCode, + 'his_detail' => [ + 'RegID' => $this->sRegID, + 'Medrec' => $this->sNomorRekamMedis + ] ]; $payment_detail = null; diff --git a/app/Models/OLDLMS/Appointment.php b/app/Models/OLDLMS/Appointment.php index 5ece2794..374b6bfb 100644 --- a/app/Models/OLDLMS/Appointment.php +++ b/app/Models/OLDLMS/Appointment.php @@ -50,15 +50,13 @@ class Appointment extends Model 'dUpdateOn', 'dDeleteOn', ]; - - - + protected $appends = [ 'status_name', 'payment_method' ]; - protected function StatusName(): Attribute + protected function statusName(): Attribute { return Attribute::make( get: function ($value) { @@ -67,7 +65,7 @@ class Appointment extends Model ); } - protected function PaymentMethod(): Attribute + protected function paymentMethod(): Attribute { return Attribute::make( get: function ($value) { diff --git a/app/Models/OLDLMS/Livechat.php b/app/Models/OLDLMS/Livechat.php index 1c1a50cf..a2012f87 100644 --- a/app/Models/OLDLMS/Livechat.php +++ b/app/Models/OLDLMS/Livechat.php @@ -31,7 +31,7 @@ class Livechat extends Model 'status_name', ]; - protected function StatusName(): Attribute + protected function statusName(): Attribute { return Attribute::make( get: function ($value) { diff --git a/app/Models/OLDLMS/User.php b/app/Models/OLDLMS/User.php index 50b8f0a1..9669b63a 100644 --- a/app/Models/OLDLMS/User.php +++ b/app/Models/OLDLMS/User.php @@ -2,6 +2,7 @@ namespace App\Models\OLDLMS; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; @@ -17,4 +18,25 @@ class User extends Model protected $connection = 'oldlms'; protected $table = 'tm_users'; + + protected $appends = [ + 'full_name', + ]; + + protected function fullName(): Attribute + { + return Attribute::make( + get: function ($value) { + $names = []; + if (!empty($this->sFirstName)) { + array_push($names, $this->sFirstName); + } + if (!empty($this->sLastName)) { + array_push($names, $this->sLastName); + } + + return implode(' ', $names); + } + ); + } } diff --git a/frontend/dashboard/src/pages/Report/Appointments/List.tsx b/frontend/dashboard/src/pages/Report/Appointments/List.tsx index c26fcbbf..10a2a5a8 100644 --- a/frontend/dashboard/src/pages/Report/Appointments/List.tsx +++ b/frontend/dashboard/src/pages/Report/Appointments/List.tsx @@ -178,13 +178,17 @@ export default function List() { return ( - + + setOpen(!open)}> + {open ? : } + + {row.date_created ? row.date_created : '-'} {row.date_appointment ? row.date_appointment : '-'} + {row.booking_code ?? '-'} + {row.patient_name ? row.patient_name : '-'} {row.health_care ? row.health_care : '-'} {row.doctor_name ? row.doctor_name : '-'} - {row.speciality ? row.speciality : '-'} - {row.appointment_media ? row.appointment_media : '-'} {row.status ? row.status : '-'} @@ -197,6 +201,21 @@ export default function List() { + + + + + + Spesialisasi: {row.speciality} + Via: {row.appointment_media} + Metode Pembayaran: {row.payment_method} + HIS RegID: {row.his_detail?.sRegID} + HIS Medrec: {row.his_detail?.Medrec} + + + + + - Tanggal Booking + Tanggal Pemesanan Tanggal Appointment + + Kode Booking + + + Pasien + Faskes - Nama Dokter - - - Spesialisasi + Dokter Appointment Via App/Website