Add Care Units, beds, and dated staff assignments.
Deploy Ladill Care / deploy (push) Successful in 1m8s

Models employment as department/unit/shift placements with primary and temporary kinds so nurses are not permanently bound to a ward.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-20 10:04:39 +00:00
co-authored by Cursor
parent 56a663a777
commit 3735be3425
21 changed files with 1595 additions and 0 deletions
@@ -0,0 +1,86 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Staff management foundations:
* Department Care Unit Bed (inpatient)
* Member Staff Assignment (dated, primary/temporary/specialty)
*/
return new class extends Migration
{
public function up(): void
{
Schema::create('care_care_units', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->foreignId('organization_id')->constrained('care_organizations')->cascadeOnDelete();
$table->foreignId('department_id')->constrained('care_departments')->cascadeOnDelete();
$table->string('name');
$table->string('code')->nullable();
/** inpatient | outpatient | service | float_pool */
$table->string('kind')->default('inpatient');
$table->boolean('is_active')->default(true);
$table->unsignedSmallInteger('sort_order')->default(0);
$table->timestamps();
$table->softDeletes();
$table->index(['organization_id', 'kind']);
$table->index(['department_id', 'is_active']);
});
Schema::create('care_beds', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->foreignId('organization_id')->constrained('care_organizations')->cascadeOnDelete();
$table->foreignId('care_unit_id')->constrained('care_care_units')->cascadeOnDelete();
$table->string('label');
$table->string('room')->nullable();
/** available | occupied | reserved | maintenance | closed */
$table->string('status')->default('available');
$table->boolean('is_active')->default(true);
$table->unsignedSmallInteger('sort_order')->default(0);
$table->timestamps();
$table->softDeletes();
$table->index(['care_unit_id', 'status']);
$table->index(['organization_id', 'is_active']);
});
Schema::create('care_staff_assignments', function (Blueprint $table) {
$table->id();
$table->string('owner_ref')->index();
$table->foreignId('organization_id')->constrained('care_organizations')->cascadeOnDelete();
$table->foreignId('member_id')->constrained('care_members')->cascadeOnDelete();
$table->foreignId('department_id')->nullable()->constrained('care_departments')->nullOnDelete();
$table->foreignId('care_unit_id')->nullable()->constrained('care_care_units')->nullOnDelete();
/** primary | temporary | specialty */
$table->string('kind')->default('primary');
/** Nursing/post title on this assignment — not RBAC Member.role */
$table->string('assignment_role')->nullable();
/** day | evening | night | rotating — full shift entities come later */
$table->string('shift_code')->nullable();
$table->date('starts_on');
$table->date('ends_on')->nullable();
/** active | scheduled | ended */
$table->string('status')->default('active');
$table->text('notes')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['organization_id', 'status']);
$table->index(['member_id', 'status']);
$table->index(['care_unit_id', 'status']);
$table->index(['starts_on', 'ends_on']);
});
}
public function down(): void
{
Schema::dropIfExists('care_staff_assignments');
Schema::dropIfExists('care_beds');
Schema::dropIfExists('care_care_units');
}
};