Modified CS PROJECT
Modified CS PROJECT
HOSPITAL
MANAGEMENT
SYSTEM
2024-25
Presented by :
PAUL & ADITYARAJ
Class- XII-A
1
CONTENT
Sr. No. CONTENT NAME PageNo.
1 Certificate 5
2 Acknowledgments 6
6 Tkinter Window 12
8 Viewing Medicines 15
9 Checking Expiry 15
11 GUI Widgets 17
3
2024-25
PM SHRI KENDRIYA
VIDYALAYA
AMBARNATH
SHIFT - 1
2
CONTENT
Sr. No. CONTENT NAME PageNo.
14 Device Specifications 27
15 RESOURCES 28
4
CERTIFICATE!!
___________________ ___________________
Signature of Student Date
___________________
Signature of Teacher
5
CERTIFICATE!!
___________________ ___________________
Signature of Student Date
___________________
Signature of Teacher
5
ACKNOWLEDGEMENT
6
WHY WE CHOOSE
THIS TOPIC ???????
Hospitals and medical facilities rely heavily on
timely and accurate management of their
medicine inventory to provide quality healthcare.
Manual processes or outdated systems can lead
to inefficiencies, such as:
7
Importing the
mysql.connector Module
8
Importing Required
Libraries
mysql.connector
This library is used to establish a
tkinter
connection between Python and
a MySQL database. Tkinter is a Python library for
It provides functionalities to creating Graphical User Interfaces
perform database operations (GUIs).
such as executing SQL queries, tk is the main module for creating
retrieving data, and managing widgets (like buttons, labels, entry
transactions. fields).
messagebox: A submodule in
Tkinter used for displaying dialog
boxes (e.g., error messages, success
notifications).
9
Establishing the
Connection
Assigning the Connection Object
db = mysql.connector.connect(...)
A connection object (db) is created. This object represents the active connection to
the MySQL server.
Parameters:
host:
Value: "127.0.0.1"
This is the IP address of the MySQL server.
"127.0.0.1" refers to the localhost, meaning the database is hosted on the same
machine where the script is running.
port:
Value: 3306
This is the port number MySQL listens to for connections.
3306 is the default port for MySQL.
user:
Value: "root"
This is the username used to authenticate with the database.
password:
Value: "ROOT"
database:
Value: "hospital"
Specifies the name of the database to connect to.
10
create the table
a clean start
You can access the all the past medicines entries without a
loss of any medicine.
Purpose
Creates the medicines table if it does not already exist
SQL Command
CREATE TABLE IF NOT EXISTS creates a new table.
Table Structure
medicine_code VARCHAR(6) PRIMARY KEY:
A column to store unique medicine codes.
maximum length of 6 characters.
name VARCHAR(255):
A column for the name of the medicine.
Maximum length of 255 characters.
supplier VARCHAR(255):
A column for the supplier's name.
maximum length of 255 characters.
units INT:
A column to store the quantity of the medicine available.
INT specifies an integer data type.
cost_per_unit FLOAT:
A column for the cost per unit of the medicine.
FLOAT is a data type for decimal numbers.
manufacture_date DATE:
A column to store the medicine's manufacture date.
DATE is a data type for dates in YYYY-MM-DD format.
expiry_date DATE:
A column to store the medicine's expiry date.
11
Tkinter window
root = tk.Tk()
Creates the main window of the GUI application.
Tk is the main class in the tkinter
root is a common variable name used to reference the main window
root.geometry("1000x1000")
Defines the size of the main window in pixels.
1000x1000 means:
Width = 1000 pixels
Height = 1000 pixels
root.configure(bg="#f0f8ff")
#f0f8ff is a hexadecimal color code that represents Alice Blue, a light blue shade.
Enhances the GUI.
Output
12
header_label = tk.Label(...)
MAX(medicine_code
An SQL function that retrieves the highest value in the medicine_code
Ensures the new medicine code is unique
result = cursor.fetchone()[0]
Fetches the first row from the query result.
new_id = last_id + 1
Assigns the first medicine code with numeric value 1
13
Function to add a new medicine
Collects user
inputs from the
GUI fields.
Generates a unique
medicine code
Displays a success
message
check_expiry
datetime.now():
Fetches the current date and time as a datetime object.
.date():
Extracts only the date (YYYY-MM-DD) part of the datetime object.
timedelta(days=1):
Represents a time difference of one day.
+ timedelta(days=1):
Adds one day to the current date to calculate tomorrow’s date.
Example; - If today's date is 2024-11-15, then,
tomorrow = datetime.now().date() + timedelta(days=1)
tomorrow = datetime.now().date() + timedelta(days=1)
15
Function to delete a medicine
Retrieve the
medicine code from
the input field.
Validate the input to
ensure it's not
empty.
Execute a
parameterized SQL
DELETE query to
remove the record
with the given
medicine_code.
Check the number of
affected rows:
16
GUI Widgets
1. Label: Displays the text "Medicine Name" to indicate the input field’s purpose.
2. font: Sets the font style and size to Arial, 12.
3. bg: Background color of the label (#f0f8ff, a light blue shade).
4. pack(): Adds the label to the window with default alignment.
5. Entry: Provides a text input field for entering the medicine name.
6. pady: Adds vertical padding of 5 pixels around the input field.
command: Links the button to the add_medicine function. When clicked, the function runs, validating
inputs and adding the new medicine to the database.
bg: Sets the button’s background color to light blue (#87cefa).
pady: Adds vertical padding of 10 pixels around the button.
Workflow
Input medicine details (name, supplier, units, cost, manufacture date, expiry date).
Click "Add Medicine" to save the data in the database.
Click "View Medicines" to display all records.
Use "Check Expiry" to identify medicines nearing expiration.
Use "Medicine Code to Delete" and click "Delete Medicine" to remove specific records.
17
Display area for viewing medicines
18
1. Interface
2. Input
19
3. Input Successful
20
5. View Medicine
21
6. Checking Expiry
22
AFTER DELETION:
(VIEW MEDICINE)
23
IN MYSQL
1. USING DATABASE:
24
Input
mysql
25
Input
mysql
26
DEVICE
SPECIFICATIONS
27
RESOURCES
28
THANK YOU!
29