-
Notifications
You must be signed in to change notification settings - Fork 0
/
hospital.cpp
472 lines (436 loc) · 15.1 KB
/
hospital.cpp
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
#include<iostream>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
struct doctor1
{
int id;
char name[20],Q[20],age[20],exp[20],city[20],special[20];
};
struct patient1
{
int id1;
char name[20],age[20],city[20],dis[20],room[20],sym[20],con[20],date[20],charg[20],bill[20];
};
using namespace std;
class doctor;
class patient;
class hospital
{
public:
// int id=0,id1=0,
int counter=0;
};
class doctor:public hospital
{
public:
int docid=0;
struct doctor1 arr[10];
void add_doc_info()
{
int i,en;
cout<<"How Many Entries you want to add :";
cin>>en;
for(i=0;i<=en;i++)
{
cout<<"Enter Doctor's ID :";
cin>>arr[docid].id;
cout<<"Enter Doctor's Name :";
cin>>arr[docid].name;
cout<<"Enter Doctor's Age :";
cin>>arr[docid].age;
cout<<"Enter Doctor's Qualification :";
cin>>arr[docid].Q;
cout<<"Enter Doctor's Specialization :";
cin>>arr[docid].special;
cout<<"Enter Doctor's Experience :";
cin>>arr[docid].exp;
cout<<"Enter Doctor's city :";
cin>>arr[docid].city;
docid++;
counter++;
cout<<"\n";
cout<<"You filled all Entries of "<<i<<" doctor successfully"<<"\n";
cout<<"enter value for "<<" "<<i+1<<" "<<"doctor"<<"\n";
}
}
void Display()
{
system("cls");
int n,i;
cout<<"\n Enter the doctor's ID to display Record :";
cin>>n;
if(n==0)
{
cout<<"\n\n OOPS!!!! "<<"\n\n";
cout<<"Note:- No Record To Display Plz Go Back And Enter Some Entries...... "<<"\n";
}
else
{
int status=0;
for(i=0;i<docid;i++)
{
if(arr[i].id==n)
{
status=1;
break;
}
}
if(status)
{
cout<<"\n\n";
cout<<"1.Doctor's ID :"<<arr[i].id<<"\n";
cout<<"2.Doctor's Name :"<<arr[i].name<<"\n";
cout<<"3.Doctor's Age :"<<arr[i].age<<"\n";
cout<<"4.Doctor's Qualification :"<<arr[i].Q<<"\n";
cout<<"5.Doctor's Specialization :"<<arr[i].special<<"\n";
cout<<"6.Doctor's Experience :"<<arr[i].exp<<"\n";
cout<<"8.Doctor's city :"<<arr[i].city<<"\n";
cout<<" \n Press Any KEY To choose another Option.... ";
}
else
{
cout<<" \n\n No such ID in database "<<endl;
cout<<" \n Press Any KEY To choose another Option.... ";
}
}
getch();
}
void doctor_detail()
{
int i;
if(docid==0)
{
cout<<" \n\n\n OOPS!!!! "<<"\n\n";
cout<<"Note:- No Record To Display Plz Go Back And Enter Some Entries...... "<<"\n";
}
else{
cout<<"********************************************************************************"<<"\n";
cout<<"\t \t \t Details Of All The Doctors In The Hospital \n";
cout<<"********************************************************************************"<<"\n \n";
cout<<"ID"<<"\t \t"<<"specialization"<<"\t \t"<<"Qualification"<<"\t \t"<<"Age";
cout<<"\n \n";
for(i=0;i<docid;i++)
{
cout<<arr[i].id<<"\t \t"<<arr[i].special<<"\t \t \t"<<arr[i].Q<<"\t \t \t"<<arr[i].age<<"\n";
}
cout<<" \n Press Any Button To choose another Option.... ";
}
getch();
}
void tot_no_of_doc()
{
system("cls");
int i=counter;
cout<<"Total Doctor's in Hospital : "<<i<<"\n";
cout<<" \n Press Any Button To choose another Option.... ";
getch();
}
};
class patient:public hospital
{
public:
int docid1=0;
struct patient1 arr[10];
void add_pat_info();
void Display();
void patient_report();
void patient_detail();
void tot_no_of_pat();
void gen_pat_report();
};
void patient :: add_pat_info()
{
int i,en;
cout<<"How Many Entries you want to add :";
cin>>en;
for(i=1;i<=en;i++)
{
cout<<" 1.Enter Patient's ID :";
cin>>arr[docid1].id1;
cout<<" 2. Enter patient's Name :";
cin>>arr[docid1].name;
cout<<"3. Enter patient's Age :";
cin>>arr[docid1].age;
cout<<" 4. Enter patient's Disease :";
cin>>arr[docid1].dis;
cout<<" 5. Enter patient's Symptoms :";
cin>>arr[docid1].sym;
cout<<" 6. Enter Patient's Room No. :";
cin>>arr[docid1].room;
cout<<" 7. Enter Patient's condition Before Admit :";
cin>>arr[docid1].con;
cout<<" 8. Enter Patient's ADMIT Date :";
cin>>arr[docid1].date;
cout<<" 9. Enter Patient's Room Charge :";
cin>>arr[docid1].charg;
cout<<" 10. Enter Patient's Medicine charge :";
cin>>arr[docid1].bill;
docid1++;
counter++;
cout<<"\n";
cout<<"You filled all Entries of "<<i<<" patient successfully"<<"\n";
cout<<"enter value for "<<" "<<i+1<<" "<<"patient"<<"\n";
}
}
void patient :: Display()
{
system("cls");
int n,i;
cout<<"\n Enter the Patient's ID to display info :";
cin>>n;
if(n==0)
{
cout<<"\n\n OOPS!!!! "<<"\n \n";
cout<<"Note:- No Record To Display Plz Go Back And Enter Some Entries...... "<<"\n";
cout<<" \n Press Any KEY To choose another Option.... ";
}
else
{
int status=0;
for(i=0;i<docid1;i++)
{
if(arr[i].id1==n)
{
status=1;
break;
}
}
if(status==1)
{
cout<<"1.Patient's ID :"<<arr[i].id1<<"\n";
cout<<"2.Patient's Name :"<<arr[i].name<<"\n";
cout<<"3.Patient's Age :"<<arr[i].age<<"\n";
cout<<"4.Patient's Disease :"<<arr[i].dis<<"\n";
cout<<"5.Patient's Symptoms :"<<arr[i].sym<<"\n";
cout<<"6.Patient's Room No. :"<<arr[i].room<<"\n";
cout<<"7.Patient's condition Before Admit :"<<arr[i].con<<"\n";
cout<<"8.Patient's ADMIT Date :"<<arr[i].date<<"\n";
cout<<"9.Patient's Room Charge :"<<arr[i].charg<<"\n";
cout<<"10.Patient's Medicine charge :"<<arr[i].bill<<"\n";
cout<<" \n Press Any KEY To choose another Option.... ";
}
else{
cout<<" \n\n No such ID in database "<<endl;
cout<<" \n Press Any KEY To choose another Option.... ";
}
}
getch();
}
void patient :: patient_report()
{
system("cls");
int i,n;
cout<<"\n Enter the Patient's ID to Display Report :";
cin>>n;
int status=0;
for(i=0;i<docid1;i++)
{
if(arr[i].id1==n)
{
status=1;
break;
}
}
if(status)
{
cout<<"\n\n *** Patient's Report *** "<<"\n \n";
cout<< "1. Patient's Name "<<arr[i].name<<"\n";
cout<< "2. Patient's Age "<<arr[i].age<<"\n";
cout<< "3. Patient symptoms "<<arr[i].sym<<"\n";
cout<< "4. Patient Disease "<<arr[i].dis<<"\n";
cout<< "5. Patient Admit Date "<<arr[i].date<<"\n";
cout<< "6. Patient condition At The Time Of Discharge "<<arr[i].con<<"\n";
cout<<"Press Any Key To Go Back....";
}
else{
cout<<" \n\n No such ID in database "<<endl;
cout<<" \n Press Any KEY To choose another Option.... ";
}
getch();
}
void patient:: patient_detail()
{
int i;
if(docid1==0)
{
cout<<" \n\n\n\n\n OOPS!!!! "<<"\n\n\n";
cout<<"Note:- No Record To Display Plz Go Back And Enter Some Entries...... "<<"\n";
}
else{
cout<<"********************************************************************************"<<"\n";
cout<<"\t \t \t Details Of All The Pateint In The Hospital \n";
cout<<"********************************************************************************"<<"\n \n";
cout<<"ID"<<"\t \t"<<"illness"<<"\t \t"<<"ADMITTED Date"<<"\t \t"<<"Age";
cout<<"\n \n";
for(i=0;i<docid1;i++)
{
cout<<arr[i].id1<<"\t \t"<<arr[i].dis<<"\t \t \t"<<arr[i].date<<"\t \t \t"<<arr[i].age<<"\n";
}
cout<<" \n Press Any KEY To choose another Option.... ";
}
getch();
}
void patient :: tot_no_of_pat()
{
system("cls");
int i=counter;
cout<<"Total Patients in Hospital : "<<i<<"\n";
cout<<" \n Press Any KEY To choose another Option.... ";
getch();
}
void patient :: gen_pat_report()
{
system("cls");
int i,n;
cout<<"\n Enter the Patient's ID to Display Bill :";
cin>>n;
int status=0;
for(i=0;i<docid1;i++)
{
if(arr[i].id1==n)
{
status=1;
break;
}
}
if(status)
{
cout<<"\n\n *** Patient's Report *** "<<"\n \n";
cout<< "1. Patient's Medicine Charge "<<arr[i].bill<<"\n";
cout<< "2. Patient's Room Charge "<<arr[i].charg<<"\n";
cout<<"Press Any Key To Go Back....";
}
else{
cout<<" \n\n No such ID in database "<<endl;
cout<<" \n Press Any KEY To choose another Option.... ";
}
getch();
}
int main()
{
system("color B0");
bool repeat= true;
int ch1,ch2,ch3,ch4;
doctor d;
patient p;
xyz:
system("cls");
cout<<"\n\n";
cout<<" *** Welcome to the Hospital Management System *** "<<"\n\n\n";
cout<<" 1. Menu : "<<"\n\n";;
cout<<" 2. Exit : "<<"\n\n\n\n";
cout<<"Enter Your Choice :";
cin>>ch1;
cout<<"\n\n\n";
if(ch1==1)
{
xyz2:
system("cls");
cout<<"\n\n";
cout<<" 1. Enter into Doctor's DataBase "<<endl;
cout<<" 2. Enter into Patient's DataBase "<<endl;
cout<<" 3. Generate Patient's Report "<<endl;
cout<<" 4. Generate Patient's Bill "<<endl;
cout<<" 5. EXIT "<<"\n";
cout<<"Please Enter Your choice :"<<" ";
cin>>ch2;
while(repeat==true)
{
system("cls");
switch(ch2)
case 1:
{
cout<<"\n\n";
cout<<" *** Welcome To Doctor's DataBase *** "<<"\n \n \n\n";
cout<< " \t 1. Add New Doctor's Information "<<endl;
cout<< " \t 2. Display Doctor's Information "<<endl;
cout<< " \t 3. Detail OF ALL The Doctors In The Hospital "<<endl;
cout<< " \t 4. Total Number of Doctor's in Hospital "<<endl;
cout<< " \t 5. EXIT "<<"\n";
cout<<"Please Enter your choice :"<<" ";
cin>>ch3;
switch(ch3)
{
case 1:
system("cls");
d.add_doc_info();
break;
case 2:
d.Display();
cout<<"\n";
break;
case 3:
system("cls");
d.doctor_detail();
break;
case 4:
d.tot_no_of_doc();
break;
case 5:
goto xyz2;
break;
default:
cout<<"invalid";
}
break;
case 2:
cout<<"\n\n";
cout<<" *** Welcome To Patient's DataBase *** "<<"\n \n";
cout<< "1. Add New Patient's Information "<<endl;
cout<< "2. Display Patient's Information "<<endl;
cout<< "3. Detail OF ALL The Patient In The Hospital "<<endl;
cout<< "4. Total Number of Patient's in Hospital "<<endl;
cout<< "5. EXIT "<<"\n";
cout<<"Please Enter your choice :"<<" ";
cin>>ch4;
switch(ch4)
{
case 1:
system("cls");
p.add_pat_info();
break;
case 2:
p.Display();
cout<<"\n";
break;
case 3:
system("cls");
p.patient_detail();
break;
case 4:
p.tot_no_of_pat();
break;
case 5:
goto xyz2;
break;
default:
cout<<"invalid";
break;
}
break;
case 3:
p.patient_report();
goto xyz2;
break;
case 4:
p.gen_pat_report();
goto xyz2;
break;
case 5:
goto xyz;
break;
}
}
}
else if(ch1==2)
{
return 0;
}
else
{
cout<<"Wrong Input"<<endl;
}
return 0;
}