first commit
Some checks failed
tests / ci (8.5) (push) Has been cancelled
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled

This commit is contained in:
brusnitsyn
2026-04-03 17:20:05 +09:00
commit 3edc8e667e
358 changed files with 39258 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
<?php
use App\Models\Department;
use App\Models\HospitalUnit;
use App\Models\Profile;
use Database\Seeders\DepartmentSeeder;
use Database\Seeders\HospitalUnitSeeder;
use Database\Seeders\ProfileSeeder;
test('finance profiles and hospital units are seeded from configured structure', function () {
$this->seed([
ProfileSeeder::class,
HospitalUnitSeeder::class,
]);
expect(Profile::query()->orderBy('sort_order')->pluck('name')->all())->toBe([
'Терапевтический',
'Хирургический',
'ОПЦ',
'РСЦ',
'Реанимации',
'Прочие',
]);
$unit = HospitalUnit::query()
->where('name', 'Рентгенологическое отделение')
->first();
expect($unit)->not->toBeNull();
expect($unit?->profile?->name)->toBe('Прочие');
expect($unit?->is_reporting_unit)->toBeTrue();
expect($unit?->report_input_type)->toBe('sectioned_department_metrics');
});
test('non-reporting finance rows remain in the structure but are not marked as reporting units', function () {
$this->seed([
ProfileSeeder::class,
HospitalUnitSeeder::class,
]);
$unit = HospitalUnit::query()
->where('name', 'Сотрудники')
->first();
expect($unit)->not->toBeNull();
expect($unit?->profile?->name)->toBe('Прочие');
expect($unit?->is_reporting_unit)->toBeFalse();
expect($unit?->report_input_type)->toBeNull();
});
test('department abbreviations are mapped to finance hospital units where configured', function () {
$this->seed([
ProfileSeeder::class,
HospitalUnitSeeder::class,
DepartmentSeeder::class,
]);
$department = Department::query()
->where('name', 'Гематология')
->first();
expect($department)->not->toBeNull();
expect($department?->hospitalUnit?->name)->toBe('Гематологическое отделение');
$adultClinic = Department::query()
->where('name', 'П-ка взрослая')
->first();
expect($adultClinic)->not->toBeNull();
expect($adultClinic?->hospitalUnit?->name)->toBe('Областная консультативно-диагностическая поликлиника');
$intensiveCare = Department::query()
->where('name', 'РАО 1')
->first();
expect($intensiveCare)->not->toBeNull();
expect($intensiveCare?->hospitalUnit?->name)->toBe('Отделение анестезиологии-реанимации с палатами реанимации и интенсивной терапии');
$pathology = Department::query()
->where('name', 'ПАО')
->first();
expect($pathology)->not->toBeNull();
expect($pathology?->hospitalUnit?->name)->toBe('Патологоанатомическое отделение');
});