0% found this document useful (0 votes)
77 views29 pages

Computer Science Project

The document describes a hospital billing system project created using Python and MySQL. It includes details on the tables created in the MySQL database to store medicine, employee and patient data. It also provides the Python code with functions to add, remove, check and display patient records from the database.

Uploaded by

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

Computer Science Project

The document describes a hospital billing system project created using Python and MySQL. It includes details on the tables created in the MySQL database to store medicine, employee and patient data. It also provides the Python code with functions to add, remove, check and display patient records from the database.

Uploaded by

om711707
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

INVESTIGATORY PROJECT WORK

SUBMITED BY
OM PATIL
CLASS:12th B
BOARD ROLL NUMBER:

UNDER THE GUIDANCE OF


[Link] RAUT
[Link] SCIENCE
CERTIFICATE
This is to certify that OM PATIL of Class XII section B
Of Kendriya Vidyalaya Ambarnath has successfully
completed His project report in computer SCIENCE
INVESTIGATORY PROJECT on the topic
“HOSPITAL BILLING SYSTEM” under the
guidance of [Link] Raut Mam during the
year 2023-24 , in partial fulfillment of computer
science practical

Examination conducted by CBSE, New Delhi.


Date-

Signature of External Examination. Signature of Principal. Signature of CS Teacher


ACKNOWLEDGEMENT

I would like to express a deep sense of thanks & gratitude to


My project guide Computer Science teacher [Link]
Raut for guiding me immensely through the Course of the
project. He always evinced keen interest in my Work. His
constructive advice & constant motivation have Been
responsible for the successful completion of this Project

My sincere thanks go to Mr. MUKESH KUMAR SINGH, Our


principal sir, for his co-ordination in extending every Possible
support for the completion of this project.

I also thanks to my parents for their motivation & Support. I


must thanks to my classmates for their timely Help, While
doing this project I learnt a lot of new things and I got a lot of
inspiration for my future endeavors too & Support for
compilation of this project.

Last but not the least; I would like to thank all those who had Helped directly or
indirectly towards the completion of this
OBJECTIVE OF THE PROJECT
REPORT

HOSPITAL BILLING SYSTEM

 Automate billing procedures.


 Enhance accuracy in financial transactions.
 Provide a user-friendly billing interface.
 Streamline invoice generation and payment
tracking.
TABLE OF CONTENT

 OBJECTIVE
 SOFTWARE REQUIRED
 FLOWCHART OF THE TOPIC
 CODING
 OUTPUT
 BIBLOGRAPHY
INTRODUCTION
Python
Python is a widely used general-purpose, high level programming language. It
is Also quite easy to learn, understand, and code.
Python downloads with an extensive library and it contain code for various
Purposes like regular expressions , documentation - generation, unit-testing,
web Browsers, threading, databases, CGI, email, image manipulation, and
more .It Also does not need curly braces to define blocks, and indentation is
Mandatory. This further aids the readability of the code. This language
supports Both the procedural and object-oriented programming paradigms.

MYSQL
MySQL is a fast, easy-to-use RDBMS (Relational Database Management
System) being used for many small and big businesses. MySQL is released
Under an open-source license. So you have nothing to pay to use it. MySQL Is
a very
Powerful program in its own right. It handles a large subset of the
Functionality of the most expensive and powerful database packages. MySQL
uses a standard form of the well- known SQL data language. MySQL Works on
many operating systems and with many languages including PHP, PERL, C,
C++, JAVA, etc. MySQL works very quickly and works well even with Large
data sets. MySQL is very friendly to PHP, the most appreciated Language for
web development.
SOFTWARE REQUIRED
PLATEFORM WINDOW 7 and
above
FRONT END PYTHON
BACK END MYSQL

FLOW CHART
FUNCTION AND MODULE

Modules:

Import [Link]:

By importing this package , we are able to


establish the connection between SQL and
python.
FUNCTION
 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 in:
<cursor object>=<connection object>.cursor()
 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.
 fetchone():
This function will return one row from the
result set in the form of a tuple containing the
records.
 Commit():
The function provides change in the database
physically.
DETAILED DESCRIPTION
Our project has 3 MySQL tables. these are:-
1. MEDICINES
2. EMPLOYEES
3. PATIENT
1) The table MEDICINES contain the following columns:
 Medicine
 Code
 Category
 cost
2) The table EMPLOYEES contain the following columns:
 ID
 Name
 Post
 Password
3) The table patient contain the following columns:
 Name
 Medicine_code
 Medicine_quantity
 Total_money
SOURCE CODE
For Mysql:
Create database hospital;
Use hospital;

CREATE TABLE MEDICINES


(medicine VARCHAR(50),
Code INT UNIQUE ,
Category VARCHAR(50),
Cost INT );

CREATE TABLE EMPLOYEES


(ID INT UNIQUE ,
Name VARCHAR(50),
Post VARCHAR(50),
Password VARCHAR(8));

CREATE TABLE PATIENT


(ID INT UNIQUE,
(NAME VARCHAR(50),
MEDICINE_CODE INT,
MEDICINE_QUANTITY,
TOTAL_MONEY));
CODING
FOR PYTHON:
import [Link]
mycon = [Link](
host="localhost",
user="root",
password="yash2510",
database="hospital")

def add_patient():
ID = int(input("Write a new ID: "))
name = input("Name of patient: ")
[Link]("SELECT * FROM MEDICINES")
medicines = [Link]()
print("Medicine List:")
for medicine in medicines:
print(medicine)
print(" ")
medicine_code = int(input("Write a medicine code from the above list: "))
medicine_quantity = int(input("Write medicine quantity: "))
total_cost = medicine_code * medicine_quantity
[Link]("INSERT INTO PATIENT (ID, NAME, MEDICINE_CODE,
MEDICINE_QUANTITY, TOTAL_MONEY) VALUES (%s, %s, %s, %s, %s)", (ID,
name, medicine_code, medicine_quantity, total_cost))
[Link]()
logemp()

def addpatient():
ID = int(input("Write a new ID: "))
name = input("Name of patient: ")
[Link]("SELECT * FROM MEDICINES")
medicines = [Link]()
print("Medicine List:")
for medicine in medicines:
print(medicine)
print(" ")
medicine_code = int(input("Write a medicine code from the above list: "))
medicine_quantity = int(input("Write medicine quantity: "))
total_cost = medicine_code * medicine_quantity
[Link]("INSERT INTO PATIENT (ID, NAME, MEDICINE_CODE,
MEDICINE_QUANTITY, TOTAL_MONEY) VALUES (%s, %s, %s, %s, %s)",(ID,
name, medicine_code, medicine_quantity, total_cost))
[Link]()
menu()
def checkpatient():
patient_name = input("enter patient name:-")
ID = int(input("enter id "))
[Link]("SELECT * FROM PATIENT WHERE ID = %s and
NAME=%s", (ID, patient_name))
result = [Link]()
if result:
print("Patient details:")
print(f"ID: {result[0]}")
print(f"Name: {result[1]}")
print(f"Medicine Code: {result[2]}")
print(f"Medicine Quantity: {result[3]}")
print(f"Total Money: {result[4]}")
else:
print("Patient not found.")
[Link]()
def check_employee():
C=0
name = input("Enter employee name: ")
idn = int(input("Enter ID: "))
passw = input("Enter password: ")
[Link]("SELECT * FROM EMPLOYEES WHERE ID = %s and NAME
= %s and PASSWORD = %s", (idn, name, passw))
result = [Link]()
if result:
print("Employee found in the table.")
C=C+1
else:
print("Employee not found in the table.")
return C

def remove_patient():
name = input("Enter patient name: ")
idp = int(input("Enter patient ID: "))
[Link]("SELECT * FROM PATIENT WHERE ID = %s AND NAME =
%s", (idp, name))
result = [Link]()
if result:
[Link]("DELETE FROM PATIENT WHERE ID = %s AND NAME =
%s", (idp, name))
print(f"Patient with ID {idp} and name {name} removed successfully.")
else:
print("Patient not found. Please check the entered ID or name and try
again.")
[Link]()
logemp()

def display_patient_list():
try:
mycursor = [Link]()
[Link]("SELECT * FROM PATIENT")
patients = [Link]()
if patients:
print("Patient List:")
for patient in patients:
print(f"ID: {patient[0]}, Name: {patient[1]}, Medicine Code:
{patient[2]}, Medicine Quantity: {patient[3]}, Total Money: {patient[4]}")
else:
print("No Patient List.")
except Exception as e:
print(f"Error fetching patient list: {e}")
finally:
[Link]()
logemp()

def logemp():
print(" YOU ARE SUCCESSFULLY LOGIN")
print(" ")
print(" ENTER 'C' TO CHECK PATIENT LIST")
print(" ENTER 'R' TO REMOVE PATIENT FROM DATABASE")
print(" ENTER 'A' TO ADD PATIENT TO DATABASE")
print(" ENTER 'N' TO EXIT")
s = input(" ENTER ---->")
if [Link]() == 'c':
display_patient_list()
elif [Link]() == 'r':
remove_patient()
elif [Link]() == 'a':
add_patient()
elif [Link]() == 'n':
menu()
else:
print("PLEASE RE TRY")

def pat():
print("")
print(" PLEASE TELL THAT YOU ARE OLD OR NEW PATIENT")
print("")
print(" ENTER 'N' FOR NEW PATIENT")
print(" ENTER 'O' FOR OLD PATIENT")
print("")
q = input("ENTER----->")
if [Link]() == 'n':
addpatient()
menu()
elif [Link]() == 'o':
checkpatient()
menu()

def menu():

print("*********************************************************
*************************************************")
print(" ")
print(" WELCOME TO MAULI
HOSPITAL ")
print(" ")
print(" lOGIN
")
print(" ")
print(" Enter 'E' for EMPLOYEE")
print(" Enter 'P' for PATIENT")
A = input("ENTER---->")
if [Link]() == "e":
print(" ")
print("IF YOU ARE EMPLOYEE FILL THE ABOVE SECTION")
C = check_employee()
if C == 1:
logemp()
else:
print(" PLEASE TRY AGAIN")
elif [Link]() == "p":
pat()
menu()
OUTPUT
1. Login to patient or employee
2. Add new patient

3. Check Old patient


4. Employee add patient

5. Employee remove patient


6. Employee check patient list
TABLES
SELECT *FROM PATIENT;
SELECT * FROM MEDICINES;
SELECT * FROM EMPLOYEES;
BIBLOGRAPHY

 [Link]

 [Link]

 [Link]

 class 12 C.S textbook


THANK
YOU

You might also like