From 4b4104bc6b7cfd12de5bac767a5961531c8f8e7e Mon Sep 17 00:00:00 2001 From: Muhammad Fajar Date: Fri, 4 Nov 2022 09:54:08 +0700 Subject: [PATCH 1/2] migration appointment & seeder --- ..._084316_create_appointment_types_table.php | 34 +++++++++++++++ ...11_04_084333_create_appointments_table.php | 40 ++++++++++++++++++ ..._create_appointment_participants_table.php | 35 ++++++++++++++++ ...d_appointment_id_to_table_appointments.php | 42 +++++++++++++++++++ database/seeders/AppointmentTypesSeeder.php | 30 +++++++++++++ 5 files changed, 181 insertions(+) create mode 100644 database/migrations/2022_11_04_084316_create_appointment_types_table.php create mode 100644 database/migrations/2022_11_04_084333_create_appointments_table.php create mode 100644 database/migrations/2022_11_04_084351_create_appointment_participants_table.php create mode 100644 database/migrations/2022_11_04_093755_add_speciality_id_organization_id_appointment_id_to_table_appointments.php create mode 100644 database/seeders/AppointmentTypesSeeder.php diff --git a/database/migrations/2022_11_04_084316_create_appointment_types_table.php b/database/migrations/2022_11_04_084316_create_appointment_types_table.php new file mode 100644 index 00000000..f97975d5 --- /dev/null +++ b/database/migrations/2022_11_04_084316_create_appointment_types_table.php @@ -0,0 +1,34 @@ +id(); + $table->string('code'); + $table->string('name'); + $table->string('description'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('appointment_types'); + } +}; diff --git a/database/migrations/2022_11_04_084333_create_appointments_table.php b/database/migrations/2022_11_04_084333_create_appointments_table.php new file mode 100644 index 00000000..f1505db1 --- /dev/null +++ b/database/migrations/2022_11_04_084333_create_appointments_table.php @@ -0,0 +1,40 @@ +id(); + $table->string('status'); + $table->string('cancelation_reason'); + $table->string('appointment_type'); + $table->string('description'); + $table->string('duration_minutes'); + $table->string('start_time'); + $table->string('end_time'); + $table->text('comment'); + $table->text('patient_instruction'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('appointments'); + } +}; diff --git a/database/migrations/2022_11_04_084351_create_appointment_participants_table.php b/database/migrations/2022_11_04_084351_create_appointment_participants_table.php new file mode 100644 index 00000000..c7e8d341 --- /dev/null +++ b/database/migrations/2022_11_04_084351_create_appointment_participants_table.php @@ -0,0 +1,35 @@ +id(); + $table->string('type'); + $table->string('participantable_type'); + $table->string('participantable_id'); + $table->string('status'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('appointment_participants'); + } +}; diff --git a/database/migrations/2022_11_04_093755_add_speciality_id_organization_id_appointment_id_to_table_appointments.php b/database/migrations/2022_11_04_093755_add_speciality_id_organization_id_appointment_id_to_table_appointments.php new file mode 100644 index 00000000..daa8ab66 --- /dev/null +++ b/database/migrations/2022_11_04_093755_add_speciality_id_organization_id_appointment_id_to_table_appointments.php @@ -0,0 +1,42 @@ +foreignId('speciality_id')->nullable()->after('appointment_type'); + $table->foreignId('organization_id')->nullable()->after('end_time'); + }); + + Schema::table('appointment_participants', function (Blueprint $table) { + $table->foreignId('appointment_id')->nullable()->after('id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('appointments', function (Blueprint $table) { + $table->dropColumn('speciality_id'); + $table->dropColumn('organization_id'); + }); + + Schema::table('appointment_participants', function (Blueprint $table) { + $table->dropColumn('appointment_id'); + }); + } +}; diff --git a/database/seeders/AppointmentTypesSeeder.php b/database/seeders/AppointmentTypesSeeder.php new file mode 100644 index 00000000..4865b38a --- /dev/null +++ b/database/seeders/AppointmentTypesSeeder.php @@ -0,0 +1,30 @@ +insert([ + 'code' => $codes[$i], + 'name' => $names[$i], + 'description' => $descriptions[$i] + ]); + } + } +} From bc9c859a68e60905f85aa9e7b4d11192537d3cc4 Mon Sep 17 00:00:00 2001 From: Muhammad Fajar Date: Fri, 4 Nov 2022 10:10:20 +0700 Subject: [PATCH 2/2] fix hospital show --- Modules/Linksehat/Http/Controllers/Api/HospitalController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Linksehat/Http/Controllers/Api/HospitalController.php b/Modules/Linksehat/Http/Controllers/Api/HospitalController.php index 8a6e322c..744986a3 100755 --- a/Modules/Linksehat/Http/Controllers/Api/HospitalController.php +++ b/Modules/Linksehat/Http/Controllers/Api/HospitalController.php @@ -102,7 +102,7 @@ class HospitalController extends Controller ->with(['practitionerRoles' => function ($query) { $query->select(['organization_id', 'speciality_id']) ->whereNot('speciality_id') - ->groupBy(['speciality_id']) + ->groupBy(['organization_id', 'speciality_id']) ->orderBy('speciality_id'); }]) ->when($request->lat && $request->lng, function (Builder $query) use ($request) {