wip
This commit is contained in:
parent
5c606bbbf0
commit
8046436bc0
12
app/Models/Enums/ReportStatus.php
Normal file
12
app/Models/Enums/ReportStatus.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Enums;
|
||||
|
||||
enum ReportStatus: int
|
||||
{
|
||||
case Pending = 0;
|
||||
case Opened = 1;
|
||||
case Draft = 2;
|
||||
case Finalized = 3;
|
||||
case Signed = 4;
|
||||
}
|
27
app/Models/Enums/StudyModality.php
Normal file
27
app/Models/Enums/StudyModality.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Enums;
|
||||
|
||||
enum StudyModality:string
|
||||
{
|
||||
case CR = 'CR';
|
||||
case CT = 'CT';
|
||||
case MR = 'MR';
|
||||
case NM = 'NM';
|
||||
case PT = 'PT';
|
||||
case US = 'US';
|
||||
case XA = 'XA';
|
||||
case RF = 'RF';
|
||||
case DX = 'DX';
|
||||
case MG = 'MG';
|
||||
case IO = 'IO';
|
||||
case PR = 'PR';
|
||||
case SR = 'SR';
|
||||
case OT = 'OT';
|
||||
case GM = 'GM';
|
||||
case XC = 'XC';
|
||||
case SM = 'SM';
|
||||
case LS = 'LS';
|
||||
case RG = 'RG';
|
||||
case TG = 'TG';
|
||||
}
|
15
app/Models/Site.php
Normal file
15
app/Models/Site.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Site extends Model
|
||||
{
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
9
app/Models/Study.php
Normal file
9
app/Models/Study.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Study extends Model
|
||||
{
|
||||
}
|
9
app/Models/StudyAttachment.php
Normal file
9
app/Models/StudyAttachment.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudyAttachment extends Model
|
||||
{
|
||||
}
|
9
app/Models/StudyNote.php
Normal file
9
app/Models/StudyNote.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StudyNote extends Model
|
||||
{
|
||||
}
|
@ -9,14 +9,17 @@
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Laravel\Jetstream\HasProfilePhoto;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens;
|
||||
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory;
|
||||
|
||||
use HasProfilePhoto;
|
||||
|
||||
use HasRoles;
|
||||
use Notifiable;
|
||||
use TwoFactorAuthenticatable;
|
||||
|
||||
|
@ -3,17 +3,28 @@
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"framework"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"php": "^8.3",
|
||||
"hashids/hashids": "^5.0",
|
||||
"laravel/framework": "^11.31",
|
||||
"laravel/jetstream": "^5.3",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
"livewire/livewire": "^3.0"
|
||||
"livewire/livewire": "^3.0",
|
||||
"spatie/laravel-permission": "^6.10",
|
||||
"spatie/laravel-settings": "^3.4",
|
||||
"vinkla/hashids": "^12.0",
|
||||
"yajra/laravel-datatables-oracle": "^11.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.14",
|
||||
"barryvdh/laravel-ide-helper": "^3.3",
|
||||
"doctrine/dbal": "^4.2",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/pail": "^1.1",
|
||||
"laravel/pint": "^1.13",
|
||||
@ -51,6 +62,23 @@
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"clear-all": [
|
||||
"@php artisan clear-compiled",
|
||||
"@php artisan cache:clear",
|
||||
"@php artisan route:clear",
|
||||
"@php artisan view:clear",
|
||||
"@php artisan config:clear",
|
||||
"composer dumpautoload -o"
|
||||
],
|
||||
"cache-all": [
|
||||
"@php artisan config:cache",
|
||||
"@php artisan route:cache"
|
||||
],
|
||||
"reset": [
|
||||
"composer clear-all",
|
||||
"composer cache-all"
|
||||
],
|
||||
"fix": "php-cs-fixer fix",
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
|
||||
|
1446
composer.lock
generated
1446
composer.lock
generated
File diff suppressed because it is too large
Load Diff
23
database/migrations/0000_01_26_171436_create_sites_table.php
Normal file
23
database/migrations/0000_01_26_171436_create_sites_table.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?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('sites', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sites');
|
||||
}
|
||||
};
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Site;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -20,6 +21,7 @@ public function up(): void
|
||||
$table->rememberToken();
|
||||
$table->foreignId('current_team_id')->nullable();
|
||||
$table->string('profile_photo_path', 2048)->nullable();
|
||||
$table->foreignIdFor(Site::class, 'site_id')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
//$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);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
//$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();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$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);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Site;
|
||||
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('studies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('orthanc_uid')->unique();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->tinyInteger('priority')->default(0);
|
||||
$table->string('patient_id')->nullable();
|
||||
$table->string('patient_name');
|
||||
$table->string('patient_sex');
|
||||
$table->date('patient_birthdate')->nullable();
|
||||
$table->string('study_instance_uid')->unique();
|
||||
$table->string('institution_name');
|
||||
$table->string('accession_number')->nullable();
|
||||
$table->string('study_description')->nullable();
|
||||
$table->text('history')->nullable();
|
||||
$table->dateTime('study_date')->index();
|
||||
$table->dateTime('upload_date')->index();
|
||||
$table->foreignIdFor(Site::class)->constrained()->onDelete('cascade');
|
||||
$table->tinyInteger('report_status')->default(0);
|
||||
$table->string('study_modality');
|
||||
$table->foreignIdFor(User::class, 'assigned_radiologist_id')->nullable()->constrained()->onDelete('set null');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['site_id', 'upload_date']);
|
||||
$table->index(['site_id', 'accession_number']);
|
||||
$table->index(['site_id', 'report_status', 'priority', 'upload_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('studies');
|
||||
}
|
||||
};
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
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_attachments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('file_name');
|
||||
$table->integer('file_size');
|
||||
$table->foreignIdFor(Study::class)->constrained()->onDelete('cascade');
|
||||
$table->foreignIdFor(User::class)->nullable()->constrained()->onDelete('SET NULL');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('study_attachments');
|
||||
}
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
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_notes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Study::class)->constrained()->onDelete('cascade');
|
||||
$table->foreignIdFor(User::class)->nullable()->constrained()->onDelete('cascade');
|
||||
$table->text('note');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('study_notes');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user