This commit is contained in:
Dr Masroor Ehsan 2024-12-28 18:21:35 +06:00
parent 5c04b31ecd
commit 7bf6a94363
8 changed files with 55 additions and 10 deletions

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models\Enums;
enum StudyRequestStatus: int
{
case Pending = 0;
case Rejected = 1;
case Cancelled = 2;
case Completed = 3;
}

View File

@ -8,7 +8,7 @@ enum UserRole: int
case Admin = 1;
case Radiologist = 2;
case ReferringPhysician = 3;
case Technologist = 4;
case Technician = 4;
case Patient = 5;
case Other = 6;
}

View File

@ -0,0 +1,7 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class StudyDeleteRequest extends Model {}

View File

@ -22,11 +22,8 @@ public function getStudies(): array
$studies = json_decode($response->getBody()->getContents(), true);
$result = [];
foreach ($studies as $study) {
$study['LastUpdate'] = Carbon::parse($study['LastUpdate'], 'UTC')->tz(config('app.timezone'))->toDateTimeString();
$sdt = $study['MainDicomTags']['StudyDate'].' '.$study['MainDicomTags']['StudyTime'];
$study_date = Carbon::createFromFormat('Ymd His.u', $study['MainDicomTags']['StudyDate'].' '.$study['MainDicomTags']['StudyTime'], 'UTC');
$study['StudyDateTime'] = $study_date->tz(config('app.timezone'))->toDateTimeString();
$study['ReceiveDateTime'] = Carbon::parse($study['LastUpdate'], 'UTC');
$study['StudyDateTime'] = Carbon::createFromFormat('Ymd His.u', $study['MainDicomTags']['StudyDate'].' '.$study['MainDicomTags']['StudyTime'], 'UTC');
$result[] = $study;
}

View File

@ -35,7 +35,7 @@ public function definition(): array
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'phone' => fake()->phoneNumber(),
'role' => static::$role ??= UserRole::Technologist->value,
'role' => static::$role ??= UserRole::Technician->value,
'password' => static::$password ??= Hash::make('password'),
'two_factor_secret' => null,
'two_factor_recovery_codes' => null,

View File

@ -0,0 +1,30 @@
<?php
use App\Models\Enums\StudyRequestStatus;
use App\Models\Study;
use App\Models\User;
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_delete_requests', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Study::class)->unique()->constrained()->cascadeOnDelete();
$table->foreignIdFor(User::class, 'requesting_user_id')->index()->constrained()->cascadeOnDelete();
$table->foreignIdFor(User::class, 'performing_user_id')->index()->nullable()->constrained()->nullOnDelete();
$table->unsignedTinyInteger('status')->default(StudyRequestStatus::Pending->value);
$table->timestamps();
$table->index(['status', 'created_at']);
});
}
public function down(): void
{
Schema::dropIfExists('study_delete_requests');
}
};

View File

@ -25,12 +25,12 @@ public function run(): void
User::factory(2)->create([
'institute_id' => $chevron->id,
'role' => UserRole::Technologist->value,
'role' => UserRole::Technician->value,
]);
User::factory(2)->create([
'institute_id' => $srini->id,
'role' => UserRole::Technologist->value,
'role' => UserRole::Technician->value,
]);
}
}

View File

@ -36,7 +36,7 @@
{{ $study['StudyDateTime'] }}
</td>
<td>
{{ $study['LastUpdate'] }}
{{ $study['ReceiveDateTime'] }}
</td>
<td>
{{ $study['MainDicomTags']['InstitutionName'] }}