This commit is contained in:
Masroor Ehsan 2024-12-30 22:45:26 +06:00
parent 7f770512cd
commit 414d66e5d7
6 changed files with 21 additions and 5 deletions

View File

@ -9,5 +9,6 @@ enum UserRole: int
case ReferringPhysician = 2;
case Technician = 3;
case Radiologist = 4;
case Associate = 5;
case Admin = 99;
}

View File

@ -11,7 +11,7 @@ class Study extends BaseModel
{
protected $casts = [
'is_locked' => 'boolean',
'is_active' => 'boolean',
'is_archived' => 'boolean',
'study_status' => StudyLevelStatus::class,
'report_status' => ReportStatus::class,
];
@ -35,4 +35,9 @@ public function reports(): HasMany
{
return $this->hasMany(StudyReport::class);
}
public function shares(): HasMany
{
return $this->hasMany(SharedStudy::class);
}
}

View File

@ -182,15 +182,18 @@ private function updateStudy(int $row_id, mixed $study): void
{
$payload = $this->prepareData($study);
unset($payload['study']['orthanc_uid']);
$payload['study']['updated_at'] = now();
DB::table('studies')->where('id', $row_id)->update($payload['study']);
if (! empty($payload['details'])) {
$payload['details']['updated_at'] = now();
DB::table('study_details')->where('study_id', $row_id)->update($payload['details']);
}
foreach ($payload['series'] as $series) {
$series_guid = $series['orthanc_uid'];
unset($series['orthanc_uid']);
$series['updated_at'] = now();
DB::table('study_series')->where('orthanc_uid', $series_guid)->update($series);
}
}
@ -204,6 +207,7 @@ private function insertStudy(mixed $study): void
foreach ($payload['series'] as $series) {
$series['study_id'] = $row->id;
$series['created_at'] = now();
DB::table('study_series')->insert($series);
}
}

View File

@ -15,10 +15,13 @@ public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('is_active')->default(true);
$table->string('first_name');
$table->string('last_name')->nullable();
$table->string('display_name');
$table->string('username')->unique();
$table->string('email')->nullable()->index();
$table->string('phone')->nullable()->index();
$table->string('email')->nullable()->index();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();

View File

@ -15,8 +15,8 @@ public function up(): void
Schema::create('studies', function (Blueprint $table) {
$table->id();
$table->string('orthanc_uid')->unique();
$table->boolean('is_active')->default(true);
$table->boolean('is_locked')->default(true);
$table->boolean('is_archived')->default(false);
$table->boolean('is_locked')->default(false);
$table->unsignedTinyInteger('study_priority')->default(0);
$table->string('patient_id')->nullable();
$table->string('patient_uid')->nullable();

View File

@ -16,6 +16,9 @@ public function up(): void
$table->foreignId('sender_id')->nullable()->constrained('users')->nullOnDelete();
$table->unsignedTinyInteger('access_flags')->default(StudyAccessFlags::Forbidden->value);
$table->string('access_password')->nullable();
$table->string('patient_name')->nullable();
$table->string('study_description')->nullable();
$table->dateTime('study_date')->nullable();
$table->dateTime('expires_at')->nullable();
$table->string('remarks')->nullable();
$table->timestamps();