Skip to content

SmartHealth is a healthcare management system with a Spring Boot backend and dual frontend apps (User portal + Admin portal). It provides features for patient management, appointments, records, and admin control.

License

Notifications You must be signed in to change notification settings

psonagara/SmartHealth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ SmartHealth - Healthcare Appointment Booking System (Spring Boot, Java, JWT, MySQL)

Java
Spring Boot
Database
License


SmartHealth project containing:

  • Backend (Spring Boot) β†’ SmartHealth/
  • User Frontend (HTML, CSS and JavaScript) β†’ sh/
  • Admin Frontend (HTML, CSS and JavaScript) β†’ admin/

πŸ“‚ Structure

SmartHealth/
β”œβ”€ SmartHealth/ β†’ Spring Boot backend
β”œβ”€ sh/ β†’ User frontend
β”œβ”€ admin/ β†’ Admin frontend

πŸš€ Getting Started

Backend (Spring Boot)

  1. Import the Gradle project SmartHealth into your IDE (STS, Eclipse, IntelliJ). (Optional)
  2. Open src/main/resources/application.properties and configure the following:
    • Database Connection: Update spring.datasource.driver-class-name, spring.datasource.url, spring.datasource.username, and spring.datasource.password according to your database setup.
    • Image Storage Path: Set smarthealth.paths.image-storage-path to the desired location for storing profile images.
    • CORS Configuration: Update properties starting with smarthealth.cors to allow cross-origin requests as per your requirements.
    • Other Properties: Adjust settings like server port, log file path, etc. as needed.
  3. Run the application:
    • From IDE: Execute the main method in SmartHealthApplication class.
    • From Command Line:
      • Navigate to the SmartHealth/ directory.
      • Build the project:
        ./gradlew clean build
        (Use ./gradlew clean build -x test to skip tests.)
      • After a successful build, navigate to build/libs/ and run:
        java -jar SmartHealth-1.0.0.jar

Common Issues & Fixes

  1. Database Connection Errors (e.g., JDBCConnectionException, driver not found, connection refused):

    • Verify database driver, URL, host, port, username, and password.
    • Ensure the database server is running and accessible.
  2. Mapper Class Dependency Issues (when running from IDE):

    • These are usually caused by missing generated MapperImpl classes. You can resolve this by either:
      a) Running

      ./gradlew clean build

      and checking if the MapperImpl classes are generated under
      build/generated/sources/annotationProcessor/java/main/com/ps/mapper/.
      If generated, the application should start. You may need to link source file as above location based on your IDE.

      b) Enabling Annotation Processing in your IDE settings.

    ⚑ Tip: If you frequently modify mapper interfaces, enabling annotation processing in your IDE is recommended. Otherwise, you’ll need to rebuild the project every time via Gradle.


Frontend (User & Admin)

  1. Simple Hosting

    • Copy the sh/ (User Frontend) and admin/ (Admin Frontend) folders to your hosting server.
    • Example: If you’re using XAMPP, place both folders inside \xampp\htdocs\.
    • Start Apache and access the applications via:
  2. Using Virtual Hosts (Recommended for cleaner URLs)

    • You can configure custom domain mappings for better accessibility.

    • Example: If your project resides in F:/Projects/SmartHealth and you’re using XAMPP, add the following configuration to
      \xampp\apache\conf\extra\httpd-vhosts.conf:

      <VirtualHost *:80>
          ServerName smarthealth
          DocumentRoot "F:/Projects/SmartHealth/sh"
          <Directory "F:/Projects/SmartHealth/sh">
              Options Indexes FollowSymLinks Includes ExecCGI
              AllowOverride All
              Require all granted
          </Directory>
      </VirtualHost>
      
      <VirtualHost *:80>
          ServerName admin.sh
          DocumentRoot "F:/Projects/SmartHealth/admin"
          <Directory "F:/Projects/SmartHealth/admin">
              Options Indexes FollowSymLinks Includes ExecCGI
              AllowOverride All
              Require all granted
          </Directory>
      </VirtualHost>
    • After saving the configuration:

      1. Restart Apache server.
      2. Update your system’s hosts file to map domains:
        127.0.0.1   smarthealth
        127.0.0.1   admin.sh
        
      3. Access the apps via:

    Note: Change BASE_API_URL value according to your backend configuration. You will found BASE_API_URL inside /sh/js/constant.js and /admin/assets/js/constant.js files.


✨ Features

πŸ”‘ Common

  • πŸ”’ Stateless session management using JWT
  • πŸ›‘οΈ Role-based access control (Doctor, Patient, Admin)
  • βœ… Secure Authentication & Authorization

πŸ‘©β€βš•οΈ Doctor Module

  • πŸ‘€ Account Management

    • πŸ“ Register, πŸ”‘ Login, πŸšͺ Logout
    • πŸ“Š Dashboard with key statistics
    • 🧾 Profile management (πŸ‘€ View & ✏️ Update profile, πŸ” Change password)
  • πŸ“… Availability Management

    • ⚑ Generate availability slots using multiple modes:
      • πŸ”„ AUTO (default auto generation)
      • πŸ“ CUSTOM_ONE_TIME
      • ♻️ CUSTOM_CONTINUOUS
      • βœ‹ MANUAL
    • πŸ”§ Update slot generation preferences anytime
    • πŸ—‘οΈ Bulk delete slots (with validations)
    • πŸ” View availability slots with filters & pagination
    • πŸ“– View detailed slot information
  • πŸ“† Appointment Management

    • πŸ‘€ View appointments with filters & pagination
    • πŸ“„ View appointment details
    • πŸ”„ Update appointment status (Approved βœ…, Completed 🎯, Cancelled ❌)
  • 🌴 Leave Management

    • ✍️ Apply for leave
    • πŸ“‘ View applied leaves with filters & pagination

πŸ§‘β€πŸ€β€πŸ§‘ Patient Module

  • πŸ‘€ Account Management

    • πŸ“ Register, πŸ”‘ Login, πŸšͺ Logout
    • πŸ“Š Dashboard with appointment statistics
    • 🧾 Profile management (πŸ‘€ View & ✏️ Update profile, πŸ” Change password)
  • πŸ” Doctor Search & Booking

    • πŸ‘¨β€βš•οΈ Search doctors with filters & pagination
    • πŸ“… View doctor availability slots
    • πŸ“Œ Book appointments for self or relatives (sub-profiles)
  • πŸ“† Appointment Management

    • πŸ‘€ View appointments with filters & pagination
    • πŸ“„ View appointment details
    • ❌ Cancel appointments

πŸ› οΈ Admin Module

  • πŸ‘€ Account Management

    • πŸ“ Register, πŸ”‘ Login, πŸšͺ Logout
    • πŸ“Š Dashboard with real-time statistics (users, slots, appointments, leaves, holidays)
  • πŸ‘₯ User Management

    • πŸ‘©β€βš•οΈ View doctors & πŸ§‘β€πŸ€β€πŸ§‘ patients with filters & pagination
    • πŸ”„ Activate / Deactivate users
    • πŸ“„ View detailed user profiles
  • πŸ“… Slot Management

    • πŸ‘€ View all availability slots with filters & pagination
    • πŸ—‘οΈ Delete slots
    • πŸ“– View slot details
  • πŸ“† Appointment Management

    • πŸ‘€ View all appointments with filters & pagination
    • πŸ“„ View appointment details
    • πŸ”„ Update appointment status
  • 🌴 Leave & Holiday Management

    • πŸ“‘ View leave requests (Doctors)
    • βœ… Approve / ❌ Reject leave requests
    • πŸŽ‰ Manage holidays (βž• Add / πŸ—‘οΈ Delete with pagination)

βš™οΈ Backend Highlights

  • πŸ” Spring Security β†’ Authentication & Authorization
  • πŸ”‘ JWT β†’ Secure stateless session management
  • πŸ“˜ Swagger UI β†’ API visualization & testing
  • πŸ—„οΈ Spring Data JPA β†’ Database interaction
  • 🌐 Spring Web β†’ RESTful API development
  • πŸ”„ MapStruct β†’ DTO ↔ Entity mapping
  • ✨ Lombok β†’ Boilerplate code reduction
  • πŸ“Š JaCoCo β†’ Test coverage reporting
  • πŸ§ͺ JUnit β†’ Unit & integration testing

πŸ“˜ Swagger UI

Swagger UI is integrated for interactive API documentation.
It allows you to:

  • πŸ“– Explore all available REST APIs
  • πŸ§ͺ Test endpoints directly from the browser
  • πŸ“‚ View request/response schemas and parameters

πŸ”— Access

Once your backend is running, open:
πŸ‘‰ http://localhost:9902/swagger-ui.html


⚠️ Important (JWT Authentication)

Most of our APIs require a JWT token in the request header:
Authorization: Bearer <your_token> Currently, the Swagger setup does not include an input field for headers, so you’ll need to configure Swagger/OpenAPI for header-based authentication before you can test secured endpoints directly from Swagger UI.
Until then, use an API client like Postman or cURL for testing JWT-protected APIs.


πŸ“Έ Screenshot

Swagger UI


πŸ“Š JaCoCo Test Report

We use JaCoCo to measure unit and integration test coverage across the project.
It provides detailed reports in both HTML and XML formats.

▢️ Generate Report

Run the following Gradle commands from the project root: Include jacocoTestReport at the end of command to generate test report.

# Clean, build, run tests and generate test report
./gradlew clean build jacocoTestReport

# Run tests and generate test report
./gradlew test jacocoTestReport

πŸ“‚ Report Location

After execution, you can find the report at: build/reports/jacoco/test/html/index.html. Open the file in your browser to explore detailed coverage (classes, methods, lines, branches).

πŸ“Έ Screenshot

Jacoco Test Report


πŸ§‘β€πŸ€β€πŸ§‘ Patient Module Screenshots

🏠 Patient Dashboard

  • Displays upcoming appointments and key statistics at a glance.
  • Provides a quick overview of bookings, completed visits, and cancellations.

πŸ“Έ Screenshot
Patient Dashboard


πŸ‘€ Patient Profile

  • View and update personal details (name, dob, height, weight, etc.).
  • Upload / change profile picture.
  • Update password for secure login.

πŸ“Έ Screenshot
Patient Profile Update Password


πŸ” Search Doctor

  • Search for doctors using filters (specialization, name, degree, availability, etc.).
  • Results are paginated for smooth browsing.

πŸ“Έ Screenshot
Search Doctor


πŸ“… Book Appointment

  • View doctor availability slots in real-time.
  • Select a preferred date & time to book.
  • Option to book for self or for a relative (sub-profile).

πŸ“Έ Screenshot View Available Slots Book Appointment


πŸ“† My Appointments

  • List of all appointments with filters & pagination.
  • View detailed appointment information.
  • Option to cancel appointment if needed.

πŸ“Έ Screenshot
My Appointments Appointment Details


πŸ‘©β€βš•οΈ Doctor Module Screenshots

🏠 Doctor Dashboard

  • Displays today’s appointments, slot statistics, and quick insights.
  • Helps doctors manage their day efficiently.

πŸ“Έ Screenshot
Doctor Dashboard


πŸ‘€ Doctor Profile

  • View and update personal details (name, dob, degree, experience, etc.).
  • Upload / change profile picture.
  • Update password for secure login.

πŸ“Έ Screenshot
Doctor Profile Update Password


πŸ“… Manage Availability

  • Generate availability slots using multiple modes:
    • πŸ”„ AUTO
    • πŸ“ CUSTOM_ONE_TIME
    • ♻️ CUSTOM_CONTINUOUS
    • βœ‹ MANUAL
  • View generated slots with filters & pagination.
  • Delete unwanted slots or update preferences anytime.

πŸ“Έ Screenshot
Generate Slots

Delete Slots

View Slots


πŸ“† My Appointments

  • View appointments booked by patients in available slots.
  • Access detailed information for each appointment.
  • Change appointment status (Approve βœ…, Complete 🎯, Cancel ❌).

πŸ“Έ Screenshot
Doctor Appointments Appointment Details


🌴 Leave Management

  • Apply for leave (single or multiple days).
  • View applied leaves with filters & pagination.
  • Leave requests are sent to Admin for approval/rejection.

πŸ“Έ Screenshot
Doctor Leaves


πŸ›‘οΈ Admin Module Screenshots

πŸ–₯️ Admin Dashboard

  • Displays overall platform statistics including doctors, patients, appointments, and system activity.
  • Provides quick insights for platform monitoring.

πŸ“Έ Screenshot
Admin Dashboard
Admin Dashboard


πŸ‘€ Admin Profile

  • View and update personal details (name).
  • Upload / change profile picture.
  • Update password for secure login.

πŸ“Έ Screenshot
Admin Profile Update Password


πŸ‘¨β€βš•οΈ Manage Doctors

  • View all registered doctors with filters & pagination.
  • Activate / Deactivate doctors.
  • Access detailed doctor profiles.

πŸ“Έ Screenshot
Manage Doctors
Doctor Details


πŸ§‘β€πŸ€β€πŸ§‘ Manage Patients

  • View all registered patients with filters & pagination.
  • Activate / Deactivate patients.
  • Access detailed patient profiles.

πŸ“Έ Screenshot
Manage Patients
Patient Details


πŸ“… Manage Slots

  • View all doctor availability slots.
  • Delete slots if required.
  • View details about slot.

πŸ“Έ Screenshot
Manage Slots
Slots Details


πŸ“‹ Manage Appointments

  • View all appointments across the platform.
  • Filter, sort, and paginate appointments.
  • Update appointment status: Approve, Cancel, Complete.
  • View Appointment details.

πŸ“Έ Screenshot
Manage Appointments
Appointment Details


πŸ–οΈ Manage Holidays

  • βž• Add holidays (festivals, national holidays, etc.).
  • ❌ Delete holidays.
  • Ensures no slots are generated on holidays.

πŸ“Έ Screenshot
Manage Holidays


🩺 Doctor Leave Management

  • βœ… Approve / ❌ Reject doctor leave requests.
  • On approval, system auto-cancels slots & appointments.
  • Maintains smooth doctor availability management.

πŸ“Έ Screenshot
Doctor Leave Management

About

SmartHealth is a healthcare management system with a Spring Boot backend and dual frontend apps (User portal + Admin portal). It provides features for patient management, appointments, records, and admin control.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published