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
{
if ($datePart === null || $timePart === null) {
if (blank($datePart) || blank($timePart)) {
return null;
}

View File

@ -13,7 +13,7 @@ final class InstituteMapper
private static int $catchAll = -1;
public static function map(string $input): int
public static function map(?string $input): int
{
if (empty(self::$patterns)) {
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;
}
$input = strtolower($input);
if (! blank($input)) {
$input = strtolower($input);
foreach (self::$patterns as $pattern) {
if (InputMatcher::match($input, $pattern->name, NameMatchModes::from($pattern->match_mode))) {
return $pattern->institute_id;
foreach (self::$patterns as $pattern) {
if (InputMatcher::match($input, $pattern->name, NameMatchModes::from($pattern->match_mode))) {
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'),
'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'),
'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('study_modality', 4)->nullable();
$table->dateTime('study_date');
$table->dateTime('received_at');
$table->dateTime('assigned_at')->nullable();
$table->dateTime('reported_at')->nullable();
$table->dateTime('authorized_at')->nullable();
$table->timestamp('study_date');
$table->timestamp('received_at');
$table->timestamp('assigned_at')->nullable();
$table->timestamp('reported_at')->nullable();
$table->timestamp('authorized_at')->nullable();
$table->timestamp('archived_at')->nullable();
$table->foreignIdFor(Institute::class)->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->text('url')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
$table->timestamp('created_at');
});
}

View File

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