modified: .gitignore
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('department_patients', function (Blueprint $table) {
|
||||
$table->id('department_patient_id');
|
||||
$table->unsignedBigInteger('rf_department_id');
|
||||
$table->string('source_type')->default('manual');
|
||||
$table->unsignedBigInteger('rf_medicalhistory_id')->nullable();
|
||||
$table->string('full_name');
|
||||
$table->date('birth_date');
|
||||
$table->string('patient_kind');
|
||||
$table->string('diagnosis_code')->nullable();
|
||||
$table->text('diagnosis_name')->nullable();
|
||||
$table->dateTime('admitted_at');
|
||||
$table->boolean('is_current')->default(true);
|
||||
$table->string('outcome_type')->nullable();
|
||||
$table->dateTime('outcome_at')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->dateTime('linked_to_mis_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['rf_department_id', 'patient_kind'], 'idx_department_patients_department_kind');
|
||||
$table->index(['rf_department_id', 'is_current'], 'idx_department_patients_department_current');
|
||||
$table->index(['rf_medicalhistory_id'], 'idx_department_patients_medical_history');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('department_patients');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('medical_history_snapshots', function (Blueprint $table) {
|
||||
$table->string('patient_uid')->nullable()->after('patient_type');
|
||||
$table->string('patient_source_type')->nullable()->after('patient_uid');
|
||||
$table->unsignedBigInteger('rf_department_patient_id')->nullable()->after('rf_medicalhistory_id');
|
||||
$table->string('patient_kind')->nullable()->after('rf_department_patient_id');
|
||||
$table->string('full_name')->nullable()->after('patient_kind');
|
||||
$table->date('birth_date')->nullable()->after('full_name');
|
||||
$table->string('diagnosis_code')->nullable()->after('birth_date');
|
||||
$table->text('diagnosis_name')->nullable()->after('diagnosis_code');
|
||||
$table->dateTime('admitted_at')->nullable()->after('diagnosis_name');
|
||||
$table->string('outcome_type')->nullable()->after('admitted_at');
|
||||
$table->dateTime('outcome_at')->nullable()->after('outcome_type');
|
||||
$table->boolean('is_manual')->default(false)->after('outcome_at');
|
||||
|
||||
$table->index(['rf_report_id', 'patient_uid'], 'idx_snapshots_report_uid');
|
||||
$table->index(['patient_uid'], 'idx_snapshots_patient_uid');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('medical_history_snapshots', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_snapshots_report_uid');
|
||||
$table->dropIndex('idx_snapshots_patient_uid');
|
||||
|
||||
$table->dropColumn([
|
||||
'patient_uid',
|
||||
'patient_source_type',
|
||||
'rf_department_patient_id',
|
||||
'patient_kind',
|
||||
'full_name',
|
||||
'birth_date',
|
||||
'diagnosis_code',
|
||||
'diagnosis_name',
|
||||
'admitted_at',
|
||||
'outcome_type',
|
||||
'outcome_at',
|
||||
'is_manual',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('observation_patients', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('rf_department_patient_id')->nullable()->after('rf_medicalhistory_id');
|
||||
$table->index(['rf_department_patient_id'], 'idx_observation_patients_department_patient');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('observation_patients', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_observation_patients_department_patient');
|
||||
$table->dropColumn('rf_department_patient_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('department_patient_operations', function (Blueprint $table) {
|
||||
$table->id('department_patient_operation_id');
|
||||
$table->unsignedBigInteger('rf_department_patient_id');
|
||||
$table->unsignedBigInteger('rf_kl_service_medical_id')->nullable();
|
||||
$table->string('service_code', 64)->nullable();
|
||||
$table->string('service_name', 500)->nullable();
|
||||
$table->dateTime('started_at');
|
||||
$table->dateTime('ended_at');
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['rf_department_patient_id'], 'idx_department_patient_operations_patient');
|
||||
$table->index(['started_at'], 'idx_department_patient_operations_started_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('department_patient_operations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement('ALTER TABLE medical_history_snapshots ALTER COLUMN rf_medicalhistory_id DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('ALTER TABLE medical_history_snapshots ALTER COLUMN rf_medicalhistory_id SET NOT NULL');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('department_patient_operations', function (Blueprint $table) {
|
||||
$table->string('urgency', 32)->nullable()->after('service_name');
|
||||
$table->index(['urgency'], 'idx_department_patient_operations_urgency');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('department_patient_operations', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_department_patient_operations_urgency');
|
||||
$table->dropColumn('urgency');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('reports', function (Blueprint $table) {
|
||||
$table->string('period_type')->default('day') // day|week|month|year
|
||||
->comment('Тип отчетного периода');
|
||||
$table->dateTime('period_start')->nullable()
|
||||
->comment('Начало отчетного периода');
|
||||
$table->dateTime('period_end')->nullable()
|
||||
->comment('Окончание отчетного периода');
|
||||
|
||||
$table->integer('report_month')->storedAs('EXTRACT(MONTH FROM created_at)::integer')
|
||||
->comment('Отчетный месяц');
|
||||
$table->integer('report_year')->storedAs('EXTRACT(YEAR FROM created_at)::integer')
|
||||
->comment('Отчетный год');
|
||||
|
||||
$table->string('status')->default('draft')
|
||||
->comment('Статус отчета');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('reports', function (Blueprint $table) {
|
||||
$table->dropColumn(['period_type', 'period_start', 'period_end', 'status', 'report_year', 'report_month']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('metrika_items', function (Blueprint $table) {
|
||||
$table->string('code')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('metrika_items', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user