PM SHRI KENDRIYA VIDYALAYA
KAMLA NEHRU NAGAR
GHAZIABAD
Academic Year: 2024-2025
PROJECT ON
LIBRARY MANAGEMENT SYSTEM
As per CBSE AISSCE guidelines for Board Examination
GROUP MEMBER :
Manasmay Singh,
Riya Yadav
CLASS : XII A
SUBJECT : COMPUTER
SCIENCE SUBJECT CODE: 083
PROJECT GUIDE : Mrs. KIRAN SINGH (PGT CS)
PM SHRI KENDRIYA VIDALAYA KNN
GZB-I AGRA REGION
Page 1 of
20
PM SHRI K.V. K.N.N. G.Z.B.- I
CERTIFICATE
This is to certify that Master Manasmay Singh and Miss Riya Yadav
have successfully completed the project work entitled Hospital
Management System in the subject Computer Science (083) laid
down in the regulations of CBSE for Class XII practical.
Internal Examiner External Examiner
Page 2 of
20
TABLE OF CONTENTS
SER DESCRIPTION PAGE
NO
01 ACKNOWLEDGEMENT 04
02 INTRODUCTION 05
03 SOFTWARE USED 05
04 FEATURES OF HOSPITAL 05
MANAGEMENT SYSTEM
05 SOURCE CODE AND OUTPUT 06-20
06 SOFTWARE REQUIREMENT 21
07 CREDITS 21
Page 3 of
20
ACKNOWLEDGEMENT
Apart from the efforts, the success of any project depends largely on
the encouragement and guidelines of many others. We take this
opportunity to express our gratitude to the people who have been
instrumental in the successful completion of this project.
We express deep sense of gratitude to almighty God for giving us
strength for the successful completion of the project.
We express our heartfelt gratitude to our parents for constant
encouragement while carrying out this project.
We gratefully acknowledge the contribution of the individuals, our
teachers who contributed to bringing this project up to this level, who
continues to look after us despite our flaws,
We express our deep sense of gratitude to the luminary computer
science teacher Mrs. Kiran Singh, PM SHRI KV KNN GZB who has been
continuously motivating and extending her helping hand to us.
We express our sincerity and thanks to the academician The
Principal, Vice principal for constant encouragement and the guidance
provided during this project
The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the
success of the project. We are grateful for their constant support and help.
Page 4 of
20
PROJECT ON CREATING HOSPITAL MANAGEMENT
SYSTEM
INTRODUCTION
What is Hospital Management System Project in Python?
A Hospital Management System Project in Python is A computer system
that helps keep track of health care information and helps health care
providers do their jobs better.
SOFTWARE USED
Operating software Windows 11 24H2
Python Version 3.12
Database MySQL
IDE VS Code
Database connectivity mysql-connector-python
FEATURES AND BENEFITS OF HOSPITAL MANAGEMENT SYSTEM IN
PYTHON
Here as we are using MySQL for database creation in Hospital Management,
we are
able to -
Register new patient.
View the staff, patient information, discharge, and bill payment
summary details.
Delete the details.
We can add, delete and modify and view the details of the
doctors, nurses, and workers.
Page 5 of
20
PROGRAM OF HOSPITAL MANAGEMENT SYSTEM IN PYTHON WITH
SOURCE CODE AND OUTPUT
IMPORT THE MODULE AND PERFORM DATABASE CONNECTIVITY
0 | ##creating database connectivity
1 | import [Link]
2 | passwd = str(input("Enter the Password Please!!:"))
3 | mysql = [Link](host="localhost",
user="root", passwd="your password")
4 | mycursor = [Link]()
5 | [Link]("create database if not exists
city_hospitals")
6 | [Link]("use city_hospitals")
Here, we are importing the module [Link] to perform all the
database connectivity. Use the while loop while writing the code.
The connect() function accepts connection credentials and returns an object
of type MySQLConnection for database connection. The [Link]() to
communicate with the MySQL database. The [Link]() executes the
database operations for such as patient details, doctors details, nurse
details, and other worker details.
OUTPUT
Page 6 of
20
PERFORM NEW REGISTRATION
1 | u = input("Input your username!!:")
2 | p = input("Input the password (Password must be strong!!!:")
3 | [Link]("insert into user_data values('" + u +
"','" + p + "')")
4 | [Link]()
In this code block, the patients register themselves by providing a username
and password.
OUTPUT
DISPLAY THE LIST OF OPTIONS THE USER COULD SELECT IN THE
HOSPITAL
Page 7 of
20
1 | #enter the username and password of the user whose data is
to display
2 | a = int(input("ENTER YOUR CHOICE:"))
3 | # if user wants to enter administration option
4 | if a == 1:
5 | print("""
6 | 1. Display the details
7 | 2. Add a new member
8 | 3. Delete a member
9 | 4. Make an exit
10| """)
11| b = int(input("Enter your Choice:"))
12| if b == 1:
13| print("""
14| 1. Doctors Details
15| 2. Nurse Details
16| 3. Others
17| """)
In this code block, as we provide the choice option, we can select which
service to choose from the list of options.
OUTPUT
ADDING THE DATA OF THE ADMINISTRATION STAFF FOR THE
HOSPITAL MANAGEMENT SYSTEM IN PYTHON
Page 8 of
20
1 | c = int(input("ENTER YOUR CHOICE:"))
2 | # FOR ENTERING DETAILS OF DOCTORS
3 | if c == 1:
4 | # ASKING THE DETAILS
5 | name = input("Enter the doctor's name")
6 | spe = input("Enter the specilization:")
7 | age = input("Enter the age:")
8 | add = input("Enter the address:")
9 | cont = input("Enter Contact Details:")
10| fees = input("Enter the fees:")
11| ms = input("Enter Monthly Salary:")
12| [Link](
13| "insert into doctor_details values('" + name + "','" +
spe + "','" + age + "','" + add + "','" + cont + "','" + fees +
"','" + ms + "')")
14| [Link]()
15| print("SUCCESSFULLY ADDED")
16| ct No.:")
Selecting the add the member choice, the system asks to choose from the
administration staff whose information wants to add the doctor, the nurse, or the worker.
Similarly, we can add the details of the other staff members
OUTPUT
DELETING THE DETAILS OF THE ADMINISTRATION STAFF
1 | #if unser wants to delete data
2 | c = int(input("Enter your Choice:")
3 | if c == 1:
Page 9 of
20
4 | name = input("Enter Doctor's Name:")
5 | [Link]("select * from doctor_details where
name='" + name + "'")
6 | row = [Link]()
7 | print(row)
8 | p = input("you really wanna delete this data? (y/n):")
9 | if p == "y":
10| [Link]("delete from doctor_details where
name='" + name + "'")
11| [Link]()
12| print("SUCCESSFULLY DELETED!!")
13| else:
14| print("NOT DELETED")
Here after entering the name of the staff MySQL executes the queries and fetches data
from the databases of name using the fetchall() function deletes the details and prints
the message successfully deleted else not deleted.
OUTPUT
DISPLAY
ING THE PATIENTS INFORMATION AND ADDING THE NEW PATIENT
1 | #Display thee details of the patient by selecting the option
2 | b = int(input("Enter your Choice:"))
3 | if b == 1:
4 | [Link]("select * from patient_details")
5 | row = [Link]()
Page 10 of
20
6 | for i in row:
7 | b = 0
8 | v = list(i)
9 | k = ["NAME", "SEX", "AGE", "ADDRESS", "CONTACT"]
10| d = dict(zip(k, v))
11| print(d)
12|
13| # adding new patient
14| elif b == 2:
15| name = input("Enter your name ")
16| sex = input("Enter the gender: ")
17| age = input("Enter age: ")
18| address =input("Enter address: ")
19| contact = input("Contact Details: ")
20| [Link](
21| "insert into patient_details values('" + name + "','" +
sex + "','" +
22| age + "','" + address + "','" + contact + "')")
23| [Link]()
24| [Link]("select * from patient_details")
25| for i in mycursor:
26| v = list(i)
27| k = ['NAME', 'SEX', 'AGE', 'ADDRESS', 'CONTACT']
28| print(dict(zip(k, v)))
In this code, we are able to display the information of the patient. The system executes
the query and fetches the patient’s information using the fetchall() function.
We are able to add new patient details to the database and complete the information
with the commit operation.
OUTPUT
Page 11 of
20
DISCHARGE PROCESS OF THE PATIENT AND ACCOUNTING OF THE
BILLS
Page 12 of
20
1 | name = input("Enter the Patient Name:")
2 | [Link]("select * from patient_details where
name='" + name + "'")
3 | row = [Link]() print(row)
4 | bill = input("Has he paid all the bills? (y/n):")
5 | if bill == "y":
6 | [Link]("delete from patient_details where name='"
+ name + "'")
7 | [Link]()
Here we are completing the discharge process of the patient by confirming the bill
payment in the hospital management system in python.
If the username and password are not present in the database the system will not
perform any further operations.
OUTPUT
COMPLETE PYTHON PROGRAM OF HOSPITAL MANAGEMENT SYSTEM
WITH SOURCE CODE
1 | while (True):
Page 13 of
20
2 | print("""
3 | ================================
4 | Welcome To CityHospital
5 | ================================
6 | """)
7 | # creating database connectivity
8 | import [Link]
9 | passwd = str(input("Enter the Password Please!!:"))
10|
11| mysql = [Link](
12| host="localhost", user="root", passwd=passwd)
13| mycursor = [Link]()
14| [Link]("create database if not exists
city_hospitals")
15| [Link]("use city_hospitals")
16| # creating the tables we need
17| [Link](
18| "create table if not exists patient_detail(name
varchar(30) primary key,sex varchar(15),age int(3),address
varchar(50),contact varchar(15))")
19| [Link]("create table if not exists
doctor_details(name varchar(30) primary key,specialisation
varchar(40),age int(2),address varchar(30),contact
varchar(15),fees int(10),monthly_salary int(10))")
20| [Link](
21| "create table if not exists nurse_details(name varchar(30)
primary key,age int(2),address varchar(30),contact
varchar(15),monthly_salary int(10))")
22| [Link](
23| "create table if not exists other_workers_details(name
varchar(30) primary key,age int(2),address varchar(30),contact
varchar(15),monthly_salary int(10))")
24|
25| # creating table for storing the username and password of
the user
26| [Link](
27| "create table if not exists user_data(username varchar(30)
primary key,password varchar(30) default'000')")
28|
29| while (True):
30| print("""
31| 1. Sign In
32| 2. Registration
33| """)
34|
35| r = int(input("enter your choice:"))
36| if r == 2:
37| print("""
38|
39| =======================================
40| !!!!!!!!!!Register Yourself!!!!!!!!
41| =======================================
Page 14 of
20
42| """)
43| u = input("Input your username!!:")
44| p = input("Input the password (Password must be
strong!!!:")
45| [Link](
46| "insert into user_data values('" + u + "','" + p + "')")
47| [Link]()
48|
49| print("""
50| ============================================
51| !!Well Done!!Registration Done Successfully!!
52| ============================================
53| """)
54| x = input("enter any key to continue:")
55| # IF USER WANTS TO LOGIN
56| elif r == 1:
57| print("""
58| ==================================
59| !!!!!!!! {{Sign In}} !!!!!!!!!!
60| ==================================
61| """)
62| un = input("Enter Username!!:")
63| ps = input("Enter Password!!:")
64|
65| [Link](
66| "select password from user_data where username='" + un +
"'")
67| row = [Link]()
68| for i in row:
69| a = list(i)
70| if a[0] == str(ps):
71| while (True):
72| print("""
73| [Link]
74| [Link](Details)
75| [Link] Out
76|
77| """)
78|
79| a = int(input("ENTER YOUR CHOICE:"))
80| if a == 1:
81| print("""
82| 1. Display the details
83| 2. Add a new member
84| 3. Delete a member
85| 4. Make an exit
86| """)
87| b = int(input("Enter your Choice:"))
88| # details
89| if b == 1:
90| print("""
91| 1. Doctors Details
Page 15 of
20
92| 2. Nurse Details
93| 3. Others
94| """)
95|
96| c = int(input("Enter your Choice:"))
97| if c == 1:
98| [Link](
99| "select * from doctor_details")
100| row = [Link]()
101| for i in row:
102| b = 0
103| v = list(i)
104| k = ["NAME", "SPECIALISATION", "AGE", "ADDRESS",
"CONTACT", "FEES",
105| "MONTHLY_SALARY"]
106| d = dict(zip(k, v))
107| print(d)
108| # displays nurses details
109| elif c == 2:
110| [Link](
111| "select * from nurse_details")
112| row = [Link]()
113| for i in row:
114| v = list(i)
115| k = ["NAME", "SPECIALISATION", "AGE",
116| "ADDRESS", "CONTACT", "MONTHLY_SALARY"]
117| d = dict(zip(k, v))
118| print(d)
119| # displays worker details
120| elif c == 3:
121| [Link](
122| "select * from other_workers_details")
123| row = [Link]()
124| for i in row:
125| v = list(i)
126| k = ["NAME", "SPECIALISATION", "AGE",
127| "ADDRESS", "CONTACT""MONTHLY_SALARY"]
128| d = dict(zip(k, v))
129| print(d)
130| # IF USER WANTS TO ENTER DETAILS
131| elif b == 2:
132| print("""
133|
134| 1. Doctor Details
135| 2. Nurse Details
136| 3. Others
137| """)
138| c = int(input("ENTER YOUR CHOICE:"))
139| # enter doctor details
140| if c == 1:
141| # ASKING THE DETAILS
142| name = input("Enter the doctor's name")
Page 16 of
20
143| spe = input("Enter the specilization:")
144| age = input("Enter the age:")
145| add = input("Enter the address:")
146| cont = input("Enter Contact Details:")
147| fees = input("Enter the fees:")
148| ms = input("Enter Monthly Salary:")
149| # Inserting values in doctors details
150| [Link]("insert into doctor_details
values('" + name + "','" + spe +
151| "','" + age + "','" + add + "','" + cont +
"','" + fees + "','" + ms + "')")
152| [Link]()
153| print("SUCCESSFULLY ADDED")
154| # for nurse details
155| elif c == 2:
156| # ASKING THE DETAILS
157| name = input("Enter Nurse name:")
158| age = input("Enter age:")
159| add = input("Enter address:")
160| cont = input("Enter Contact No:")
161| ms = int(input("Enter Monthly Salary"))
162| # INSERTING VALUES ENTERED TO THE TABLE
163| [Link]("insert into nurse_details
values('" + name + "','" + age + "','" + add + "','" + cont +
"','" + str(
164| ms) + "')")
165| [Link]()
166| print("SUCCESSFULLY ADDED")
167| # for entering workers details
168| elif c == 3:
169| # ASKING THE DETAILS
170| name = input("Enter worker name:")
171| age = input("Enter age:")
172| add = input("Enter address:")
173| cont = input("Enter Contact No.:")
174| ms = input("Enter Monthly Salary:")
175| # INSERTING VALUES ENTERED TO THE TABLE
176| [Link]("insert into
other_workers_details values('" +
177| name + "','" + age + "','" + add + "','" +
cont + "','" + ms + "')")
178| [Link]()
179| print("SUCCESSFULLY ADDED")
180| # to delete data
181| elif b == 3:
182| print("""
183| 1. Doctor Details
184| 2. Nurse Details
185| 3. Others
186| """)
187| c = int(input("Enter your Choice:"))
188| # deleting doctor's details
Page 17 of
20
189| if c == 1:
190| name = input("Enter Doctor's Name:")
191| [Link](
192| "select * from doctor_details where name='" +
name + "'")
193| row = [Link]()
194| print(row)
195| p = input(
196| "you really wanna delete this data? (y/n):")
197| if p == "y":
198| [Link](
199| "delete from doctor_details where name='" + name
+ "'")
200| [Link]()
201| print("SUCCESSFULLY DELETED!!")
202| else:
203| print("NOT DELETED")
204|
205| # deleting nurse details
206| elif c == 2:
207| name = input("Enter Nurse Name:")
208| [Link](
209| "select * from nurse_details where name='" + name
+ "'")
210| row = [Link]()
211| print(row)
212| p = input(
213| "you really wanna delete this data? (y/n):")
214| if p == "y":
215| [Link](
216| "delete from nurse_details where name='" + name
+ "'")
217| [Link]()
218| print("SUCCESSFULLY DELETED!!")
219| else:
220| print("NOT DELETED")
221| # deleting other_workers details
222| elif c == 3:
223| name = input("Enter the worker Name")
224| [Link](
225| "select * from workers_details where name='" +
name + "'")
226| row = [Link]()
227| print(row)
228| p = input(
229| "you really wanna delete this data? (y/n):")
230| if p == "y":
231| [Link](
232| "delete from other_workers_details where name='"
+ name + "'")
233| [Link]()
234| print("SUCCESSFULLY DELETED!!")
Page 18 of
20
235| else:
236| print("NOT DELETED")
237| elif b == 4:
238| break
239|
240| # entering the patient details table
241| elif a == 2:
242|
243| print("""
244| 1. Show Patients Info
245| 2. Add New Patient
246| 3. Discharge Summary
247| 4. Exit
248| """)
249| b = int(input("Enter your Choice:"))
250| # showing the existing details
251| # if user wants to see the details of PATIENT
252| if b == 1:
253| [Link](
254| "select * from patient_detail")
255| row = [Link]()
256| for i in row:
257| b = 0
258| v = list(i)
259| k = ["NAME", "SEX", "AGE",
260| "ADDRESS", "CONTACT"]
261| d = dict(zip(k, v))
262| print(d)
263|
264| # adding new patient
265| elif b == 2:
266| name = input("Enter your name ")
267| sex = input("Enter the gender: ")
268| age = input("Enter age: ")
269| address = input("Enter address: ")
270| contact = input("Contact Details: ")
271| [Link]("insert into patient_detail
values('" + name + "','" + sex + "','" +
272| age + "','" + address + "','" + contact +
"')")
273| [Link]()
274| [Link](
275| "select * from patient_detail")
276| for i in mycursor:
277| v = list(i)
278| k = ['NAME', 'SEX', 'AGE',
279| 'ADDRESS', 'CONTACT']
280| print(dict(zip(k, v)))
281| print("""
282| ====================================
283| !!!!!!!Registered Successfully!!!!!!
284| ====================================
Page 19 of
20
285| """)
286| # dischare process
287| elif b == 3:
288| name = input("Enter the Patient Name:")
289| [Link](
290| "select * from patient_detail where name='" + name
+ "'")
291| row = [Link]()
292| print(row)
293| bill = input(
294| "Has he paid all the bills? (y/n):")
295| if bill == "y":
296| [Link](
297| "delete from patient_detail where name='" + name
+ "'")
298| [Link]()
299| # if user wants to exit
300| elif b == 4:
301| break
302| # SIGN OUT
303|
304| elif a == 3:
305| break
306|
307| # IF THE USERNAME AND PASSWORD IS NOT IN THE DATABASE
308| else:
309| break
SOFTWARE REQUIREMENTS
Windows OS
Python 3.x
MySQL
CREDITS
Few suggestions from subject teacher Mrs. Kiran Singh
Youtube
Computer Science with Python class 12th by Sumita Arora
Computer Science with Python class 11th by Sumita Arora
[Link]
development/
THANK YOU
Page 20 of
20