Skip to content

dan-kingo/telemedicine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telemedicine Web Application

A comprehensive virtual consultation system connecting patients and doctors. Built with PHP, MySQL, JavaScript, HTML, and CSS with a modern, responsive design.

🖼️ Project Screenshots

🔐 Dashboard

Login Screenshot


🏠 Find Doctor Page

Dashboard Screenshot


👤 Health Records Page

Profile Screenshot


⚙️ Appointements Page

Settings Screenshot

🌟 Features

Patient Features

  • ✅ User registration and secure login
  • ✅ Schedule appointments with available doctors
  • ✅ Upload and manage medical history files (PDF, JPG, PNG)
  • ✅ View appointment status and history
  • ✅ Access and download prescriptions
  • ✅ Responsive dashboard with appointment overview

Doctor Features

  • ✅ Secure doctor login and dashboard
  • ✅ View and manage assigned appointments
  • ✅ Accept, reject, or mark appointments as completed
  • ✅ Access patient medical history and files
  • ✅ Create and manage prescriptions
  • ✅ Download patient files and prescription reports
  • ✅ Real-time appointment statistics

System Features

  • ✅ Role-based access control (Patient/Doctor)
  • ✅ Session-based authentication
  • ✅ File upload and download management
  • ✅ PDF prescription generation
  • ✅ Responsive design for all devices
  • ✅ Secure file handling and validation

📁 Project Structure

telemedicine-app/
├── backend/
│   ├── appointments/
│   │   ├── book.php              # Patient appointment booking
│   │   ├── list.php              # List appointments by role
│   │   ├── respond.php           # Doctor appointment responses
│   │   └── view.php              # View appointment details
│   ├── auth/
│   │   ├── login.php             # User authentication
│   │   ├── logout.php            # Session termination
│   │   └── register.php          # User registration
│   ├── config/
│   │   └── db.php                # Database configuration
│   ├── history/
│   │   ├── fetch.php             # Fetch medical history
│   │   ├── upload.php            # Upload medical files
│   │   └── view.php              # View/download medical files
│   ├── middleware/
│   │   └── auth.php              # Authentication middleware
│   ├── prescriptions/
│   │   ├── create.php            # Create prescriptions
│   │   ├── index.php             # List prescriptions
│   │   └── view.php              # View/download prescriptions
│   ├── users/
│   │   ├── doctors.php           # List available doctors
│   │   └── profile.php           # User profile management
│   └── utils/
│       └── get_dashboard_data.php # Dashboard statistics
├── frontend/
│   ├── assets/
│   │   ├── css/
│   │   │   └── style.css         # Main stylesheet
│   │   └── js/
│   │       ├── appointments.js   # Appointment functionality
│   │       ├── auth.js           # Authentication scripts
│   │       ├── history.js        # Medical history scripts
│   │       ├── prescriptions.js  # Prescription scripts
│   │       ├── script.js         # Main JavaScript
│   │       ├── session.js        # Session management
│   │       └── utils.js          # Utility functions
│   ├── components/
│   │   └── navbar.html           # Reusable navigation component
│   ├── doctor/
│   │   ├── dashboard.html        # Doctor dashboard
│   │   ├── prescriptions.html    # Prescription management
│   │   ├── respond-appointment.html # Appointment management
│   │   └── view-history.html     # Patient history viewer
│   └── patient/
│       ├── dashboard.html        # Patient dashboard
│       ├── medical-history.html  # Medical history management
│       ├── prescriptions.html    # View prescriptions
│       └── schedule-appointment.html # Book appointments
├── lib/
│   └── fpdf/                     # PDF generation library
│       ├── font/                 # Font files for PDF
│       └── fpdf.php              # Main FPDF class
├── uploads/
│   └── history/                  # Medical file storage
├── index.html                    # Landing page
├── login.html                    # Login page
├── register.html                 # Registration page
└── README.md                     # Project documentation

🛠️ Technology Stack

  • Backend: PHP 8.0+
  • Database: MySQL
  • Frontend: HTML5, CSS3, JavaScript (ES6+)
  • PDF Generation: FPDF Library
  • Server: Apache (XAMPP/WAMP/LAMP)
  • Authentication: PHP Sessions
  • File Upload: PHP File Handling

⚙️ Requirements

  • PHP >= 8.0
  • MySQL >= 5.7
  • Apache Web Server
  • Modern web browser (Chrome, Firefox, Safari, Edge)
  • Minimum 100MB disk space

📦 Installation & Setup

1. Clone the Repository

git clone https://github.com/dan-kingo/telemedicine-app.git
cd telemedicine-app

2. Database Setup

Create a MySQL database and import the schema:

CREATE DATABASE telemedicine;
USE telemedicine;

-- Users table
CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    full_name VARCHAR(100) NOT NULL,
    email VARCHAR(100) UNIQUE NOT NULL,
    password VARCHAR(255) NOT NULL,
    role ENUM('patient', 'doctor') NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Appointments table
CREATE TABLE appointments (
    id INT AUTO_INCREMENT PRIMARY KEY,
    patient_id INT NOT NULL,
    doctor_id INT NOT NULL,
    appointment_date DATE NOT NULL,
    appointment_time TIME NOT NULL,
    reason TEXT,
    status ENUM('pending', 'confirmed', 'cancelled', 'completed') DEFAULT 'pending',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (patient_id) REFERENCES users(id) ON DELETE CASCADE,
    FOREIGN KEY (doctor_id) REFERENCES users(id) ON DELETE CASCADE
);

-- Medical history table
CREATE TABLE medical_history (
    id INT AUTO_INCREMENT PRIMARY KEY,
    patient_id INT NOT NULL,
    file_name VARCHAR(255) NOT NULL,
    file_path VARCHAR(500) NOT NULL,
    description TEXT,
    uploaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (patient_id) REFERENCES users(id) ON DELETE CASCADE
);

-- Prescriptions table
CREATE TABLE prescriptions (
    id INT AUTO_INCREMENT PRIMARY KEY,
    appointment_id INT NOT NULL,
    doctor_id INT NOT NULL,
    patient_id INT NOT NULL,
    prescription_text TEXT NOT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (appointment_id) REFERENCES appointments(id) ON DELETE CASCADE,
    FOREIGN KEY (doctor_id) REFERENCES users(id) ON DELETE CASCADE,
    FOREIGN KEY (patient_id) REFERENCES users(id) ON DELETE CASCADE
);

3. Configure Database Connection

Update backend/config/db.php with your database credentials:

<?php
$host = 'localhost';
$dbname = 'telemedicine';
$username = 'root';      // Your MySQL username
$password = '';          // Your MySQL password
?>

4. Set Up File Permissions

Ensure the uploads directory is writable:

chmod -R 755 uploads/
mkdir -p uploads/history
chmod -R 755 uploads/history

5. Start the Server

Using XAMPP:

  1. Start Apache and MySQL services
  2. Place the project in htdocs/telemedicine-app/
  3. Access via http://localhost/telemedicine-app/

Using PHP built-in server:

php -S localhost:8000

🚀 Usage Guide

For Patients

  1. Registration: Create an account by selecting "Patient" role
  2. Login: Access your dashboard with email and password
  3. Book Appointment:
    • Select a doctor from the dropdown
    • Choose date and time
    • Provide reason for visit
  4. Upload Medical History:
    • Navigate to Medical History section
    • Upload PDF, JPG, or PNG files
    • Add descriptions for each file
  5. View Prescriptions: Access all prescriptions from doctors

For Doctors

  1. Login: Access doctor dashboard with credentials
  2. Manage Appointments:
    • View all assigned appointments
    • Accept, reject, or mark as completed
  3. View Patient History:
    • Access patient medical files
    • Download files for review
  4. Create Prescriptions:
    • Write prescriptions for completed appointments
    • Generate PDF reports

🔐 Security Features

  • Password Hashing: BCrypt encryption for user passwords
  • Session Management: Secure PHP session handling
  • Role-Based Access: Middleware protection for routes
  • File Validation: Restricted file types and size limits
  • SQL Injection Protection: Prepared statements
  • XSS Prevention: Input sanitization and validation

📱 Responsive Design

The application is fully responsive and works on:

  • Desktop computers (1200px+)
  • Tablets (768px - 1199px)
  • Mobile phones (320px - 767px)

🔧 API Endpoints

Authentication

  • POST /backend/auth/register.php - User registration
  • POST /backend/auth/login.php - User login
  • POST /backend/auth/logout.php - User logout

Appointments

  • POST /backend/appointments/book.php - Book appointment (Patient)
  • GET /backend/appointments/list.php - List appointments
  • POST /backend/appointments/respond.php - Respond to appointment (Doctor)

Medical History

  • POST /backend/history/upload.php - Upload medical file (Patient)
  • GET /backend/history/fetch.php - Fetch medical history
  • GET /backend/history/view.php - View/download files

Prescriptions

  • POST /backend/prescriptions/create.php - Create prescription (Doctor)
  • GET /backend/prescriptions/index.php - List prescriptions
  • GET /backend/prescriptions/view.php - View/download prescriptions

Users

  • GET /backend/users/doctors.php - List available doctors
  • GET /backend/users/profile.php - Get user profile

🐛 Troubleshooting

Common Issues

  1. Database Connection Error

    • Check database credentials in backend/config/db.php
    • Ensure MySQL service is running
  2. File Upload Issues

    • Verify uploads/history/ directory permissions
    • Check PHP upload_max_filesize and post_max_size settings
  3. Session Issues

    • Clear browser cookies and cache
    • Check PHP session configuration
  4. PDF Generation Issues

    • Ensure FPDF library is properly included
    • Check file permissions for PDF output

🔄 Future Enhancements

  • Video consultation integration
  • Real-time chat between patients and doctors
  • Email notifications for appointments
  • SMS reminders
  • Payment gateway integration
  • Multi-language support
  • Advanced reporting and analytics
  • Mobile app development

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-feature)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/new-feature)
  5. Create a Pull Request

📞 Support

For support and questions:


Note: This is a demonstration project. For production use, implement additional security measures, error handling, and testing protocols.

About

A PHP-based platform for remote healthcare consultations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published