fixes
This commit is contained in:
parent
fd786881e9
commit
35583b0895
@ -157,7 +157,7 @@ public function transformData(mixed $orthanc_src): array
|
|||||||
'dicom_server_id' => $this->dicomServer->id,
|
'dicom_server_id' => $this->dicomServer->id,
|
||||||
'orthanc_uuid' => strtolower($orthanc_src['ID']),
|
'orthanc_uuid' => strtolower($orthanc_src['ID']),
|
||||||
'institution_name' => $inst_name,
|
'institution_name' => $inst_name,
|
||||||
'organization_id' => $routing['institute_id'],
|
'organization_id' => $routing['organization_id'],
|
||||||
'department_id' => $routing['department_id'],
|
'department_id' => $routing['department_id'],
|
||||||
|
|
||||||
'patient_uuid' => strtolower($orthanc_src['ParentPatient']),
|
'patient_uuid' => strtolower($orthanc_src['ParentPatient']),
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
final class DicomStudyRouter
|
final class DicomStudyRouter
|
||||||
{
|
{
|
||||||
private static ?Collection $rules;
|
private static ?Collection $rules = null;
|
||||||
private static ?Collection $activeRads;
|
private static ?Collection $activeRads = null;
|
||||||
private static int $catchAll = -1;
|
private static int $catchAll = -1;
|
||||||
|
|
||||||
const int CACHE_TTL = 15;
|
const int CACHE_TTL = 15;
|
||||||
@ -32,8 +32,7 @@ public static function matchStudy(array $dicomHeaders): array
|
|||||||
|
|
||||||
foreach (self::$rules as $rule) {
|
foreach (self::$rules as $rule) {
|
||||||
$conditions = $rule->conditions()->orderByDesc('priority')->get();
|
$conditions = $rule->conditions()->orderByDesc('priority')->get();
|
||||||
$matchCondition = MatchCondition::from($rule->match_condition);
|
$matches = $rule->match_condition === MatchCondition::ALL
|
||||||
$matches = $matchCondition === MatchCondition::ALL
|
|
||||||
? $conditions->every(fn ($condition) => self::matchCondition($condition, $dicomHeaders))
|
? $conditions->every(fn ($condition) => self::matchCondition($condition, $dicomHeaders))
|
||||||
: $conditions->contains(fn ($condition) => self::matchCondition($condition, $dicomHeaders));
|
: $conditions->contains(fn ($condition) => self::matchCondition($condition, $dicomHeaders));
|
||||||
|
|
||||||
@ -93,21 +92,20 @@ private static function matchCondition(DicomRuleCondition $condition, array $dic
|
|||||||
$dicomTag = $condition->dicom_tag;
|
$dicomTag = $condition->dicom_tag;
|
||||||
$dicomValue = $dicomHeaders[$dicomTag] ?? '';
|
$dicomValue = $dicomHeaders[$dicomTag] ?? '';
|
||||||
$searchPattern = $condition->search_pattern;
|
$searchPattern = $condition->search_pattern;
|
||||||
$matchMode = MatchMode::from($condition->match_mode);
|
|
||||||
|
|
||||||
if (! $condition->case_sensitive) {
|
if (! $condition->case_sensitive) {
|
||||||
$dicomValue = strtolower($dicomValue);
|
$dicomValue = strtolower($dicomValue);
|
||||||
if ($matchMode != MatchMode::Regex) {
|
if ($condition->match_mode != MatchMode::Regex) {
|
||||||
$searchPattern = strtolower($searchPattern);
|
$searchPattern = strtolower($searchPattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContentMatcher::match($dicomValue, $searchPattern, $matchMode);
|
return ContentMatcher::match($dicomValue, $searchPattern, $condition->match_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getRadiologists(DicomRoutingRule $rule): array
|
private static function getRadiologists(DicomRoutingRule $rule): array
|
||||||
{
|
{
|
||||||
if (!is_null($rule->assignment_panel_id)) {
|
if (! is_null($rule->assignment_panel_id)) {
|
||||||
$panel = AssignmentPanel::active()
|
$panel = AssignmentPanel::active()
|
||||||
->with('radiologists:id')
|
->with('radiologists:id')
|
||||||
->find($rule->assignment_panel_id);
|
->find($rule->assignment_panel_id);
|
||||||
@ -118,9 +116,9 @@ private static function getRadiologists(DicomRoutingRule $rule): array
|
|||||||
return array_intersect($rads, self::$activeRads->toArray());
|
return array_intersect($rads, self::$activeRads->toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!is_null($rule->radiologist_id)) {
|
} elseif (! is_null($rule->user_id)) {
|
||||||
if (self::$activeRads->contains($rule->radiologist_id)) {
|
if (self::$activeRads->contains($rule->user_id)) {
|
||||||
return [$rule->radiologist_id];
|
return [$rule->user_id];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user