wip
This commit is contained in:
parent
9777669f84
commit
8c580f55d6
@ -7,7 +7,7 @@
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
final class InstituteMapper
|
||||
final class DicomStudyMapper
|
||||
{
|
||||
private static array $patterns = [];
|
||||
|
||||
@ -21,7 +21,9 @@ public static function map(?string $input): array
|
||||
if (empty(self::$patterns)) {
|
||||
self::$patterns = Cache::remember('institute_names',
|
||||
now()->addMinutes(15),
|
||||
fn () => DB::table('institute_names')->orderBy('priority')->get()->toArray()
|
||||
fn () => DB::table('dicom_mapping_rules')
|
||||
->orderByDesc('sort_order')
|
||||
->get()->toArray()
|
||||
);
|
||||
self::$catchAll = DB::table('institutes')->first('id')->id;
|
||||
}
|
@ -5,8 +5,8 @@
|
||||
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\InstituteMapper;
|
||||
use App\Services\Pacs\OrthancRestClient;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
@ -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 = InstituteMapper::map($inst_name);
|
||||
$inst_id = DicomStudyMapper::map($inst_name);
|
||||
|
||||
$patient_name = data_get($orthanc_src, 'PatientMainDicomTags.PatientName');
|
||||
|
||||
|
@ -11,19 +11,22 @@
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('institute_names', function (Blueprint $table) {
|
||||
Schema::create('dicom_mapping_rules', static function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Institute::class)->constrained()->cascadeOnDelete();
|
||||
$table->foreignIdFor(Facility::class)->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->string('name')->unique();
|
||||
$table->string('dicom_tag');
|
||||
$table->string('search_pattern');
|
||||
$table->unsignedTinyInteger('match_mode')->default(StringMatchMode::Exact->value);
|
||||
$table->unsignedTinyInteger('priority')->default(0);
|
||||
$table->unsignedTinyInteger('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['institute_id', 'dicom_tag']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('institute_names');
|
||||
Schema::dropIfExists('dicom_mapping_rules');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user