feat(hospitalportal): add provider and request log schema

This commit is contained in:
2026-05-13 16:34:54 +07:00
parent 5042cd7800
commit cf831c4602
6 changed files with 373 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?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('providers', function (Blueprint $table) {
$table->id();
$table->foreignId('organization_id')->nullable()->index();
$table->string('username')->index();
$table->string('password');
$table->string('code')->index();
$table->string('status')->default('active');
$table->text('header_token')->nullable();
$table->text('token')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable()->index();
$table->unsignedBigInteger('updated_by')->nullable()->index();
$table->unsignedBigInteger('deleted_by')->nullable()->index();
$table->unique(['organization_id', 'username']);
$table->unique(['organization_id', 'code']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('providers');
}
};

View File

@@ -0,0 +1,93 @@
<?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()
{
if (!Schema::hasTable('request_logs')) {
Schema::create('request_logs', function (Blueprint $table) {
$table->id();
$table->uuid('uuid');
$table->string('code')->index();
$table->foreignId('organization_id')->nullable()->index();
$table->foreignId('member_id')->nullable()->index();
$table->foreignId('plan_id')->nullable()->index();
$table->string('service_code')->nullable()->comment('IP / OP');
$table->string('status')->nullable()->default('approved');
$table->boolean('final_log')->default(false);
$table->string('status_final_log')->nullable();
$table->string('source')->nullable()->default('api');
$table->text('keterangan')->nullable();
$table->string('penempatan_kamar')->nullable();
$table->decimal('total_cob', 18, 2)->nullable();
$table->string('nomor_sep')->nullable();
$table->string('inacbgs_code')->nullable();
$table->decimal('inacbgs_amount', 18, 2)->nullable();
$table->string('no_transaksi_provider')->nullable();
$table->dateTime('admission_date')->nullable();
$table->dateTime('discharge_date')->nullable();
$table->string('diagnosis')->nullable();
$table->string('nomor_rujukan')->nullable();
$table->string('status_rujukan')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable()->index();
$table->unsignedBigInteger('updated_by')->nullable()->index();
$table->unsignedBigInteger('deleted_by')->nullable()->index();
});
return;
}
Schema::table('request_logs', function (Blueprint $table) {
if (!Schema::hasColumn('request_logs', 'plan_id')) {
$table->foreignId('plan_id')->nullable()->index()->after('member_id');
}
if (!Schema::hasColumn('request_logs', 'nomor_sep')) {
$table->string('nomor_sep')->nullable()->after('penempatan_kamar');
}
if (!Schema::hasColumn('request_logs', 'inacbgs_code')) {
$table->string('inacbgs_code')->nullable()->after('nomor_sep');
}
if (!Schema::hasColumn('request_logs', 'inacbgs_amount')) {
$table->decimal('inacbgs_amount', 18, 2)->nullable()->after('inacbgs_code');
}
if (!Schema::hasColumn('request_logs', 'no_transaksi_provider')) {
$table->string('no_transaksi_provider')->nullable()->after('inacbgs_amount');
}
if (!Schema::hasColumn('request_logs', 'admission_date')) {
$table->dateTime('admission_date')->nullable()->after('submission_date');
}
if (!Schema::hasColumn('request_logs', 'nomor_rujukan')) {
$table->string('nomor_rujukan')->nullable()->after('nomor_sep');
}
if (!Schema::hasColumn('request_logs', 'status_rujukan')) {
$table->string('status_rujukan')->nullable()->after('nomor_rujukan');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('request_logs');
}
};

View File

@@ -0,0 +1,54 @@
<?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()
{
if (!Schema::hasTable('request_log_benefits')) {
Schema::create('request_log_benefits', function (Blueprint $table) {
$table->id();
$table->foreignId('request_log_id')->index();
$table->foreignId('benefit_id')->index();
$table->decimal('amount_incurred', 18, 2)->nullable()->default(0);
$table->decimal('amount_approved', 18, 2)->nullable()->default(0);
$table->decimal('excess_paid', 18, 2)->nullable()->default(0);
$table->string('keterangan')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable()->index();
$table->unsignedBigInteger('updated_by')->nullable()->index();
$table->unsignedBigInteger('deleted_by')->nullable()->index();
$table->unique(['request_log_id', 'benefit_id']);
});
return;
}
Schema::table('request_log_benefits', function (Blueprint $table) {
if (!Schema::hasColumn('request_log_benefits', 'keterangan')) {
$table->string('keterangan')->nullable()->after('excess_paid');
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('request_log_benefits');
}
};