Skip to content

A comprehensive hospital management system for Kenyan healthcare facilities. Features admin dashboard, doctor portal, patient booking, real-time notifications, and appointment management. Built with Laravel 11 and MySQL.

Notifications You must be signed in to change notification settings

denko5/afyacare

Repository files navigation

AfyaCare Hospital Management System

A comprehensive web-based hospital management system designed to streamline healthcare operations in Kenya. The system facilitates efficient management of appointments, doctors, departments, and patient interactions while providing real-time notifications and analytics.

About

AfyaCare is a modern hospital management solution built to address the challenges faced by healthcare facilities in managing patient appointments and medical staff coordination. The system provides three distinct user interfaces tailored to the needs of administrators, doctors, and patients, ensuring smooth workflow and enhanced patient care delivery.

The platform enables hospitals to digitize their appointment booking process, manage doctor schedules, track patient visits, and maintain organized department structures. By providing real-time notifications and comprehensive dashboards, AfyaCare helps reduce administrative overhead while improving patient experience and operational efficiency.

Key Features

Administrator Module

  • Complete hospital dashboard with analytics and statistics
  • Doctor profile management (add, edit, remove doctors)
  • Department management and organization
  • Appointment oversight and monitoring
  • Real-time system metrics and reporting
  • User access control and management

Doctor Module

  • Personal dashboard with appointment overview
  • View all scheduled appointments with patient details
  • Confirm or decline appointment requests
  • Provide reasons for declined appointments with alternative date suggestions
  • Mark appointments as completed
  • Add medical notes and observations to patient records
  • Direct patient contact capabilities (call/email)
  • Filter appointments by status (pending, confirmed, completed)

Patient Module

  • User-friendly appointment booking interface
  • Browse available doctors by department and specialization
  • View doctor profiles including qualifications and consultation fees
  • Track appointment history and status
  • Real-time notification system for appointment updates
  • Dashboard showing upcoming and completed appointments
  • Notification center with read/unread status management

Notification System

  • Automated notifications for appointment confirmations
  • Alerts for appointment declinations with doctor's reasoning
  • Notifications for completed appointments
  • Suggested alternative dates from doctors
  • Mark notifications as read/unread
  • Delete old notifications
  • Unread notification counter in navigation

Technical Specifications

Built With

  • Laravel 11 - PHP web application framework
  • PHP 8.2 - Server-side scripting language
  • MySQL - Relational database management system
  • Bootstrap 5 - Frontend CSS framework
  • JavaScript - Client-side interactivity
  • Blade - Laravel templating engine

System Requirements

  • PHP >= 8.2
  • Composer
  • MySQL >= 5.7 or MariaDB >= 10.3
  • Apache or Nginx web server
  • Node.js and NPM (for asset compilation)

Installation Instructions

1. Clone the Repository

git clone https://github.com/YOUR-USERNAME/afyacare.git
cd afyacare

2. Install Dependencies

composer install

3. Environment Configuration

cp .env.example .env

Edit the .env file and configure your database connection:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=afyacare_db
DB_USERNAME=your_username
DB_PASSWORD=your_password

4. Generate Application Key

php artisan key:generate

5. Run Database Migrations

php artisan migrate

6. Seed Initial Data (Optional)

php artisan db:seed

7. Create Storage Link

php artisan storage:link

8. Start Development Server

php artisan serve

The application will be available at http://127.0.0.1:8000

Database Structure

Main Tables

  • users: User authentication and profile information
  • patients: Patient-specific data
  • doctors: Doctor profiles and specializations
  • departments: Hospital departments
  • appointments: Appointment bookings and details
  • notifications: User notification management

Relationships

  • One user can be one patient, doctor, or admin
  • Doctors belong to departments
  • Appointments link patients to doctors
  • Notifications belong to users

Default Login Credentials

After installation, you can create test accounts or use seeded data:

Administrator

Doctor

Patient

Note: Change these credentials in production environment.

User Roles and Permissions

Admin

  • Full system access
  • Manage doctors and departments
  • View all appointments
  • System configuration
  • User management

Doctor

  • View assigned appointments
  • Confirm/decline appointments
  • Add medical notes
  • Update appointment status
  • View patient contact information

Patient

  • Book appointments
  • View appointment history
  • Receive notifications
  • View doctor profiles
  • Update personal information

Workflow

Appointment Booking Process

  1. Patient registers/logs into the system
  2. Patient browses available doctors by department
  3. Patient selects a doctor and books an appointment
  4. Appointment status set to "pending"
  5. Doctor receives notification of new appointment
  6. Doctor reviews and confirms or declines appointment
  7. Patient receives notification of doctor's decision
  8. If declined, doctor can suggest alternative dates
  9. Confirmed appointments appear in both doctor and patient dashboards
  10. After consultation, doctor marks appointment as completed
  11. Patient receives completion notification

Security Features

  • Password hashing using bcrypt
  • CSRF protection on all forms
  • Role-based access control
  • Session management
  • SQL injection prevention through Eloquent ORM
  • XSS protection via Blade templating
  • Secure authentication system

Future Enhancements

Potential features for future development:

  • Medical records management
  • Prescription management
  • Billing and invoicing system
  • SMS notifications via Africa's Talking API
  • Email notifications
  • Online payment integration (M-Pesa)
  • Patient medical history tracking
  • Doctor schedule management
  • Video consultation capabilities
  • Report generation and export
  • Multi-language support (English, Swahili)

Project Structure

afyacare/
├── app/
│   ├── Http/
│   │   ├── Controllers/
│   │   │   ├── Admin/
│   │   │   ├── Doctor/
│   │   │   └── Patient/
│   │   └── Middleware/
│   └── Models/
├── database/
│   ├── migrations/
│   └── seeders/
├── resources/
│   └── views/
│       ├── admin/
│       ├── doctor/
│       ├── patient/
│       └── layouts/
├── routes/
│   └── web.php
└── public/

Contributing

This project is currently maintained for academic purposes. For suggestions or improvements, please contact the project owner.

Troubleshooting

Common Issues

Issue: "Class not found" errors Solution: Run composer dump-autoload

Issue: "No application encryption key has been specified" Solution: Run php artisan key:generate

Issue: Database connection errors Solution: Verify database credentials in .env file and ensure MySQL service is running

Issue: 404 errors on routes Solution: Run php artisan route:clear and php artisan cache:clear

Issue: Permission denied on storage Solution: Set proper permissions chmod -R 775 storage bootstrap/cache

System Architecture

The system follows the MVC (Model-View-Controller) architecture pattern:

  • Models: Represent database tables and business logic
  • Views: Blade templates for user interface
  • Controllers: Handle HTTP requests and application logic

Authentication and authorization are managed through Laravel's built-in authentication system with custom role-based middleware.

API Documentation

Currently, the system uses web routes. RESTful API endpoints can be added for mobile application integration in future versions.

Testing

Run the test suite:

php artisan test

Deployment

Production Deployment Checklist

  1. Set APP_ENV=production in .env
  2. Set APP_DEBUG=false in .env
  3. Configure production database
  4. Run php artisan config:cache
  5. Run php artisan route:cache
  6. Run php artisan view:cache
  7. Set up proper file permissions
  8. Configure web server (Apache/Nginx)
  9. Set up SSL certificate
  10. Configure backup strategy

Recommended Hosting

  • VPS: DigitalOcean, Linode, Vultr
  • Shared Hosting: Compatible with cPanel hosting
  • Cloud: AWS, Google Cloud, Azure
  • Platform: Railway, Render, Heroku alternatives

License

This project is licensed for educational and academic use only. Commercial use requires explicit permission from the author.

Support and Contact

For technical support, feature requests, or bug reports:

Acknowledgments

Built as a demonstration of modern web application development using Laravel framework, following best practices for healthcare management systems.

Version History

Version 1.0.0 (Initial Release)

  • Basic user authentication system
  • Admin, Doctor, and Patient modules
  • Appointment management
  • Department management
  • Notification system
  • Responsive design

Technical Documentation

For detailed technical documentation, including database schema, API endpoints, and architecture diagrams, please refer to the /docs directory (to be added).

Screenshots

Screenshots and demo videos available upon request.

Disclaimer

This system is designed for educational purposes and demonstration. For production use in healthcare settings, ensure compliance with local healthcare regulations and data protection laws (such as HIPAA, GDPR, or Kenya Data Protection Act).

About

A comprehensive hospital management system for Kenyan healthcare facilities. Features admin dashboard, doctor portal, patient booking, real-time notifications, and appointment management. Built with Laravel 11 and MySQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages