wip
This commit is contained in:
parent
a1b6856fbc
commit
8101904029
24
app/Http/Requests/StudySeriesRequest.php
Normal file
24
app/Http/Requests/StudySeriesRequest.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StudySeriesRequest extends FormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'study_id' => ['required', 'exists:studies'],
|
||||
'body_part_examined' => ['nullable'],
|
||||
'series_description' => ['nullable'],
|
||||
'series_date' => ['nullable', 'date'],
|
||||
'series_number' => ['required'],
|
||||
];
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
26
app/Http/Resources/StudySeriesResource.php
Normal file
26
app/Http/Resources/StudySeriesResource.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\StudySeries;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin StudySeries */
|
||||
class StudySeriesResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'body_part_examined' => $this->body_part_examined,
|
||||
'series_description' => $this->series_description,
|
||||
'series_date' => $this->series_date,
|
||||
'series_number' => $this->series_number,
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
|
||||
'study_id' => $this->study_id,
|
||||
];
|
||||
}
|
||||
}
|
21
app/Models/StudySeries.php
Normal file
21
app/Models/StudySeries.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ public function definition(): array
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'phone' => fake()->phoneNumber(),
|
||||
'role' => static::$role ??= UserRole::Technician->value,
|
||||
'user_role' => static::$role ??= UserRole::Guest->value,
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'two_factor_secret' => null,
|
||||
'two_factor_recovery_codes' => null,
|
||||
|
@ -26,7 +26,6 @@ public function up(): void
|
||||
$table->foreignId('current_team_id')->nullable();
|
||||
$table->string('profile_photo_path')->nullable();
|
||||
$table->foreignIdFor(Institute::class)->nullable()->index();
|
||||
$table->string('avatar')->nullable();
|
||||
$table->string('timezone')->default('Asia/Dhaka');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
@ -17,7 +17,7 @@ public function run(): void
|
||||
'name' => 'Administrator',
|
||||
'username' => 'admin',
|
||||
'email' => 'test@example.com',
|
||||
'role' => UserRole::Admin->value,
|
||||
'user_role' => UserRole::Admin->value,
|
||||
]);
|
||||
|
||||
$chevron = Institute::where('name', 'Chevron')->first();
|
||||
@ -25,12 +25,18 @@ public function run(): void
|
||||
|
||||
User::factory(2)->create([
|
||||
'institute_id' => $chevron->id,
|
||||
'role' => UserRole::Technician->value,
|
||||
'user_role' => UserRole::Technician->value,
|
||||
]);
|
||||
|
||||
User::factory(2)->create([
|
||||
'institute_id' => $srini->id,
|
||||
'role' => UserRole::Technician->value,
|
||||
'user_role' => UserRole::Technician->value,
|
||||
]);
|
||||
|
||||
User::factory(2)->create([
|
||||
'user_role' => UserRole::Radiologist->value,
|
||||
]);
|
||||
|
||||
User::factory(4)->create();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user