* изменил таблицы в основном отчете

* изменил метод сохранения пациентов основного отчета
This commit is contained in:
brusnitsyn
2026-05-07 18:00:43 +09:00
parent 723ccee8d3
commit bb9e67ab3d
25 changed files with 1438 additions and 52 deletions

View File

@@ -0,0 +1,47 @@
<?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::create('report_duties', function (Blueprint $table) {
$table->id();
$table->date('report_date');
$table->dateTime('sent_at')->nullable();
$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->foreignIdFor(\App\Models\ReportStatus::class, 'status_id')->default(1);
$table->foreignIdFor(\App\Models\MisLpuDoctor::class, 'rf_lpudoctor_id')->nullable();
$table->foreignIdFor(\App\Models\Department::class, 'rf_department_id')->default(1);
$table->foreignIdFor(\App\Models\User::class, 'rf_user_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('report_duties');
}
};

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.
*/
public function up(): void
{
Schema::create('report_duty_patients', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\ReportDuty::class, 'report_duty_id');
$table->string('source_type');
$table->bigInteger('original_id');
$table->string('medical_card_number')->nullable();
$table->string('full_name');
$table->date('birth_date')->nullable();
$table->dateTime('recipient_date');
$table->dateTime('extract_date')->nullable();
$table->dateTime('death_date')->nullable();
$table->boolean('male')->default(true);
$table->integer('urgency_id')->nullable();
$table->integer('hospital_result_id')->nullable();
$table->integer('visit_result_id')->nullable();
$table->text('comment')->nullable();
$table->foreignIdFor(\App\Models\User::class, 'user_id');
$table->unique(['report_duty_id', 'source_type', 'original_id']); // защита от дублей
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('report_duty_patients');
}
};

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.
*/
public function up(): void
{
Schema::create('report_duty_migration_patients', function (Blueprint $table) {
$table->id();
$table->foreignIdFor( \App\Models\ReportDutyPatient::class, 'medical_history_id');
$table->dateTime('ingoing_date')->nullable();
$table->dateTime('out_date')->nullable();
$table->integer('diagnosis_id')->nullable();
$table->string('diagnosis_code')->nullable();
$table->string('diagnosis_name')->nullable();
$table->integer('interrupted_event_id')->nullable();
$table->integer('stationar_branch_id')->nullable();
$table->integer('department_id')->nullable();
$table->integer('visit_result_id')->nullable();
$table->integer('stat_cure_result_id')->nullable();
$table->foreignIdFor(\App\Models\User::class, 'user_id')->nullable();
$table->integer('mis_user_id')->nullable();
$table->text('comment')->nullable();
$table->timestamps();
$table->unique(['medical_history_id', 'ingoing_date'], 'uniq_rdmp_medical_history_id_and_ingoing_date');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('report_duty_migration_patients');
}
};