study details/series -> JSON

This commit is contained in:
Dr Masroor Ehsan 2024-12-31 07:40:54 +06:00
parent 9288f1b71d
commit 3c7d43542b
11 changed files with 27 additions and 70 deletions

View File

@ -12,4 +12,12 @@ public function study(): BelongsTo
{ {
return $this->belongsTo(Study::class); return $this->belongsTo(Study::class);
} }
protected function casts()
{
return [
'properties' => 'array',
'series' => 'array',
];
}
} }

View File

@ -1,21 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class StudySeries extends Model
{
public function study(): BelongsTo
{
return $this->belongsTo(Study::class);
}
protected function casts(): array
{
return [
'series_date' => 'datetime',
];
}
}

View File

@ -30,10 +30,12 @@ class UserFactory extends Factory
public function definition(): array public function definition(): array
{ {
return [ return [
'name' => fake()->name(), 'first_name' => fake()->firstName(),
'last_name' => fake()->lastName(),
'display_name' => fake()->name(),
'username' => fake()->unique()->userName(), 'username' => fake()->unique()->userName(),
'email' => fake()->unique()->safeEmail(), 'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(), 'email_verified_at' => fake()->dateTime(),
'last_seen_at' => fake()->dateTime(), 'last_seen_at' => fake()->dateTime(),
'phone' => fake()->phoneNumber(), 'phone' => fake()->phoneNumber(),
'user_role' => static::$role ??= UserRole::Guest->value, 'user_role' => static::$role ??= UserRole::Guest->value,
@ -44,6 +46,7 @@ public function definition(): array
'profile_photo_path' => null, 'profile_photo_path' => null,
'current_team_id' => null, 'current_team_id' => null,
'institute_id' => null, 'institute_id' => null,
'is_active' => fake()->boolean(),
]; ];
} }

View File

@ -24,13 +24,13 @@ public function up(): void
$table->string('email')->nullable()->index(); $table->string('email')->nullable()->index();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');
$table->rememberToken();
$table->unsignedTinyInteger('user_role')->default(UserRole::Guest->value); $table->unsignedTinyInteger('user_role')->default(UserRole::Guest->value);
$table->foreignId('current_team_id')->nullable(); $table->foreignId('current_team_id')->nullable();
$table->string('profile_photo_path')->nullable(); $table->string('profile_photo_path')->nullable();
$table->foreignIdFor(Institute::class)->nullable()->index(); $table->foreignIdFor(Institute::class)->nullable()->index();
$table->string('timezone')->default('Asia/Dhaka'); $table->string('timezone')->default('Asia/Dhaka');
$table->timestamp('last_seen_at')->nullable(); $table->timestamp('last_seen_at')->nullable();
$table->rememberToken();
$table->timestamps(); $table->timestamps();
}); });

View File

@ -16,11 +16,8 @@ public function up(): void
$table->text('surgical_history')->nullable(); $table->text('surgical_history')->nullable();
$table->text('lab_results')->nullable(); $table->text('lab_results')->nullable();
$table->text('clinical_diagnosis')->nullable(); $table->text('clinical_diagnosis')->nullable();
$table->string('station_name')->nullable(); $table->json('properties')->nullable();
$table->string('operators_name')->nullable(); $table->json('series')->nullable();
$table->string('manufacturer')->nullable();
$table->string('manufacturer_model_name')->nullable();
$table->string('software_versions')->nullable();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('study_series', function (Blueprint $table) {
$table->id();
$table->foreignId('study_id')->constrained('studies')->cascadeOnDelete();
$table->string('orthanc_uid')->unique();
$table->dateTime('series_date');
$table->string('series_instance_uid')->nullable();
$table->string('body_part_examined')->nullable();
$table->string('series_description')->nullable();
$table->string('modality', 4)->nullable();
$table->string('series_number')->nullable();
$table->string('protocol_name')->nullable();
$table->string('sequence_name')->nullable();
$table->string('performed_procedure_step_description')->nullable();
$table->unsignedSmallInteger('num_instances')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('study_series');
}
};

View File

@ -14,9 +14,12 @@ public function run(): void
// User::factory(10)->create(); // User::factory(10)->create();
User::factory()->create([ User::factory()->create([
'name' => 'Administrator', 'first_name' => 'Administrator',
'display_name' => 'Administrator',
'username' => 'admin', 'username' => 'admin',
'email' => 'test@example.com', 'email' => 'test@example.com',
'email_verified_at' => now(),
'phone' => '+8801733938582',
'user_role' => UserRole::Admin->value, 'user_role' => UserRole::Admin->value,
]); ]);