Skip to content

Smartcare v.1

Latest

Choose a tag to compare

@R204570 R204570 released this 04 Aug 16:11
· 5 commits to main since this release
13bc38b

SmartCare HMS v1.0.0

A modular Django 4.2 Hospital Management System for a multi-specialty hospital.
This first stable release delivers full patient, appointment, admission, pharmacy,
billing, and public-website workflows behind role-based access control, following a
clean per-feature architecture (views/ + forms/ packages, business logic in
services.py, read queries in selectors.py).

Highlights

  • Role-based access for 6 profiles — Admin, Doctor, Nurse, Head Nurse,
    Receptionist, and Pharmacist — enforced by RoleBasedAccessMiddleware plus
    per-view role decorators.
  • Patients & medical records — registration with profile pictures, structured
    vitals (BP, sugar, temperature, weight), diagnoses, treatment plans, X-ray uploads,
    structured prescriptions, and printable PDF reports.
  • Appointments — booking, per-doctor weekly availability, emergency (24/7)
    appointments, and a doctor leave-request → admin-review approval flow.
  • Admissions & wards — 6-floor / department layout with rooms and beds,
    doctor-raised admission requests, room assignment, discharge, and emergency
    admissions. Nurses are assigned to floors with shift and patient-load limits.
  • In-house pharmacy
    • Nurse → Pharmacy drug requests — nurses request medicine for a patient;
      the pharmacy approves/rejects and dispenses as an atomic internal stock movement
      (PENDING → APPROVED → DISPENSED, with reject/cancel paths). Insufficient stock
      blocks dispensing. Full docs in docs/DRUG_REQUESTS.md.
    • Retail sales & billing — walk-in sales generate an invoice and printable
      receipt with cash/card/insurance/mobile payment support.
    • Purchasing — supplier records, purchase orders, and goods-receiving with
      batch numbers and expiry tracking.
  • Hospital inventory (equipment / surgical / consumables) — full add/edit for the
    Head Nurse, view + search only for other nurses; reorder levels, maintenance and
    warranty tracking.
  • Billing — patient bills with line items, discounts, insurance claims, multiple
    payment methods, and receipt generation.
  • Admin analytics dashboard — hospital-wide KPIs: bed occupancy by floor, revenue,
    low-stock and expired-medicine alerts, and more.
  • Public website — landing pages, doctor-authored blogs (with comments and email
    subscriptions), plus contact and appointment inquiries with two-way email replies
    (SMTP send + IMAP inbound polling).

Tech Stack

  • Backend: Django 4.2.9 (Python)
  • Database: SQLite
  • Frontend: Django Templates, Bootstrap 5, crispy-forms, widget-tweaks
  • Auth: Django auth with a custom users.User model + role middleware
  • PDF: xhtml2pdf · Email/OTP: SMTP + IMAP (Gmail app password)
  • Async: channels / daphne (ASGI)

Apps / Modules

App Responsibility
core Shared constants, decorators, mixins, utils
users Auth, roles, profiles, OTP, admin analytics
patient Patients, medical records, prescriptions, rooms/beds, admissions
appointment Appointments, doctor availability, leave requests, role dashboards
pharmacy Medicines, suppliers, purchases, sales, drug requests, hospital inventory
billing Bills, bill items, payments, services, bed types
website Public site, blogs, contact & appointment inquiries, email replies

Getting Started

git clone https://github.com/R204570/hospital-management-system.git
cd hospital-management-system
python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate
pip install -r requirements.txt

Create a .env in the project root:
EMAIL_HOST=your.address@gmail.com
EMAIL_APP_PASSKEY=your-gmail-app-password
SECRET_KEY=change-me-in-production
DJANGO_ENV=dev # 'dev' (default) or 'prod'

Then:

python manage.py migrate
python manage.py create_default_users     # default staff accounts
python manage.py setup_hospital           # floors, rooms, beds
python setup/data_import.py               # optional demo data
python manage.py createsuperuser
python manage.py runserver

App: http://127.0.0.1:8000/ · Admin: http://127.0.0.1:8000/admin/

Environments

Settings are split into hms_project/settings/{base,dev,prod}.py, selected via
DJANGO_ENV. dev enables DEBUG and local hosts; prod disables DEBUG, sets
allowed hosts, and enables secure cookies.

Management Commands

  • create_default_users — create default staff accounts
  • setup_hospital — set up floors, rooms, and beds
  • setup_nurse_assignments — assign nurses to floors
  • setup_test_data — populate test data
  • check_email_replies — poll inbound email replies

Requirements

django==4.2.9, pymongo==3.12.3, pillow, django-crispy-forms,
crispy-bootstrap5, channels, daphne, xhtml2pdf, django-widget-tweaks,
python-dotenv

Notes