0% found this document useful (0 votes)
22 views9 pages

Hospital Management System Report

Uploaded by

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

Hospital Management System Report

Uploaded by

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

East West University

PROJECT REPORT : CSE 246

Project Title: Hospital Management System

Section: 05

Submitted by
Name ID
Najmul Haque Majumder 2022-2-60-059
K.M Iftekhar Uddin 2022-2-60-034
Md Arman Hossian 2022-2-60-043
Omar Faisal Shanto 2022-2-60-125

Submitted to
Amit Mandal

Lecturer

Department of Computer Science and Enginnering

East West University

Submission Date: 31/5/2025


[Link] Overview :
This project is a simple system to help hospitals during health emergencies. It
keeps track of patients and hospitals. It gives help to the sickest patients first,
based on what the hospitals have. An admin can add patients and hospitals, give
out resources automatically or manually, and save or load the data. It is useful in
situations like pandemics, accidents, or natural disasters. The system checks what
each patient needs (like oxygen, ICU, or ventilator) and finds a hospital that has
those things. It tries to use hospital resources in the best way so more lives can be
[Link] system also lets users sort patients by urgency. It shows all the
hospitals and their available beds and equipment. This makes it easy for
emergency teams to make fast and fair decisions.

2. Problem Decomposition & Algorithmic Pipeline


2.1 High-Level Breakdown:
 Patient Management
 Hospital Management
 Patient Sorting by Urgency
 Resource Allocation (Auto)
 Allocation by Hand (Manual)
 Data Conservation (Save/Load)
2.2 Algorithm Mapping:
 Patient Sorting by Urgency

 Algorithm: Bubble Sort


 Goal: To make certain that patients are treated in the correct order, the
most urgent first.
 Given: Array of Patient structs (entered by user)
 Outputs: Sorted array (used in allocation)

 Auto Allocation

 Algorithm: Greedy Matching


 Goal: To allocate patients to the first hospital available
 Given: Sorted patient list, hospital list
 Outputs: Allocation report to [Link], updates to hospital resources

 Manual Allocation

 Algorithm: User Conditional Checks


 Goal: Permit admin to assign specific patient per given Hospital
 Given: Patient and hospital index from admin
[Link] Diagram:

[Link] Details:
 Bubble Sort (Urgency Sorting)

 Purpose: Prioritize patients


 Input: Patient pts[MAX], sorted by urgency
 Output: Sorted pts array
 Time Complexity: Best: O(n), Avg/Worst: O(n^2) – due to nested loops
 Memory Usage: O(1) extra (in-place)
 Implementation Notes: No optimization; can be replaced with faster sort if
needed
 Greedy Allocation

 Purpose: Quickly match patients to available hospitals


 Input: Sorted Patient array (pts[]) and Hospital array (hos[]) from memor
 Output: Console output showing allocation results; hospital data (beds,
res[]) is updated.
 Time Complexity: O(p * h) where p = patient count, h = hospital count
 Memory Usage: O(1) extra
 Implementation Notes: Stops at first valid match for speed

 Manual Allocation

 Purpose: Override automatic system


 Input: Patient & hospital index
 Output: Direct assignment or error
 Time Complexity: O(1)
 Memory Usage: O(1)

 File I/O (Persistence)

 Purpose: It will Save/load session data


 Input: Struct arrays, counts
 Output: Binary file or console messages
 Time Complexity: O(n) for n = total entries
 Memory Usage: O for (file size)
 Implementation Notes: Uses fwrite/fread for binary storage
5. Runtime Measurement & Graphical Analysis

5.1 Method Used:

 Tools: We used clock() from <time.h> in C to measure how long the


program takes to run.
 Measurement: Sorting patients by urgency (Bubble Sort) and Automatic
allocation of patients to hospitals
 Test Cases: 3 sizes: 10, 25, 50 patients

5.2 Individual Graphs:

 Bubble Sort: Quadratic curve (as expected)


 Greedy Allocation: Linear rise with p * h
5.3 Combined Graph:

 This graph adds the time for sorting and allocation together.
 It shows that the sorting step becomes very slow with more patients.
 Bubble Sort is slow for large inputs due to its O(n²) nature.
5.4 Comparison with Models:

 Bubble Sort diverges sharply from linear model


 Allocation follows linear trend (validated)
 Suggestion: Replace Bubble Sort with Quick/Merge Sort for scalability
[Link] & Input Conditions
 Random Input: Patients and hospitals entered with arbitrary
urgency/resources
 Sorted Input: Patients entered in increasing urgency to test sort
correctness
 Edge Cases:

 No patients / no hospitals
 Max 50 patients/hospitals tested successfully
 Patients requiring unavailable resources

 Bug Encountered & Fixed:

 Problem: fgets reading leftover newline characters after scanf


 Fix: Added clearInput() after every scanf to flush stdin

7. Conclusion & Reflections:


In this project, we gained practical experience working with C language concepts
like structures, arrays, sorting, file handling, and simulation logic. One of the
hardest parts to debug was handling mixed input using scanf and fgets, which
caused unexpected behavior and took time to fix. We realized that there are
areas for improvement, such as replacing the inefficient bubble sort with a faster
sorting algorithm and adding better input validation to prevent user errors. In the
future, this project can be extended by adding a graphical user interface (GUI),
allowing priority-based hospital selection, and including a dynamic system to
monitor patients in real-time.

Common questions

Powered by AI

The Greedy Allocation approach is considered effective in the hospital management system context because it quickly matches patients to available hospitals in a real-time environment, with a time complexity of O(p * h), where p represents patients and h hospitals. This is efficient for immediate decision-making, critical in emergencies. In contrast, the Bubble Sort step has a time complexity of O(n²) and becomes a bottleneck with large numbers of patients due to its slower nature. The difference in performance highlights Greedy Allocation's suitability for dynamic allocation tasks, while Bubble Sort's inefficiency for larger datasets suggests a need for algorithmic improvements in patient sorting .

The 'Greedy Matching' algorithm is employed in the hospital management system to allocate patients to available hospitals efficiently. Once patients are sorted by urgency, the algorithm swiftly finds an available hospital with the necessary resources (like beds, ICU, or ventilators) for each patient, updating the hospital's resource availability status immediately upon allocation. This approach prioritizes speed and immediate resource matching but stops at the first valid match to facilitate real-time decision-making in emergencies. The algorithm has a time complexity of O(p * h), where p is the number of patients and h is the number of hospitals, making it suitable for dynamic allocation without delay .

The primary components of the algorithmic pipeline in the hospital management system include Patient Management, Hospital Management, Patient Sorting by Urgency, Resource Allocation (both automatic and manual), and Data Conservation (including Saving/Loading). These components work together to manage hospital resources efficiently and handle patient data, especially during emergencies .

A significant challenge encountered was handling mixed input data based on using scanf and fgets functions, leading to unexpected behavior due to leftover newline characters in the input buffer. This issue was addressed by adding a custom function, clearInput(), after every scanf to flush the stdin stream and prevent these artifacts from affecting subsequent input reads. This solution improved the reliability of data entry and ensured smoother operation without input errors .

The data persistence method used in the hospital management system involves saving and loading session data through binary file operations, utilizing fwrite and fread functions. This method ensures that patient and hospital data, including resource allocations and patient urgencies, are retained across sessions. It enables continuity and consistency in data handling, offering a reliable way to store large sets of structured data efficiently without data loss, essential for real-time systems processing and analysis .

The runtime measurement tools used in the hospital management system included the clock() function from the time.h library in C. This tool was utilized to assess the execution time of critical processes such as sorting patients by urgency using Bubble Sort and automatically allocating patients to hospitals. By measuring the runtime with varying numbers of patient inputs, it facilitated performance evaluation, revealing the inefficiencies of Bubble Sort as patient numbers increased and confirming that the automatic allocation followed a linear performance trajectory, helping to identify areas for potential optimization .

The hospital management system prioritizes patient care by sorting patients by urgency using the Bubble Sort algorithm. The aim is to ensure that patients are treated in the correct order based on their urgency, thereby addressing the sickest patients first. This sorting is critical for the subsequent allocation of hospital resources. However, Bubble Sort is noted for its inefficiency with a time complexity of O(n²), especially as the number of patients grows, suggesting the need for potentially faster sorting algorithms for better scalability .

The main limitation of using the Bubble Sort algorithm in the hospital management system is its inefficiency with larger datasets, as it has a time complexity of O(n²), which results in slower performance with increasing patient numbers. The quadratic nature of its runtime is shown graphically where the sorting time becomes significant as patient entries grow. To improve efficiency, the system explicitly suggests replacing Bubble Sort with more efficient sorting algorithms like Quick Sort (O(n log n)) or Merge Sort (O(n log n)), which are better suited for handling larger datasets .

The manual allocation process in the hospital management system operates by allowing an admin to specifically assign a patient to a given hospital based on indices. Intended as an override to automatic allocation, this process is particularly useful in scenarios where manual judgment is critical, such as when a specific hospital is known to have the best facilities for a patient's unique needs, or when personal choice and specific preferences need to be accommodated. The process operates with O(1) time complexity, enabling immediate assignments when required .

Future expansions for the hospital management system suggested include the development of a graphical user interface (GUI) to improve user interaction, the implementation of a priority-based hospital selection mechanism to manage patient allocations more effectively, and the incorporation of a dynamic system for real-time patient monitoring. These enhancements aim to make the system more intuitive and responsive to changes in patient status and resource availability, thereby extending its utility in managing health emergencies .

You might also like