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,
|
||||
'orthanc_uuid' => strtolower($orthanc_src['ID']),
|
||||
'institution_name' => $inst_name,
|
||||
'organization_id' => $routing['institute_id'],
|
||||
'organization_id' => $routing['organization_id'],
|
||||
'department_id' => $routing['department_id'],
|
||||
|
||||
'patient_uuid' => strtolower($orthanc_src['ParentPatient']),
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
final class DicomStudyRouter
|
||||
{
|
||||
private static ?Collection $rules;
|
||||
private static ?Collection $activeRads;
|
||||
private static ?Collection $rules = null;
|
||||
private static ?Collection $activeRads = null;
|
||||
private static int $catchAll = -1;
|
||||
|
||||
const int CACHE_TTL = 15;
|
||||
@ -32,8 +32,7 @@ public static function matchStudy(array $dicomHeaders): array
|
||||
|
||||
foreach (self::$rules as $rule) {
|
||||
$conditions = $rule->conditions()->orderByDesc('priority')->get();
|
||||
$matchCondition = MatchCondition::from($rule->match_condition);
|
||||
$matches = $matchCondition === MatchCondition::ALL
|
||||
$matches = $rule->match_condition === MatchCondition::ALL
|
||||
? $conditions->every(fn ($condition) => self::matchCondition($condition, $dicomHeaders))
|
||||
: $conditions->contains(fn ($condition) => self::matchCondition($condition, $dicomHeaders));
|
||||
|
||||
@ -93,16 +92,15 @@ private static function matchCondition(DicomRuleCondition $condition, array $dic
|
||||
$dicomTag = $condition->dicom_tag;
|
||||
$dicomValue = $dicomHeaders[$dicomTag] ?? '';
|
||||
$searchPattern = $condition->search_pattern;
|
||||
$matchMode = MatchMode::from($condition->match_mode);
|
||||
|
||||
if (! $condition->case_sensitive) {
|
||||
$dicomValue = strtolower($dicomValue);
|
||||
if ($matchMode != MatchMode::Regex) {
|
||||
if ($condition->match_mode != MatchMode::Regex) {
|
||||
$searchPattern = strtolower($searchPattern);
|
||||
}
|
||||
}
|
||||
|
||||
return ContentMatcher::match($dicomValue, $searchPattern, $matchMode);
|
||||
return ContentMatcher::match($dicomValue, $searchPattern, $condition->match_mode);
|
||||
}
|
||||
|
||||
private static function getRadiologists(DicomRoutingRule $rule): array
|
||||
@ -118,9 +116,9 @@ private static function getRadiologists(DicomRoutingRule $rule): array
|
||||
return array_intersect($rads, self::$activeRads->toArray());
|
||||
}
|
||||
}
|
||||
} elseif (!is_null($rule->radiologist_id)) {
|
||||
if (self::$activeRads->contains($rule->radiologist_id)) {
|
||||
return [$rule->radiologist_id];
|
||||
} elseif (! is_null($rule->user_id)) {
|
||||
if (self::$activeRads->contains($rule->user_id)) {
|
||||
return [$rule->user_id];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user