You are on page 1of 46

SCAN SBV NO..

2 ‘B’ BLOCK
JANAKPURI NEW DELHI -58
A PROJECT REPORT ON

“HOSPITAL MANAGEMENT SYSTEM”

SUBMITTED BY:
NAME : BRAHM DEV TRIPATHI
CLASS : XII A
ROLL NO. :
UNDER THE GUIDANCE OF:
MR. GANESH MEENA SIR
PGT (COMPUTER SCIENCE)

1
CERTIFICATE
THIS IS TO CERTIFY THAT BRAHM DEV TRIPATHI OF
CLASS XII A, ROLL NO.:********** HAS PREPARED
THIS REPORT ON THE PROJECT ENTITLED“
HOSPITAL MANAGEMENT SYSTEM ” . THIS REPORT
IS THE RESULT OF HIS EFFORTS AND ENDEAVORS.
THE REPORT IS FOUND WORTHY OF ACCEPTANCE AS
FINAL REPORT FOR THE SUBJECT COMPUTER
SCIENCE OF CLASS XII SC. HE HAS PREPARED THE
REPORT UNDER MY GUIDANCE.

(MRS. GANESH MEENA)


PGT( COMPUTER SCIENCE )
SCAN SBV NO.2 B BLOCK JANAKPURI ,
WEST DELHI 58

2
ACKNOWLEDGEMENT
I THANK MY COMPUTER SCIENCE TEACHER
MR. GANESH MEENA FOR GUIDANCE AND
SUPPORT. I WOULD ALSO LIKE TO THANK MY
PARENTS AND MY BROTHER FOR
ENCOURAGING ME DURING THE COURSE OF
THIS PROJECT. I WOULD LIKE TO THANK MY
FRIENDS MOHIT SHARMA AND
HIMANSHU KASOHTIYA FOR HELPING ME IN
MANY ASPECTS. FINALLY I WOULD LIKE TO
THANK CBSE FOR GIVING ME THIS
OPPORTUNITY TO UNDERTAKE THIS
PROJECT.

3
CONTENTS
• About Python ................................................................................ 05

• Feature of Python ......................................................................... 06

• About MySQL ................................................................................07

• Feature of MySQL ........................................................................ 08

• Requirements ............................................................................... 09

• About the Project……………………………………………………...9

• Coding……………………………………………………………….…11

• Output………………………………………………………………….33

• Table Structure………………………………………………………..44

• Bibliography…………………………………………………………..46

4
ABOUT PYTHON
Python is an interpreter, high-level and
general-purpose programming
language. Python's design philosophy
emphasizes code readability with its notable
use of significant whitespace. Its language
constructs and object-oriented
approach aim to help
programmers write clear, logical code for
small and large-scale projects.

Python is dynamically typed and garbage-collected. It supports multiple programming paradigms,


including structured (particularly, procedural), object-oriented and functional programming. Python is
often described as a "batteries included" language due to its comprehensive standard library.

Python was created in the late 1980s, and first released in 1991, by Guido van Rossum as a
successor to the ABC programming language.
Python 2.0, released in 2000, introduced new
features, such as list comprehensions, and a
garbage collection system with
reference counting, and was discontinued
with version 2.7 in 2020.

Python's large standard library, commonly cited as


one of its greatest strengths, provides tools
suited to many tasks. For Internet-facing
applications, many standard formats and protocols such as MIME and HTTP are supported. It includes
modules for creating graphical user interfaces, connecting to relational databases, generating
pseudorandom numbers, arithmetic with arbitrary-precision decimals manipulating regular
expressions, and unit testing.

Python uses dynamic typing and a combination of reference counting and a cycle- detecting garbage
collector for memory management. It also features dynamic name resolution (late binding), which
binds method and variable names during program execution.

5
FEATURES OF PYTHON
1. Easy to use: Due to simple syntax rule
2. Interpreted language: Code execution & interpretation line by line.
3. Cross-platform language: It can run on windows, Linux, Macintosh etc. equally
4. Expressive language: Less code to be written as itself express the purpose of the code.
5. Completeness: Support wide range of library.
6. Free & Open Source: Can be downloaded freely and source code can be modify for improvement.

SHORTCOMINGS OF PYTHON
1. Lesser libraries : as compared to other programming languages like c++, java, .net

2. Slow language : it is interpreted languages, it executes the program slowly.

3. Weak on Type-binding: It not pin point on use of a single variable for different data type.

6
ABOUT MYSQL
INTRODUCTION
MySQL is currently the most popular open source database software. It is a multi-user, multithreaded

database management system. MySQL is especially popular on the web. It is one of the parts of the

very popular LAMP platform. Linux, Apache, MySQL and PHP or WIMP platform Windows, Apache,

MySQL and PHP. MySQL AB was founded by Michael W idenius (Monty), David Axmark and Allan

Larsson in Sweden in year 1995.

7
FEATURES OF MYSQL:
OPEN SOURCE & FREE OF COST:
It is Open Source and available at free of cost.

• Portability: Small enough in size to install and run it on any types of Hardware and OS like Linux,
MS Windows or Mac etc.

• Security: Its Databases are secured & protected with password.

• Connectivity: Various APIs are developed to connect it with many programming languages.

• Query Language: It supports SQL (Structured Query Language) for handling database.

8
REQUIREMENTS
HARDWARE REQUIREMENTS
• Computer, for coding and typing the required documents of the project.
• Printer, to print the required documents of the project.
• Compact drive.
• Processor : Pentium quad core
• Ram : 64 mb
• Hard disk : 20 gb

SOFTWARE REQUIREMENTS
• Operating system : windows 10 or 11
• Python 3 : for execution of program
• MySQL : for storing data in the database
• Python – MySQL connector : for database connectivity and
• MS word – For presetation of output

9
ABOUT THE PROJECT
My project on “HOSPITAL MANAGEMENT SYSTEM” give idea about the management in

hospital. The package gives all the information regarding the details of doctors, nurses,

other workers and patient medical facilities.

10
CODING
##hospital management software

##PRINTING WELCOME NOTE

import sys

#---------------------------------Start Function for Registration --------------------------------- def

Registration():

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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

======================================================================""")

#---------------------------------Start Function for Administration --------------------------------- def

Administration():

ch=1

while ch!=5:

11
print("""===============================================================
==== !!!!!!!!!!!!!!!!!!!!!!!!!!! {( ADMINISTRATION )} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
===========================================================================

1. SHOW DETAILS
2. ADD NEW MEMBER
3. DELETE EXISTING ONE
4. UPDATE RECORDS
5. EXIT

""")

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

#showing the existing details

if b==1:

ch=1

while ch!=4:

print("""==============================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!! {( SHOW RECORDS )} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
4. UPDATE RECORDS
5. EXIT
""")
#ASKING USER'S CHOICE

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


#if user wants to see the details doctors

if c==1:

mycursor.execute("select * from doctor_details")

row=mycursor.fetchall()

12
if len(row)>0:

for i in row:

b=0

v=list(i)

k=["DRID","NAME", "SPECIALISATION", "AGE", "ADDRESS", "CONTACT", "FEES",

"MONTHLY_SALARY"]

d=dict(zip(k,v))

print(d)

else:

print(" RECORD DOES NOT EXISTS!!")

#if user wants to see the details of nurses

elif c==2:

mycursor.execute("select * from nurse_details")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

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

d=dict(zip(k,v))

print(d)

else:

print(" RECORD DOES NOT EXISTS!!")

#if user wants to see the details of other_workers

elif c==3:

mycursor.execute("select * from other_workers_details")

row=mycursor.fetchall()

13
if len(row)>0:

for i in row:

v=list(i)

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

d=dict(zip(k,v))

print(d)

else:

print(" RECORD DOES NOT EXISTS!!")

ch=c

#IF USER WANTS TO ENTER DETAILS

elif b==2:

ch=1

while ch!=4:
print("""===============================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!! {( ADD RECORDS )} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

1. DOCTOR DETAILS

2. NURSE DETAILS

3. OTHER WORKERS

4. EXIT

""")

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

#FOR ENTERING DETAILS OF DOCTORS

if c==1:

14
#ASKING THE DETAILS
name=input("ENTER DR. NAME:")
spe=input("ENTER YOUR SPECIALISATION:")
age=input("ENTER YOUR AGE:")

add=input("ENTER YOUR 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

(name,specialisation,age,address,contact,fees,monthly_salary)

values('"+name.upper()+"','"+spe.upper()+"','"+age+"','"+add.upper()+"','"+cont+"','"+fees+"','"+ms+"')

")

mysql.commit()

print(" SUCCESSFULLY ADDED!!")

#for entering nurse details


elif c==2:

#ASKING THE DETAILS

name=input("ENTER NURSE NAME:")

age=input("ENTER NURSE AGE:")

add=input("ENTER NURSE ADDRESS:")

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

ms=int(input("ENTER MONTHLY_SALARY:"))

#INSERTING VALUES ENTERED TO THE TABLE

mycursor.execute("insert into nurse_details(name,age,address,contact,monthly_salary)

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

mysql.commit()

15
print(" SUCCESSFULLY ADDED!!")

#for entering workers details

elif c==3:
#ASKING THE DETAILS

name=input("ENTER WORKER NAME:")

age=input("ENTER WORKER AGE:")

] add=input("ENTER WORKER ADDRESS:")

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

ms=input("ENTER MONTHLY_SALARY:")

#INSERTING VALUES ENTERED TO THE TABLE

mycursor.execute("insert into

other_workers_details(name,age,address,contact,monthly_salary)

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

)")

mysql.commit()

print(" SUCCESSFULLY ADDED!!")

ch=c

#if unser wants to delete data

elif b==3:

ch=1

while ch!=4:

print("""================================================================

!!!!!!!!!!!!!!!!!!!!!!!!!! {( DELETE RECORDS )} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

16
1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
4. EXIT

""")

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

#deleting doctor's details

if c==1:

pkid=input("ENTER DOCTOR'S ID:")

mycursor.execute("select * from doctor_details where pkid='"+pkid+"'")

row=mycursor.fetchall()

if len(row)>0:

print(row)

p=input("you really wanna delete this data? (y/n):")

if p=="y":

mycursor.execute("delete from doctor_details where pkid='"+pkid+"'")

mysql.commit()

print(" SUCCESSFULLY DELETED!!")

else:

print(" NOT DELETED!!")

else:

print(" RECORD DOES NOT EXISTS!!")

#deleting nurse details

elif c==2:

pkid=input("ENTER NURSE ID:")

mycursor.execute("select * from nurse_details where pkid='"+pkid+"'")

row=mycursor.fetchall()

17
if len(row)>0:

print(row)

p=input("you really wanna delete this data? (y/n):")

if p=="y":

mycursor.execute("delete from nurse_details where pkid='"+pkid+"'")

mysql.commit()

print(" SUCCESSFULLY DELETED!!")

else:

print(" NOT DELETED!!")

else:

print(" RECORD DOES NOT EXISTS!!")

#deleting other_workers details

elif c==3:

pkid=input("ENTER THE WORKER ID:")

mycursor.execute("select * from other_workers_details where pkid='"+pkid+"'")

row=mycursor.fetchall()

if len(row)>0:

print(row)

p=input("you really wanna delete this data? (y/n):")

if p=="y":

mycursor.execute("delete from other_workers_details where pkid='"+pkid+"'")

mysql.commit()

print(" SUCCESSFULLY DELETED!!")

else:
print(" NOT DELETED!!")

else:

print(" RECORD DOES NOT EXISTS!!")

18
ch=c

#if unser wants to update data

elif b==4:

ch=1

while ch!=4:

print("""============================================================

!!!!!!!!!!!!!!!!!!!!!!!!!! {( UPDATE RECORDS )} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

1. DOCTOR DETAILS
2. NURSE DETAILS
3. OTHER WORKERS
4. EXIT """)

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

#updating doctor's details

if c==1:

pkid=input("ENTER DOCTOR'S ID:")

mycursor.execute("select * from doctor_details where pkid='"+pkid+"'")

row=mycursor.fetchall()

if len(row)>0:

print(row)

p=input("you really wanna update this data? (y/n):")

if p=="y":

#ASKING THE DETAILS

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

spe=input("ENTER YOUR SPECIALISATION:")

age=input("ENTER YOUR AGE:")

add=input("ENTER YOUR ADDRESS:")

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

19
fees=input("ENTER FEES:")

ms=input("ENTER MONTHLY_SALARY:")

#UPDATING VALUES ENTERED INTO THE DOCTORS_TABLE

mycursor.execute("update doctor_details set

name=UPPER('"+name+"'),specialisation=UPPER('"+spe+"'),age='"+age+"',address=UPPER('"+add

+"'),contact='"+cont+"',fees='"+fees+"',monthly_salary='"+ms+"' where pkid='"+pkid+"'")

mysql.commit()

print(" SUCCESSFULLY UPDATED!!")

else:

print(" NOT UPDATED!!")

else:

print(" RECORD DOES NOT EXISTS!!")

#updating nurse details

elif c==2:

pkid=input("ENTER NURSE ID:")

mycursor.execute("select * from nurse_details where pkid='"+pkid+"'")

row=mycursor.fetchall()

if len(row)>0:

print(row)

p=input("you really wanna update this data? (y/n):")

if p=="y":

#ASKING THE DETAILS

name=input("ENTER NURSE NAME:")

age=input("ENTER NURSE AGE:")

add=input("ENTER NURSE ADDRESS:")

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

ms=int(input("ENTER MONTHLY_SALARY:"))

20
mycursor.execute("update nurse_details set

name=UPPER('"+name+"'),age='"+age+"',address=UPPER('"+add+"'),contact='"+cont+"',monthly_

s alary='"+str(ms)+"' where pkid='"+pkid+"'")

mysql.commit()

print(" SUCCESSFULLY UPDATED!!")

else:

print(" NOT UPDATED!!")

else:

print(" RECORD DOES NOT EXISTS!!")

#updating other_workers details

elif c==3:

pkid=input("ENTER THE WORKER ID:")

mycursor.execute("select * from other_workers_details where pkid='"+pkid+"'")

row=mycursor.fetchall()

if len(row)>0:

print(row)

p=input("you really wanna update this data? (y/n):")

if p=="y":

#ASKING THE DETAILS

name=input("ENTER WORKER NAME:")

age=input("ENTER WORKER AGE:")

add=input("ENTER WORKER ADDRESS:")

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

ms=input("ENTER MONTHLY_SALARY:")

#UPDATING VALUES ENTERED TO THE TABLE

21
mycursor.execute("update other_workers_details set

name=UPPER('"+name+"'),age='"+age+"',address=UPPER('"+add+"'),contact='"+cont+"',monthly_

s alary='"+str(ms)+"' where pkid='"+pkid+"'")

mysql.commit()

print(" SUCCESSFULLY UPDATED!!")

else:

print(" NOT UPDATED!!")

else:

print(" RECORD DOES NOT EXISTS!!")

ch=c

elif b==5:

return

ch=b

#-----------------

----------------

Start Function

for Patient ----

-------------------

----------

def Patient():

ex=1

while ex!=5:

print("""==================================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! {( PATIENT )} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

1. SHOW ALL PATIENT DETAILS


2. ADD NEW PATIENT

22
3. DISCHARGE PATIENT
4. SEARCH PATIENT DETAILS
5. 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)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

v[-1]='DISCHARGED'

k=['PUID', 'NAME', 'SEX', 'AGE', 'ADDRESS', 'CONTACT', 'DOCTOR_RECOMMENDED',

'STATUS']

d=dict(zip(k,v))

print(d)

#adding new patient

elif b==2:

#puid=str(input("ENTER PATIENT NUMBER: "))

name=str(input("ENTER PATIENT NAME: "))

sex=str(input("ENTER PATIENT SEX: "))

23
age=str(input("ENTER PATIENT AGE: "))

address=str(input("ENTER PATIENT ADDRESS: "))

contact=str(input("ENTER PATIENT CONTACT NUMBER: "))

docRecmd=str(input("ENTER DOCTOR NAME WHO RECOMMENDED: "))

PaidBill='N'

con=input("DO YOU WANT TO SAVE THIS RECORD? (y/n): ")

if con=='Y' or con=='y':

mycursor.execute ("insert into patient_details

(name,sex,age,address,contact,doctor_recommended,PaidBill)

values('"+str(name.upper())+"','"+str(sex.upper())+"','"+str(age)+"','"+str(address.upper())+"','"+str(c

o ntact)+"','"+str(docRecmd.upper())+"','"+str(PaidBill)+"')")

mysql.commit()

print("""=============================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!REGISTERED SUCCESSFULLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

""")

mycursor.execute("select * from patient_details")

for i in mycursor:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

24
#dischare process

elif b==3:

puid=str(input("ENTER THE PATIENT ID:"))

mycursor.execute("select * from patient_details where puid='"+puid+"' and paidbill='N'")

row=mycursor.fetchall()

if len(row)>0:

print(row)

bill=input("HAS HE/SHE PAID ALL THE BILLS ? (y/n):")

if bill=="y":

mycursor.execute("update patient_details set paidbill='Y' where puid='"+puid+"'")

mysql.commit()

print(" PATIENT DISCHARGED SUCESSFULLY.")

else:

print(" RECORD DOES NOT EXISTS OR PATIENT HAS

BEEN DISCHARGE ALREADY!!")

#Search process

elif b==4:

ch=1

while ch!=7:

print("""========

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

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

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

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

25
!!!!!!!!!!!!!!!!!!!!!!!!!! {( SEARCH PATIENT DETAILS )} !!!!!!!!!!!!!!!!!!!!!!!!!

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

1. PATIENT ID WISE
2. PATIENT NAME WISE
3. PATIENT SEX WISE
4. PATIENT AGE WISE
5. PATIENT CONTACT WISE
6. RECOMMENDED DOCTOR WISE
7. EXIT

""")

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


#Search data according to patient id wise

if c==1:

pId=input("ENTER PATIENT ID:")

mycursor.execute("select * from patient_details where puid='"+pId+"'")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

else:

print(" RECORD DOES NOT EXITS!!")

#Search data according to patient name wise

26
elif c==2:

pname=input("ENTER PATIENT NAME:")

mycursor.execute("select * from patient_details where name='"+pname+"'")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

else:

print(" RECORD DOES NOT EXITS!!")

#Search data according to patient sex

elif c==3:

psex=input("ENTER PATIENT SEX:")

mycursor.execute("select * from patient_details where sex='"+psex+"'")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

27
v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

else:

print(" RECORD DOES NOT EXITS!!")

#Search data according to patient age

elif c==4:

print("ENTER PATIENT AGE RANGE")

pages=input("ENTER PATIENT AGE FROM:" )

pagee=input("ENTER PATIENT AGE TO:" )

mycursor.execute("select * from patient_details where age between '"+pages+"' and

'"+pagee+"' order by AGE")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

else:

print(" RECORD DOES NOT EXITS!!")

#Search data according to patient contact

28
elif c==5:

pcnt=input("ENTER PATIENT CONTACT:")

mycursor.execute("select * from patient_details where contact='"+pcnt+"'")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

else:

v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

else:

print(" RECORD DOES NOT EXITS!!")

#Search data according to patient doctor recommended

elif c==6:

prdw=input("ENTER PATIENT RECOMMENDED DOCTOR WISE:")

mycursor.execute("select * from patient_details where doctor_recommended

='"+prdw+"'")

row=mycursor.fetchall()

if len(row)>0:

for i in row:

v=list(i)

if v[-1]=='N' or v[-1]=='n':

v[-1]='NOT DISCHARGE'

29
else:

v[-1]='DISCHARGED'

k=['PUID','NAME','SEX','AGE','ADDRESS','CONTACT','DOCTOR_RECOMMENDED','STATUS']

print(dict(zip(k,v)))

else:
print(" RECORD DOES NOT EXITS!!")

ch=c

ex=b

#if user wants to exit

#elif b==5:

return

#---------------------------------------------------- Start Main Program ---------------------------------------------------

while(True):
print("""====================================================================

!!!!!!!!!!!!!!!!!!!!!! {{WELCOME TO HOSPITALS PVT. LTD.}} !!!!!!!!!!!!!!!!!!!!!!

====================================================================== """)

##creating database connectivity

import mysql.connector
#passwd=str(input("ENTER THE DATABASE PASSWORD;"))

mysql=mysql.connector.connect(host="localhost",user="root",passwd="admin@123")

mycursor=mysql.cursor()

#creating database mycursor.execute("create database if not exists hospitals")

mycursor.execute("use hospitals")

#creating the tables we need

mycursor.execute("create table if not exists patient_details(puid int(10) NOT NULL

30
AUTO_INCREMENT primary key,name varchar(30) not null,sex varchar(10),age int(3),address

varchar(50),contact varchar(15),doctor_recommended varchar(30),PaidBill CHAR(1))")

mycursor.execute("create table if not exists doctor_details(pkid int(10) NOT NULL

AUTO_INCREMENT primary key,name varchar(30),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(pkid int(10) NOT NULL

AUTO_INCREMENT primary key,name varchar(30),age int(2),address varchar(30),contact

varchar(15),monthly_salary int(10))")

mycursor.execute("create table if not exists other_workers_details(pkid int(10) NOT NULL

AUTO_INCREMENT primary key,name varchar(30),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("""=================================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! {{LOGIN }} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

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

1. SIGN IN (LOGIN)

2. SIGN UP (REGISTER)

0. CLOSE THE PROGRAM

""")

r=int(input("ENTER YOU CHOICE:"))

#IF USER WANTS TO REGISTER

if r==0:

31
mycursor.close()

sys.exit()

elif r==2:

Registration();

x=input("PRESS 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("""===============

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

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

!!!!!!!!!!!!!!!!!!!!!!!!!!!!! {{MAIN MENU}} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

32
==============================================================

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:

Administration();

#entering the patient details table

elif a==2:

Patient();

###SIGN OUT

elif a==3:

break

#IF THE USERNAME AND PASSWORD IS NOT IN THE DATABASE

else:

print(" You have entered wrong password. Try again!")

break

else:

if len(row)==0:

print(" Username does not exists. Try again!")

OUTPUT
When open the program show first page.

33
Figure 1

If user enter choice number “0” then close the program.


If user enter choice number “2” then show following screen:

Figure 2

If user enter choice number “1” then show following screen: Figure

Figure 4

If user enter choice number “3” then exit the menu and show following screen: Figure

34
If user enter choice number “1” then show following screen: Figure

If user enter choice number “1” then show following screen: Figure

In above men oned screen give three types to show the details. If user enter choice number “1” then show following
screen:

Figure 8

If user enter choice number “2” then show following screen

: Figure 9

35
If user enter choice number “3” then show following screen:

Figure 10

If user enter choice number 4 then come back on Figure 6. A er that if user enter choice number “2” then
show following screen:

Figure 11

If user enter choice number “1” then show following screen and wants following details of doctor. User entered
all require details and system give message “SUCCESSFULLY ADDED”.

Figure 12

If user enter choice number “2” then show following screen and wants following details of nurse. User entered
all require details and system give message “SUCCESSFULLY ADDED”. Figure 13

36
If user enter choice number “3” then show following screen and wants following details of other worker. User
entered all require details and system give message “SUCCESSFULLY ADDED”. Figure 14

If user enter choice number “4” then come back on Figure 6. A er that if user enter choice number “3” then show
following screen:

Figure 15

If user enter choice number “1” then show following screen and system ask to user doctor id for delete the
record, user enter doctor id, system will check the id and if record does not exists into system then show
following message:

Figure 16

If user enter choice number “1” then show following screen and system ask to user doctor id for delete the
record, user enter doctor id, system will check the id and if record does exists into system then show the
doctor’s details and ask to user delete the records. If user enter “N” then record does not delete and show
following screen:

Figure 17

37
A er select choice number “1” and enter doctor id for delete, if user enter “Y” then show following screen: Figure

18

If user enter choice number “2” then show following screen and system ask to user nurse id for delete the
record, user enter nurse id, system will check the id and if record does not exists into system then show
following message:

Figure 19

If user enter choice number “2” then show following screen and system ask to user nurse id for delete the
record, user enter nurse id, system will check the id and if record exists into system then show the nurse’s
details and ask to user delete the records. If user enter “N” then record does not delete and show following
screen:

Figure 20

A er select choice number “2” and enter nurse id for delete, if user enter “Y” then show following screen: Figure

21

38
If user enter choice number “3” then show following screen and system ask to user other worker id for delete
the record, user enter other worker id, system will check the id and if record does not exists into system then
show following message:

Figure 22

If user enter choice number “3” then show following screen and system ask to user other worker id for delete
the record, user enter other worker id, system will check the id and if record exists into system then show the
other worker’s details and ask to user delete the records. If user enter “N” then record does not delete and
show following screen:

Figure 23

A er select choice number “3” and enter other worker id for delete, if user enter “Y” then show following screen:

Figure 24

If user enter choice number “4” then come back on Figure 6. A er that if user enter choice number “4” then show
following screen:

Figure 25

If user enter choice number “1” then system ask to user doctor id and check into database, if record does not exists
then show following screen:

Figure 26

39
If record exists into database then show the exists details of doctor and ask to user for update, if user enter “N”
choice then show following screen:

Figure 27

If record exists into database then show the exists details of doctor and ask to user for update, if user enter “Y”
choice then system ask to user all details of doctor’s and user enter all details again with new changes: Figure
28

If user enter choice number “2” then system ask to user nurse id and check into database, if record does not exists
then show following screen:

Figure 29

If record exists into database then show the exists details of nurse and ask to user for update, if user enter “N”
choice then show following screen:

Figure 30

If record exists into database then show the exists details of nurse and ask to user for update, if user enter “Y”
choice then system ask to user all details of nurse’s and user enter all details again with new changes: Figure
31

40
If user enter choice number “3” then system ask to user other worker id and check into database, if record
does not exists then show following screen: Figure 32

If record exists into database then show the exists details of other worker and ask to user for update, if user
enter “N” choice then show following screen: Figure 33

If record exists into database then show the exists details of other worker and ask to user for update, if user
enter “Y” choice then system ask to user all details of other worker’s and user enter all details again with new
changes:

Figure 34

If user enter choice number “4” then come back on Figure 6 and user enter choice number “5” then come back
on Figure 3. A er that user enter choice number “2” then show following screen: Figure 35

41
If user enter choice number “1” then show following screen:

Figure 36

If user enter choice number “2” then show following screen:

Figure 37

If user enter choice number “3” then show following screen:

Figure 38

If user enter choice number “4” then show following screen:

Figure 39

42
If user enter choice number “1” then show following screen: Figure

40

If user enter choice number “2” then show following screen: Figure

41

If user enter choice number “3” then show following screen: Figure

42

If user enter choice number “4” then show following screen: Figure

43

If user enter choice number “5” then show following screen: Figure

44

43
If user enter choice number “6” then show following screen: Figure

45

If user enter choice number “7” then Figure 35. If user enter choice number “5” then show Figure 4.

TABLE STRUCTURE
Table 1

Table 2

44
Table 3

Table 4

Table 5

45
BIBLIOGRAPHY
• COMPUTER SCIENCE IN PYTHON BY ­PREETI
ARORA.

………………………………………………………………………………………………
>>>>>>>>>>>>>>>>>>>>>>>>>>THE END <<<<<<<<<<<<<<<<<<<<<<<
………………………………………………………………………………………………

46

You might also like