You are on page 1of 31

Mini Project Report

On

“Hospital Management System”


Submitted By
Singh Ashutosh [Roll no. 43 (B)]
Vinay Sonawane [Roll no .47 (B)]

Under the guidance


of
Prof. Prateeksha Chouksi

DEPARTMENT OF COMPUTER ENGINEERING


GENBA SOPANRAO MOZE COLLEGE OF ENGINEERING,
BALEWADI, PUNE-411041
SAVITRIBAI PHULE PUNE UNIVERSITY
[Year:2021-2022]
CERTIFICATE

This is to certify that the mini project report entitles

“HOSPITAL MANAGEMENT SYSTEM”

Submitted by

Singh Ashutosh [Roll no. 43 (B)]


Vinay Sonawane [Roll no .47 (B)]

has successfully completed his/her Project work on “Hospital Management System” at Genba
Sopanrao Moze College of Engineering, Balewadi, Pune in the partial fulfillment of Bachelor’s
Degree in Computer Engineering.

(Prof. Prateeksha Chouksi ) (Prof. Bharati Kudale)


Guide Head,
Department of Computer Engineering Department of Computer Engineering

(Dr.Ratnaraj Kumar Jambi)


Principal,
Genba Sopanrao Moze College of Engineering Pune – 45

Place : Pune
Date :
ACKNOWLEDGEMENT

With immense pleasure, we present the mini project report as part of


the curriculum of the T.E. Computer Engineering. We wish to thank all the
people who gave us an unending support right from when the idea was
conceived.

We express our sincere and profound thanks to Prof. Prateeksha


Chouksi our Mini Project Guide Prof. and our HOD Prof. Bharati Kudale who
always stood by us as the helping and guiding support and all those who have
directly or indirectly guided and helped us in the preparation of the Mini
Project.
ABSTRACT

This Hospital Management System project is a computerized hospital front


desk management that produces user-friendly, quick, and cost-effective
software. It handles and secures patient information, diagnosis data, and so
on. This was done by hand and its’ principal job is to register and maintain
patient and doctor information and to access and update the information
when needed. Patient information and diagnosis are entered into the system,
then the output is used to display these details on the screen. A username
and password are required to access the Hospital Management System. It can
be accessed by a receptionist or an administrator. They are the only ones who
have access to the database. The information is easily accessible. For personal
usage, the data is well-protected, and the data processing is quick
TABLE OF CONTENT

Chapter No. Name Page No.


Acknowledgement 2
Abstract 3
Table of content 4
1 Introduction 5
2 System and Software 6
Requirement
3 ER DIAGRAM and SCHEMA 7
DIAGRAM
3.1 ER Diagram
3.2 Schema Diagram
4 Modules in online 9
examination system

5 Source Code 10
5.1 Login Info
5.2 Patient Info
5.3 Doctor Info
5.4 Booking Slot
6 Screen 19
6.1 Front Page
6.2 Login Page
6.3 Booking Procedure
6.4 Booking Details
7 Conclusion 21
CHAPTER 1 : INTRODUCTION TO PRESENT SYSTEM

Hospital Management System is that which enables the Doctors & Patient to
register for the system. Patients are allowed to Book their Slots. Also, it enables
them to add, delete, update the test questions and also to keep track of the
Patient progress.

1.1 Objective:

The main objective of this project is to determine how an interactive inventory


management system helps in the smooth functioning of a Hospital compared to
traditional inventory management, by digitizing all the records and transacting
everything on a computer rather than on paper. This project is a two-tier
architecture application.
1.2 Problem Statement:

Existing systems for Hospital Management System are very inefficient and mostly
involve a lot of manual work to be done by the manager of the system. With this
project, we want to automate as many tasks as possible using the available
technology and the internet.
1.3 Scope of the report:

The essential framework of this report would be to elaborate the design of E.R-
diagram, Schema Diagram and to display how the modules of the program work
in order to achieve the automation.
CHAPTER 2 : SYSTEM AND SOFTWARE REQUIREMENTS

The program works on Desktop PC and is executed using a PHP 5 interface which
interacts with a MySQL database running on localhost.

FUNCTIONAL REQUIREMENT

A description of the facility or feature required. Functional requirements deal with


what the system should do or provide for users. They include description of the
required functions, outlines of associated reports or online queries, and details of
data to be held in the system.

2.1 SOFTWARE REQUIREMENTS:

 Programming language : PHP, MYSQL


 Operating system : ANY OS (Recommended:
Windows8, *
 Windows Vista, Windows XP)
 Application required : VS Code desktop application
 Xampp Coding language : PHP,
HTML ,CSS ,Javascript

2.2 HARDWARE REQUIREMENTS:

 CPU : Pentium IV 2.4 GHz or above


 Memory (Primary) : 512 MB, 1 GB or
above
 Hard Disk : 40 GB, 80GB, 160GB or
above
CHAPTER 3 : ER DIAGRAM, SCHEMA DIAGRAM

 This chapter of the report describes the structure of the project, followed by
Entity Relationship Diagram, Schema Diagram and the table structures.

 The ER diagram below shows the relationship between the many tables that
exist in the database for the functioning of Hospital Management System.

Fig.3.1 ER Diagram of Hospital Management System


3.3 Schema Diagram:

In any data model it is important to distinguish between the description


database and the database itself. The description of a database is called the
databae schema, which is specified during database design and is not
expected to change frequently.

A displayed schema is called a schema diagram. A schema diagram displays


onlysome aspects of a schema, such as the names of record types and data
items, and some types of constraints.

Fig .3.2 Schema Diagram for Hospital Management System


CHAPTER 4 : MODULES IN HOSPITAL MANAGEMENT SYSTEM

Hospital Management System is that which enables the Students & Doctors to
register for the system. Students are allowed to take the online test and see their
progress. Also, it enables the Doctors to add, delete, update the test questions
and also to keep track of the Patient progress.

•Patient Management
• Doctor/Physician Management
• Medicine and Prescription Management
• Online Appointment Management
• Medical and Transaction Management
• Payment and Expense Management

 Patient Management: This module covers from the process of intake until discharge of an
account of the patient’s engagement with the health-care team. Communication, empathy,
examination, evaluation, diagnosis, prognosis, and intervention are all part of the process.
 Doctor/Physician Management: The management of the physicians would be included in
creating this system. Through this process, the admin will have the information and
transactions made by the doctors with the patients.
 Medicine and Prescription Management: This module will handle the process of monitoring a
patient’s medications to verify that they are taken correctly and that the intended
therapeutic outcome is achieved.
 Online Appointment Management: This process is a tool that helps hospital admin manage
their appointments. Internet booking is one of the tools available in an appointment
management solution. Booking with a mobile app.
 Medical and Transaction Management: Medical and transaction management modules aims
to secure every transaction made by the patients and physicians in order to enhance
healthcare quality and outcomes.
`

CHAPTER 5 : SOURCE CODE

Base code:-
<!doctype html>
<html lang="en">

<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="static/css/virtualregister.css">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6u
qKI2xXr2" crossorigin="anonymous">
{% block css %}
{% endblock css %}

<title>

{% block title %}

{% endblock title %}

</title>
</head>

<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="/">Singh Multispeciality Hospital</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-
expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">Home <span
class="sr-only">(current)</span></a>
</li>

{% if current_user.usertype=="Doctor" %}
<li class="nav-item">
<a class="nav-link" href="/doctors">Doctors</a>
</li>

<li class="nav-item">
<a class="nav-link" href="/bookings">Booking Details</a>
</li>

<li class="nav-item">
<a class="nav-link" href="/details">Patients Details</a>
</li>
{% else %}

<li class="nav-item">
<a class="nav-link" href="/patients">Patients Booking</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/bookings">Booking Details</a>
</li>

{% endif %}
{% if current_user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Welcome {{current_user.username}}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">

<a class="dropdown-item" href="/logout">Logout</a>


</div>
</li>
{% else %}

<li class="nav-item dropdown">


<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Authentication
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="/signup">Signup</a>
<a class="dropdown-item" href="/login">Login </a>

</div>
</li>

{% endif %}

</ul>
<form class="form-inline my-2 my-lg-0" action="/search" method="post">
<input class="form-control mr-sm-2" type="search"
placeholder="Department" name="search" aria-label="Search">
<button class="btn btn-outline-light my-2 my-sm-0"
type="submit">Search</button>
</form>
</div>
</nav>

{% block body %}

{% endblock body %}

<div class="card text-white bg-dark">


<div class="card-header">Done By:</div>
<div class="card-body">
<h5 class="card-title">Ashutosh</h5>
<h5 class="card-title">Vinay</h5>
<p class="card-text">Some quick example text to build on the card title and make
up the bulk of the card's content.</p>
</div>
</div>

<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: jQuery and Bootstrap Bundle (includes Popper) -->


<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-
DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/
tE3MoK7ZeZDyx" crossorigin="anonymous"></script>

</body>

</html>
Main Code:-

from flask import Flask,render_template,request,session,redirect,url_for,flash


from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import login_user,logout_user,login_manager,LoginManager
from flask_login import login_required,current_user
from flask_mail import Mail
import json

with open('config.json','r') as c:
params = json.load(c)["params"]

# MY db connection
local_server= True
app = Flask(_name_)
app.secret_key='ashutosh'

# this is for getting unique user access


login_manager=LoginManager(app)
login_manager.login_view='login'

# SMTP MAIL SERVER SETTINGS

app.config.update(
MAIL_SERVER='smtp.gmail.com',
MAIL_PORT='465',
MAIL_USE_SSL=True,
MAIL_USERNAME=params['gmail-user'],
MAIL_PASSWORD=params['gmail-password']
)
mail = Mail(app)

@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))

#
app.config['SQLALCHEMY_DATABASE_URL']='mysql://username:password@localhost
/databas_table_name'
app.config['SQLALCHEMY_DATABASE_URI']='mysql://root:@localhost/hms'
db=SQLAlchemy(app)

# here we will create db models that is tables


class Test(db.Model):
id=db.Column(db.Integer,primary_key=True)
name=db.Column(db.String(100))
email=db.Column(db.String(100))

class User(UserMixin,db.Model):
id=db.Column(db.Integer,primary_key=True)
username=db.Column(db.String(50))
usertype=db.Column(db.String(50))
email=db.Column(db.String(50),unique=True)
password=db.Column(db.String(1000))

class Patients(db.Model):
pid=db.Column(db.Integer,primary_key=True)
email=db.Column(db.String(50))
name=db.Column(db.String(50))
gender=db.Column(db.String(50))
slot=db.Column(db.String(50))
disease=db.Column(db.String(50))
time=db.Column(db.String(50),nullable=False)
date=db.Column(db.String(50),nullable=False)
dept=db.Column(db.String(50))
number=db.Column(db.String(50))

class Doctors(db.Model):
did=db.Column(db.Integer,primary_key=True)
email=db.Column(db.String(50))
doctorname=db.Column(db.String(50))
dept=db.Column(db.String(50))
class Trigr(db.Model):
tid=db.Column(db.Integer,primary_key=True)
pid=db.Column(db.Integer)
email=db.Column(db.String(50))
name=db.Column(db.String(50))
action=db.Column(db.String(50))
timestamp=db.Column(db.String(50))

# here we will pass endpoints and run the fuction


@app.route('/')
def index():
a=params['gmail-user']
return render_template('index.html')
@app.route('/doctors',methods=['POST','GET'])
def doctors():

if request.method=="POST":

email=request.form.get('email')
doctorname=request.form.get('doctorname')
dept=request.form.get('dept')

query=db.engine.execute(f"INSERT INTO `doctors` (`email`,`doctorname`,`dept`)


VALUES ('{email}','{doctorname}','{dept}')")
flash("Information is Stored","primary")
return render_template('doctor.html')
@app.route('/patients',methods=['POST','GET'])
@login_required
def patient():
doct=db.engine.execute("SELECT * FROM `doctors`")

if request.method=="POST":
email=request.form.get('email')
name=request.form.get('name')
gender=request.form.get('gender')
slot=request.form.get('slot')
disease=request.form.get('disease')
time=request.form.get('time')
date=request.form.get('date')
dept=request.form.get('dept')
number=request.form.get('number')
subject="HOSPITAL MANAGEMENT SYSTEM"
query=db.engine.execute(f"INSERT INTO `patients` (`email`,`name`,
`gender`,`slot`,`disease`,`time`,`date`,`dept`,`number`) VALUES
('{email}','{name}','{gender}','{slot}','{disease}','{time}','{date}','{dept}','{number}')")

# mail starts from here

# mail.send_message(subject, sender=params['gmail-user'],
recipients=[email],body=f"YOUR bOOKING IS CONFIRMED THANKS FOR CHOOSING US
\nYour Entered Details are :\nName: {name}\nSlot: {slot}")
flash("Booking Confirmed","info")

return render_template('patient.html',doct=doct)

@app.route('/bookings')
@login_required
def bookings():
em=current_user.email
if current_user.usertype=="Doctor":
query=db.engine.execute(f"SELECT * FROM `patients`")
return render_template('booking.html',query=query)
else:
query=db.engine.execute(f"SELECT * FROM `patients` WHERE email='{em}'")
return render_template('booking.html',query=query)

@app.route("/edit/<string:pid>",methods=['POST','GET'])
@login_required
def edit(pid):
posts=Patients.query.filter_by(pid=pid).first()
if request.method=="POST":
email=request.form.get('email')
name=request.form.get('name')
gender=request.form.get('gender')
slot=request.form.get('slot')
disease=request.form.get('disease')
time=request.form.get('time')
date=request.form.get('date')
dept=request.form.get('dept')
number=request.form.get('number')
db.engine.execute(f"UPDATE `patients` SET `email` = '{email}', `name` = '{name}',
`gender` = '{gender}', `slot` = '{slot}', `disease` = '{disease}', `time` = '{time}', `date` =
'{date}', `dept` = '{dept}', `number` = '{number}' WHERE `patients`.`pid` = {pid}")
flash("Slot is Updates","success")
return redirect('/bookings')

return render_template('edit.html',posts=posts)

@app.route("/delete/<string:pid>",methods=['POST','GET'])
@login_required
def delete(pid):
db.engine.execute(f"DELETE FROM `patients` WHERE `patients`.`pid`={pid}")
flash("Slot Deleted Successful","danger")
return redirect('/bookings')
@app.route('/signup',methods=['POST','GET'])
def signup():
if request.method == "POST":
username=request.form.get('username')
usertype=request.form.get('usertype')
email=request.form.get('email')
password=request.form.get('password')
user=User.query.filter_by(email=email).first()
if user:
flash("Email Already Exist","warning")
return render_template('/signup.html')
encpassword=generate_password_hash(password)

new_user=db.engine.execute(f"INSERT INTO `user`


(`username`,`usertype`,`email`,`password`) VALUES
('{username}','{usertype}','{email}','{encpassword}')")

# this is method 2 to save data in db


# newuser=User(username=username,email=email,password=encpassword)
# db.session.add(newuser)
# db.session.commit()
flash("Signup Succes Please Login","success")
return render_template('login.html')

return render_template('signup.html')

@app.route('/login',methods=['POST','GET'])
def login():
if request.method == "POST":
email=request.form.get('email')
password=request.form.get('password')
user=User.query.filter_by(email=email).first()

if user and check_password_hash(user.password,password):


login_user(user)
flash("Login Success","primary")
return redirect(url_for('index'))
else:
flash("invalid credentials","danger")
return render_template('login.html')

return render_template('login.html')

@app.route('/logout')
@login_required
def logout():
logout_user()
flash("Logout SuccessFul","warning")
return redirect(url_for('login'))

@app.route('/test')
def test():
try:
Test.query.all()
return 'My database is Connected'
except:
return 'My db is not Connected'

@app.route('/details')
@login_required
def details():
# posts=Trigr.query.all()
posts=db.engine.execute("SELECT * FROM `trigr`")
return render_template('trigers.html',posts=posts)

@app.route('/search',methods=['POST','GET'])
@login_required
def search():
if request.method=="POST":
query=request.form.get('search')
dept=Doctors.query.filter_by(dept=query).first()
name=Doctors.query.filter_by(doctorname=query).first()
if name:

flash("Doctor is Available","info")
else:
flash("Doctor is Not Available","danger")
return render_template('index.html')

app.run(debug=True
CHAPTER 6 : SCREEN

Front Page

Fig 6.1 Front page

6.1 INPUTS

Login Page :

Fig 6.2 Login / Sign in


Booking Procedure:-

Fig 6.3 Booking Slot

Booking Details:-

Fig 6.4 Booking Details


CHAPTER 7 : CONCLUSION

The Hospital Management System provides better functionality for an Hospital to


be more efficient and reduce manual paperwork in order to automate all possible
tasks. For implementing this system, PHP, HTML, CSS, JavaScript and MySQL are
used. The system comprises of following features:

Management of Patient Data.

Automated Booking For Appointments.

Adding/deleting quizzes and questions.

You might also like