Class 12 Cs Project File
Class 12 Cs Project File
RAM : 2 GB or more
Tables used:-
1. Patient_Details:
Purpose: Stores information about patients.
Columns:
puid (Primary Key): Patient ID
Name: Patient name
Age: Patient age
Address: Patient address
doctor_recommended: Doctor recommended for the
patient
2. Doctor_Details:
Purpose: Stores details about doctors.
Columns:
Name (Primary Key): Doctor's name
Specialisation: Doctor's area of specialization
Age: Doctor's age
Address: Doctor's address
Contact: Doctor's contact number
Fees: Doctor's fees
Monthly_salary: Doctor's monthly salary
3. Nurse_Details:
Purpose: Stores information about nurses.
Columns:
Name (Primary Key): Nurse's name
Age: Nurse's age
Address: Nurse's address
Contact: Nurse's contact number
Monthly_salary: Nurse's monthly salary
4. Other_Workers_Details:
Purpose: Stores information about other workers (non-
doctor/non-nurse staff).
Columns:
Name (Primary Key): Worker's name
Age: Worker's age
Address: Worker's address
Contact: Worker's contact number
Monthly_salary: Worker's monthly salary
5. User_Data:
Purpose: Stores usernames and passwords for user
authentication.
Columns:
Username (Primary Key): User's chosen username
Password: User's chosen password (default value is set
to '000')
Various functions performed by the
project
➤User Registration/Login:
Presents the user with options to either register a new
account or log in.
Captures user-provided credentials (username and
password) during the registration process.
Validates user login by comparing entered credentials
with those stored in the 'user_data' table.
➤ Administration Options:
For authenticated administrators-
Displays a menu with options to manage staff details.
Allows viewing existing staff details (doctors, nurses,
other workers).
Facilitates the addition of new staff members with
specified details.
Supports the deletion of existing staff members based
on user input.
➤ Patient Management:
Offers functionality related to patient data-
Displays existing patient details.
Enables the addition of new patient records, including
personal information.
Provides a process for discharging patients, including
bill payment verification.
➤ User Logout:
Allows users to gracefully exit the system, terminating
the active session.
PROGRAM CODE
##hospital management software
##PRINTING WELCOME NOTE
while(True):
print("""
========================
WELCOME TO MYHOSPITAL
========================
""")
#creating database connectivity import mysql.connector
import mysql.connector
password=str(input("ENTER THE DATABASE PASSWORD:"))
mysql=mysql.connector.connect(host="localhost", user="root",passwd="password")
mycursor=mysql.cursor()
#creating database
mycursor.execute("create database if not exists my_hospitals")
mycursor.execute("use my_hospitals")
#creating the tables we need
mycursor.execute("create table if not exists patient_details(puid int(10) primary key,name varchar(30) not null,sex
varchar(10),age int(3), address varchar(50), contact varchar(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_salary int(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. SIGN IN (LOGIN)
2. SIGN UP (REGISTER)
""")
r=int(input("enter your choice:"))
#IF USER WANTS TO REGISTER
if r==2:
print("""
=================================
!!!!!!!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:
#PRINTING THE SINGIN OPTION AGAIN TO THE USER AFTER REGISTRATION
print("""
=================================
!!!!!!!! {{SIGN IN }} !!!!!!!!!!
=================================
""")
un-input("ENTER THE USERNAME!!:")
ps=input("ENTER THE PASSWORD!!:")
mycursor.execute("select password from user_data where username=""+un+"")
row-mycursor.fetchall()
for i in row:
a=list(i)
if a[0]==str(ps):
while(True):
#displaying the task you can perform
print("""
1.ADMINISTRATION
2.PATIENT (ADMISSION AND DISCHARGE PROCESS)
3.SIGN OUT
""")
#asking for the task from user
a=int(input("ENTER YOUR CHOICE:"))
#if user wants to enter administration option
if a==1:
print("""
1. SHOW DETAILS
2. ADD NEW MEMBER
3. DELETE EXISTING ONE
4. EXIT
""")
b=int(input("ENTER YOUR CHOICE:"))
#showing the existing details
if b==1:
print("""
1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
#ASKING USER'S CHOICE
c=int(input("ENTER YOUR CHOICE:"))
#if user wants to see the details of doctors
""")
if c==1:
mycursor.execute("select * from doctor_details")
row-mycursor.fetchall()
for i in row:
b=0
v=list(i)
k=["NAME", "SPECIALISATION", "AGE","ADDRESS","CONTACT", "FEES", "MONTHLY_SALARY"]
d=dict(zip(k,v))
print(d)
#if user wants to see the details of nurses
elif c==2:
mycursor.execute("select * from nurse_details")
row=mycursor.fetchall()
for i in row:
v=list(i)
k=["NAME", "AGE","ADDRESS","CONTACT", "MONTHLY_SALARY"]
d=dict(zip(k,v))
print(d)
#if user wants to see the details of other_workers
elif c==3:
mycursor.execute("select * from other_workers_details")
row-mycursor.fetchall()
for i in row:
v=list(i)
-----------------------
Conclusion & Bibliography