Facilities Module

Comprehensive Facility Management System Documentation

Version 1.0 | Priority: 115

Overview

The Facilities Module is a comprehensive facility management system designed for healthcare organizations. It provides complete control over organizational structures, buildings, floors, rooms, staff members, departments, and service definitions.

Module Name

Facilities

Module Alias

facilities

Priority Level

115

Namespace

Modules\Facilities

Key Capability: This module serves as the backbone for managing physical and organizational infrastructure in healthcare environments, enabling efficient resource allocation and facility tracking.

Architecture

The Facilities module follows Clean Architecture principles with clear separation of concerns across multiple layers.

D

Domain Layer

Contains business entities, repository interfaces, and domain models representing core facilities concepts.

A

Application Layer

Houses service classes that orchestrate business logic and coordinate between controllers and repositories.

I

Infrastructure Layer

Implements repository interfaces using Eloquent ORM for data persistence and database operations.

P

Presentation Layer

HTTP controllers, request validation, API resources, and views for user interaction.

Service Provider Configuration

// FacilitiesServiceProvider binds interfaces to implementations Repositories Registered: - BuildingRepositoryInterface → EloquentBuildingRepository - FloorRepositoryInterface → EloquentFloorRepository - OrganizationRepositoryInterface → EloquentOrganizationRepository - RoomRepositoryInterface → EloquentRoomRepository - RoomAllotmentRepositoryInterface → EloquentRoomAllotmentRepository - ServiceDefinitionRepositoryInterface → EloquentServiceDefinitionRepository - StaffMemberRepositoryInterface → EloquentStaffMemberRepository CRUD Services Bound: Controllers are dynamically injected with their respective service classes

API Endpoints

All API routes are protected with auth:sanctum, resolve.location, and resolve.locale middleware.

Organizations Management

GET /api/facilities/organizations
List all organizations with pagination, filtering, and statistics. Includes card status with total, active, and inactive counts.
GET /api/facilities/organizations/{id}
Retrieve detailed information about a specific organization by ID.
POST /api/facilities/organizations
Create a new organization entity.
PUT /api/facilities/organizations/{id}
Update an existing organization's information.
DELETE /api/facilities/organizations/{id}
Delete an organization from the system.
GET /api/facilities/all-organizations
Retrieve a complete list of all organizations (using OrganizationApiController).
GET /api/facilities/organizations/building-details/{id}
Get detailed building information for a specific organization, including building list with organization name.

Buildings Management

GET /api/facilities/buildings
List all buildings with pagination support.
GET /api/facilities/buildings/{id}
Retrieve details of a specific building.
POST /api/facilities/buildings
Create a new building record.
PUT /api/facilities/buildings/{id}
Update building information.
DELETE /api/facilities/buildings/{id}
Remove a building from the system.

Floors Management

GET /api/facilities/floors
List all floors across all buildings.
GET /api/facilities/floors/{id}
Get details of a specific floor.
POST /api/facilities/floors
Create a new floor within a building.
PUT /api/facilities/floors/{id}
Update floor details.
DELETE /api/facilities/floors/{id}
Delete a floor.

Rooms Management

GET /api/facilities/rooms
List all rooms in the facility.
GET /api/facilities/rooms/{id}
Get detailed information about a specific room.
POST /api/facilities/rooms
Create a new room.
PUT /api/facilities/rooms/{id}
Update room information.
DELETE /api/facilities/rooms/{id}
Delete a room.

Service Definitions

GET /api/facilities/services
List all available service definitions.
GET /api/facilities/services/{id}
Retrieve a specific service definition.
POST /api/facilities/services
Create a new service definition.
PUT /api/facilities/services/{id}
Update a service definition.
DELETE /api/facilities/services/{id}
Delete a service definition.

Staff Members

GET /api/facilities/staff
List all staff members.
GET /api/facilities/staff/{id}
Get details of a specific staff member.
POST /api/facilities/staff
Register a new staff member.
PUT /api/facilities/staff/{id}
Update staff member information.
DELETE /api/facilities/staff/{id}
Remove a staff member.

Room Allotments

GET /api/facilities/room-allotments
List all room allotment assignments.
GET /api/facilities/room-allotments/{id}
Get details of a specific room allotment.
POST /api/facilities/room-allotments
Create a new room allotment.
PUT /api/facilities/room-allotments/{id}
Update room allotment information.
DELETE /api/facilities/room-allotments/{id}
Delete a room allotment.

Departments

GET /api/facilities/departments
List all departments with statistics (total, active, inactive). Returns allDepartments array and cardStatus with department counts.
GET /api/facilities/departments/{department}
Retrieve detailed information about a specific department (numeric ID required).
POST /api/facilities/departments
Create a new department.
PUT /api/facilities/departments/{department}
Update department details.
DELETE /api/facilities/departments/{department}
Delete a department.

Controllers

Controller Type Purpose
OrganizationController CRUD API Manages healthcare organizations and institutions
BuildingController CRUD API Handles building management within organizations
FloorController CRUD API Manages floors within buildings
RoomController CRUD API Controls room creation and management
RoomAllotmentController CRUD API Manages room assignments and allocations
ServiceDefinitionController CRUD API Defines available services in facilities
StaffMemberController CRUD API Manages staff member records
DepartmentController API (Custom) Department management with statistics and card status
OrganizationApiController API (Custom) Extended organization endpoints with building details
FacilitiesController Web Web interface controller for facilities module
Note: All CRUD controllers extend BaseCrudController from HmsCore, providing standardized REST operations. Custom API controllers add specialized functionality like statistics, filtering, and complex data retrieval.

Key Features

1

Multi-Level Hierarchy

Supports organization → building → floor → room structure for complete facility representation.

2

Department Management

Track departments with active/inactive status and comprehensive statistics.

3

Room Allotment System

Efficiently allocate and track room assignments across the facility.

4

Service Definitions

Define and manage services available within the facility infrastructure.

5

Staff Member Tracking

Maintain comprehensive records of staff members associated with facilities.

6

Location & Locale Resolution

Automatic location and locale middleware for multi-location healthcare systems.

7

Authorization & Security

Complete policy-based authorization on all operations with Sanctum authentication.

8

Statistics & Analytics

Built-in card status and statistics for organizations and departments.

Dependencies & Integration

Service Providers

FacilitiesServiceProvider RouteServiceProvider AuthServiceProvider

Core Dependencies

HMS

HmsCore Package

Leverages BaseCrudController, CrudServiceInterface, ResolveLocale, and ResolveLocation middleware from the core package.

Core

Core Module

Uses Department entity from Modules\Core for department management functionality.

Auth

Laravel Sanctum

All API routes protected with auth:sanctum middleware for secure API access.

Database Seeding

// Configured database seeder Seeder Class: Modules\Facilities\Database\Seeders\FacilitiesDatabaseSeeder // Run seeder php artisan module:seed Facilities

Translations

Translation files are loaded from resources/lang with the facilities namespace.

Migrations

Database migrations are automatically loaded from Database/Migrations directory.

← Back to Documentation