- Overview
- Features
- Technologies Used
- Project Structure
- Installation
- Prerequisites
- Database Setup
- Backend Setup
- Frontend Setup
- Usage
- Contributing
- Contact
- Quick Reference
- Notes
The Healthcare Management System is a comprehensive web application designed to streamline interactions between patients and healthcare providers. It facilitates user registration, profile management, appointment scheduling, messaging, treatment tracking, and blood test management. The system leverages modern technologies like React for the frontend, Node.js with Express for the backend, and Docker for containerization, ensuring a scalable and maintainable architecture.
- User Authentication: Secure registration and login for users and administrators using JWT.
- Profile Management: Users and doctors can create and update their profiles.
- Appointment Scheduling: Users can book appointments with doctors, and doctors can manage their schedules.
- Messaging System: Real-time messaging between patients and doctors.
- Treatment Tracking: Doctors can assign treatments to patients, and users can view their treatment history.
- Blood Test Management: Users can submit blood test results, and doctors can view and analyze them.
- Admin Dashboard: Administrators can manage users, doctors, and oversee the system's operations.
- Responsive Design: Built with React and Bootstrap to ensure compatibility across devices.
- React: Frontend library for building user interfaces.
- Bootstrap: CSS framework for responsive design.
- Webpack: Module bundler for managing assets and dependencies.
- ESLint & Prettier: Tools for maintaining code quality and consistency.
- React Router: For client-side routing.
- Axios: For handling HTTP requests.
- PropTypes: For type-checking of props.
- React Bootstrap: UI components for React.
- Node.js & Express: Backend runtime and framework.
- MySQL: Relational database for data storage.
- jsonwebtoken (JWT): For secure authentication.
- Docker: Containerization of the backend services.
- mysql2: MySQL client for Node.js.
- dotenv: For managing environment variables.
- CORS: To enable Cross-Origin Resource Sharing.
- ESLint: For maintaining code quality.
- RxJS: For handling asynchronous data streams in frontend API calls.
- RapidAPI Services:
- Geocoding: Forward-Reverse Geocoding API.
- Fitness Calculator: BMI calculation API.
- Distance Calculation: Driving distance API.
├── frontend
│ ├── package.json
│ ├── webpack.config.js
│ ├── src
│ │ ├── components
│ │ │ ├── Bloodtests
│ │ │ │ └── Bloodtests.js
│ │ │ ├── ... (other components)
│ │ ├── contexts
│ │ │ └── auth.js
│ │ ├── hooks
│ │ │ └── useApp.js
│ │ ├── utils
│ │ │ └── api.js
│ │ ├── index.js
│ │ ├── App.js
│ │ └── index.css
│ └── public
│ └── index.html
├── backend
│ ├── Dockerfile
│ ├── docker-compose.yml
│ ├── package.json
│ ├── server.js
│ ├── config
│ │ └── mysql.config.js
│ ├── controller
│ │ ├── bloodtest.js
│ │ ├── doctors.js
│ │ └── ... (other controllers)
│ ├── routes.js
│ └── queries
│ └── queries.js
├── database
│ └── hy359.sql
└── README.md
- Node.js & npm: Ensure you have Node.js and npm installed. Download Node.js
- Docker: Required for backend containerization. Download Docker
- Git: Version control system. Download Git
- MySQL: For local database setup (if not using Docker-managed MySQL).
The backend is configured to use a MySQL database via Docker. Ensure Docker is installed and running.
If you prefer to set up MySQL manually:
- Install MySQL: Download MySQL
- Create Database and Tables:
- Import the provided
hy359.sqlfile located in thedatabasedirectory.
mysql -u your_username -p your_database_name < database/hy359.sql - Import the provided
- Configure Environment Variables:
- Update the
.envfile with your MySQL credentials.
- Update the
- Navigate to the Backend Directory:
cd backend - Create Environment Variables:
- Create a
.envfile in the backend directory with the following variables:
DB_HOST=your_database_host DB_USER=your_database_user DB_PASSWORD=your_database_password DB_NAME=hy359 DB_CONNECTION_LIMIT=10 SERVER_PORT=3000 JWT_SECRET=your_jwt_secret- Note: Replace the placeholder values with your actual database credentials and desired configurations.
- Create a
- Build and Run the Backend Containers:
docker-compose up --build
- This command builds the Docker images and starts the backend services.
- The backend runs on
http://localhost:3000by default.
Ensure your docker-compose.yml includes the MySQL service and links it appropriately. An example configuration:
version: '3.8'
services:
backend:
build: .
ports:
- "3000:3000"
environment:
- DB_HOST=mysql
- DB_USER=your_db_user
- DB_PASSWORD=your_db_password
- DB_NAME=hy359
- DB_CONNECTION_LIMIT=10
- SERVER_PORT=3000
- JWT_SECRET=your_jwt_secret
depends_on:
- mysql
mysql:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: your_root_password
MYSQL_DATABASE: hy359
MYSQL_USER: your_db_user
MYSQL_PASSWORD: your_db_password
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
volumes:
db_data:- Navigate to the Frontend Directory:
cd frontend - Install Dependencies:
npm install
- Configure Environment Variables (If Applicable):
- If your frontend requires environment variables (e.g., API endpoints), create a
.envfile in the frontend directory.
REACT_APP_API_BASE_URL=http://localhost:3000 - If your frontend requires environment variables (e.g., API endpoints), create a
- Run the Frontend Application:
npm run start
- Note: Ensure that
node_modulesare installed before running the application. - The frontend runs on
http://localhost:8080by default.
- Note: Ensure that
-
Access the Application:
- Open your browser and navigate to
http://localhost:8080to access the frontend.
- Open your browser and navigate to
-
Register as a User or Doctor:
- Navigate to the registration page to create a new account.
- Fill in the required details and submit the form.
-
Login:
- Use your credentials to log in.
- Admins can log in through the admin login page.
-
Manage Appointments:
- Users can book appointments with available doctors.
- Doctors can view and manage their appointment schedules.
-
Messaging:
- Engage in real-time messaging with doctors or patients.
-
Track Treatments and Blood Tests:
- Doctors can assign treatments and view patient blood test results.
- Users can view their treatment history and submit blood test results.
-
Admin Dashboard:
- Administrators can manage users, doctors, and oversee system operations.
Contributions are welcome! Please follow these steps:
-
Fork the Repository
-
Create a Feature Branch:
git checkout -b feature/YourFeature
-
Commit Your Changes:
git commit -m "Add YourFeature" -
Push to the Branch:
git push origin feature/YourFeature
-
Open a Pull Request
Please ensure that your code adheres to the project's coding standards and passes all linting checks.
For any questions, issues, or contributions, please reach out:
- Email: csd3933@csd.uoc.gr
-
Start Frontend:
cd frontend npm install npm run start -
Start Backend:
cd backend docker-compose up --build -
Frontend Build Commands:
- Development:
webpack serve --open - Production:
npm run build(to be defined)
- Development:
-
Backend Dependencies:
- Express, MySQL, JWT, CORS, dotenv, etc.
-
Frontend Dependencies:
- React, Bootstrap, Webpack, Babel, ESLint, Prettier, etc.
-
Environment Variables:
- Ensure that environment variables for the backend (like database credentials and JWT secrets) are properly configured using
.envfiles or Docker secrets.
- Ensure that environment variables for the backend (like database credentials and JWT secrets) are properly configured using
-
Custom Webpack Setup:
- The project avoids using
npx create-react-appto minimize dependencies, offering a custom Webpack setup.
- The project avoids using
-
Code Quality:
- ESLint and Prettier are configured for code quality and consistency.
-
Dockerization:
- The backend is fully containerized using Docker, facilitating easy deployment and scalability.
-
Feature Implementation:
- Most admin functionalities are operational.
- User and doctor profiles, appointment management, messaging, and blood test submissions are fully implemented.
- Some features like treatment visualization and appointment reminders are pending due to time constraints.
-
Bug Handling:
- Certain components, such as the new treatment feature, are present but may have unresolved bugs and are not fully functional.
-
Localization:
- Parts of the project documentation and comments are in Greek, reflecting the development context.
-
Database Configuration:
- The backend uses a MySQL database with connection pooling for efficient resource management. Queries are organized in a separate module for maintainability.
-
Authentication:
- JWT is used for securing API endpoints. Middleware is implemented to verify tokens and manage user roles (e.g., admin, doctor, user).
-
API Endpoints:
- The backend exposes various endpoints for managing users, doctors, appointments, blood tests, treatments, and messaging. Protected routes ensure that only authorized users can access sensitive operations.
-
Frontend Components:
- The React frontend is structured with reusable components, context for authentication state management, and hooks for handling application logic. Forms are validated, and user feedback is provided through alerts and messages.
-
API Keys:
- API keys used for third-party services (e.g., RapidAPI) should be secured and managed via environment variables. Do not expose actual API keys in the codebase.
-
Security Considerations:
- Passwords should be hashed before storage (e.g., using bcrypt).
- Implement proper validation and sanitization to prevent SQL injection and other vulnerabilities.
- Use HTTPS in production environments to secure data transmission.