Repository navigation
Expand file tree
/
Copy pathHospital Management System.cpp
More file actions
312 lines (252 loc) · 8.62 KB
/
Copy pathHospital Management System.cpp
File metadata and controls
312 lines (252 loc) · 8.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cctype>
#include <climits>
#include <cmath>
using namespace std;
/*This program performs following operetions/functions:
1) On Pressing 1 it will call admit patient function which will admit patient
with his/her folowing details:
Patient_ID
Name
Age
Gender
Diease he/she is suffering From.
2) On Pressing 2 it will call Patients List function which will print following details of patient:
Patient_ID
Name
Age
Gender
Diease he/she is suffering From.
3) On Pressing 3 it will call Patients Search by ID function which will search in the vector for the ID.
if found then it will store in the variable index this indus will variable will be used as index
to printing following deatils of patient:
Patient_ID
Name
Age
Gender
Diease he/she is suffering From.
4) On Pressing 4 it will call Patients with same disease function which will ask the user the user
to enter the disease then It will search in the vector if it is found then it will store its index in
another vector.
If the size of the vector in which we were storing the indecies is not equal to zero then it will
print the following details of the patient
Patient_ID
Name
Age
Gender
Diease he/she is suffering From.
From every index stored in the vector.
5) On pressing 5 it will call the discharge patient function which will ask the user to
enter the ID of patient you want to discharge. If Id is avalible in the ID vector then it will remove
it using erase function.
6) On Pressing 6 it will Display list of Doctors function which will print the list of doctors with
their following details:
Doctor Name
Doctor Specialization
Doctor Availability
*/
// 1) Function To Admit Patients (Name, Age, Gender, Medical Condition):
int RANDOM_ID = 701400;
void Admit_Patient(vector<long> &ID, vector<string> &name, vector<int> &age, vector<string> &gender, vector<string> &medical_condition)
{
ID.push_back(RANDOM_ID);
RANDOM_ID = RANDOM_ID + 1;
string Patient_name;
cout << "Enter Patient Name(Without Spaces In UPPER CASE):";
cin >> Patient_name;
name.push_back(Patient_name);
int Patient_Age;
cout << "Enter Patient Age:";
cin >> Patient_Age;
age.push_back(Patient_Age);
string Patient_Geneder;
cout << "Enter Patient Gender(Without Spaces In UPPER CASE):";
cin >> Patient_Geneder;
gender.push_back(Patient_Geneder);
string Patient_Medical_Condition;
cout << "Enter Patient Medical Condition(Without Spaces In UPPER CASE):";
cin >> Patient_Medical_Condition;
medical_condition.push_back(Patient_Medical_Condition);
}
// 2) Function To Display List of Patients:
void Patients_List(vector<long> ID, vector<string> name, vector<int> age, vector<string> gender, vector<string> medical_condition)
{
for (int i = 0; i < name.size(); i++)
{
cout << "Patient ID: " << ID[i] << endl;
cout << "Patient Name: " << name[i] << endl;
cout << "Patient Age: " << age[i] << endl;
cout << "Patient Gender: " << gender[i] << endl;
cout << "Patient Medical Condition: " << medical_condition[i] << endl;
cout << endl;
}
}
// 3)Function To Search Patient By Their ID:
void Search_Patient_by_ID(vector<long> ID, vector<string> name, vector<int> age, vector<string> gender, vector<string> medical_condition)
{
int Key;
cout << "Enter patient ID: ";
cin >> Key;
int index = -1;
for (int i = 0; i < ID.size(); i++)
{
if (ID[i] == Key)
{
index = i;
}
}
if (index != -1)
{
cout << "Patient ID: " << ID[index] << endl;
cout << "Patient Name: " << name[index] << endl;
cout << "Patient Age: " << age[index] << endl;
cout << "Patient Gender: " << gender[index] << endl;
cout << "Patient Medical Condition: " << medical_condition[index] << endl;
cout << endl;
}
else
cout << "Patient Not Found." << endl;
}
// 4)Function List of Patients With Same Disease:
void Patients_Same_Disease(vector<long> ID, vector<string> name, vector<int> age, vector<string> gender, vector<string> medical_condition)
{
string disease;
cout << "Enter Patient Medical Condition(Without Spaces In UPPER CASE):";
cin >> disease;
vector<int> targets;
for (int i = 0; i < medical_condition.size(); i++)
{
if (disease == medical_condition[i])
{
targets.push_back(i);
}
}
if (targets.size() != 0)
{
for (int i = 0; i < targets.size(); i++)
{
cout << "Patient ID: " << ID[targets[i]] << endl;
cout << "Patient Name: " << name[targets[i]] << endl;
cout << "Patient Age: " << age[targets[i]] << endl;
cout << "Patient Gender: " << gender[targets[i]] << endl;
cout << "Patient Medical Condition: " << medical_condition[targets[i]] << endl;
cout << endl;
}
}
else
cout << "No Such Patients Found In The System";
}
// 5)Function to discharge patients:
void discharge_patient(vector<long> &ID, vector<string> &name, vector<int> &age, vector<string> &gender, vector<string> &medical_condition)
{
long target;
cout << "Enter patient ID to who you want to discharge: ";
cin >> target;
int target_index = -1;
for (int i = 0; i < ID.size(); i++)
{
if (ID[i] == target)
{
target_index = i;
}
}
if (target_index != -1)
{
ID.erase(ID.begin() + target_index);
name.erase(name.begin() + target_index);
age.erase(age.begin() + target_index);
gender.erase(gender.begin() + target_index);
medical_condition.erase(medical_condition.begin() + target_index);
cout << target << " Has Been Discharged!" << endl;
}
else
cout << "No Such Patient Found In The System!" << endl;
}
// 6)Function Display list of Doctors:
void Doctors_List(string DOC_NAME[], string DOC_AVAIL[], string DOC_SPECIAL[])
{
for (int i = 0; i < 5; i++)
{
cout << "Doctor Name: " << DOC_NAME[i] << endl;
cout << "Doctor Specialization : " << DOC_SPECIAL[i] << endl;
cout << "Doctor Availability: " << DOC_AVAIL[i] << endl;
cout << endl;
}
}
int main()
{
cout << "Welcome AAA Hospital" << endl;
// Patients Details:
vector<long> Patient_ID;
vector<string> Patient_NAME;
vector<int> Patient_AGE;
vector<string> Patient_GENDER;
vector<string> Patient_Medical_CONDITION;
// Doctors Details:
string Doctors_Name[5] = {"Dr Abdullah Kaleem", "Dr Muhammad Ammar Qaisar", "Dr Choomu Areeb Khan", "Dr Muhammad Almas Manzoor", "Dr Muhammad Moin Juddu"};
string Doctors_Availability[5] = {"Monday to Friday \n 8:00 to 14:00", "Only Monday \n 10:00 to 10:15", "24/7", "Saturday & Sunday \n 8:00 to 17:00", "ON HOLIDAYS"};
string Doctors_Specialization[5] = {"Surgeon", "Oncologist", "General Physician", "Endocrinologist", "Optometrist"};
int choice;
cout << "Press 1: To Add Patients" << endl;
cout << "Press 2: To Display List of Patients" << endl;
cout << "Press 3: To Search Patients by Patient ID" << endl;
cout << "Press 4: To Display List of Patients With Same Disease" << endl;
cout << "Press 5: To Discharge patient" << endl;
cout << "Press 6: To Display Doctors List" << endl;
cout << "Press 0: To Exit." << endl;
cin >> choice;
while (choice != 0)
{
if (choice == 1)
{
Admit_Patient(Patient_ID, Patient_NAME, Patient_AGE, Patient_GENDER, Patient_Medical_CONDITION);
}
else if (choice == 2)
{
Patients_List(Patient_ID, Patient_NAME, Patient_AGE, Patient_GENDER, Patient_Medical_CONDITION);
}
else if (choice == 3)
{
Search_Patient_by_ID(Patient_ID, Patient_NAME, Patient_AGE, Patient_GENDER, Patient_Medical_CONDITION);
}
else if (choice == 4)
{
Patients_Same_Disease(Patient_ID, Patient_NAME, Patient_AGE, Patient_GENDER, Patient_Medical_CONDITION);
}
else if (choice == 5)
{
discharge_patient(Patient_ID, Patient_NAME, Patient_AGE, Patient_GENDER, Patient_Medical_CONDITION);
}
else if (choice == 6)
{
Doctors_List(Doctors_Name,Doctors_Availability,Doctors_Specialization);
}
else if (choice == 0)
{
break;
}
else
{
cout << "Invalid Choice.";
break;
}
cout << "Press 1: To Add Patients" << endl;
cout << "Press 2: To Display List of Patients" << endl;
cout << "Press 3: To Search Patients by Patient ID" << endl;
cout << "Press 4: To Display List of Patients With Same Disease" << endl;
cout << "Press 5: To Discharge patient" << endl;
cout << "Press 6: To Display Doctors List" << endl;
cout << "Press 0: To Exit." << endl;
cin >> choice;
}
cout << "Thank You For Chosing Our Serivce! " << endl << endl;
cout << "Programmed By: " << endl;
cout << "Muhammad Ammar Qaisar" << endl;
cout << "Abdullah Kaleem" << endl;
cout << "Muhammad Areeb Khan" << endl;
return 0;
}