Обновлен стартовый экран
Переписаны запросы для статистики, отчетов Добавлена интеграция отчета сестры
This commit is contained in:
@@ -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('report_duty_migration_patients', function (Blueprint $table) {
|
||||
$table->bigInteger('original_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('report_duty_migration_patients', function (Blueprint $table) {
|
||||
$table->dropColumn('original_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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('duty_report_metric_results', function (Blueprint $table) {
|
||||
$table->id('metrika_result_id')
|
||||
->comment('Идентификатор результата метрики');
|
||||
$table->foreignIdFor(\App\Models\MetrikaItem::class, 'rf_metrika_item_id')
|
||||
->comment('Идентификатор метрики')
|
||||
->constrained();
|
||||
$table->foreignIdFor(\App\Models\ReportDuty::class, 'rf_report_id')
|
||||
->comment('Идентификатор отчета')
|
||||
->constrained();
|
||||
$table->text('value');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('duty_report_metric_results');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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_reanimations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->bigInteger('original_id')->unique();
|
||||
$table->bigInteger('migration_patient_id');
|
||||
$table->bigInteger('medical_history_id');
|
||||
$table->dateTime('in_date')->unique();
|
||||
$table->dateTime('out_date')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->text('comment')->nullable();
|
||||
$table->bigInteger('stationar_branch_id');
|
||||
$table->bigInteger('migration_stationar_branch_id');
|
||||
$table->bigInteger('migration_department_id');
|
||||
$table->bigInteger('doctor_id');
|
||||
$table->bigInteger('user_id')->nullable();
|
||||
$table->bigInteger('mis_user_id')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['migration_patient_id', 'in_date'], 'uniq_rdr_migration_patient_id_and_in_date');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('report_duty_reanimations');
|
||||
}
|
||||
};
|
||||
@@ -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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('observable_medical_histories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('source_type');
|
||||
$table->bigInteger('original_id');
|
||||
|
||||
$table->dateTime('observable_in');
|
||||
$table->dateTime('observable_out')->nullable();
|
||||
$table->text('observable_reason')->nullable();
|
||||
$table->text('out_reason')->nullable();
|
||||
|
||||
$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(['source_type', 'original_id']); // защита от дублей
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('observable_medical_histories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('duty_unwanted_events', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(\App\Models\ReportDuty::class, 'report_duty_id');
|
||||
$table->string('title');
|
||||
$table->text('comment');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('duty_unwanted_events');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// Обновляем слаги существующих ролей под единую схему
|
||||
DB::table('roles')->where('slug', 'head_of_department')->update([
|
||||
'slug' => 'zav',
|
||||
'name' => 'Заведующий отделением',
|
||||
]);
|
||||
|
||||
DB::table('roles')->where('slug', 'doctor')->update([
|
||||
'slug' => 'dej',
|
||||
'name' => 'Врач-дежурный',
|
||||
]);
|
||||
|
||||
// Добавляем новые роли (если ещё не существуют)
|
||||
$existing = DB::table('roles')->pluck('slug')->toArray();
|
||||
|
||||
$newRoles = [
|
||||
['name' => 'Главный врач', 'slug' => 'gv', 'is_active' => true],
|
||||
['name' => 'Зам. главного врача', 'slug' => 'zam', 'is_active' => true],
|
||||
['name' => 'Старшая мед. сестра', 'slug' => 'nurse', 'is_active' => true],
|
||||
];
|
||||
|
||||
foreach ($newRoles as $role) {
|
||||
if (! in_array($role['slug'], $existing)) {
|
||||
DB::table('roles')->insert($role);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('roles')->where('slug', 'zav')->update(['slug' => 'head_of_department', 'name' => 'Заведующий отделением']);
|
||||
DB::table('roles')->where('slug', 'dej')->update(['slug' => 'doctor', 'name' => 'Врач']);
|
||||
DB::table('roles')->whereIn('slug', ['gv', 'zam', 'nurse'])->delete();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user