wip
This commit is contained in:
parent
d204bfc900
commit
3b7c5c3a6f
@ -3,13 +3,13 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Domain\Rule\MatchCondition;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Models\Traits\Active;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class DicomRoutingRule extends BaseModel
|
||||
{
|
||||
use HasFactory;
|
||||
use Active;
|
||||
|
||||
public function conditions(): HasMany
|
||||
{
|
||||
|
@ -3,14 +3,11 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Domain\Rule\MatchMode;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class DicomRuleCondition extends BaseModel
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function routingRule(): BelongsTo
|
||||
public function rule(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DicomRoutingRule::class);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\Pacs;
|
||||
|
||||
use App\Services\StudyRouter\DicomTagIdentifiers;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
@ -5,9 +5,9 @@
|
||||
use App\Domain\Study\Priority;
|
||||
use App\Domain\Study\StudyLevelStatus;
|
||||
use App\Models\DicomServer;
|
||||
use App\Services\Pacs\DicomStudyMapper;
|
||||
use App\Services\Pacs\DicomUtils;
|
||||
use App\Services\Pacs\OrthancRestClient;
|
||||
use App\Services\StudyRouter\DicomStudyRouter;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Pipeline\Pipeline;
|
||||
@ -108,7 +108,7 @@ public function fetchStudyDetails(string $orthanc_uuid): ?array
|
||||
public function transformData(mixed $orthanc_src): array
|
||||
{
|
||||
$inst_name = data_get($orthanc_src, 'MainDicomTags.InstitutionName');
|
||||
$inst_id = DicomStudyMapper::map($inst_name);
|
||||
$inst_id = DicomStudyRouter::map($inst_name);
|
||||
|
||||
$patient_name = data_get($orthanc_src, 'PatientMainDicomTags.PatientName');
|
||||
|
||||
|
@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Pacs;
|
||||
namespace App\Services\StudyRouter;
|
||||
|
||||
use App\Domain\Rule\MatchMode;
|
||||
use App\Models\DicomRoutingRule;
|
||||
use App\Services\ContentMatcher;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
final class DicomStudyMapper
|
||||
final class DicomStudyRouter
|
||||
{
|
||||
private static array $rules = [];
|
||||
private static ?Collection $rules;
|
||||
|
||||
private static int $catchAll = -1;
|
||||
|
||||
@ -18,13 +20,10 @@ final class DicomStudyMapper
|
||||
*/
|
||||
public static function map(?string $input): array
|
||||
{
|
||||
if (empty(self::$rules)) {
|
||||
self::$rules = Cache::remember('institute_names',
|
||||
if (is_null(self::$rules)) {
|
||||
self::$rules = Cache::remember('dicom.routers',
|
||||
now()->addMinutes(15),
|
||||
fn () => DB::table('dicom_routing_rules')
|
||||
->orderByDesc('priority')
|
||||
->get()
|
||||
->toArray()
|
||||
fn () => DicomRoutingRule::active()->with('conditions')->get()
|
||||
);
|
||||
self::$catchAll = DB::table('institutes')
|
||||
->where('name', 'Catch-all')
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Pacs;
|
||||
namespace App\Services\StudyRouter;
|
||||
|
||||
enum DicomTagIdentifiers: string
|
||||
{
|
Loading…
Reference in New Issue
Block a user