Cs Project Hospital Management
Cs Project Hospital Management
Name: - Raghav
Chadha
Class: - XII – A
Roll No: -
Certificate
This is to certify that Raghav Chadha
of class Xll – A has worked successfully
under the supervision of Mrs. Meera
Bhalla during academic year 2024 –
25 on the project “Hospital
Management System” as per the
guidelines issued by Central Board of
Secondary Education (CBSE).
Objective
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.
Software Requirements
❖Windows OS
Similar Softwares
Some of the pre-existing similar
software are shown below
Future Scope of
the
Project
Our project has a large scope in the future as
it is easy to use it, understand it and modify it.
✓ In this age of evolving technologies, our
software aims to modernize Data
Storing which were not able to stand the
test of time, either because of superior
competition or due to heavy storing of
data in the system.
✓ Our software helps the management
department to manage and maintain
the records of doctors, patients and the
other staff workers of the hospital much
easier and effective method from virtually
anywhere in the world.
✓ Our software is a paperless software which
makes it easy to sustain and aids
the environment.
✓ Our software increases the precision and
efficiently by eliminating the human
chance of error.
✓ Our software is laidback and can be accessed
by employees and users.
Source Code
##hospital management software
##PRINTING WELCOME NOTE
while(True):
print("""
=====================================
=====================================
=======
=====================================
=====================================
=======
""")
##creating database connectivity
import mysql.connector
passwd=str(input("ENTER THE DATABASE PASSWORD;")
mysql=mysql.connector.connect(host="localhost",u
ser="root",password=passwd)
mycursor=mysql.cursor()
#creating database
mycursor.execute("create database if not exists
af_hospitals")
#creating the tables we need
mycursor.execute("create table if not exists
patient_details(name varchar(30) not null,sex
varchar (1),age int(3),address
varchar(50),contact int(10))")
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_salaryint(10))")
=============================
mycursor.execute("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))")
mycursor.execute("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))")
#login or signup option
#creating table for storing the username and
password of the user
mycursor.execute("create table if not exists
user_data(username varchar(30) primary
key,password varchar(30) default'000')")
#printing option
while(True):
print("""
1.LOGIN
2.REGISTER
""")
===============================================
==================================
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!PLEASE REGISTER
YOURSELF!!!!!!!!!!!!!!!!!!!!!!!!!!!
===============================================
==================================
""")
u=input("ENTER YOUR PREFERRED USERNAME!!:")
p=input("ENTER YOUR PREFERRED PASSWORD(PASSWORD
SHOULD BE STRONG!!!):")
#ENTERING THE ENTERED VALUE TO THE USER_DATA TABLE
mycursor.execute("insert into user_data
values('"+u+"','"+p+"')")
mysql.commit()
print("""
================================================
=================================
!!!!!!!!!!!!!!!!!!!!!!!!!!!REGISTERED
SUCCESSFULLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================
=================================
""")
x=input("enter any key to continue:")
#IF USER WANTS TO LOGIN
elif r==1:
print("""
================================================
=================================
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! {{SIGN
IN }} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================
=================================
""")
un=input("ENTER THE USERNAME!!:")
ps=input("ENTER THE PASSWORD!!:")
1.ADMINISTRATION
3.SIGN OUT
""")
1. SHOW DETAILS
4. EXIT
""")
1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
""")
1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
""")
mysql.commit()
print("SUCCESSFULLY ADDED")
#for entering nurse details
elif c==2:
#ASKING THE DETAILS
name=input("ENTER NURSE NAME:")
age=input("ENTER AGE:")
add=input("ENTER ADDRESS:")
cont=input("ENTER CONTACT NO.:")
ms=int(input("ENTER MONTHLY_SALARY:"))
#INSERTING VALUES ENTERED TO THE TABLE
mycursor.execute("insert into nurse_details
values('"+name+"','"+age+"','"+add+"','"+con
t+"','"+str(ms)+"')")
mysql.commit()
print("SUCCESSFULLY ADDED")
#for entering workers details
elif c==3:
#ASKING THE DETAILS
name=input("ENTER WORKER NAME:")
age=input("ENTER AGE:")
add=input("ENTER ADDRESS:")
cont=input("ENTER CONTACT NO.:")
ms=input("ENTER MONTHLY_SALARY:")
#INSERTING VALUES ENTERED TO THE TABLE
mycursor.execute("insert into
other_workers_details
values('"name"','"age"','"add"','"cont"','"m
s"')")
mysql.commit()
print("SUCCESSFULLY ADDED")
#if user wants to delete data
elif b==3:
print("""
1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
""")
c=int(input("ENTER YOUR CHOICE:"))
#deleting doctor's details
if c==1:
name=input("ENTER DOCTOR'S NAME:")
mycursor.execute("select * from
doctor_details where name=='"name"'")
row=mycursor.fetchall()
print(row)
p=input("you really wanna delete this data?
(y/n):")
if p=="y":
mycursor.execute("delete from
doctor_details where name='"+name+"'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
#deleting nurse details
elif c==2:
name=input("ENTER NURSE NAME:")
mycursor.execute("select * nurse_details
where name=='"+name+"'")
row=mycursor.fetchall()
print(row)
p=input("you really wanna delete this data?
(y/n):")
if p=="y":
mycursor.execute("delete from
nurse_details where name='"+name+"'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
mycursor.execute("select * from
workers_details where name=='"+name+"'")
row=mycursor.fetchall()
print(row)
p=input("you really wanna delete this data
(y/n):")
if p=="y":
mycursor.execute("delete from
other_workers_details where
name='"+name+"'")
mysql.commit()
print("SUCCESSFULLY DELETED!!")
else:
print("NOT DELETED")
elif b==4:
break
#entering the patient details table
elif a==2:
print("""
3. DISCHARGE PATIENT
4. EXIT
""")
b=int(input("ENTER YOUR CHOICE:"))
#showing the existing details
#if user wants to see the details of PATIENT
if b==1:
mycursor.execute("select * from
patient_details")
row=mycursor.fetchall()
for i in row:
b=0
v=list(i)
k=["NAME","SEX","AGE","ADDRESS","CONTACT
"]
d=dict(zip(k,v))
print(d)
#adding new patient
elif b==2:
name=str(input("ENTER NAME: "))
sex=str(input("ENTER SEX: "))
age=str(input("ENTER AGE: "))
address=str(input("ADDRESS: "))
contact=str(input("CONTACT NUMBER: "))
mycursor.execute ("insert into
patient_details values('"+str(name)
+"','"+str(sex)+"','"+str(age)
+"','"+str(address)+"','"+str(contact)+"')")
mysql.commit()
mycursor.execute("select * from
patient_details")
for i in mycursor:
v=list(i)
k=['NAME','SEX','AGE','ADDRESS','CONTACT
']
print(dict(zip(k,v)))
print("""
========================================
========================================
=
!!!!!!!!!!!!!!!!!!!!!!!!!!!REGISTERED
SUCCESSFULLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!
========================================
========================================
=
""")
#dischare process
elif b==3:
name=input("ENTER THE PATIENT NAME:")
mycursor.execute("select * from
patient_details where name='"+name+"'")
row=mycursor.fetchall()
print(row)
bill=input("HAS HE PAID ALL THE BILLS ?
(y/n):")
if bill=="y":
mycursor.execute("delete from
patient_details where name='"+name+"'")
mysql.commit()
#if user wants to exit
elif b==4:
break
###SIGN OUT
elif a==3:
break