Skip to content

FUHEKl/MedTun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MedTun - Complete Medical Appointment Platform for Tunisia

MedTun is a comprehensive web application that revolutionizes healthcare access in Tunisia by connecting patients with doctors, specialists, and medical facilities. The platform provides a complete ecosystem for medical appointment management, user administration, and healthcare services discovery.

๐Ÿš€ Key Features

๐Ÿ‘ฅ Multi-Role User System

  • Patients: Complete profile management with medical history
  • Doctors: Professional profiles with specialties, qualifications, and clinic information
  • Administrators: Full system control and management capabilities

๐Ÿ“… Advanced Appointment Management

  • Flexible Booking: Book appointments with preferred doctors
  • Status Tracking: Real-time appointment status (En attente, Confirmรฉ, Terminรฉ, Annulรฉ)
  • Cancellation System: Cancel appointments with detailed reasons
  • Complete History: View all past and upcoming appointments

๐Ÿฅ Doctor Discovery & Management

  • Comprehensive Directory: Search doctors by specialty, location, or name
  • Detailed Profiles: View doctor qualifications, experience, and clinic information
  • Specialty Icons: Consistent visual representation for all medical specialties
  • Location-based Search: Find doctors in specific cities

๐Ÿช Pharmacy Locator

  • Interactive Map: Find nearby pharmacies with precise locations
  • Contact Information: Access pharmacy details and contact info
  • Geographic Coverage: Comprehensive pharmacy database across Tunisia

๐Ÿ” Security & Authentication

  • JWT Authentication: Secure token-based authentication system
  • Role-based Access Control: Different permissions for patients, doctors, and admins
  • Protected Routes: Secure access to sensitive areas

๐Ÿ› ๏ธ Admin Interface

  • Complete System Control: Manage all users, appointments, and system data
  • User Management: Create, edit, and delete users of any role
  • Appointment Oversight: Monitor and manage all appointments
  • Statistics Dashboard: Real-time insights and system analytics
  • Bulk Operations: Efficient management of large datasets

๐Ÿ—๏ธ Technical Architecture

Frontend (React + TypeScript)

  • Framework: React 18 with TypeScript for type safety
  • Styling: Bootstrap 5 for responsive design and modern UI
  • Routing: React Router for seamless navigation
  • State Management: React Context for authentication and global state
  • API Integration: Axios for HTTP requests with interceptors
  • Form Handling: Controlled components with validation

Backend (Spring Boot + Java)

  • Framework: Spring Boot 3.x with Java
  • Security: Spring Security with JWT authentication
  • Database: JPA/Hibernate with MySQL
  • API Design: RESTful APIs with proper HTTP status codes
  • Architecture: Layered architecture (Controller โ†’ Service โ†’ Repository)
  • Password Security: BCrypt encryption for secure password storage

Database Design

  • Relational Model: Well-structured MySQL database
  • Entity Relationships: Proper foreign key relationships
  • Data Integrity: Constraints and validations
  • Performance: Optimized queries and indexing

๐Ÿ“ Project Structure

Frontend Architecture

frontend/
โ”œโ”€โ”€ public/                    # Static assets
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/           # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ admin/           # Admin-specific components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminDashboard.tsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminUsersManagement.tsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AdminAppointmentsManagement.tsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AdminCreateUser.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ layout/          # Layout components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Header.tsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Footer.tsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Layout.tsx
โ”‚   โ”‚   โ””โ”€โ”€ common/          # Shared components
โ”‚   โ”œโ”€โ”€ contexts/            # React contexts
โ”‚   โ”‚   โ””โ”€โ”€ AuthContext.tsx  # Authentication state management
โ”‚   โ”œโ”€โ”€ pages/               # Page components
โ”‚   โ”‚   โ”œโ”€โ”€ admin/           # Admin pages
โ”‚   โ”‚   โ”œโ”€โ”€ auth/            # Authentication pages
โ”‚   โ”‚   โ”œโ”€โ”€ HomePage.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ DoctorsPage.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ AppointmentsPage.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ DashboardPage.tsx
โ”‚   โ”‚   โ””โ”€โ”€ PharmaciesPage.tsx
โ”‚   โ”œโ”€โ”€ styles/              # Global styles
โ”‚   โ””โ”€โ”€ types/               # TypeScript definitions
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ tsconfig.json

Backend Architecture

backend/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main/
โ”‚   โ”‚   โ”œโ”€โ”€ java/com/example/backend/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ controller/     # REST endpoints
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AuthController.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ UserController.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ AppointmentController.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DoctorController.java
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AdminController.java
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ model/          # Entity classes
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ User.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Patient.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Doctor.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Admin.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Appointment.java
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Specialty.java
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Pharmacy.java
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ repository/     # Data access layer
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ service/        # Business logic
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config/         # Configuration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ security/       # Authentication & authorization
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ enums/          # Enumerations
โ”‚   โ”‚   โ””โ”€โ”€ resources/
โ”‚   โ”‚       โ”œโ”€โ”€ application.properties
โ”‚   โ”‚       โ””โ”€โ”€ sample-data/    # Initial data scripts
โ”‚   โ””โ”€โ”€ test/                   # Test classes
โ”œโ”€โ”€ pom.xml
โ””โ”€โ”€ mvnw.cmd

๐Ÿ› ๏ธ Installation & Setup

Prerequisites

  • Node.js 16+ and npm
  • Java 11 or higher
  • MySQL 8.0+
  • Maven (included via wrapper)

Database Setup

  1. Create MySQL database:
CREATE DATABASE medtun_db;
  1. Update database configuration in backend/src/main/resources/application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/medtun_db
spring.datasource.username=your_username
spring.datasource.password=your_password

Backend Setup

cd backend
./mvnw clean install
./mvnw spring-boot:run

The API will be available at http://localhost:8080/api

Frontend Setup

cd frontend
npm install
npm start

The application will be available at http://localhost:3000

๐Ÿ”ง Admin Access

Creating Admin User

  1. Start the backend server
  2. Use your database management tool to insert an admin user:
INSERT INTO users (email, password, role, first_name, last_name, phone_number, created_at, updated_at) 
VALUES ('admin@medtun.com', '$2a$10$encoded_password_hash', 'ADMIN', 'Admin', 'User', '+216 XX XXX XXX', NOW(), NOW());

Accessing Admin Interface

  1. Login with admin credentials at http://localhost:3000/login
  2. Navigate to http://localhost:3000/admin or click the "Administration" link in the navigation
  3. Access complete system management features

๐ŸŽฏ Admin Interface Features

Dashboard

  • System Statistics: Total users, appointments, and system metrics
  • Real-time Data: Live updates of system status
  • Quick Actions: Fast access to common administrative tasks

User Management

  • View All Users: Paginated list with role filtering
  • Edit Users: Modify user information and roles
  • Delete Users: Remove users from the system
  • Create Users: Add new patients, doctors, or admins

Appointment Management

  • View All Appointments: Complete appointment oversight
  • Status Management: Change appointment statuses
  • Filter & Search: Find specific appointments quickly
  • Bulk Operations: Manage multiple appointments efficiently

๐ŸŒŸ Key Implemented Features

Recent Enhancements

  1. Appointment Cancellation System

    • Added cancellation reasons tracking
    • Display cancellation details in appointment history
    • Status management for cancelled appointments
  2. Visual Consistency

    • Standardized specialty icons across the platform
    • Consistent UI/UX design patterns
    • Responsive design for all devices
  3. Form Optimization

    • Removed duplicate fields in patient registration
    • Streamlined user input processes
    • Enhanced form validation
  4. Complete Admin System

    • Full CRUD operations for all entities
    • Role-based access control
    • Comprehensive system monitoring

๐Ÿ”’ Security Features

  • JWT Authentication: Secure token-based authentication
  • Password Encryption: BCrypt hashing for all passwords
  • Role-based Authorization: Different access levels for each user type
  • Protected API Endpoints: Secure backend routes
  • Input Validation: Frontend and backend validation
  • CORS Configuration: Secure cross-origin requests

๐Ÿš€ API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration

User Management

  • GET /api/users/profile - Get current user profile
  • PUT /api/users/profile - Update user profile

Appointments

  • GET /api/appointments - Get user appointments
  • POST /api/appointments - Create new appointment
  • PUT /api/appointments/{id}/cancel - Cancel appointment

Admin Endpoints

  • GET /api/admin/dashboard - Get system statistics
  • GET /api/admin/users - Get all users with pagination
  • POST /api/admin/users - Create new user
  • DELETE /api/admin/users/{id} - Delete user
  • GET /api/admin/appointments - Get all appointments

๐ŸŽจ UI/UX Features

  • Responsive Design: Works on desktop, tablet, and mobile
  • Modern Interface: Clean and intuitive user interface
  • Accessibility: WCAG compliant design elements
  • Loading States: User feedback during API calls
  • Error Handling: Graceful error messages and recovery
  • Consistent Branding: Unified design language throughout

๐Ÿ”ฎ Future Enhancements

  • Real-time Notifications: Push notifications for appointments
  • Video Consultations: Telemedicine integration
  • Payment Gateway: Online payment for consultations
  • Mobile App: Native mobile applications
  • AI Recommendations: Smart doctor and specialty recommendations
  • Multi-language Support: Arabic and French language options

๐Ÿ“Š Performance & Scalability

  • Optimized Queries: Efficient database operations
  • Pagination: Handle large datasets efficiently
  • Lazy Loading: Component-based code splitting
  • Caching Strategy: Strategic caching for improved performance
  • Scalable Architecture: Designed for horizontal scaling

๐Ÿค Contributing

This project follows standard development practices:

  • Clean code principles
  • Comprehensive error handling
  • Proper documentation
  • Type safety with TypeScript
  • RESTful API design

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published