An enterprise-grade, doctor-first Hospital & Clinic Management SaaS platform designed by CodeHype Tech Labs. Built on a secure multi-tenant architecture with 31 PostgreSQL database models, 70+ REST API endpoints, 148+ automated integration tests, role-aware JhaMed AI Assistant with 20 backend domain tools, native Android patient application, Razorpay payment gateway, dynamic slot concurrency row-locking, live sequential queue tokens, digital Rx letterhead designer, and automated staff payroll hub.
JhaMed HMS is an enterprise-grade, doctor-first Hospital & Clinic Management SaaS platform designed by CodeHype Tech Labs. Built on a secure multi-tenant architecture, it provides every healthcare practitioner with an isolated, branded, and end-to-end digital practice environment while centralizing SaaS governance, subscription packaging, and security oversight under a single administrative umbrella.
┌────────────────────────────────────────────────────────┐
│ JhaMed HMS Core │
│ (Flask 3 · SQLAlchemy · PostgreSQL · REST APIs v1) │
└───────────────────────────┬────────────────────────────┘
│
┌────────────────────────────────────────┼────────────────────────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────────────────────┐ ┌─────────────────────────────────┐ ┌────────────────────────────────┐
│ Platform Administration │ │ Multi-Tenant Doctor │ │ Public & Patient Portals │
│ • Doctor Vetting & Approval │ │ Workspaces (Isolated) │ │ • Dedicated /dr/slug Sites │
│ • 10-Digit Recovery Workflow │ │ • Queue & Sequential Tokens │ │ • Native Android Mobile APK │
│ • Granular Feature Overrides │ │ • Digital Rx & Letterheads │ │ • Live Queue Position & Wait│
│ • Subscription Periods (FIFO)│ │ • Multi-Session Courses │ │ • Razorpay Online Advance │
│ • Contact Inquiries & Audits │ │ • Staff Attendance & Payroll│ │ • JhaMed AI Patient Copilot │
│ │ │ • 30-Day Internal Team Chat │ │ • GST Invoices & PDF Rx │
│ │ │ • Pharmacy & Stock Manager │ │ │
└─────────────────────────────────┘ └─────────────────────────────────┘ └─────────────────────────────────┘
Each doctor operates in their own autonomous workspace with customized consultation fees, session intervals, staff roles, and branded letterhead pads.
Instant high-speed public clinic webpage generated under /dr/doctor-slug alongside native Android APK support for direct patient engagement.
SuperAdmin controls medical council doctor vetting, multi-tier subscription billing, feature entitlement flags, 10-digit emergency recovery IDs, and JhaMed AI tools.
The platform enforces rigorous role boundaries across 4 core stakeholder portals and an embedded AI Assistant, each tailored with specialized workflows, interfaces, and contextual processors.
DoctorSubscriptionPeriod), eliminating plan overwriting and preventing revenue leakage.
/dr/doctor-slug): Professional doctor-branded public microsite containing clinic bio, timings, address map, treatment catalogs, and instant online booking.
The backbone of JhaMed HMS comprises 10 custom-developed domain engines designed for high concurrency, deterministic financial calculations, clinical compliance, and zero timezone drift.
┌─────────────────────────────────────────────────────────┐
│ Patient / Staff Selects Date │
└────────────────────────────┬────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Check Doctor Booking Window & Blocked Dates │
└────────────────────────────┬────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Generate Time Slots for Doctor Sessions │
└────────────────────────────┬────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Is appointment_date == get_ist_today() & Public? │
└──────────────┬───────────────────────────┬─────────────┘
│ YES │ NO
▼ ▼
┌──────────────────────────┐ ┌───────────────────────────┐
│ Filter slot <= IST Time │ │ Include All Session Slots │
└──────────────┬───────────┘ └─────────────┬─────────────┘
│ │
└─────────────┬──────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ Count Active Bookings (CONFIRMED/CHECKED_IN/DOCTOR) │
│ Calculate: Remaining = max_patients - active_count │
│ Exclude slots where Remaining <= 0 │
└────────────────────────────┬───────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ Row-Lock on booking_day_locks (SELECT FOR UPDATE) │
│ Atomically Commit New Booking with Unique Ref Code │
└────────────────────────────────────────────────────────┘
Enforces zero double-booking race conditions during simultaneous checkout requests via explicit transaction locking on booking_day_locks.
For today's bookings, instantly prunes past hour slots according to Asia/Kolkata current time while allowing staff overrides for late arrivals.
Supports Morning, Afternoon, and Evening schedule sessions with independent consultation intervals (10m, 15m, 20m, 30m, 45m, 60m).
Upon patient arrival check-in on the appointment date, the system issues an incremental, sequential queue token (Token #1, Token #2, etc.) isolated per doctor and date.
Live wait calculation: Estimated Wait = (Tokens Ahead of Patient) × (Doctor Session Slot Duration). Updates instantly when consultations conclude.
Medicine name, dosage, frequency (1-0-1), food relation (Before/After Food), duration in days, diagnosis, and advice notes.
Automatically fetches prior clinical notes, chronic medications, and dosage histories for returning patients to save doctor typing time.
Configurable top and bottom print margins (in cm) allowing printing directly onto physical clinic letterhead stationery or blank paper.
Configurable treatment items with pricing, duration, prep times, and staff directives.
For procedures requiring multiple sittings (Orthodontics, Root Canals, PRP, Physiotherapy): total planned vs completed sessions counter (e.g. Session 3 of 6), date logs, and clinical observation notes.
Automatically computes consultation fees, procedure pricing, and repeat visit waivers (e.g. Free consultation if visiting within doctor-configured window).
ALL, DOCTOR, or specific staff roles (RECEPTIONIST, NURSE, PHARMACIST).appointments, assisted_booking, queue, billing, etc.).PRESENT, ABSENT, HALF_DAY, LEAVE), and remarks./api/v1/razorpay/webhook) ensuring zero payment drops.ONLINE_RAZORPAY, CASH, UPI, CARD, and NETBANKING.ZoneInfo("Asia/Kolkata") (IST, UTC+5:30) across all business workflows.TIMESTAMP WITHOUT TIME ZONE).get_ist_today() and get_ist_time().|ist_datetime and |ist_date Jinja filters with zero timezone skew across midnight/day boundaries.JhaMed HMS offers structured subscription tiers designed for single-practitioner clinics up to multi-specialty healthcare centers, complemented by flexible mobile patient app distribution models.
/dr/slug)Deliver a dedicated mobile app for your clinic where patients can book appointments, track live sequential queue tokens in real-time, and download digital prescriptions.
First 6 months included free. One-time fee for direct APK download button on doctor's public microsite with auto-updates.
Official listed Android App on Google Play Store with clinic branding, push notifications, and seamless installation.
Full dual-platform mobile deployment on both Google Play Store and Apple App Store with unified backend sync.
JhaMed HMS utilizes 31 interconnected SQLAlchemy models across 6 core architectural categories with complete foreign-key cascading and integrity constraints.
[ users ] (id, email, password_hash, full_name, phone, login_role, is_active, created_at)
│
├── 1:1 ──► [ doctors ] (id, user_id, public_slug, registration_number, consultation_fee, plan_id, recovery_identifier, letterhead_*)
│ │
│ ├── 1:N ──► [ doctor_subscription_periods ] (FIFO Queued Subscription Periods)
│ ├── 1:N ──► [ doctor_features ] (Doctor Feature Overrides)
│ ├── 1:N ──► [ doctor_schedules ] ──► 1:N ──► [ doctor_schedule_sessions ]
│ ├── 1:N ──► [ doctor_booking_blocks ]
│ ├── 1:N ──► [ schedule_exceptions ]
│ ├── 1:N ──► [ doctor_treatments ]
│ ├── 1:N ──► [ patient_treatment_courses ]
│ ├── 1:N ──► [ pharmacy_medicines ]
│ ├── 1:N ──► [ staff ] ──► 1:N ──► [ staff_attendances ]
│ │ ──► 1:N ──► [ staff_salary_payments ]
│ ├── 1:N ──► [ clinic_messages ] (30-Day Auto-Expiring Team Chat)
│ ├── 1:N ──► [ doctor_recovery_requests ]
│ ├── 1:N ──► [ invoices ] ──► 1:N ──► [ invoice_items ]
│ │ ──► 1:N ──► [ payments ] ──► 1:N ──► [ payment_transactions ]
│ └── 1:N ──► [ bookings ] (id, booking_reference, doctor_id, user_id, appointment_date, appointment_time, status, queue_token, total_fee)
│ │
│ ├── 1:1 ──► [ prescriptions ] ──► 1:N ──► [ prescription_medicines ]
│ └── 1:N ──► [ patient_vitals ] (BP, Pulse, Temperature, SpO2, Weight)
│
├── 1:N ──► [ bookings ] (as Patient)
├── 1:N ──► [ patient_recovery_requests ]
└── 1:1 ──► [ staff ] (as Staff Account)
[ plans ] (id, name, price, billing_interval, is_active)
└── M:N (plan_features) ──► [ features ] (id, key, name, category, parent_key, display_order)
[ contact_messages ] (id, sender_name, sender_email, phone, organization, subject, message, is_read)
[ booking_day_locks ] (id, doctor_id, appointment_date, locked_at)
id, email, password_hash, full_name, phone, login_role (SUPERADMIN, DOCTOR, STAFF, PATIENT), is_active, created_at
id, user_id, public_slug, registration_number, specialization, consultation_fee, plan_id, recovery_identifier, letterhead_*
id, doctor_id, plan_id, start_date, end_date, is_active, source • Immutable queued subscription periods
id, doctor_id, feature_id, is_enabled • Granular per-doctor feature toggle overrides
id, doctor_id, day_of_week (0-6), is_active • Parent container for weekly schedule days
id, schedule_id, session_name (Morning/Evening), start_time, end_time, slot_duration_minutes, max_patients
id, doctor_id, start_date, end_date, reason • Full-date range clinic closure and holiday blocks
id, doctor_id, exception_date, start_time, end_time, is_available • Single-day override hours
id, doctor_id, name, description, fee, prep_time_minutes, clinical_prep_directives
id, doctor_id, appointment_date, locked_at • Row-level locking for zero double-bookings
id, booking_reference, doctor_id, user_id, appointment_date, appointment_time, status, queue_token, total_fee
id, booking_id, doctor_id, user_id, diagnosis, clinical_advice, qr_token, created_at
id, prescription_id, medicine_name, dosage, frequency, timing (Before/After Food), duration_days
id, doctor_id, user_id, treatment_id, total_planned_sessions, completed_sessions, status, logs
id, booking_id, doctor_id, patient_id, blood_pressure, pulse, temperature, spo2, weight_kg
id, doctor_id, name, generic_name, category, batch_number, expiry_date, current_stock, reorder_level
id, doctor_id, user_id, staff_role (RECEPTIONIST, NURSE), monthly_salary, permissions_json
id, staff_id, attendance_date, status (PRESENT, ABSENT, HALF_DAY, LEAVE), check_in_time, remarks
id, staff_id, month, year, base_salary, calculated_deductions, bonus, net_amount, payment_status
id, doctor_id, sender_id, recipient_role, message, patient_token_tag, created_at, expires_at
id, invoice_number, doctor_id, patient_id, booking_id, total_taxable, cgst, sgst, igst, total_amount
id, invoice_id, item_description, item_type (CONSULTATION, PROCEDURE, MEDICINE), unit_price, quantity, tax_rate
id, invoice_id, amount_paid, payment_method (RAZORPAY, CASH, UPI, CARD), payment_status, paid_at
id, payment_id, razorpay_order_id, razorpay_payment_id, razorpay_signature, status, raw_webhook_payload
id, user_id, phone, otp_hash, is_used, expires_at • Secure patient password recovery
id, name (Standard, Professional, Enterprise), price, billing_interval, is_active
id, key, name, category, parent_key, display_order • Master feature registry
plan_id, feature_id • Many-to-many relationship linking plans to entitlements
id, doctor_id, recovery_identifier_attempt, status (PENDING, APPROVED, REJECTED), admin_notes
id, sender_name, sender_email, phone, organization, subject, message, is_read, created_at
id, user_id, token_hash, device_name, is_revoked, expires_at • Mobile app bearer tokens
The codebase is backed by 148 comprehensive end-to-end automated integration tests across 16 test files validating 100% of application flows against PostgreSQL.
$ pytest --verbose
platform darwin -- Python 3.13.15, pytest-8.4.2
rootdir: /JhaMed-HMS, configfile: pytest.ini
collected 148 items across 16 test suites
tests/test_hms.py ............................................. [ 45%]
tests/test_chatbot_security.py ................. [ 65%]
tests/test_razorpay_payments.py ............ [ 80%]
tests/test_postgresql_migration.py ........... [ 90%]
tests/test_timezone.py ............... [100%]
================================== 148 passed in 31.40s =====================================
Registration, admin vetting/approval, temporary password forced resets, and role boundary protection.
Schedule creation, exception blocks, appointment management, queue progression, and lifelong EHR history.
Structured medicine dosage, smart prefill for returning patients, and letterhead margin rendering.
Multi-session course progress logs, attendance tracking, and dynamic repeat-patient fee waiver rules.
Staff login delegation, 11 permission gates, daily attendance rosters, deduction calculations, bonus adjustments, and payment disbursement.
20 controlled domain tools, prompt injection defense, RBAC permission verification, and ephemeral memory auto-wipe.
Order generation, HMAC webhook signature verification, CGST/SGST calculation, and vector PDF invoice compilation.
Verified cascading deletion of clinic records, orphan cleanups, and non-destructive plan reassignments.
Verified resilient error handling and non-blocking transactional email delivery.
Validated Asia/Kolkata boundary calculations, naive UTC storage, and same-day past-slot auto-filtering.
JhaMed HMS is actively deployed in production. Explore the live multi-tenant doctor microsites, patient queue flows, and digital practice management live at hms.codehypetech.in.