[go: up one dir, main page]

0% found this document useful (0 votes)
5 views39 pages

CS Project - Copy

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 39

S.

R GLOBAL SCHOOL LUCKNOW

COMPUTER SCIENCE (083)


PROJECT RECORD
(HOSPITAL MANAGEMENT SYSTEM)
Session 2024-2025
SUBMITTED TO:- SUBMITTED BY:
MOHAMMAD BILAL AHMAD MOHD MEHFOOZ:-
(PGT COMPUTER SCIENCE)
OM CHETAN PANDEY:-
CLASS :- 12 A1
CERTIFICATE
This is to certify that MOHD MEHFOOZ of class 12 – A1 from
S.R Global School, Lucknow has successfully completed his
Computer Science Project File (Hospital Management
System) based on Python and File handling TEXT module
under the guidance of Mr .Mohammad Bilal Ahmad for the
academic session 2024- 2025. He has taken proper care and show
utmost sincerity in the completion of this project file . I certify
that this project file is up to my expectation and as per the
guidelines issued by C.B.S.E

MR. MOHAMMAD BILAL AHMAD Ms RICHA MISHRA


Internal examiner External examiner
(Appointed by CBSE)
S R Global School
Lucknow

Mr. C.K OJHA


( Principal) School Stamp
S. R Global School
Lucknow
ACKNOWLEDGEMENT

I would like to express a deep sense of thanks and gratitude to my


Computer Teacher Mr. Mohammad Bilal Ahmed, he always
evinced keen interest in my work. The art of teaching of this
teacher is the art of assisting discovery. His constructive advice
and constant motivation have been responsible for the successful
completion of this project file and I am also thankful to my Principal
Mr. C. K Ojha sir who gave me the golden opportunity to do this
wonderful practical based on programming concept (Python and
Text file programming) which also helped me in doing a lot of
research and I came to know about so many new things and I am
really thankful to them and I am also thankful to my parents and
friends who helped me for completing this Python Project Record
with in the limited time frame.

Mohd Mehfooz
12 A1
Board roll no.:
INDEX
S No Topic Pg No
1 HARDWARE AND SOFTWARE 1
2 INTRODUCTION 2
3 HOSPITAL 3
4 NEED OF HMS 4
5 FUTURE SCOPE 5
6 EXISTING SYSTEM 6-7

7 SOURCE CODE(PYTHON) 8-20


8 SCREENSHOTS OF OUTPUT 21-31

9 LIMITATIONS OF HMS 32
1 CONCLUSION 33
0
1 BIBLIOGRAPHY 34
1
HARDWARE AND SOFTWARE
REQUIRED

HARDWARE
 Process : 11th Gen Intel(R) Core(TM) i3-1115G4 @
3.00GHz 3.00 GHz
 Installed RAM : 8.00 GB (7.79 GB usable)

 System Type : 64-bit operating system, x64-based


Processor

SOFTWARE
 PYTHON (3.13 bugfix 2024-10-07 2029-10 PEP 719)

 DATABASE MODULE- TEXT FILES


1
INTRODUCTION
The project Hospital Management System includes registration
of patients, storing their details into the system. The software
has the facility to give a unique id for every patient and stores
the details of every patient and the staff automatically. It
includes a search facility to know the current status of each
room. User can search availability of a doctor and the details of
a patient using the id. The Hospital Management System can
be entered using a username and password. Only they can add
data into the database. The data can be retrieved easily. The
interface is very user-friendly. The data are well protected for
personal use and makes the data processing very fast. The
purpose of the project entitled as "HOSPITAL
MANAGEMENT SYSTEM" is to computerize the Front
Office Management of Hospital to develop software which is
user friendly, simple, fast, and cost-effective. It deals with the
collection of patient's information, diagnosis details, etc., and
also to manipulate these details meaningfully System input
contains patient details, diagnosis details, while system output
is to get these details on to the screen.

2
HOSPITAL
A hospital is a health care institution providing patient treatment
with specialized staff and equipment. Hospital are usually funded
by public sector by health organizations (for profit or non-
profit), by health insurance companies, or by departments (e.g.,
surgery, and urgent care etc)

HOSPITAL
MANAGEMENT SYSTEM
A hospital management system is an information system that
manages the aspects of a hospital. This may include the
administrative, financial, and medical processing. It is an
integrated end-to-end Hospital Management System that provides
relevant information across the hospital to support effective
decision making for patient care, hospital administration and
critical financial accounting, In a seamless flow. This program
can look after Inpatients, OPD patients, records, treatment, status
illness, etc

3
NEED OF HMS
1. Minimized documentation and no duplication of
records.
2. Reduce paper work.
3. Improved patient care.
4. Better administration control.
5. Smart revenue management.
6. Exact stock information.

4
FUTURE SCOPE
Data-driven
Using analytics to help with strategic planning, healthcare
administrators can monitor performance and make timely
decisions.

Web-based
Moving data from paperless records to the web in a structured
way can reduce costs and increase convenience.

Streamlined processes
HMS can automate and streamline administrative and clinical
processes, reducing manual effort and healthcare staff workload.

Improved patient care


HMS can help maintain patient history, which can be critical for
managing disease.

Enhanced data security


HMS can secure and store patient records in one location, and
can also integrate with external systems like insurance providers
and laboratories.

Inventory management
HMS can help with traceability, availability, and security of
inventory, and can also help with expiry date management.

User-friendly
HMS should be easy to use and navigate for both staff and
patients. 5
EXISTING SYSTEM

ADVANTAGE
In today's world if someone wants to book a Doctor's
Appointment we need to call in clinic or personally go to that
place and book the appointment.

This consumes precious time of the patient. Also if the doctor


cancels his/her schedule, the patient does not come to know
about it unless he/she goes to the clinic.

6
DISADVANTAGE OF EXISTING
SYSTEM

 Lack of privacy
 Risk in the management of the data
Less security
Less user friendly
Accuracy nor guaranteed
Not in reach of distinct users
There is no storage and automation if users have some enquiry

8
SOURCE CODE
(PYTHON)

9
import os
import hashlib
import re
from datetime import datetime

# Files for storing data


USER_FILE = "users.txt"
PATIENT_FILE = "hospital_records.txt"
SPECIALISTS_FILE = "specialists.txt"

# Utility Functions
def hash_password(password):
"""Hash a password for secure storage."""
return hashlib.sha256(password.encode()).hexdigest()

# Intializing files.
def initialize_files():
"""Ensure required files exist."""
for file in [USER_FILE, PATIENT_FILE,
SPECIALISTS_FILE]:
if not os.path.exists(file):
with open(file, "w") as f:
pass

# Registering User.
def register_user():
"""Register a new user."""
print("\n--- Register ---")
username = input("Enter a username: ")
password = input("Enter a password: ")
with open(USER_FILE, "r") as f:
for line in f: 10
stored_username, _ = line.strip().split(",")
if stored_username == username:
print("Username already exists. Please try a different
one.")
return False

with open(USER_FILE, "a") as f:


f.write(f"{username},{hash_password(password)}\n")
print("Registration successful!")
return True

# Logging in User.
def login_user():
"""Login an existing user."""
print("\n--- Login ---")
username = input("Enter your username: ")
password = input("Enter your password: ")
hashed_password = hash_password(password)

with open(USER_FILE, "r") as f:


for line in f:
stored_username, stored_password =
line.strip().split(",")
if stored_username == username and stored_password
== hashed_password:
print("Login successful!")
return True

print("Invalid username or password. Please try again.")


return False

# Specialist Management Functions


def add_specialist():
"""Add a new specialist to the system."""
print("\n--- Add New Specialist ---") 11
name = input("Enter Specialist Name: ")
specialty = input("Enter Specialty: ")
with open(SPECIALISTS_FILE, "a") as f:
f.write(f"{name},{specialty}\n")
print(f"Specialist {name} added successfully!\n")
# Viewing Specialist
def view_specialists():
"""View all specialists."""
print("\n--- Available Specialists ---")
if not os.path.exists(SPECIALISTS_FILE) or
os.path.getsize(SPECIALISTS_FILE) == 0:
print("No specialists found.")
return

with open(SPECIALISTS_FILE, "r") as f:


specialists = f.readlines()
print("{:<20} {:<20}".format("Specialist Name",
"Specialty"))
print("-" * 40)
for specialist in specialists:
fields = specialist.strip().split(",")
print("{:<20} {:<20}".format(*fields))

# Patient Management Functions


def add_patient():
"""Add a new patient record."""
print("\n--- Add New Patient ---")
patient_id = input("Enter Patient ID: ")
registrations_date = input("Enter Registrations Date
(YYYY-MM-DD): ")
while not validate_date(registrations_date):
registrations_date = input("Invalid date format. Enter
again (YYYY-MM-DD): ")
12
name = input("Enter Patient Name: ")
age = input("Enter Age: ")
while not age.isdigit():
age = input("Invalid age. Enter a valid number for age: ")
diagnosis = input("Enter Diagnosis: ")

# Show specialists and ask the user to select


print("\nAvailable Specialists:")
with open(SPECIALISTS_FILE, "r") as f:
specialists = f.readlines()
if specialists:
for idx, specialist in enumerate(specialists, 1):
fields = specialist.strip().split(",")
print(f"{idx}. {fields[0]} - {fields[1]}")
specialist_choice = input("Select a Specialist (enter
number): ")
try:
specialist_choice = int(specialist_choice)
if 1 <= specialist_choice <= len(specialists):
doctor = specialists[specialist_choice -
1].strip().split(",")[0]
else:
print("Invalid choice. Defaulting to General
Practitioner.")
doctor = "General Practitioner"
except ValueError:
print("Invalid input. Defaulting to General
Practitioner.")
doctor = "General Practitioner"
else:
print("No specialists available. Assigning general
practitioner.")
doctor = "General Practitioner" 13
appointment = input("Enter Appointment Date (YYYY-
MM-DD): ")
while not validate_date(appointment):
appointment = input("Invalid date format. Enter again
(YYYY-MM-DD): ")

address = input("Enter Address: ")


pincode = input("Enter Pincode: ")
while not pincode.isdigit() or len(pincode) != 6:
pincode = input("Invalid pincode. Enter a valid 6-digit
pincode: ")

with open(PATIENT_FILE, "a") as f:


f.write(f"{patient_id},{registrations_date},{name},{age},
{diagnosis},{doctor},{appointment},{address},{pincode}\n")
print("Patient added successfully!\n")
# Validate Date
def validate_date(date_str):
"""Validate the date format YYYY-MM-DD."""
try:
datetime.strptime(date_str, "%Y-%m-%d")
return True
except ValueError:
return False
# Viewing Patient
def view_patients():
"""View all patient records."""
print("\n--- Patient Records ---")
if not os.path.exists(PATIENT_FILE) or
os.path.getsize(PATIENT_FILE) == 0:
print("No patient records found.") 14
return
with open(PATIENT_FILE, "r") as f:
records = f.readlines()
print("{:<10} {:<30} {:<30} {:<30} {:<25} {:<30}
{:<30} {:<30} {:<30}".format(
"ID", "Registrations Date", "Name", "Age",
"Diagnosis", "Doctor", "Appointment", "Address", "Pincode"))
print("-" * 220)
for record in records:
fields = record.strip().split(",")
if len(fields) == 9:
print("{:<10} {:<30} {:<30} {:<30} {:<25} {:<30}
{:<30} {:<30} {:<30}".format(*fields))
# Searchung Patient
def search_patient():
"""Search for a patient record by ID."""
print("\n--- Search Patient ---")
search_id = input("Enter Patient ID to search: ")

found = False
with open(PATIENT_FILE, "r") as f:
for line in f:
fields = line.strip().split(",")
if fields[0] == search_id:
print("\nPatient Found:")
print(f"ID: {fields[0]}")
print(f"Registrations Date: {fields[1]}")
print(f"Name: {fields[2]}")
print(f"Age: {fields[3]}")
print(f"Diagnosis: {fields[4]}")
print(f"Doctor: {fields[5]}")
print(f"Appointment: {fields[6]}") 15
print(f"Address: {fields[7]}")
print(f"Pincode: {fields[8]}")
found = True
break

if not found:
print("Patient not found.")
# Deleting Patient
def delete_patient():
"""Delete a patient record by ID."""
print("\n--- Delete Patient ---")
delete_id = input("Enter Patient ID to delete: ")

records = []
found = False

with open(PATIENT_FILE, "r") as f:


records = f.readlines()

with open(PATIENT_FILE, "w") as f:


for record in records:
fields = record.strip().split(",")
if fields[0] != delete_id:
f.write(record)
else:
found = True

if found:
print("Patient record deleted successfully!")
else:
print("Patient ID not found.")
def update_patient():
"""Update an existing patient's record."""
print("\n--- Update Patient ---")
16
update_id = input("Enter Patient ID to update: ")
updated_records = []
found = False

with open(PATIENT_FILE, "r") as f:


records = f.readlines()

for record in records:


fields = record.strip().split(",")
if fields[0] == update_id:
print("\nUpdating record for patient ID:", update_id)
fields[0]=input(f" Enter new Id ({fields[0]}):") or
fields[0]
fields[1] = input(f"Enter new Registration
date({fields[1]}): ") or fields[1]
fields[2] = input(f"Enter new Name({fields[2]}): ") or
fields[2]
fields[3] = input(f"Enter new Age ({fields[3]}): ") or
fields[3]
fields[4] = input(f"Enter new Diagnosis ({fields[4]}):
") or fields[4]
fields[5] = input(f"Enter new Doctor date ({fields[5]}):
") or fields[5]
fields[6] = input(f"Enter new Appointment
({fields[6]}): ") or fields[6]
fields[7]=input(f" Enter new Address ({fields[7]}): ")
or fields [7]
fields[8]=input(f" Enter new Pincode ({fields[8]}): ")
or fields [8]
found = True
updated_records.append(",".join(fields))

17
with open(PATIENT_FILE, "w") as f:
f.writelines(record + "\n" for record in updated_records)
if found:
print("Patient record updated successfully!")
else:
print("Patient ID not found.")

# Filtering Patient
def filter_patients():
"""Filter patients by diagnosis or doctor."""
print("\n--- Filter Patients ---")
print("1. Filter by Diagnosis")
print("2. Filter by Doctor")
choice = input("Enter your choice: ")

if choice not in ["1", "2"]:


print("Invalid choice.")
return

keyword = input("Enter the keyword to filter: ")

print("\nFiltered Patient Records:")


with open(PATIENT_FILE, "r") as f:
records = f.readlines()
for record in records:
fields = record.strip().split(",")
if (choice == "1" and keyword.lower() in
fields[4].lower()) or \
(choice == "2" and keyword.lower() in
fields[5].lower()):
print(record.strip())
18
# Generating summary
def generate_summary():
"""Generate a summary report of patient records."""
print("\n--- Summary Report ---")
total_patients = 0
diagnoses = {}
doctors = {}

with open(PATIENT_FILE, "r") as f:


records = f.readlines()
total_patients = len(records)
for record in records:
fields = record.strip().split(",")
diagnosis = fields[4]
doctor = fields[5]
diagnoses[diagnosis] = diagnoses.get(diagnosis, 0) + 1
doctors[doctor] = doctors.get(doctor, 0) + 1

print(f"Total Patients: {total_patients}")


print("\nDiagnosis Counts:")
for diag, count in diagnoses.items():
print(f"{diag}: {count}")
print("\nDoctor Counts:")
for doc, count in doctors.items():
print(f"{doc}: {count}")

# Main Menu
def main_menu():
"""Display the main menu."""
while True:
print("\n--- Hospital Management System ---")
print("1. Add Patient")
print("2. View Patients")
19
print("3. Search Patient")
print("4. Update Patient")
print("5. Delete Patient")
print("6. Filter Patient")
print("7. Add Specialist")
print("8. View Specialists")
print("9. Generate Summary")
print("10. Logout")
choice = input("Enter your choice: ")

if choice == "1":
add_patient()
elif choice == "2":
view_patients()
elif choice == "3":
search_patient()
elif choice == "4":
update_patient()
elif choice == "5":
delete_patient()
elif choice == "6":
filter_patients()
elif choice == "7":
add_specialist()
elif choice == "8":
view_specialists()
elif choice == "9":
generate_summary()
elif choice == "10":
print("Logging out....")
break
else:
print("Invalid choice. Please try again.")
20
# Entry Point
if __name__ == "__main__":
initialize_files()
print("--- Welcome to the Hospital Management System
---")

while True:
print("\n1. Login")
print("2. Register")
print("3. Exit")
user_choice = input("Enter your choice: ")

if user_choice == "1":
if login_user():
main_menu()
elif user_choice == "2":
register_user()
elif user_choice == "3":
print("Exiting the system. Goodbye!")
break
else:
print("Invalid choice. Please try again.")

21
SCREENSHOTS

2
22
1. MAIN MENU

2. REGISTRATION

23
3.Logging

24
4.Adding Specialist Details

5.Adding Two More Doctors Details

25
6.Viewing Specialist Details

7.Adding Patient Details


26
Adding two more details of Patients
27
8.Viewing Details of Patient

9.Searching Patient Details


28
10. Updating Patient Details
Patient details after Update

11. Deleting Patient Record

29
Patients Record After Deleting
12.Filtering Patient Records

Filtering By Diagnosis

30

 Filtering By Doctor
11.Generating Summary

31
12. Logging Out
13. EXITING

32
LIMITATION OF HMS
 Hospital management system (HMS) projects can face
several limitations, including:

 Implementation challenges: Adapting workflows to new


systems can be difficult and require careful planning.

 Initial costs: Implementing an HMS can involve significant


upfront costs for hardware, software, training, and infrastructure
updates.

 Technical challenges: Networks and computers can have


different maintenance problems, and there may be a lack of
standards for data entry and retrieval.

 Time and effort: Many studies show that HMS requires more
effort, time, and work.

 User training: It can be difficult to train users technically to use


HMS.

 Data security and loss: There are challenges with data


security and data loss, as every time there is a data security issue
as the systems as data is stored in local servers. So the IT
department needs to take care of the data.

 Accessibility: There may be challenges with accessibility, as


all the software installed locally installed within the hospital
Premise. So the staff, Physicians, and other stakeholders need to
depend on the hospital system

33
CONCLUSION
Hospital Management System (HMS) is essential to the delivery of
modern healthcare. It can boost patient outcomes, lower medical
errors, and improve the overall quality of care. It enables hospitals
with a centralized platform to manage their operations, automate
mundane processes, and enhance communication.
59% of millennials are willing to switch doctors for better online
access. An HMS will improve communication between patients and
hospitals by allowing patients to access their medical records, book
appointments, receive reminders, and communicate online with their
doctors and nurses. You will have improved patient engagement, a
reduction in waiting times, and increased patient satisfaction

Implementing hospital management software can lead to significant


cost savings for hospitals. It helps by reducing administrative
overheads, improving resource allocation, and minimizing the
wastage of medical supplies. An HMS can also optimize revenue
streams by ensuring timely billing and reducing claim denials.

In summary, Hospital Management System (HMS) is a software


designed to handle electronic medical records, laboratory tests and
their results, radiology images, pharmacy records etc. It helps in
managing patient data efficiently so that hospitals can provide better
care and services.

34
BIBLIOGRAPHY

 Computer Science with Sumita Arora.


 Computer Science with Preeti Arora.

 IDLE (Python 3.12 64-BIT)

 www.wikipedia.org

 www.w3resouce.com

35

You might also like