radfusion/database/seeders/DicomRoutingRuleSeeder.php
2025-02-01 13:44:10 +06:00

44 lines
1.5 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\Department;
use App\Models\DicomRoutingRule;
use App\Models\Organization;
use Illuminate\Database\Seeder;
class DicomRoutingRuleSeeder extends Seeder
{
public function run(): void
{
$chev = Organization::where('name', 'Chevron Panchlaish')->first();
$dept_chev_xr = Department::where('name', 'DR')->first();
$chev_dep_ct_mr = Department::where('name', 'Imaging')->first();
$dr_modalities = ['DR', 'CR', 'DX', 'MG', 'OT', 'RF', 'XA', 'XRF', 'DXA', 'DBT', 'OPT'];
$dr = collect($dr_modalities)->map(fn ($modality) => sprintf('"%s"', $modality))->implode(', ');
DicomRoutingRule::create(
[
'is_active' => true,
'name' => 'Chevron Panchlaish Imaging',
'organization_id' => $chev->id,
'department_id' => $chev_dep_ct_mr->id,
'condition' => sprintf('(study.institution_name ?? "" starts with "chevron") and (study.modality not in [%s])', $dr),
]
);
DicomRoutingRule::create(
[
'is_active' => true,
'name' => 'Chevron Panchlaish X-ray',
'organization_id' => $chev->id,
'department_id' => $dept_chev_xr->id,
'condition' => sprintf('(study.institution_name ?? "" starts with "chevron") and (study.modality in [%s])', $dr),
'priority' => 99,
]
);
}
}