From 46af57b17c94163131325fe6100ed724b97cfd26 Mon Sep 17 00:00:00 2001 From: R Date: Wed, 15 Feb 2023 10:13:07 +0700 Subject: [PATCH] Show additional patient information in Dashboard Appointment --- .../Http/Controllers/Api/AppointmentController.php | 2 +- app/Models/OLDLMS/User.php | 5 +++++ app/Models/OLDLMS/UserDetail.php | 9 +++++++++ .../dashboard/src/pages/Report/Appointments/List.tsx | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Modules/Internal/Http/Controllers/Api/AppointmentController.php b/Modules/Internal/Http/Controllers/Api/AppointmentController.php index e8aa6994..e9ac3ca7 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', 'user') + ->with('doctor.user', 'doctor.speciality', 'appointmentDetail', 'healthCare', 'user', 'user.detail') ->latest() ->paginate(15); return response()->json(Helper::paginateResources(AppointmentResource::collection($appointments))); diff --git a/app/Models/OLDLMS/User.php b/app/Models/OLDLMS/User.php index 9669b63a..d24c35f6 100644 --- a/app/Models/OLDLMS/User.php +++ b/app/Models/OLDLMS/User.php @@ -39,4 +39,9 @@ class User extends Model } ); } + + public function detail() + { + return $this->hasOne(UserDetail::class, 'nIDUser', 'nID'); + } } diff --git a/app/Models/OLDLMS/UserDetail.php b/app/Models/OLDLMS/UserDetail.php index 915db287..c37f0ef6 100644 --- a/app/Models/OLDLMS/UserDetail.php +++ b/app/Models/OLDLMS/UserDetail.php @@ -8,4 +8,13 @@ use Illuminate\Database\Eloquent\Model; class UserDetail extends Model { use HasFactory; + + const CREATED_AT = 'dCreateOn'; + const UPDATED_AT = 'dUpdateOn'; + const DELETED_AT = 'dDeleteOn'; + + protected $connection = 'oldlms'; + + protected $table = 'tm_users_detail'; + } diff --git a/frontend/dashboard/src/pages/Report/Appointments/List.tsx b/frontend/dashboard/src/pages/Report/Appointments/List.tsx index 10a2a5a8..afc2552b 100644 --- a/frontend/dashboard/src/pages/Report/Appointments/List.tsx +++ b/frontend/dashboard/src/pages/Report/Appointments/List.tsx @@ -211,6 +211,10 @@ export default function List() { Metode Pembayaran: {row.payment_method} HIS RegID: {row.his_detail?.sRegID} HIS Medrec: {row.his_detail?.Medrec} + No HP: {row.patient.sPhone ?? ''} + E-mail: {row.patient.sEmail ?? ''} + Alamat: {row.patient.detail.sAlamat ?? ''} + KTP: {row.patient.detail.sKTP ?? ''}