This commit is contained in:
2022-07-12 13:23:27 +07:00
parent b5f892641d
commit 4e99ba5109
29 changed files with 1826 additions and 228 deletions

View File

@@ -15,10 +15,65 @@ return new class extends Migration
{
Schema::create('benefits', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->string('name');
$table->foreignId('corporate_id')->index()->nullable();
$table->string('service_code')->index()->nullable();
$table->string('plan_code')->index()->nullable();
$table->string('benefit_code')->index()->nullable();
$table->string('code')->index()->nullable();
$table->text('description')->nullable();
$table->string('budget')->nullable();
$table->string('budget_conditions')->nullable();
$table->string('budget_code')->nullable();
$table->string('primary_benefit_code')->index()->nullable();
$table->string('benefit_mode')->nullable();
$table->string('room_class_coverage')->nullable();
$table->string('max_bed_coverage')->nullable();
$table->string('tolerance_parameter')->nullable();
$table->string('max_room_class')->nullable();
$table->decimal('limit_amount', 15, 2)->nullable();
$table->boolean('area_limit')->default(false)->nullable();
$table->string('shared_benefit')->nullable();
$table->string('shared_benefit_type')->nullable();
$table->string('msc')->nullable();
$table->string('genders')->nullable();
$table->string('min_age')->nullable();
$table->string('max_age')->nullable();
$table->string('max_frequency_period')->nullable();
$table->string('daily_frequency')->nullable();
$table->string('weekly_frequency')->nullable();
$table->string('monthly_frequency')->nullable();
$table->string('yearly_frequency')->nullable();
$table->string('custom_frequency_days')->nullable();
$table->string('custom_duration_value')->nullable();
$table->string('allowed_transaction_types')->nullable();
$table->string('high_plan_factor')->nullable();
$table->boolean('pre_post_treatment')->nullable();
$table->string('pre_treatment_days')->nullable();
$table->string('post_treatment_days')->nullable();
$table->string('layer_type_1')->nullable();
$table->string('layer_value_1')->nullable();
$table->string('layer_type_2')->nullable();
$table->string('layer_value_2')->nullable();
$table->tinyInteger('cashless_percentage')->default(100)->nullable();
$table->tinyInteger('reimbursement_percentage')->default(100)->nullable();
$table->tinyInteger('digital_percentage')->default(100)->nullable();
$table->tinyInteger('co_share_m_percentage')->default(100)->nullable();
$table->tinyInteger('co_share_s_percentage')->default(100)->nullable();
$table->tinyInteger('co_share_c_percentage')->default(100)->nullable();
$table->decimal('cashless_deductible', 15, 2)->nullable();
$table->decimal('reimbursement_deductible', 15, 2)->nullable();
$table->decimal('digital_deductible', 15, 2)->nullable();
$table->decimal('co_share_m_deductible', 15, 2)->nullable();
$table->decimal('co_share_s_deductible', 15, 2)->nullable();
$table->decimal('co_share_c_deductible', 15, 2)->nullable();
$table->string('prorate_type')->nullable();
$table->string('prorate_lookup')->nullable();
$table->string('max_days_for_disability')->nullable();
$table->string('max_period_for_disability')->nullable();
$table->string('currency')->nullable();
$table->string('show_benefit_item')->nullable();
$table->string('show_benefit_value')->nullable();
$table->timestamps();
$table->softDeletes();

View File

@@ -1,89 +0,0 @@
<?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('member_benefits', function (Blueprint $table) {
$table->id();
$table->string('service_code')->index()->nullable();
$table->string('plan_code')->index()->nullable();
$table->string('benefit_code')->index()->nullable();
$table->text('description')->nullable();
$table->string('budget')->nullable();
$table->string('budget_conditions')->nullable();
$table->string('budget_code')->nullable();
$table->string('primary_benefit_code')->index()->nullable();
$table->string('room_class_coverage')->nullable();
$table->string('max_bed_coverage')->nullable();
$table->string('tolerance_parameter')->nullable();
$table->string('max_room_class')->nullable();
$table->decimal('limit_amount', 15, 2)->nullable();
$table->boolean('area_limit')->default(false)->nullable();
$table->string('shared_benefit')->nullable();
$table->string('msc')->nullable();
$table->string('genders')->nullable();
$table->string('min_age')->nullable();
$table->string('max_age')->nullable();
$table->string('max_frequency_period')->nullable();
$table->string('daily_frequency')->nullable();
$table->string('weekly_frequency')->nullable();
$table->string('monthly_frequency')->nullable();
$table->string('custom_frequency_days')->nullable();
$table->string('custom_duration_value')->nullable();
$table->string('allowed_transaction_types')->nullable();
$table->string('high_plan_factor')->nullable();
$table->boolean('pre_post_treatment')->nullable();
$table->string('pre_treatment_days')->nullable();
$table->string('post_treatment_days')->nullable();
$table->string('layer_type_1')->nullable();
$table->string('layer_value_1')->nullable();
$table->string('layer_type_2')->nullable();
$table->string('layer_value_2')->nullable();
$table->tinyInteger('cashless_percentage')->default(100)->nullable();
$table->tinyInteger('reimbursement_percentage')->default(100)->nullable();
$table->tinyInteger('digital_percentage')->default(100)->nullable();
$table->tinyInteger('co_share_m_percentage')->default(100)->nullable();
$table->tinyInteger('co_share_s_percentage')->default(100)->nullable();
$table->tinyInteger('co_share_c_percentage')->default(100)->nullable();
$table->decimal('cashless_deductible', 15, 2)->nullable();
$table->decimal('reimbursement_deductible', 15, 2)->nullable();
$table->decimal('co_share_m_deductible', 15, 2)->nullable();
$table->decimal('co_share_s_deductible', 15, 2)->nullable();
$table->decimal('co_share_c_deductible', 15, 2)->nullable();
$table->string('prorate_type')->nullable();
$table->string('prorate_lookup')->nullable();
$table->string('max_days_for_disability')->nullable();
$table->string('max_period_for_disability')->nullable();
$table->string('currency')->nullable();
$table->string('show_benefit_item')->nullable();
$table->string('show_benefit_value')->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreignId('created_by')->nullable()->index();
$table->foreignId('updated_by')->nullable()->index();
$table->foreignId('deleted_by')->nullable()->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('member_benefits');
}
};

View File

@@ -0,0 +1,43 @@
<?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('corporate_benefits', function (Blueprint $table) {
$table->id();
$table->foreignId('corporate_id')->index();
$table->string('code')->index();
$table->string('name')->nullable();
$table->text('description')->nullable();
$table->timestamps();
$table->softDeletes();
$table->foreignId('created_by')->nullable()->index();
$table->foreignId('updated_by')->nullable()->index();
$table->foreignId('deleted_by')->nullable()->index();
$table->unique(['corporate_id', 'code']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('corporate_benefits');
}
};

View File

@@ -2,6 +2,8 @@
namespace Database\Seeders;
use App\Models\Benefit;
use App\Models\MemberBenefit;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
@@ -14,37 +16,14 @@ class BenefitSeeder extends Seeder
*/
public function run()
{
$listOfBenefit = [
[
"service_code" => 'OP',
"code" => "GP",
"name" => "General Practitioner",
"description" => "Consultation With General Practitioner"
],
[
"service_code" => 'OP',
"code" => "GP",
"name" => "General Practitioner",
"description" => "Consultation With General Practitioner"
],
[
"service_code" => 'OP',
"code" => "GP",
"name" => "General Practitioner",
"description" => "Consultation With General Practitioner"
],
[
"service_code" => 'OP',
"code" => "GP",
"name" => "General Practitioner",
"description" => "Consultation With General Practitioner"
],
[
"service_code" => 'OP',
"code" => "GP",
"name" => "General Practitioner",
"description" => "Consultation With General Practitioner"
],
];
$member_benefits = MemberBenefit::pluck('benefit_code')->unique();
foreach ($member_benefits as $benefit_code) {
Benefit::create([
'code' => $benefit_code,
'name' => "Benefit ". $benefit_code,
'corporate_id' => 3,
]);
}
}
}