0% found this document useful (0 votes)
18 views16 pages

Jose Science Project Class 12

y

Uploaded by

3339aks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views16 pages

Jose Science Project Class 12

y

Uploaded by

3339aks
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

INDEX

SL.NO CONTENTS PAGE.NO


1. CERTIFICATE 2

2. ACKNOWLEDGEMENT 3

3. AIM 4

4. PROJECT ANALYSIS 5

5. FUNCTIONS AND 7
MODULES
6. DETAILED 9
DESCRIPTION
7. SOURCE CODE 10

8. SCREENSHOTS 14

9. BIBLIOGRAPHY 15
ACKNOWLEDGEMENT

I hereby acknowledge my deep sense of


gratitude and indebtedness to the personalities
whose immense help, genius guidance,
encouragement, necessary suggestions,
initiations, enthusiasm and inspiration made
this work a master art and a joint enterprise.

I express my sincere gratitude towards our


Principal, Vice Principal and also express my
sincere thanks to my computer science teacher
Mr. Pramod Kumar for giving me this great
opportunity to do this project on creating a
hospital management application, which
helped me to understand the various concepts
and better understanding in MYSQL
connectivity.

I also thank my parents who have helped me in


collecting data regarding the project.
-------------------------------------------------------------------

HOSPITAL
MANAGEMENT
APPLICATION

-----------------------------------------------------------------
PROJECT ANALYSIS
Our application program is specially designed for
hospitals .

Hospital Management System is indispensable in


modern healthcare settings, improving efficiency,
accuracy, patient care and compliance while also
enabling healthcare providers to focus on what matters
most: the well-being of their patients.

We have tried to maximize the efficiency and strived for


customer and user ease as well as satisfaction.

We have thoroughly examined the needs of the hospitals


and after the analysis we have constructed the program.

We have used PYTHON and MYSQL as our platform to


carry out this task.
SCREENSHOTS
SOURCE CODE
import mysql.connector as s1
print("Welcome to CS project 2025")
print("To connect to mysql,please enter password below")
passw=input("Enter password:")

con=s1.connect(host="localhost",user="root",password=passw)
cur=con.cursor()
cur.execute("CREATE DATABASE IF NOT EXISTS HOS_MNGMNT")
con.close()

con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS PATIENTS(Pat_id int,Pat_name varchar(30),Pat_age
int,Phno char(10),Pat_housename varchar(30),Pat_dept varchar(30))")

def add():
con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
patient_id=int(input("Enter Patient's ID"))
patient_name=input("Enter Patient's Name")
patient_age=int(input("Enter Patient's Age"))
phone_number=input("Enter Patient's Phone Number")
while phone_number.isdigit():
break
else:
print("Phone number should be numbers")
phno=input("Enter Patient's Phone Number")
house_name=input("Enter Patient's House Name")
department=input("Department")
query='INSERT INTO PATIENTS(Pat_id,Pat_name,Pat_age,Phno,Pat_housename,Pat_dept)
VALUES(%s,%s,%s,%s,%s,%s)'
values=(patient_id,patient_name,patient_age,phone_number,house_name,department)
cur.execute(query,values)
con.commit()
print()
print("Successfully added",patient_name)
con.close()

def search_update():
con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
record=None
print("Before updating a record verification is required")
patient_id=int(input("Enter patients id "))
sql="select * from patients where pat_id={}".format(patient_id)
cur.execute(sql)
record=cur.fetchone()

ans=False
try:
if(patient_id==record[0]):
ans=True
print("Patient id found...update new phone number.")
if ans==True:
phone_no=int(input("Enter phone number:"))
age=int(input('Enter age:'))
house_name=input("Enter Patient's House Name")
department=input("Department")
patient_address=input("Enter patient's addresss")
doctor_name=input("Enter doctor's name")
sql1="Update patients set Phno=%s where pat_id=%s"
val1=(phone_no,patient_id)
cur.execute(sql1,val1)
con.commit()
sql2="Update patients set Pat_age=%s where pat_id=%s"
val2=(age,patient_id)
cur.execute(sql2,val2)
con.commit()
sql3="Update patients set Pat_housename=%s where pat_id=%s"
val3=(house_name,patient_id)
cur.execute(sql3,val3)
con.commit()
sql4="Update patients set Pat_dept=%s where pat_id=%s"
val4=(department,patient_id)
cur.execute(sql4,val4)
con.commit()
sql5="Update patients set Pat_address=%s where pat_id=%s"
val5=(patient_address,patient_id)
cur.execute(sql5,val5)
con.commit()
sql6="Update patients set Doc_name=%s where pat_id=%s"
val6=(doctor_name,patient_id)
cur.execute(sql6,val6)
con.commit()
print("Update successfully...")
else:
print("Wrong entry...")
except:
print("Not found.Please enter valid patient_id. ")
def delt():
con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
nm=input("Enter name:")
query="DELETE FROM patients WHERE Pat_name=%s"
cur.execute(query,(nm,))
if cur.rowcount == 0:
print("No records found with that name.")
else:
con.commit()
print("Successfully deleted")
con.close()

def disp():
print("1.Display all records")
print("2.Display n records")
print("3.Display first record")
ans="y"
while ans=="y" or ans=="Y":
ch=int(input("Enter your choice(1-3):"))
if ch==1:
con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
cur.execute("SELECT * FROM patients")
x=cur.fetchall()
if len(x)==0:
print("There are no records available.")
else:
for row in x:
print(row)
con.close()
elif ch==2:
con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
cur.execute("SELECT * FROM patients")
n=int(input("Enter the number of records to be displayed:"))
print("Displaying",n,"records")
x=cur.fetchmany(n)
if len(x)==0:
print("There are no records available.")
else:
for row in x:
print(row)
con.close()
elif ch==3:
con=s1.connect(host="localhost",user="root",password=passw,database="HOS_MNGMNT")
cur=con.cursor()
cur.execute("SELECT * FROM patients")
print("Displaying first record")
x=cur.fetchone()
if len(x)==0:
print("There are no records available.")
else:
print(x)
con.close()
else:
print("Invalid choice..")
ans=input("Do you want to perform more operations?(y/n):")

while True:
print()
print("Available options are:")
print()
print("1.Add")
print("2.Delete")
print("3.Update")
print("4.Display")
print("5.Exist")
print()
try:
n=int(input("Enter your choice:"))
if n==1:
add()
elif n==2:
delt()
elif n==3:
search_update()
elif n==4:
disp()
elif n==5:
break
else:
print("Invalid choice")
continue
except ValueError:
print("Invalid input. Please enter a number.")
FUNCTIONS AND MODULES

MODULES:

 Import mysql.connector:
By importing this package, we are able to establish
the connection between SQL and Python.

FUNTIONS:

 connect():
This function establishes connection between Python
and MYSQL

 cursor():
It is a special control structure that facilitates the
row-by-row processing of records in the result set.
The Syntax is:
<cursor object><connection object>.cursor()

 execute():
This function is used to execute the sql query and
retrieve records using python.
The Syntax is :
<cursor object >.execute(<sql query string>)
JAWAHAR NAVODAYA
VIDYALAYA IDUKKI 2024-25

COMPUTER SCIENCE
PROJECT

Topic :Hospital Management

Submitted by : Josepaul Jude Christy


Class: XII A
REG.NO. :
 def():
A function is a block of code which only runs when it is
called.

 fetchall():
This function will return all the rows from the result set
in the form of a tuple containing the records.

 commit():
This function provides changes in the database
physically.

 def search_update():
This function allows the user to search the details of the
patient and update it if needed.
DETAILED DESCRIPTION
 Our Project has 1 MySQL table:
1) Patients

 The table patients contain the following columns:

a) Pat_id
b) Pat_name
c) Pat_age
d) Phno
e) Pat_housename
f) Pat_dep
BIBLIOGRAPHY

To develop this project many references were used:

 COMPUTER SCIENCE Class XII:SUMITA ARORA


 UPGRAD CS

https://www.upgrad.com/blog/computer-science
project-ideas-topics-beginners/

 GEEKS FOR GEEKS

https://www.geeksforgeeks.org/computer-science-
projects/
JAWAHAR NAVODAYA VIDYALAYA
IDUKKI 2024-25

CERTIFICATE
This is to certify that this bonafide project work in the
subject of Computer Science has been done by
Josepaul Jude Christy of class XII in the academic year
2024-25 and submitted to AISSCE practical
examination conducted by CBSE at JNV IDUKKI on

TEACHER IN
PRINCIPAL
CHARGE

EXTERNAL EXAMINER

You might also like