OOP-MCIROPROJECT
SYCM-2
C-batch
|
• COURSE :- COMPUTER TECHNOLOGY
• TOPIC :- HOSPITAL MANAGEMNT SYSTEM
PROGRAM CODE USING C++
• GUIDED BY :- SHILPA JADHAV MA’AM
• SUBMITTED BY :- SWAGAT PATIL (2320)
PRANAV SHIMPI (2321)
SHUBHAM HAVALE (2322)
2
INDEX :-
TITLE PAGE-NO REMARK
PROGRAM 3-6
WORKING 7-9
OUTPUT 10 - 12
CONCLUSION 13
3
PROGRAM OF HOSPITAL MANAGEMENT
SYSTEM
#include <iostream>
#include "hospital.h"
using namespace std;
class doctor; // Forward declaration
class patient
{
public:
int pid;
char pname[20];
char paddress[20];
char pgender[10];
char diseases[20];
char symptoms[20];
void getdatap()
{
cout << "\nEnter patient ID :";
cin >> pid;
cout << "Enter patient name :";
cin >> pname;
cout << "Enter patient address :";
cin >> paddress;
cout << "Enter patient gender :";
cin >> pgender;
cout << "Enter patient disease :";
cin >> diseases;
cout << "Enter patient symptoms :";
cin >> symptoms;
}
void sid(const patient patients[], int numPatients, int searchID)
{
bool found = false;
for (int i = 0; i < numPatients; i++)
{
if (patients[i].pid == searchID)
{
found = true;
cout << "\nPatient Information (ID: " << searchID << "):\
n";
cout << "Patient Name: " << patients[i].pname << endl;
cout << "Patient Address: " << patients[i].paddress <<
endl;
cout << "Patient Gender: " << patients[i].pgender << endl;
4
cout << "Patient Disease: " << patients[i].diseases <<
endl;
cout << "Patient Symptoms: " << patients[i].symptoms <<
endl;
break;
}
}
if (!found)
{
cout << "Patient with ID " << searchID << " not found." << endl;
}
}
// Friend function definition to display doctor information
friend void displayDoctorInfo(const doctor &d, const patient &p);
};
class doctor
{
int did;
char dname[20];
char daddress[20];
char dgender[10];
char qualification[20];
public:
void getdatad()
{
cout << "\nEnter docID :";
cin >> did;
cout << "Enter name :";
cin >> dname;
cout << "Enter address :";
cin >> daddress;
cout << "Enter gender :";
cin >> dgender;
cout << "Enter qualification :";
cin >> qualification;
}
// Friend function to display patient information
friend void displayPatientInfo(const doctor &d, patient patients[],
int numPatients);
};
// Friend function definition to display patient information
void displayPatientInfo(const doctor &d, patient patients[], int
numPatients)
{
cout << "\nDoctor Information -->\n";
cout << "Doctor ID: " << d.did << endl;
cout << "Doctor Name: " << d.dname << endl;
cout << "Doctor Address: " << d.daddress << endl;
cout << "Doctor Gender: " << d.dgender << endl;
cout << "Doctor Qualification: " << d.qualification << endl;
cout << "\nPatient Information -->\n";
5
if (numPatients == 0)
{
cout << "No patients in the system." << endl;
}
else
{
for (int i = 0; i < numPatients; i++)
{
cout << "Patient ID: " << patients[i].pid << endl;
cout << "Patient Name: " << patients[i].pname << endl;
cout << "Patient Address: " << patients[i].paddress << endl;
cout << "Patient Gender: " << patients[i].pgender << endl;
cout << "Patient Disease: " << patients[i].diseases << endl;
cout << "Patient Symptoms: " << patients[i].symptoms << endl;
cout << "________________________________" << endl;
}
}
}
int main()
{
const int maxPatients = 100; // Maximum number of patients
patient patients[maxPatients]; // Array to store patient information
doctor d;
int numPatients = 0;
int choice;
while (choice!=6)
{
cout<<"___________________________________________________________________
__________________________________________________________________________
_______________";
cout << "\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\t HOSPITAL
MANAGEMENT SYSTEM \n\n";
cout << "\n\n\t\t\t\t\t\tPlease, Choose from the following
Options: \n\n";
cout << "\t\t\t\t\t\t
_________________________________________________________________\n";
cout << "\t\t\t\t\t\t|
|\n";
cout << "\t\t\t\t\t\t| 1 >> Add New Patient Record
|\n";
cout << "\t\t\t\t\t\t| 2 >> Add Doctor Information
|\n";
cout << "\t\t\t\t\t\t| 3 >> Full History of the
Patients |\n";
cout << "\t\t\t\t\t\t| 4 >> Information About the
Hospital |\n";
cout << "\t\t\t\t\t\t| 5 >> Search Patient ID
|\n";
cout << "\t\t\t\t\t\t| 6 >> Exit the Program
|\n";
cout << "\t\t\t\t\t\t|
_________________________________________________________________|\n\n";
cout << "\t\t\t\t\t\tEnter your choice: ";
6
cin >> choice;
switch (choice)
{
case 1:
if (numPatients < maxPatients)
{
patients[numPatients].getdatap();
numPatients++;
}
else
{
cout << "Maximum number of patients reached." << endl;
}
break;
case 2:
d.getdatad();
break;
case 3:
displayPatientInfo(d, patients, numPatients);
break;
case 4:
displayHospitalInfo();
break;
case 5:
int searchID;
cout << "\nEnter the patient ID to search: ";
cin >> searchID;
patient p;
p.sid(patients, numPatients, searchID);
break;
case 6:
cout << "\nThank you for using the ISNP Hospital Management
System!\n";
cout << "We hope our services have been helpful to you.\n";
return 0;
default:
cout << "\nEnter valid choice!";
}
}
return 0;
}
7
WORKING OF PROGRAM :-
The code works by presenting a menu-driven interface to the user.
It repeatedly prompts the user to select an option from the menu
until they choose to exit. Here's a high-level overview of how it
works:
The program initializes an array to store patient records and
creates an instance of the `doctor` class to store doctor
information.
In the main loop, the program displays a menu of options for the
user to choose from.
Depending on the user's choice, the program performs
various actions:
o STEP 1: Allows the user to input patient information and adds
it to the patient records array.
o STEP 2: Allows the user to input doctor information.
o STEP 3: Displays the information of all patients and the
doctor.
o STEP 4: (Missing in the provided code) Likely intended to
display information about the hospital.
o STEP 5: Allows the user to search for a patient by their ID and
displays their information.
o STEP 6: Exits the program.
8
CLASS PATIENT
• The `patient` class is designed to represent a patient's
information in the hospital management system.
• It includes member variables for storing the patient's ID,
name, address, gender, diseases, and symptoms.
• The `getdatap()` method is responsible for inputting
patient information from the user. It prompts the user to
enter data for each member variable.
• The `sid()` method is used to search for a patient by their
ID. It iterates through the patient array, and if a patient
with the specified ID is found, it displays their
information. If not found, it informs the user.
9
CLASS DOCTOR
• The `doctor` class is intended to represent doctor
information within the system.
• It contains member variables for doctor ID, name,
address, gender, and qualification.
• The `getdatad()` method is responsible for gathering
doctor information. It requests input from the user for
each member variable.
displayPatientInfo() function:
• The `displayPatientInfo() function serves two purposes:
displaying doctor information and patient information.
• It takes a `doctor` object as input, which is used to display
doctor details, and an array of `patient` objects, which
contains patient data. The function also requires the
number of patients in the array.
• It iterates through the patient array and prints the
information of each patient, and then it prints the
10
OUTPUT OF THE PROGRAM :-
11
12
13
CONCLUSION
In conclusion, the provided C++ code implements a
simple Hospital Management System. It allows users to
manage patient records and doctor information within a
hospital through a menu-driven interface. Users can add
patient records, input doctor information, display patient
history, search for patients by ID, and potentially view
information about the hospital.
*****
14
THANK
YOU
15