Project CS
Project CS
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)
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
Page 2 of
20
TABLE OF CONTENTS
01 ACKNOWLEDGEMENT 04
02 INTRODUCTION 05
03 SOFTWARE USED 05
04 FEATURES OF HOSPITAL 05
MANAGEMENT SYSTEM
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.
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
SOFTWARE USED
Database MySQL
IDE VS Code
Page 5 of
20
PROGRAM OF HOSPITAL MANAGEMENT SYSTEM IN PYTHON WITH
SOURCE CODE AND OUTPUT
OUTPUT
Page 6 of
20
PERFORM NEW REGISTRATION
OUTPUT
In this code block, as we provide the choice option, we can select which
service to choose from the list of options.
OUTPUT
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| mycursor.execute(
13| "insert into doctor_details values('" + name + "','" +
spe + "','" + age + "','" + add + "','" + cont + "','" + fees +
"','" + ms + "')")
14| mysql.commit()
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
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
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 | mycursor.execute("select * from patient_details where
name='" + name + "'")
3 | row = mycursor.fetchall() print(row)
4 | bill = input("Has he paid all the bills? (y/n):")
5 | if bill == "y":
6 | mycursor.execute("delete from patient_details where name='"
+ name + "'")
7 | mysql.commit()
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
1 | while (True):
Page 13 of
20
2 | print("""
3 | ================================
4 | Welcome To CityHospital
5 | ================================
6 | """)
7 | # creating database connectivity
8 | import mysql.connector
9 | passwd = str(input("Enter the Password Please!!:"))
10|
11| mysql = mysql.connector.connect(
12| host="localhost", user="root", passwd=passwd)
13| mycursor = mysql.cursor()
14| mycursor.execute("create database if not exists
city_hospitals")
15| mycursor.execute("use city_hospitals")
16| # creating the tables we need
17| mycursor.execute(
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| mycursor.execute("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| mycursor.execute(
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| mycursor.execute(
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| mycursor.execute(
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| mycursor.execute(
46| "insert into user_data values('" + u + "','" + p + "')")
47| mysql.commit()
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| mycursor.execute(
66| "select password from user_data where username='" + un +
"'")
67| row = mycursor.fetchall()
68| for i in row:
69| a = list(i)
70| if a[0] == str(ps):
71| while (True):
72| print("""
73| 1.Administration
74| 2.Patient(Details)
75| 3.Sign 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| mycursor.execute(
99| "select * from doctor_details")
100| row = mycursor.fetchall()
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| mycursor.execute(
111| "select * from nurse_details")
112| row = mycursor.fetchall()
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| mycursor.execute(
122| "select * from other_workers_details")
123| row = mycursor.fetchall()
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| mycursor.execute("insert into doctor_details
values('" + name + "','" + spe +
151| "','" + age + "','" + add + "','" + cont +
"','" + fees + "','" + ms + "')")
152| mysql.commit()
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| mycursor.execute("insert into nurse_details
values('" + name + "','" + age + "','" + add + "','" + cont +
"','" + str(
164| ms) + "')")
165| mysql.commit()
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| mycursor.execute("insert into
other_workers_details values('" +
177| name + "','" + age + "','" + add + "','" +
cont + "','" + ms + "')")
178| mysql.commit()
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| mycursor.execute(
192| "select * from doctor_details where name='" +
name + "'")
193| row = mycursor.fetchall()
194| print(row)
195| p = input(
196| "you really wanna delete this data? (y/n):")
197| if p == "y":
198| mycursor.execute(
199| "delete from doctor_details where name='" + name
+ "'")
200| mysql.commit()
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| mycursor.execute(
209| "select * from nurse_details where name='" + name
+ "'")
210| row = mycursor.fetchall()
211| print(row)
212| p = input(
213| "you really wanna delete this data? (y/n):")
214| if p == "y":
215| mycursor.execute(
216| "delete from nurse_details where name='" + name
+ "'")
217| mysql.commit()
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| mycursor.execute(
225| "select * from workers_details where name='" +
name + "'")
226| row = mycursor.fetchall()
227| print(row)
228| p = input(
229| "you really wanna delete this data? (y/n):")
230| if p == "y":
231| mycursor.execute(
232| "delete from other_workers_details where name='"
+ name + "'")
233| mysql.commit()
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| mycursor.execute(
254| "select * from patient_detail")
255| row = mycursor.fetchall()
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| mycursor.execute("insert into patient_detail
values('" + name + "','" + sex + "','" +
272| age + "','" + address + "','" + contact +
"')")
273| mysql.commit()
274| mycursor.execute(
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| mycursor.execute(
290| "select * from patient_detail where name='" + name
+ "'")
291| row = mycursor.fetchall()
292| print(row)
293| bill = input(
294| "Has he paid all the bills? (y/n):")
295| if bill == "y":
296| mycursor.execute(
297| "delete from patient_detail where name='" + name
+ "'")
298| mysql.commit()
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
https://www.geeksforgeeks.org/hospital-management-system-project-in-software-
development/
THANK YOU
Page 20 of
20