compression support
This commit is contained in:
parent
ef82c77e0d
commit
33873729b6
19
app/Casts/Compressed.php
Normal file
19
app/Casts/Compressed.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Casts;
|
||||
|
||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Compressed implements CastsAttributes
|
||||
{
|
||||
public function get(Model $model, string $key, mixed $value, array $attributes): mixed
|
||||
{
|
||||
return gzinflate($value);
|
||||
}
|
||||
|
||||
public function set(Model $model, string $key, mixed $value, array $attributes): mixed
|
||||
{
|
||||
return gzdeflate($value);
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\Compressed;
|
||||
use App\Models\Traits\HashableId;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
@ -40,6 +41,10 @@ protected function casts(): array
|
||||
'properties' => 'array',
|
||||
'series' => 'array',
|
||||
'assignment_log' => 'array',
|
||||
'clinical_history' => Compressed::class,
|
||||
'surgical_history' => Compressed::class,
|
||||
'lab_results' => Compressed::class,
|
||||
'clinical_diagnosis' => Compressed::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\Compressed;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class StudyReport extends BaseModel
|
||||
{
|
||||
use HasTimestamps;
|
||||
|
||||
public function study(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Study::class);
|
||||
@ -15,4 +19,14 @@ public function radiologist(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'radiologist_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'content' => Compressed::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ public function up(): void
|
||||
|
||||
$table->foreignIdFor(Institute::class)->index()->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignIdFor(Facility::class)->index()->nullable()->constrained()->nullOnDelete();
|
||||
|
||||
$table->foreignIdFor(Study::class)->index()->constrained()->cascadeOnDelete();
|
||||
$table->foreignIdFor(User::class, 'radiologist_id')->index()->constrained()->cascadeOnDelete();
|
||||
|
||||
|
@ -13,10 +13,11 @@ public function up(): void
|
||||
$table->foreignId('study_id')->unique()->constrained('studies')->cascadeOnDelete();
|
||||
$table->string('orthanc_uuid')->unique();
|
||||
// $table->foreignId('user_id')->constrained('users');
|
||||
$table->text('clinical_history')->nullable();
|
||||
$table->text('surgical_history')->nullable();
|
||||
$table->text('lab_results')->nullable();
|
||||
$table->text('clinical_diagnosis')->nullable();
|
||||
$table->binary('clinical_history')->nullable();
|
||||
$table->binary('surgical_history')->nullable();
|
||||
$table->binary('lab_results')->nullable();
|
||||
$table->binary('clinical_diagnosis')->nullable();
|
||||
$table->jsonb('dicom_properties')->nullable();
|
||||
$table->jsonb('properties')->nullable();
|
||||
$table->jsonb('series')->nullable();
|
||||
$table->jsonb('assignment_log')->nullable();
|
||||
|
Loading…
Reference in New Issue
Block a user