matching
This commit is contained in:
parent
7e150c972b
commit
fcb0dc17fd
@ -7,8 +7,10 @@
|
|||||||
use App\Models\DicomRoutingRule;
|
use App\Models\DicomRoutingRule;
|
||||||
use App\Models\Organization;
|
use App\Models\Organization;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||||
|
|
||||||
final class DicomStudyRouter
|
final class DicomStudyRouter
|
||||||
@ -27,9 +29,20 @@ public static function matchStudy(array $dicomHeaders): array
|
|||||||
return self::fallbackRouting();
|
return self::fallbackRouting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$study = json_decode(json_encode($dicomHeaders)); // convert to object
|
||||||
$expression = new ExpressionLanguage;
|
$expression = new ExpressionLanguage;
|
||||||
foreach (self::$rules as $rule) {
|
foreach (self::$rules as $rule) {
|
||||||
$matches = (bool) $expression->evaluate($rule->condition, ['study' => $dicomHeaders]);
|
try {
|
||||||
|
$matches = (bool) $expression->evaluate($rule->condition, ['study' => $study]);
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
Log::error('Error evaluating expression', [
|
||||||
|
'rule_id' => $rule->id,
|
||||||
|
'condition' => $rule->condition,
|
||||||
|
'error' => $exc->getMessage(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return self::fallbackRouting();
|
||||||
|
}
|
||||||
|
|
||||||
if ($matches) {
|
if ($matches) {
|
||||||
return [
|
return [
|
||||||
|
Loading…
Reference in New Issue
Block a user