0% found this document useful (0 votes)
15 views21 pages

Cs Pra-2

This document outlines a hospital management software project that maintains records of doctors, patients, and staff. It details the hardware and software requirements, including the use of Python and MySQL for database management. The source code provided includes functionalities for user registration, login, and management of hospital records.

Uploaded by

Pughazhendhi M
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)
15 views21 pages

Cs Pra-2

This document outlines a hospital management software project that maintains records of doctors, patients, and staff. It details the hardware and software requirements, including the use of Python and MySQL for database management. The source code provided includes functionalities for user registration, login, and management of hospital records.

Uploaded by

Pughazhendhi M
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/ 21

Index

ABOUT PROJECT

Hardware and software configuration

About python

About mysql connector

Source code

Output screen

Conclusion

About the Project:


This software is used to maintain
records of doctors, patients with their
history of medication, and other staff
working in the hospital. The objective of
this project is to let students apply
programming knowledge in a real-world
situation and understand how
programming helps in developing effective
software solutions

HARDWARE
REQUIREMENTS:
❖Operating System: - Windows 10 or
above

❖Processor: - Pentium (Any) or AMD


Athlon (3800+ - 4200 + Dual Core)

❖RAM: - 512 MB+


❖Hard Disk: - SATA 40GB Or Above
❖Motherboard: - 1.845 Or 915,995
For Pentium or MSI K9MM-V VIA
K8M800+8237R Plus Chipset for AMD
Athlon

Software
Requirements :
❖Windows OS

❖Python Programming Language


❖MySQL Database Management
System

About Python:
Python is a high-level, interpreted
programming language known for its
simplicity and versatility. It is widely
used for software development, data
analysis, artificial intelligence, and
more. In this project, Python is used
to interact with the MySQL database
and implement the hospital
management features

About MySQL
Connector:
MySQL Connector is a Python library
that facilitates connecting Python
applications to a MySQL database. It
provides a convenient way to perform
database operations such as creating
tables, inserting records, retrieving
data, and managing transactions

Source Code:
while(True):

print("""

================================

WELCOME TO MY HOSPITAL

================================

""")

##creating database connectivity

import mysql.connector

passwd=input("ENTER THE DATABASE PASSWORD;")

mysql=mysql.connector.connect(host="localhost",user="root",p
assword="pugalmp@2008",database='hospital')
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(name varchar(30) not null,sex varchar(10),age
int(3),address varchar(50),contact int)")

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(15),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!!!:")

mycursor.execute("insert into user_data


values('"+u+"','"+p+"')")

mysql.commit()

print("""=======================================!!!!!!!!
REGISTERED SUCCESSFULLY!!!!!!!!
=======================================""")

x=input("enter any key to continue:")

elif r==1:

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):

print("""1.ADMINISTRATION 2.PATIENT (ADMISSION


NAD 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 DETAILS2. ADD NEW


MEMBER3. DELETE EXISTING ON4. EXIT""")

b=int(input("ENTER YOUR CHOICE:"))

#showing the existing details

if b==1:

print("""1. DOCTOR DETAILS2. NURSE


DETAILS3. OTHER WORKERS""")

c=int(input("ENTER YOUR CHOICE:"))

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","F
EES","MONTHLY_SALARY"]
d=dict(zip(k,v))

print(d)

elif c==2:

mycursor.execute("select * from
nurse_details")

row=mycursor.fetchall()

for i in row:

v=list(i)

k=["NAME","SPECIALISATION","AGE","ADDRESS","CONTACT","
MONTHLY_SALARY"]

d=dict(zip(k,v))

print(d)

elif c==3:

mycursor.execute("select * from
other_workers_details")

row=mycursor.fetchall()

for i in row:

v=list(i)
k=["NAME","SPECIALISATION","AGE","ADDRESS","CONTACT","
MONTHLY_SALARY"]

d=dict(zip(k,v))

print(d)

elif b==2:

print("""1. DOCTOR DETAILS2. NURSE


DETAILS3. OTHER WORKERS""")

c=int(input("ENTER YOUR CHOICE:"))

#FOR ENTERING DETAILS OF DOCTORS

if c==1:

name=input("ENTER DR. NAME:")

spe=input("ENTER SPECIALISATION:")

age=input("ENTER AGE:")

add=input("ENTER ADDRESS:")

cont=input("ENTER CONTACT NO.:")

fees=input("ENTER FEES:")

ms=input("ENTER MONTHLY_SALARY:")
#INSERTING VALUES ENTERED INTO THE
DOCTORS_TABLE

mycursor.execute("insert into doctor_details


values('"+name+"','"+spe+"','"+age+"','"+add+"','"+cont+"','"+fe
es+"','"+ms+"')")

mysql.commit()

print("SUCCESSFULLY ADDED")

#for entering nurse details

elif c==2:

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

cursor.execute("insert into nurse_details


values('"+name+"','"+age+"','"+add+"','"+cont+"','"+str(ms)+"')")

mysql.commit()

print("SUCCESSFULLY ADDED")
#for entering workers details

elif c1==3:

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+"','"+ms+"')")

mysql.commit()

print("SUCCESSFULLY ADDED")

#if unser wants to delete data

elif b==3:

print("""1. DOCTOR DETAILS2. NURSE


DETAILS3. 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")

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")

elif c==3:

name=input("ENTER THE WORKER NAME:")

mycursor.execute("select * from
workers_details wherename=='"+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")

if b==4:

break

#entering the patient details table

elif a==2:

print("""1. SHOW PATIENT DETAILS2. ADD NEW


PATIENT3. DISCHARGE PATIENT4. 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!!!!!!
====================================""")

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

#IF THE USERNAME AND PASSWORD IS NOT IN THE


DATABASE

else:

break

OUTPUT:

You might also like