Skip to content

arjun2004/hospital-management-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Healthcare Appointment Management System

A comprehensive healthcare appointment management system built with React, Django, and PostgreSQL. This system supports both patient and doctor roles with advanced appointment booking, conflict detection, and role-based access control.

Features

πŸ” Authentication System

  • User Registration & Login: Separate registration flows for patients and doctors
  • Role-based Access: Patients and doctors have different dashboards and permissions
  • JWT Authentication: Secure token-based authentication
  • Session Management: Proper logout and token refresh handling

πŸ‘¨β€βš•οΈ Doctor Features

  • Doctor Registration: Complete doctor profile with specializations, license numbers, and experience
  • Profile Management: Update doctor information and availability status
  • Availability Scheduling: Set working hours for different days of the week
  • Appointment Management: View and manage patient appointments
  • Status Updates: Confirm, cancel, or mark appointments as completed

πŸ₯ Patient Features

  • Patient Registration: Simple patient account creation
  • Doctor Discovery: Browse available doctors by specialization
  • Appointment Booking: Book appointments with conflict detection
  • Appointment History: View all past and upcoming appointments
  • Real-time Availability: See available time slots for selected doctors

πŸ“… Advanced Booking System

  • Conflict Detection: Prevents double booking of the same time slot
  • Appointment Status Workflow:
    • pending β†’ confirmed β†’ completed
    • cancelled status available at any time
  • Doctor-specific Rules: Respects doctor availability and working hours
  • Time Slot Management: 30-minute appointment slots

πŸ›‘οΈ Enhanced Management

  • Role-based Access Control:
    • Patients see only their own appointments
    • Doctors see only their scheduled appointments
  • Appointment Status Updates: Real-time status changes
  • Notes and Comments: Doctors can add notes to appointments
  • Responsive Design: Works on desktop and mobile devices

Technology Stack

Backend

  • Django 4.2.7: Web framework
  • Django REST Framework: API development
  • PostgreSQL: Database
  • JWT Authentication: Secure token-based auth
  • CORS Support: Cross-origin resource sharing

Frontend

  • React 18: User interface
  • Vite: Build tool and dev server
  • React Router: Client-side routing
  • Axios: HTTP client
  • CSS3: Styling and responsive design

Installation & Setup

Prerequisites

  • Python 3.8+
  • Node.js 16+
  • PostgreSQL 12+

Backend Setup

  1. Navigate to backend directory:

    cd backend
  2. Create and activate virtual environment:

    python -m venv venv
    source venv/Scripts/activate  # On Windows
    # or
    source venv/bin/activate      # On macOS/Linux
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure database:

    • Create a PostgreSQL database
    • Update database settings in userauth/settings.py
  5. Run migrations:

    python manage.py makemigrations
    python manage.py migrate
  6. Create superuser (optional):

    python manage.py createsuperuser
  7. Start development server:

    python manage.py runserver

Frontend Setup

  1. Navigate to frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Start development server:

    npm run dev

API Endpoints

Authentication

  • POST /api/auth/register/ - Patient registration
  • POST /api/auth/register-doctor/ - Doctor registration
  • POST /api/auth/login/ - User login
  • POST /api/auth/logout/ - User logout
  • GET /api/auth/profile/ - Get user profile

Doctor Management

  • GET /api/auth/doctor-profile/ - Get doctor profile
  • PUT /api/auth/doctor-profile/ - Update doctor profile
  • GET /api/auth/doctor-availability/ - Get doctor availability
  • POST /api/auth/doctor-availability/ - Add availability
  • GET /api/auth/doctors/ - List all doctors

Appointments

  • GET /api/auth/appointments/ - Get user appointments
  • POST /api/auth/appointments/ - Create appointment
  • GET /api/auth/appointments/{id}/ - Get appointment details
  • PUT /api/auth/appointments/{id}/ - Update appointment
  • GET /api/auth/available-slots/{doctor_id}/{date}/ - Get available slots

Usage Guide

For Patients

  1. Register as Patient:

    • Visit the registration page
    • Select "Patient" as account type
    • Fill in personal information
    • Create account
  2. Book an Appointment:

    • Login to your dashboard
    • Select a doctor from the list
    • Choose a date and available time slot
    • Provide reason for visit
    • Confirm booking
  3. Manage Appointments:

    • View all your appointments
    • Check appointment status
    • See doctor notes (if any)

For Doctors

  1. Register as Doctor:

    • Visit the registration page
    • Select "Doctor" as account type
    • Fill in personal and professional information
    • Set specialization and consultation fee
    • Create account
  2. Set Availability:

    • Login to doctor dashboard
    • Configure working hours for each day
    • Set availability status
  3. Manage Appointments:

    • View all patient appointments
    • Confirm or cancel pending appointments
    • Mark appointments as completed
    • Add notes to appointments

Database Models

User Model

  • Extended with role, phone number, date of birth, address
  • Supports both patient and doctor roles

DoctorProfile Model

  • Specialization, license number, experience
  • Consultation fee, bio, availability status

DoctorAvailability Model

  • Day of week, start/end times
  • Availability status per time slot

Appointment Model

  • Patient and doctor references
  • Date, time, status, reason, notes
  • Automatic conflict detection

Security Features

  • JWT Authentication: Secure token-based authentication
  • Role-based Access: Different permissions for patients and doctors
  • Input Validation: Server-side validation for all inputs
  • CORS Configuration: Proper cross-origin resource sharing
  • Password Security: Django's built-in password validation

Development

Running Tests

# Backend tests
cd backend
python manage.py test

# Frontend tests
cd frontend
npm test

Code Quality

  • ESLint for JavaScript/React
  • Django's built-in validation
  • TypeScript support (optional)

Deployment

Backend Deployment

  1. Set production environment variables
  2. Configure production database
  3. Run migrations
  4. Collect static files
  5. Deploy to your preferred platform

Frontend Deployment

  1. Build production bundle: npm run build
  2. Deploy to static hosting service
  3. Configure API endpoints

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License.

Support

For support and questions, please open an issue in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors