This commit is contained in:
Dr Masroor Ehsan 2024-12-31 21:26:25 +06:00
parent 389212312d
commit 7ed6a0b0c6
6 changed files with 17 additions and 16 deletions

View File

@ -18,7 +18,7 @@ public static function dateToCarbon(?string $datePart, string $timezone = 'UTC')
public static function dateTimeToCarbon(?string $datePart, ?string $timePart, string $timezone = 'UTC'): ?Carbon public static function dateTimeToCarbon(?string $datePart, ?string $timePart, string $timezone = 'UTC'): ?Carbon
{ {
if ($datePart === null || $timePart === null) { if (blank($datePart) || blank($timePart)) {
return null; return null;
} }

View File

@ -13,7 +13,7 @@ final class InstituteMapper
private static int $catchAll = -1; private static int $catchAll = -1;
public static function map(string $input): int public static function map(?string $input): int
{ {
if (empty(self::$patterns)) { if (empty(self::$patterns)) {
self::$patterns = Cache::remember('institute_names', now()->addDay(), function () { self::$patterns = Cache::remember('institute_names', now()->addDay(), function () {
@ -22,11 +22,13 @@ public static function map(string $input): int
self::$catchAll = DB::table('institutes')->first('id')->id; self::$catchAll = DB::table('institutes')->first('id')->id;
} }
$input = strtolower($input); if (! blank($input)) {
$input = strtolower($input);
foreach (self::$patterns as $pattern) { foreach (self::$patterns as $pattern) {
if (InputMatcher::match($input, $pattern->name, NameMatchModes::from($pattern->match_mode))) { if (InputMatcher::match($input, $pattern->name, NameMatchModes::from($pattern->match_mode))) {
return $pattern->institute_id; return $pattern->institute_id;
}
} }
} }

View File

@ -119,7 +119,7 @@ public function transformData(mixed $orthanc_src): array
'study_modality' => data_get($orthanc_src, 'RequestedTags.Modality'), 'study_modality' => data_get($orthanc_src, 'RequestedTags.Modality'),
'body_part_examined' => data_get($orthanc_src, 'RequestedTags.BodyPartExamined'), 'body_part_examined' => data_get($orthanc_src, 'RequestedTags.BodyPartExamined'),
'study_date' => DicomUtils::dateTimeToCarbon($orthanc_src['MainDicomTags']['StudyDate'], $orthanc_src['MainDicomTags']['StudyTime']), 'study_date' => DicomUtils::dateTimeToCarbon($orthanc_src['MainDicomTags']['StudyDate'], $orthanc_src['MainDicomTags']['StudyTime']) ?? now('UTC'),
'received_at' => Carbon::parse($orthanc_src['LastUpdate'], 'UTC'), 'received_at' => Carbon::parse($orthanc_src['LastUpdate'], 'UTC'),
'image_count' => data_get($orthanc_src, 'Statistics.CountInstances'), 'image_count' => data_get($orthanc_src, 'Statistics.CountInstances'),

View File

@ -34,12 +34,12 @@ public function up(): void
$table->string('referring_physician_name')->nullable(); $table->string('referring_physician_name')->nullable();
$table->string('study_modality', 4)->nullable(); $table->string('study_modality', 4)->nullable();
$table->dateTime('study_date'); $table->timestamp('study_date');
$table->timestamp('received_at');
$table->dateTime('received_at'); $table->timestamp('assigned_at')->nullable();
$table->dateTime('assigned_at')->nullable(); $table->timestamp('reported_at')->nullable();
$table->dateTime('reported_at')->nullable(); $table->timestamp('authorized_at')->nullable();
$table->dateTime('authorized_at')->nullable(); $table->timestamp('archived_at')->nullable();
$table->foreignIdFor(Institute::class)->constrained()->cascadeOnDelete(); $table->foreignIdFor(Institute::class)->constrained()->cascadeOnDelete();
$table->foreignIdFor(Facility::class)->nullable()->constrained()->cascadeOnDelete(); $table->foreignIdFor(Facility::class)->nullable()->constrained()->cascadeOnDelete();

View File

@ -19,8 +19,7 @@ public function up(): void
$table->string('orthanc_uuid')->nullable(); $table->string('orthanc_uuid')->nullable();
$table->text('url')->nullable(); $table->text('url')->nullable();
$table->text('notes')->nullable(); $table->text('notes')->nullable();
$table->timestamp('created_at');
$table->timestamps();
}); });
} }

View File

@ -9,7 +9,7 @@
public function up(): void public function up(): void
{ {
Schema::create(config('settings.table'), function (Blueprint $table) { Schema::create(config('settings.table'), function (Blueprint $table) {
$table->bigIncrements('id'); $table->id();
$table->string('key')->unique()->index(); $table->string('key')->unique()->index();
$table->longText('value')->nullable(); $table->longText('value')->nullable();
}); });