Merge pull request 'mhmfajar' (#4) from mhmfajar into master

Reviewed-on: http://itcorp.primaya.id:3000/rajif/aso/pulls/4
This commit is contained in:
fajar
2022-11-04 10:11:27 +07:00
6 changed files with 182 additions and 1 deletions

View File

@@ -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) {

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appointment_types', function (Blueprint $table) {
$table->id();
$table->string('code');
$table->string('name');
$table->string('description');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('appointment_types');
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appointments', function (Blueprint $table) {
$table->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');
}
};

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('appointment_participants', function (Blueprint $table) {
$table->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');
}
};

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('appointments', function (Blueprint $table) {
$table->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');
});
}
};

View File

@@ -0,0 +1,30 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class AppointmentTypesSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$codes = ['ROUTINE', 'WALKIN', 'CHECKUP', 'FOLLOWUP', 'EMERGENCY', 'TELECONSULTATION'];
$names = ['Routine', 'Walk In', 'Check-Up', 'Follow Up', 'Emergency', 'Teleconsultation'];
$descriptions = ['Routine Appointment', 'A previously unscheduled walk-in visit', 'A routine check-up, such as an annual physical', 'A follow up visit from a previous appointment', 'Emergency appointment', 'Teleconsultation appointment'];
for ($i = 0; $i < count($codes); $i++) {
DB::table('appointment_types')->insert([
'code' => $codes[$i],
'name' => $names[$i],
'description' => $descriptions[$i]
]);
}
}
}