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

@ -32,7 +32,7 @@ public function create(array $input): User
'name' => $input['name'],
'username' => $input['username'],
'email' => $input['email'],
//'phone' => $input['phone'],
// 'phone' => $input['phone'],
'phone' => phone($input['phone'])->formatE164(),
'password' => Hash::make($input['password']),
]);

View File

@ -26,7 +26,7 @@ public function details()
->on($study)
->log();
//return view('staff.studies.details', compact('study'));
// return view('staff.studies.details', compact('study'));
return response()->json($study);
}
}

View File

@ -12,4 +12,12 @@ public function study(): BelongsTo
{
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

@ -75,8 +75,8 @@
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, //default 'role_id',
'permission_pivot_key' => null, //default 'permission_id',
'role_pivot_key' => null, // default 'role_id',
'permission_pivot_key' => null, // default 'permission_id',
/*
* Change this if you want to name the related model primary key other than

View File

@ -30,10 +30,12 @@ class UserFactory extends Factory
public function definition(): array
{
return [
'name' => fake()->name(),
'first_name' => fake()->firstName(),
'last_name' => fake()->lastName(),
'display_name' => fake()->name(),
'username' => fake()->unique()->userName(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'email_verified_at' => fake()->dateTime(),
'last_seen_at' => fake()->dateTime(),
'phone' => fake()->phoneNumber(),
'user_role' => static::$role ??= UserRole::Guest->value,
@ -44,6 +46,7 @@ public function definition(): array
'profile_photo_path' => null,
'current_team_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->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->unsignedTinyInteger('user_role')->default(UserRole::Guest->value);
$table->foreignId('current_team_id')->nullable();
$table->string('profile_photo_path')->nullable();
$table->foreignIdFor(Institute::class)->nullable()->index();
$table->string('timezone')->default('Asia/Dhaka');
$table->timestamp('last_seen_at')->nullable();
$table->rememberToken();
$table->timestamps();
});

View File

@ -25,7 +25,7 @@ public function up(): void
}
Schema::create($tableNames['permissions'], function (Blueprint $table) {
//$table->engine('InnoDB');
// $table->engine('InnoDB');
$table->bigIncrements('id'); // permission id
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
@ -35,7 +35,7 @@ public function up(): void
});
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
//$table->engine('InnoDB');
// $table->engine('InnoDB');
$table->bigIncrements('id'); // role id
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();

View File

@ -11,16 +11,13 @@ public function up(): void
Schema::create('study_details', function (Blueprint $table) {
$table->id();
$table->foreignId('study_id')->unique()->constrained('studies')->cascadeOnDelete();
//$table->foreignId('user_id')->constrained('users');
// $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->string('station_name')->nullable();
$table->string('operators_name')->nullable();
$table->string('manufacturer')->nullable();
$table->string('manufacturer_model_name')->nullable();
$table->string('software_versions')->nullable();
$table->json('properties')->nullable();
$table->json('series')->nullable();
$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()->create([
'name' => 'Administrator',
'first_name' => 'Administrator',
'display_name' => 'Administrator',
'username' => 'admin',
'email' => 'test@example.com',
'email_verified_at' => now(),
'phone' => '+8801733938582',
'user_role' => UserRole::Admin->value,
]);