Skip to content

Latest commit

Β 

History

33 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Medical Prescription System

A comprehensive medical prescription management system built with React frontend and Spring Boot backend. This system allows healthcare professionals to search for medicines, create prescriptions, and generate shareable prescription receipts with unique hash-based links.

πŸ₯ Features

  • Medicine Search: Advanced search functionality to find medicines by name, category, or active ingredients
  • Prescription Management: Create and manage medical prescriptions with multiple medicines
  • Receipt Generation: Generate unique prescription receipts with shareable hash-based links
  • User Authentication: Secure JWT-based authentication system with refresh token support
  • Professional Interface: Clean, modern UI designed for healthcare professionals
  • Prescription Notes: Add specific usage instructions for each medicine

πŸ› οΈ Tech Stack

Frontend

  • React 18+ - Modern JavaScript framework
  • Redux Toolkit - State management
  • React Router - Navigation and routing
  • Axios - HTTP client for API calls
  • CSS3 - Custom styling

Backend

  • Spring Boot 3.x - Java framework
  • Spring Security - Authentication and authorization
  • JWT (JSON Web Tokens) - Secure authentication
  • JPA/Hibernate - Database ORM
  • MySQL/PostgreSQL - Database (configurable)
  • Maven - Dependency management

πŸ“ Project Structure

medical-prescription-system/
β”œβ”€β”€ frontend/                 # React application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ Redux/          # Redux store and slices
β”‚   β”‚   β”œβ”€β”€ Service/        # API service layer
β”‚   β”‚   └── css/           # Stylesheets
β”œβ”€β”€ backend/                 # Spring Boot application
β”‚   β”œβ”€β”€ src/main/java/com/reciept/backend/
β”‚   β”‚   β”œβ”€β”€ controller/     # REST controllers
β”‚   β”‚   β”œβ”€β”€ service/        # Business logic layer
β”‚   β”‚   β”œβ”€β”€ entity/         # JPA entities
β”‚   β”‚   β”œβ”€β”€ repository/     # Data access layer
β”‚   β”‚   β”œβ”€β”€ dto/           # Data transfer objects
β”‚   β”‚   └── security/      # Security configuration
β”‚   └── pom.xml            # Maven dependencies
└── README.md

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • Java 17 or higher
  • Maven 3.6+
  • MySQL or PostgreSQL database

Backend Setup

  1. Clone the repository

    git clone <repository-url>
    cd medical-prescription-system/backend
  2. Configure Database

    Update application.properties or application.yml:

    spring.datasource.url=jdbc:mysql://localhost:3306/prescription_db
    spring.datasource.username=your_username
    spring.datasource.password=your_password
    spring.jpa.hibernate.ddl-auto=update
    spring.jpa.show-sql=true
    
    # JWT Configuration
    jwt.secret=your-secret-key
    jwt.expiration=86400000
  3. Install Dependencies & Run

    mvn clean install
    mvn spring-boot:run

    The backend server will start on http://localhost:8080

  4. Database Schema

    The application will automatically create the following tables:

    • users - User authentication data
    • medicines - Medicine catalog
    • prescriptions - Prescription records
    • prescription_medicines - Many-to-many relationship
    • refresh_tokens - JWT refresh tokens

Frontend Setup

  1. Navigate to frontend directory

    cd ../frontend
  2. Install Dependencies

    npm install
    # or
    yarn install
  3. Configure API Base URL

    Update the API base URL in src/Service/api.js:

    const API_BASE_URL = 'http://localhost:8080';
  4. Start Development Server

    npm start
    # or
    yarn start

    The frontend will start on http://localhost:3000

πŸ”§ API Endpoints

Authentication

  • POST /register - User registration
  • POST /authenticate - User login
  • POST /refresh-access - Refresh access token

Medicine Management

  • GET /medicine?keyword={search_term} - Search medicines

Prescription Management

  • POST /save/medicine - Create new prescription
  • GET /get-prescription?hashId={hash} - Get prescription by hash ID

πŸ’‘ How It Works

1. User Authentication

  • Users register/login using email and password
  • JWT tokens are issued for secure API access
  • Refresh tokens ensure seamless user experience

2. Medicine Search

  • Healthcare professionals search for medicines using keywords
  • Real-time search with debounced API calls
  • Results show medicine name, category, and dosage form

3. Prescription Creation

  • Select multiple medicines from search results
  • Add specific usage instructions for each medicine
  • Create prescription with unique hash ID

4. Receipt Generation

  • Each prescription gets a unique 8-character hash ID
  • Shareable links: /receipt/{hashId}
  • Professional receipt format with all prescription details

5. Data Flow

User Search β†’ Medicine Selection β†’ Add Notes β†’ Create Prescription β†’ Generate Receipt β†’ Share Link

πŸ” Security Features

  • JWT Authentication: Secure token-based authentication
  • Password Encryption: BCrypt password hashing
  • Refresh Tokens: Automatic token renewal
  • CORS Configuration: Cross-origin request handling
  • Input Validation: Server-side request validation

🎨 UI/UX Features

  • Responsive Design: Works on desktop and mobile devices
  • Professional Interface: Clean, medical-focused design
  • Real-time Search: Instant medicine search results
  • Loading States: User-friendly loading indicators
  • Error Handling: Graceful error messages
  • Intuitive Navigation: Easy-to-use interface for healthcare professionals

πŸ“Š Database Schema

Key Entities

  • User: Healthcare professional accounts
  • Medicine: Medicine catalog with categories and dosage forms
  • Prescription: Prescription records with hash IDs
  • RefreshToken: JWT refresh token management

Relationships

  • User β†’ Prescriptions (One-to-Many)
  • Prescription β†’ Medicines (Many-to-Many)
  • User β†’ RefreshTokens (One-to-Many)

πŸš€ Deployment

Backend Deployment

  1. Build the application: mvn clean package
  2. Deploy the JAR file to your server
  3. Configure production database settings
  4. Set up reverse proxy (Nginx) if needed

Frontend Deployment

  1. Build for production: npm run build
  2. Deploy the build folder to web server
  3. Configure API endpoints for production
  4. Set up HTTPS for security

🀝 Contributing

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

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

πŸ†˜ Support

For support and questions:

  • Create an issue in the repository
  • Contact the development team
  • Check the documentation

Note: This system is designed for educational and demonstration purposes. For production use in medical environments, ensure compliance with healthcare regulations like HIPAA, GDPR, and local medical data protection laws.

About

This system allows healthcare professionals to search for medicines, create prescriptions, and generate shareable prescription receipts with unique hash-based links.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages