Update migrations for backoffice configuration

This commit is contained in:
Djery-Tom 2021-10-11 01:13:00 +01:00
parent 77dfcaf5bf
commit c5a2501865
9 changed files with 246 additions and 36 deletions

39
app/Models/NhAct.php Normal file
View File

@ -0,0 +1,39 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class NhAct
*
* @property int $id
* @property int $nh_network_config_id
* @property string $name
* @property string $billing_type
* @property string $authorization_type
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class NhAct extends Model
{
protected $table = 'nh_acts';
protected $casts = [
'nh_network_config_id' => 'int'
];
protected $fillable = [
'nh_network_config_id',
'name',
'billing_type',
'authorization_type'
];
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class NhMonthsPricesGrid
*
* @property int $id
* @property int $nh_network_config_id
* @property float $number_of_months
* @property float $min_amount
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class NhMonthsPricesGrid extends Model
{
protected $table = 'nh_months_prices_grid';
protected $casts = [
'nh_network_config_id' => 'int',
'number_of_months' => 'float',
'min_amount' => 'float'
];
protected $fillable = [
'nh_network_config_id',
'number_of_months',
'min_amount'
];
}

View File

@ -17,11 +17,15 @@ use Illuminate\Database\Eloquent\Model;
* @property string $provider_billing_period
* @property float $max_number_of_beneficiaries
* @property float $age_limit_of_child_beneficiary
* @property string $support_type
* @property float $percentage_insurer
* @property float $percentage_insured
* @property Carbon $updated_at
* @property Carbon $created_at
* @property float $coverage_limit_per_insured_per_year
* @property float $current_affection_percentage_insurer
* @property float $current_affection_percentage_insured
* @property float $long_term_affection_percentage_insurer
* @property float $long_term_affection_percentage_insured
* @property float $exoneration_percentage_insurer
* @property float $exoneration_percentage_insured
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
@ -30,20 +34,29 @@ class NhNetworksConfig extends Model
protected $table = 'nh_networks_configs';
protected $casts = [
'network_id' => 'int',
'max_number_of_beneficiaries' => 'float',
'age_limit_of_child_beneficiary' => 'float',
'percentage_insurer' => 'float',
'percentage_insured' => 'float'
];
'network_id' => 'int',
'max_number_of_beneficiaries' => 'float',
'age_limit_of_child_beneficiary' => 'float',
'coverage_limit_per_insured_per_year' => 'float',
'current_affection_percentage_insurer' => 'float',
'current_affection_percentage_insured' => 'float',
'long_term_affection_percentage_insurer' => 'float',
'long_term_affection_percentage_insured' => 'float',
'exoneration_percentage_insurer' => 'float',
'exoneration_percentage_insured' => 'float'
];
protected $fillable = [
'network_id',
'provider_billing_period',
'max_number_of_beneficiaries',
'age_limit_of_child_beneficiary',
'support_type',
'percentage_insurer',
'percentage_insured'
];
'network_id',
'provider_billing_period',
'max_number_of_beneficiaries',
'age_limit_of_child_beneficiary',
'coverage_limit_per_insured_per_year',
'current_affection_percentage_insurer',
'current_affection_percentage_insured',
'long_term_affection_percentage_insurer',
'long_term_affection_percentage_insured',
'exoneration_percentage_insurer',
'exoneration_percentage_insured'
];
}

View File

@ -0,0 +1,42 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class NhYearsPricesGrid
*
* @property int $id
* @property int $nh_network_config_id
* @property float $min_age
* @property float $max_age
* @property float $markup_percentage
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class NhYearsPricesGrid extends Model
{
protected $table = 'nh_years_prices_grid';
protected $casts = [
'nh_network_config_id' => 'int',
'min_age' => 'float',
'max_age' => 'float',
'markup_percentage' => 'float'
];
protected $fillable = [
'nh_network_config_id',
'min_age',
'max_age',
'markup_percentage'
];
}

View File

@ -14,8 +14,12 @@ class AddNanoHealthColumnsInConfigWalletTable extends Migration
public function up()
{
Schema::table('configWallet', function (Blueprint $table) {
$table->integer('nh_network_config_id')->nullable();
$table->boolean('enabled')->default(0);
if (!Schema::hasColumn('configWallet', 'nh_network_config_id')) {
$table->integer('nh_network_config_id')->nullable();
}
if (!Schema::hasColumn('configWallet', 'enabled')) {
$table->boolean('enabled')->default(1);
}
});
}
@ -28,7 +32,7 @@ class AddNanoHealthColumnsInConfigWalletTable extends Migration
{
Schema::table('configWallet', function (Blueprint $table) {
//
$table->dropColumn(['nh_network_config_id', ]);
$table->dropColumn(['nh_network_config_id', 'enabled']);
});
}
}

View File

@ -14,16 +14,20 @@ class CreateNhNetworksConfigsTable extends Migration
public function up()
{
Schema::create('nh_networks_configs', function (Blueprint $table) {
$table->integer('id', true);
$table->id();
$table->integer('network_id');
$table->enum('provider_billing_period', ['WEEKLY', 'BIMONTHLY', 'MONTHLY'])->default('WEEKLY')->comment('Période de facturatio des prestataires : hebdomadaire ou bimensuel ,mensuel ');
$table->enum('provider_billing_period', ['WEEKLY', 'BIMONTHLY', 'MONTHLY'])->default('WEEKLY')->comment('Période de facturation des prestataires : hebdomadaire ou bimensuel ,mensuel ');
$table->decimal('max_number_of_beneficiaries', 1, 0)->default(0)->comment('Nombre dayant droit maximum : un nombre à un chiffre');
$table->decimal('age_limit_of_child_beneficiary', 2, 0)->default(0)->comment('Age limite de layant droit enfant : un nombre à 2 chiffres');
$table->enum('support_type', ['CURRENT_AFFECTATION', 'LONG_TERM_AFFECTATION', 'EXONERATION'])->default('CURRENT_AFFECTATION')->comment('type de prises en charge');
$table->decimal('percentage_insurer', 2, 0)->default(0);
$table->decimal('percentage_insured', 2, 0)->default(0);
$table->timestamp('updated_at')->useCurrent();
$table->decimal('coverage_limit_per_insured_per_year', 10, 2)->default(0)->comment("Limite de la couverture par assuré par an");
$table->decimal('current_affection_percentage_insurer', 2, 0)->default(0)->comment("Affection courante: % part assureur");
$table->decimal('current_affection_percentage_insured', 2, 0)->default(0)->comment("Affection courante: % part assuré");
$table->decimal('long_term_affection_percentage_insurer', 2, 0)->default(0)->comment("Affection longue durée: % part assureur");
$table->decimal('long_term_affection_percentage_insured', 2, 0)->default(0)->comment("Affection longue durée: % part assuré");
$table->decimal('exoneration_percentage_insurer', 2, 0)->default(0)->comment("Exoneration: % part assureur");
$table->decimal('exoneration_percentage_insured', 2, 0)->default(0)->comment("Exoneration: % part assuré");
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
});
}

View File

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNhPricesGridTable extends Migration
class CreateNhYearsPricesGridTable extends Migration
{
/**
* Run the migrations.
@ -13,16 +13,14 @@ class CreateNhPricesGridTable extends Migration
*/
public function up()
{
Schema::create('nh_prices_grid', function (Blueprint $table) {
$table->integer('id')->primary();
Schema::create('nh_years_prices_grid', function (Blueprint $table) {
$table->id();
$table->integer('nh_network_config_id');
$table->decimal('min_age', 2, 0)->default(0);
$table->decimal('max_age', 2, 0)->default(0);
$table->decimal('markup_percentage', 2, 0)->default(0)->comment('Pourcentage de majoration');
$table->decimal('min_amount', 10)->default(0);
$table->decimal('number_of_months', 2, 0)->default(0);
$table->timestamp('updated_at')->useCurrent();
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
});
}
@ -33,6 +31,6 @@ class CreateNhPricesGridTable extends Migration
*/
public function down()
{
Schema::dropIfExists('nh_prices_grid');
Schema::dropIfExists('nh_years_prices_grid');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNhMonthsPricesGridTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('nh_months_prices_grid', function (Blueprint $table) {
$table->id();
$table->integer('nh_network_config_id');
$table->decimal('number_of_months', 2, 0)->default(0);
$table->decimal('min_amount', 10)->default(0);
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('nh_months_prices_grid');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNhActsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('nh_acts', function (Blueprint $table) {
$table->id();
$table->integer('nh_network_config_id');
$table->string('name');
$table->enum('billing_type', ['PACKAGE', 'UNIT_PRICE'])->default('UNIT_PRICE')->comment('Type de facturation : forfait ou prix unitaire');
$table->enum('authorization_type', ['FREE', 'PRIOR'])->default('FREE')->comment("Type d'autorisation : préalable ou libre");
$table->timestamp('created_at')->useCurrent();
$table->timestamp('updated_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('nh_acts');
}
}