Overview
The patient management system provides a complete profile for each patient, including personal demographics, contact information, medical history, and address details. Patients are scoped to specific clinics in the multi-tenant architecture.Complete Profiles
Demographics, contact info, and medical data in one place
Clinic Scoped
Each patient belongs to a specific clinic
Mobile Access
Patients can access their records via mobile app
Clinical Records
Linked to comprehensive clinical files and evolution notes
Data Model
ThePaciente model stores comprehensive patient information with strong relationships to clinics and clinical records.
Database Schema
See migration at~/workspace/source/database/migrations/2026_02_23_090302_create_paciente_table.php:14-49
Model Attributes
See complete model at~/workspace/source/app/Models/Paciente.php:16-35
| Field | Type | Description |
|---|---|---|
id_paciente | bigint | Primary key |
id_clinica | bigint | Foreign key to clinic (required) |
nombre | string | First name |
apellido_paterno | string | Paternal surname (required) |
apellido_materno | string | Maternal surname (optional) |
fecha_nacimiento | date | Date of birth |
sexo | enum | Gender: hombre or mujer |
telefono | string | Contact phone number |
curp | string | Mexican national ID (unique, 18 chars) |
ocupacion | string | Occupation/profession |
peso | decimal(5,2) | Weight in kilograms |
calle | string | Street address |
num_ext | string | External number |
num_int | string | Internal number/apartment |
colonia | string | Neighborhood |
ciudad | string | City |
estado | string | State/province |
codigo_postal | string | Postal code |
estatus | enum | Status: activo or baja |
CURP (Clave Única de Registro de Población) is Mexico’s unique population registry code. It’s similar to a social security number and consists of 18 alphanumeric characters.
Relationships
The Paciente model establishes critical relationships with multiple entities in the system.Belongs To Clinic
When a clinic is deleted, all its patients are automatically removed due to the
onDelete('cascade') constraint.Has Many Appointments
See~/workspace/source/app/Models/Paciente.php:45-48
Has One Clinical File
See~/workspace/source/app/Models/Paciente.php:51-54
ExpedienteClinico) stores:
- Hereditary medical history
- Pathological history
- Allergies
- General observations
Has One Mobile Access
See~/workspace/source/app/Models/Paciente.php:57-60
Entity Relationship Diagram
Patient Demographics
Personal Information
The system captures essential demographic data:Full Name
Three-part name: first name + paternal surname + maternal surname (Mexican standard)
Date of Birth
Used to calculate age and track pediatric vs adult patients
Gender
Binary options:
hombre (male) or mujer (female)CURP
Mexican national ID for official identification
Contact Information
Phone Number
Phone Number
- Stored as string to preserve formatting
- Typically 10 digits for Mexican numbers
- Used for appointment reminders and contact
Complete Address
Complete Address
Full address breakdown:
- Street name (
calle) - External number (
num_ext) - Internal number/apt (
num_int) - Neighborhood (
colonia) - City (
ciudad) - State (
estado) - Postal code (
codigo_postal)
Medical Information
Weight
Stored in kilograms with 2 decimal precision (e.g., 75.50 kg)
Occupation
Patient’s profession, may be relevant for certain dental conditions
Mobile Access Feature
Patients can be granted access to a mobile application to view their records, appointments, and treatment history.AccesoMovil Schema
See migration at~/workspace/source/database/migrations/2026_02_23_093639_create_acceso_movil_table.php:14-35
Mobile Access Workflow
Mobile Access States
| Status | Description |
|---|---|
temporal | Initial state, requires password change |
activo | Full access granted |
expirado | Token expired, requires re-authentication |
Patient Status Management
Patients can be marked as active or inactive without deleting their historical records.Status Values
Activo
Patient is current and can receive appointments/treatments
Baja
Patient is inactive (moved, deceased, or no longer visiting). Records preserved.
Setting a patient to
baja status should prevent scheduling new appointments while maintaining all historical data for legal and medical records requirements.Creating a Patient
While the controller code isn’t provided, patient creation would typically follow this pattern:Searching Patients
Common search patterns for patient lookup:By Name
By Phone Number
By CURP
CURP is unique across the entire system (not just per clinic), so it can be used for global patient lookup.
Data Privacy and Security
CURP Encryption
The Paciente model includes a commented-out encryption option for sensitive data:Enabling CURP Encryption
Enabling CURP Encryption
To encrypt CURP values at the database level:
- Uncomment the cast in
Paciente.php - Ensure
APP_KEYis set in.env - Laravel will automatically encrypt/decrypt on save/retrieve
Multi-Tenant Data Isolation
All patient queries should be scoped by clinic:Patient Lifecycle
Best Practices
Always Capture Full Name
Always Capture Full Name
Mexican naming conventions use three parts: first name + paternal surname + maternal surname. All three should be captured when available.
Validate CURP Format
Validate CURP Format
CURP has a specific 18-character format. Implement validation to ensure data quality:
- Pattern:
^[A-Z]{4}[0-9]{6}[HM][A-Z]{5}[0-9]{2}$ - First 4 letters: surname + name initials
- 6 digits: birthdate (YYMMDD)
- H/M: gender
- 5 letters: birthplace + consonants
- 2 digits: verification
Clinic Scoping
Clinic Scoping
Always scope patient queries by
id_clinica to maintain multi-tenant isolation.Status vs Deletion
Status vs Deletion
Use
estatus = 'baja' instead of deleting patient records. Medical records must be retained for legal compliance.Mobile Access Security
Mobile Access Security
- Hash passwords using bcrypt
- Implement token expiration
- Force password change on first login
- Log access attempts
Related Features
Clinical Records
View patient medical history and evolution notes
Appointments
Schedule patient appointments
Treatments
Manage patient treatments