wip
This commit is contained in:
parent
5c04b31ecd
commit
7bf6a94363
11
app/Models/Enums/StudyRequestStatus.php
Normal file
11
app/Models/Enums/StudyRequestStatus.php
Normal 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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
7
app/Models/StudyDeleteRequest.php
Normal file
7
app/Models/StudyDeleteRequest.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudyDeleteRequest extends Model {}
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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');
|
||||
}
|
||||
};
|
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
{{ $study['StudyDateTime'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $study['LastUpdate'] }}
|
||||
{{ $study['ReceiveDateTime'] }}
|
||||
</td>
|
||||
<td>
|
||||
{{ $study['MainDicomTags']['InstitutionName'] }}
|
||||
|
Loading…
Reference in New Issue
Block a user