radfusion/database/seeders/OrganizationSeeder.php
2025-01-23 15:06:27 +06:00

139 lines
4.5 KiB
PHP

<?php
namespace Database\Seeders;
use App\Domain\Rule\MatchCondition;
use App\Domain\Rule\MatchMode;
use App\Models\Department;
use App\Models\DicomRoutingRule;
use App\Models\DicomRuleCondition;
use App\Models\DicomServer;
use App\Models\Organization;
use App\Services\StudyRouter\RawDicomTags;
use Illuminate\Database\Seeder;
class OrganizationSeeder extends Seeder
{
public function run(): void
{
Organization::create([
'name' => 'CATCH-ALL',
'is_active' => true,
]);
$chev = Organization::create([
'name' => 'Chevron',
'is_active' => true,
]);
$cmch = Organization::create([
'name' => 'CMCH',
'is_active' => true,
]);
$dummy = Organization::create([
'name' => 'Dummy Site',
'is_active' => false,
]);
$dept_chev_xr = Department::create(
[
'is_active' => true,
'name' => 'Chevron XR',
'organization_id' => $chev->id,
]
);
$chev_dep_ct_mr = Department::create(
[
'is_active' => true,
'name' => 'Chevron CT/MR',
'organization_id' => $chev->id,
]
);
$dept_cmch_mr = Department::create(
[
'is_active' => false,
'name' => 'CMCH MR',
'organization_id' => $cmch->id,
]
);
$rul_chev_mr_ct = DicomRoutingRule::create(
[
'is_active' => true,
'name' => 'Chevron MR/CT',
'organization_id' => $chev->id,
'department_id' => $chev_dep_ct_mr->id,
'match_condition' => MatchCondition::ALL->value,
]
);
$rul_chev_xr = DicomRoutingRule::create(
[
'is_active' => true,
'name' => 'Chevron X-ray',
'organization_id' => $chev->id,
'department_id' => $dept_chev_xr->id,
'match_condition' => MatchCondition::ALL->value,
'priority' => 10,
]
);
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(
[
'is_active' => true,
'server_name' => 'Orthanc Main',
'host' => 'pacs.mylabctg.com',
'port' => 8042,
'rest_api_endpoint' => 'http://pacs.mylabctg.com:8042/',
'wado_path' => 'dicom-web',
'ae_title' => 'RADFUSION',
'stone_viewer_path' => 'stone-webviewer/index.html',
'ohif_viewer_path' => 'ohif/viewer',
]
);
DicomServer::create(
[
'is_active' => false,
'server_name' => 'Orthanc XR',
'host' => 'pacs.mylabctg.com',
'port' => 8043,
'rest_api_endpoint' => 'http://pacs.mylabctg.com:8042/',
'ae_title' => 'RADFUSION',
'wado_path' => 'dicom-web',
'stone_viewer_path' => 'stone-webviewer/index.html',
'ohif_viewer_path' => 'ohif/viewer',
'organization_id' => $chev->id,
'department_id' => $dept_chev_xr->id,
]
);
}
}