0% found this document useful (0 votes)
2 views6 pages

Hospital Management Project Class12

The Hospital Management System project for Class 12 Computer Science efficiently manages patient, doctor, and appointment records using Python and MySQL. It includes functionalities for adding and viewing patients and doctors, as well as creating and viewing appointments. The project demonstrates key concepts such as functions, database management, and connectivity, while outlining future enhancements like a graphical user interface.

Uploaded by

rkdoxxxxx
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)
2 views6 pages

Hospital Management Project Class12

The Hospital Management System project for Class 12 Computer Science efficiently manages patient, doctor, and appointment records using Python and MySQL. It includes functionalities for adding and viewing patients and doctors, as well as creating and viewing appointments. The project demonstrates key concepts such as functions, database management, and connectivity, while outlining future enhancements like a graphical user interface.

Uploaded by

rkdoxxxxx
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
You are on page 1/ 6

Hospital Management System

Class 12 Computer Science Project

Submitted By: [Your Name]

Class: XII - Computer Science

Academic Year: 2024-2025

Date: July 08, 2025


Certificate

This is to certify that [Your Name], a student of Class XII, has successfully completed the project

titled

'Hospital Management System' as part of the Computer Science curriculum during the academic

year 2024-25.

Project demonstrates the understanding of functions, connectivity, and DBMS concepts using

Python and MySQL.

Signature of Teacher: _______________

Signature of Principal: _______________

Acknowledgement

I would like to express my sincere gratitude to my Computer Science teacher for her guidance

throughout this project.

Thanks to my school for facilities and to my family for their support.

Introduction
The Hospital Management System is designed to manage patient, doctor, and appointment records

efficiently. This project uses Python for logic, MySQL for database management, and demonstrates

Class 12 CS concepts like functions and connectivity.

Objective
- To manage patient and doctor data.

- To create and manage appointments.

- To use MySQL with Python for CRUD operations.

- To modularize the logic using functions.

Scope
The system can be implemented in clinics or small hospitals to maintain patient records and

schedule appointments.

Tools and Technologies Used


- Language: Python 3.x

- Database: MySQL

- Library: mysql.connector

- IDE: IDLE/VS Code

System Requirements
Hardware:

- RAM: 2 GB minimum

- Processor: Any modern processor

Software:

- Python 3.x

- MySQL Server

- mysql-connector-python package

Database Design
Tables:

1. patient(pid, name, age, gender, disease)

2. doctor(did, name, specialization)

3. appointment(aid, pid, did, date, time)

Functional Modules
- Add/View Patient

- Add/View Doctor

- Create/View Appointment

Advantages
- Easy to use and extend
- Quick database access

- Modular and clean code

Limitations
- No graphical interface

- No login/authentication

Future Scope
- Add GUI using Tkinter or Flask

- Implement user roles and login system

Conclusion
The project successfully demonstrates Class 12 concepts including functions, connectivity, and

database usage. It simulates a real-world hospital record system.

Bibliography
- CBSE Computer Science Textbook

- https://www.geeksforgeeks.org

- https://dev.mysql.com/doc/

Source Code
"""
Hospital Management System - Class 12 Computer Science Project
Concepts: Functions, DBMS, Connectivity
Language: Python with MySQL
"""

import mysql.connector

def connect_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="yourpassword",
database="hospital")

def create_tables():
con = connect_db()
cur = con.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS patient (pid INT PRIMARY KEY, name
VARCHAR(50), age INT, gender VARCHAR(10), disease VARCHAR(100))")
cur.execute("CREATE TABLE IF NOT EXISTS doctor (did INT PRIMARY KEY, name
VARCHAR(50), specialization VARCHAR(50))")
cur.execute("CREATE TABLE IF NOT EXISTS appointment (aid INT PRIMARY KEY, pid INT, did
INT, date DATE, time TIME, FOREIGN KEY(pid) REFERENCES patient(pid), FOREIGN KEY(did)
REFERENCES doctor(did))")
con.commit()
con.close()

def add_patient():
con = connect_db()
cur = con.cursor()
pid = int(input("Enter Patient ID: "))
name = input("Enter Name: ")
age = int(input("Enter Age: "))
gender = input("Enter Gender: ")
disease = input("Enter Disease: ")
cur.execute("INSERT INTO patient VALUES (%s, %s, %s, %s, %s)", (pid, name, age, gender,
disease))
con.commit()
con.close()
print("Patient record added.")

def view_patients():
con = connect_db()
cur = con.cursor()
cur.execute("SELECT * FROM patient")
for row in cur.fetchall():
print(row)
con.close()

def add_doctor():
con = connect_db()
cur = con.cursor()
did = int(input("Enter Doctor ID: "))
name = input("Enter Doctor Name: ")
specialization = input("Enter Specialization: ")
cur.execute("INSERT INTO doctor VALUES (%s, %s, %s)", (did, name, specialization))
con.commit()
con.close()
print("Doctor added successfully.")

def view_doctors():
con = connect_db()
cur = con.cursor()
cur.execute("SELECT * FROM doctor")
for row in cur.fetchall():
print(row)
con.close()

def create_appointment():
con = connect_db()
cur = con.cursor()
aid = int(input("Enter Appointment ID: "))
pid = int(input("Enter Patient ID: "))
did = int(input("Enter Doctor ID: "))
date = input("Enter Date (YYYY-MM-DD): ")
time = input("Enter Time (HH:MM:SS): ")
cur.execute("INSERT INTO appointment VALUES (%s, %s, %s, %s, %s)", (aid, pid, did, date,
time))
con.commit()
con.close()
print("Appointment created successfully.")

def view_appointments():
con = connect_db()
cur = con.cursor()
cur.execute("SELECT a.aid, p.name, d.name, a.date, a.time FROM appointment a JOIN patient p
ON a.pid = p.pid JOIN doctor d ON a.did = d.did")
for row in cur.fetchall():
print(row)
con.close()

def main():
create_tables()
while True:
print("\nHospital Management System")
print("1. Add Patient")
print("2. View Patients")
print("3. Add Doctor")
print("4. View Doctors")
print("5. Create Appointment")
print("6. View Appointments")
print("7. Exit")
choice = input("Enter your choice: ")
if choice == '1': add_patient()
elif choice == '2': view_patients()
elif choice == '3': add_doctor()
elif choice == '4': view_doctors()
elif choice == '5': create_appointment()
elif choice == '6': view_appointments()
elif choice == '7': break
else: print("Invalid choice.")

if __name__ == "__main__": main()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy