Computer Project Ziddan
Computer Project Ziddan
PROJECT REPORT ON
Hospital Management System
CERTIFICATE
This is to certify that Master Ziddan rath Roll No: _____________ has
successfully completed the project Work entitled Hospital Management System in the
subject Computer Science (083) laid down in the regulations of CBSE for the purpose of
01 ACKNOWLEDGEMENT 1
02 INTRODUCTION 2
04 PYTHON LANGUAGE 3
05 SYNOPSIS 4
06 SOURCE CODE 6
07 OUTPUT 12
09 BIBLIOGRAPHY 16
ACKNOWLEDGEMENT
I take this opportunity to express my gratitude to the people who have been instrumental
in the successful completion of this project.
I express my deep sense of gratitude to The Principal, Mother’s Public School who has
been continuously motivating to complete the project in time.
ZIDDAN RATH
1
Hospital Management System
INTRODUCTION
The objective of this project is to let the students apply the programming
knowledge into a real- world situation/problem and exposed the students how
programming skills helps in developing a good software.
project, requiring writing and presentation skills which exemplify scholarly style in
computer science.
2
About the language – Python
A robust application needs a powerful programming language that is easy to read, update
and maintain. Python incorporates all these qualities. It offers everything (including a set
of huge libraries and utilities) that is needed to build amazing applications.
Some major benefits that Python offers to the developers and the organization
• Python has a clean and structured code base, making the updation and maintenance
tasks of the software easier for developers. They don’t require developers to write
additional code, and this, in turn, saves them effort and valuable time.
• The syntax rule of Python is composed mainly of English keywords, emphasizing the
code readability. Code readability plays a major role while building the application.
Customers' requirements can change when the software gets to employed in the real-
world.
• Python is compatible with all major platforms and operating system. Python code can be
run on any platforms.
• It is easier to run the same Python program on multiple platforms, including Windows,
Linux, mac OS, etc. You just need to make sure that Python is installed on the computer
where you are running the code.
3
SYNOPSIS
• Appointments.
• Admit patient.
• Discharge.
• Display.
• Modify Details.
Database used is
Patient_id
Name
Age
Gender
Phone
Disease
Admitted
Appointdoc
4
Appointments
This module is used to schedule an appoint with the doctor related to the disease
and stored in the database. The new patient is allotted a new id.
Admit Patient
This module is used whenever a new patient take is admitted in the hospital with all the
required data of the patient is taken input and store it in the database. The new patient
Deletion
Whenever a patient is discharged, the information of the patient is deleted from the
database.
Display
This module displays the information related to the patient by searching the database
Modify Details
searches the database using patient id and the required data is updated.
5
Source code
import random
import mysql.connector
p=input("enter password:")
con=mysql.connector.connect(host='localhost',user='root',pa
ssword='{}'.format(p))
cr=con.cursor()
cr.execute("create database hospital")
con.commit()
con.close()
con=mysql.connector.connect(host='localhost',user='root',pa
ssword='{}'.format(p),database='HOSPITAL')
cr=con.cursor()
cr.execute("create table patients(patient_id int primary
key, name varchar(100),age int , gender varchar(100),phone
bigint(15),disease varchar(100),admit
varchar(10),appointdoc varchar(100))")
con.commit()
print("====================HOSPITAL MANAGEMENT
SYSTEM====================")
def menu():
print("===========================================
==============")
print("1. Appointment\n2. Admit Patient\n3. Discharge
Patient\n4. Search Patient by ID\n5. Update Patient
Details\n6. Exit")
ch=int(input("Enter your choice:"))
if ch==1:
appoint()
elif ch==2:
admit()
elif ch==3:
discharge()
elif ch==4:
search()
elif ch==5:
update()
elif ch==6:
6
print("==========================THANK YOU
==========================")
else:
print("PLEASE TRY AGAIN!!!")
menu()
def appoint():
print("================================================
=========")
print("1.High fever and Bodyache")
print("2.Diarrhea")
print("3.Fatigue")
print("4.Nausea and vomiting")
print("5.Muscle ache and Fracture")
print("6.Skin disease")
print("7.Related to ENT")
print("8.Chest pain and problem in breathing")
ch=int(input("Enter your symptom:"))
if ch==1:
d="High fever and Bodyache"
s='DR. PRATYUSH TRIPATHY'
if ch==2:
d="Diarrhea"
s='DR. RADHIKA BHONSLE'
if ch==3:
d="FATIGUE"
s='DR. SACHIN SEKHAR BISWAL'
if ch==4:
d="NAUSEA AND VOMITING"
s='DR. GAYATRI SATAPATHY'
if ch==5:
d="MUSCLE ACHE AND FRACTURE"
s='DR. AUROBINDA DAS'
if ch==6:
d="DERMATOLOGY"
s='DR. CHINMAYEE RAJ'
if ch==7:
d="ENT"
s='DR. SAMARENDRA BEHERA'
if ch==8:
d="CARDIOLOGY"
s='DR. PARTHA MOHAPATRA'
while True:
7
i=random.randint(10000,99999)
query="select patient_id from patients where
patient_id={}".format(i)
cr.execute(query)
l=cr.fetchone()
if l==None:
p=i
break
n=input("Enter Name: ").upper()
a=input("Enter Age: ")
g=input("Enter Gender: ").upper()
ph=int(input("Enter phone no.:"))
query = "INSERT INTO patients (patient_id, name,age,
gender,phone,disease,admit,appointdoc) VALUES
({},'{}',{},'{}',{},'{}','{}','{}')".format(p,n,a,g
,ph,d,'NO',s)
cr.execute(query)
con.commit()
print("YOUR APPOINTMENT WITH",s,"HAS BEEN SCHEDULED.")
print("YOUR ID IS:",i)
menu()
def admit():
print("============================================
=============")
while True:
i=random.randint(100000,999999)
s="select patient_id from patients where
patient_id={}".format(i)
cr.execute(s)
l=cr.fetchone()
if l==None:
p=i
break
n=input("Enter Name: ").upper()
a=input("Enter Age: ")
g=input("Enter Gender: ").upper()
ph=int(input("Enter phone no.:"))
d=input("Enter Disease: ").upper()
z=input("Enter doctor's name:").upper()
query = "INSERT INTO patients (patient_id, name,
age, gender,phone,disease,admit,appointdoc) VALUES
({},'{}',{},'{}',{},'{}','{}','{}')".format(p,n,a,
,ph,d,'YES',z)
8
cr.execute(query)
con.commit()
print("PATIENT ID IS:",p)
print("PATIENT ADMITTED SUCCESSFULLY")
menu()
def discharge():
print("============================================
=============")
i=input("Enter Patient ID to discharge:")
s="select patient_id from patients where
patient_id={}".format(i)
cr.execute(s)
l=cr.fetchone()
if len(l)==1:
query="DELETE FROM patients WHERE patient_id =
{}".format(i)
cr.execute(query)
con.commit()
print("PATIENT DISCHARGED SUCCESSFULLY")
menu()
else:
print("ACCOUNT NOT AVAILABLE")
menu()
def search():
print("============================================
=============")
i=input("Enter Patient ID to search:")
s="select patient_id from patients where
patient_id={}".format(i)
cr.execute(s)
l=cr.fetchone()
if len(l)==1:
query = "select * from patients where
patient_id={}".format(i)
cr.execute(query)
d=cr.fetchone()
print("====================================
=====================")
print("PATIENT ID:",d[0],"\nPATIENT
NAME:",d[1],"\nPATIENT AGE:",d[2],"\nPATIENT
9
GENDER:",d[3],"\nPATIENT PHONE:",d[4],"\nPATIENT
DISEASE:",d[5],"\nPATIENT ADMITTED:",d[6],
"\nAPPOINTED DOCTOR:",d[7])
menu()
else:
print("ACCOUNT NOT AVAILABLE")
menu()
def update():
print("============================================
=============")
i=input("Enter Patient ID:")
s="select patient_id from patients where
patient_id={}".format(i)
cr.execute(s)
l=cr.fetchone()
if len(l)==1:
print("1. Update Name")
print("2. Update Age")
print("3. Update Gender")
print("4. Update phone no.")
print("5. Back")
ch=int(input("Enter your choice:"))
if ch==1:
uname(i)
elif ch==2:
uage(i)
elif ch==3:
ugender(i)
elif ch==4:
uph(i)
elif ch==5:
menu()
else:
print("PLEASE TRY AGAIN!!!")
update()
def uname(a):
n=input("Enter new Name: ").upper()
query="UPDATE patients SET name = '{}' WHERE
patient_id = {}".format(n,a)
cr.execute(query)
con.commit()
print("NAME CHANGED SUCCESSFULLY.")
10
menu()
def uage(a):
n=input("Enter new Age: ")
query="UPDATE patients SET age = {} WHERE
patient_id = {}".format(n,a)
cr.execute(query)
con.commit()
print("AGE CHANGED SUCCESSFULLY.")
menu()
def ugender(a):
n=input("Enter new Gender: ").upper()
query="UPDATE patients SET gender = '{}' WHERE
patient_id = {}".format(n,a)
cr.execute(query)
con.commit()
print("GENDER CHANGED SUCCESSFULLY.")
menu()
def uph(a):
n=input("Enter new Phone no.: ")
query="UPDATE patients SET phone = {} WHERE
patient_id = {}".format(n,a)
cr.execute(query)
con.commit()
print("PHONE NO. CHANGED SUCCESSFULLY.")
menu()
menu()
con.close()
11
Output
12
13
14
HARDWARE AND SOFTWARE REQUIREMENTS
SOFTWARE REQUIREMENTS:
• Windows OS
• Python
• mysql connector module
15
BIBLIOGRAPHY
16