This commit is contained in:
Masroor Ehsan 2025-01-27 18:34:03 +06:00
parent 9d13f0570c
commit 8648d1ae1e

View File

@ -2,14 +2,10 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Domain\Rule\MatchCondition;
use App\Domain\Rule\MatchMode;
use App\Models\Department; use App\Models\Department;
use App\Models\DicomRoutingRule; use App\Models\DicomRoutingRule;
use App\Models\DicomRuleCondition;
use App\Models\DicomServer; use App\Models\DicomServer;
use App\Models\Organization; use App\Models\Organization;
use App\Services\StudyRouter\RawDicomTags;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
class OrganizationSeeder extends Seeder class OrganizationSeeder extends Seeder
@ -61,7 +57,7 @@ public function run(): void
'name' => 'Chevron MR/CT', 'name' => 'Chevron MR/CT',
'organization_id' => $chev->id, 'organization_id' => $chev->id,
'department_id' => $chev_dep_ct_mr->id, 'department_id' => $chev_dep_ct_mr->id,
'match_condition' => MatchCondition::ALL->value, 'condition' => 'study.institution_name starts with "chevron" and not (study.modality in ["CR", "DX", "MG"])',
] ]
); );
@ -71,41 +67,11 @@ public function run(): void
'name' => 'Chevron X-ray', 'name' => 'Chevron X-ray',
'organization_id' => $chev->id, 'organization_id' => $chev->id,
'department_id' => $dept_chev_xr->id, 'department_id' => $dept_chev_xr->id,
'match_condition' => MatchCondition::ALL->value, 'condition' => 'study.institution_name starts with "chevron" and study.modality in ["CR", "DX", "MG"]',
'priority' => 10, 'priority' => 99,
] ]
); );
DicomRuleCondition::create([
'dicom_tag' => RawDicomTags::InstitutionName->value,
'search_pattern' => 'chevron',
'dicom_routing_rule_id' => $rul_chev_mr_ct->id,
'match_mode' => MatchMode::Contains->value,
'case_sensitive' => false,
]);
DicomRuleCondition::create([
'dicom_tag' => RawDicomTags::Modality->value,
'search_pattern' => 'MR,CT',
'dicom_routing_rule_id' => $rul_chev_mr_ct->id,
'match_mode' => MatchMode::InList->value,
'case_sensitive' => true,
]);
DicomRuleCondition::create([
'dicom_tag' => RawDicomTags::InstitutionName->value,
'search_pattern' => 'chevron',
'dicom_routing_rule_id' => $rul_chev_xr->id,
'match_mode' => MatchMode::Contains->value,
'case_sensitive' => false,
]);
DicomRuleCondition::create([
'dicom_tag' => RawDicomTags::Modality->value,
'search_pattern' => 'CR,DX,MG',
'dicom_routing_rule_id' => $rul_chev_xr->id,
'match_mode' => MatchMode::InList->value,
'case_sensitive' => true,
]);
DicomServer::create( DicomServer::create(
[ [
'is_active' => true, 'is_active' => true,