-
Notifications
You must be signed in to change notification settings - Fork 1
/
Austin.cpp
136 lines (118 loc) · 4.15 KB
/
Austin.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
#include<iostream>
#include<vector>
#include <string>
#include<iomanip>
using namespace std;
class Patient{
int pId, age;
string name, symptoms;
public:
Patient(int pId, string name, int age, string symptoms) : pId(pId), age(age), name(name), symptoms(symptoms){};
int getId(){ return pId;}
string getName(){return name;}
int getAge(){return age;}
string getSymp(){return symptoms;}
};
// class Doctor{
// int dId;
// string name, specialization;
// public:
// vector<int> pIds;
// Doctor(int dId, string name, string specialization) : dId(dId), name(name), specialization(specialization){};
// Doctor(int dId, string name, string specialization, int pId) : dId(dId), name(name), specialization(specialization){
// pIds.emplace_back(pId);
// };
// int getId(){ return dId;}
// string getName(){return name;}
// string getSpecialization(){return specialization;}
// vector<int> getPatientsId(){return pIds;}
// };
class Management{
public:
void viewPatients(vector<Patient>& patients){
cout<<"Patients Lists:\n";
cout<<setw(5)<<"pID"<<setw(15)<<"Name"<<setw(5)<<"Age"<<" "<<"Symptoms"<<endl;
for(auto &patient : patients){
cout<<setw(5)<<patient.getId()<<setw(15)<<patient.getName()<<setw(5)<<patient.getAge()<<" "<<patient.getSymp()<<endl;
}
}
// void viewDoctors(vector<Doctor>& doctors){
// cout<<"Doctors List:\n";
// cout<<setw(5)<<"dID"<<" "<<"Name"<<" "<<"Specialization"<<" "<<"PatientIds"<<endl;
// for(auto &doctor : doctors){
// cout<<setw(5)<<doctor.getId()<<" "<<doctor.getName()<<" "<<doctor.getSpecialization()<<" ";
// for(auto &pId : doctor.pIds){
// cout<<pId<<",";
// }
// cout<<endl;
// }
// }
int addPatient(vector<Patient>& patients){
int pId, age;
string name, symptoms;
cout<<"Enter the Patient Id : ";
cin>>pId;
cout<<"Enter the Patient Name : ";
cin.ignore();
getline(cin, name);
cout<<"Enter the age : ";
cin>>age;
cout<<"What are your symptoms ?\n";
cin.ignore();
getline(cin, symptoms);
for(auto &patient : patients){
if(pId == patient.getId()){
cout<<"Patient Id is already created! Please Enter a different Patient Id.\n";
return 0;
}
}
patients.emplace_back(pId, name, age, symptoms);
cout<<"Patient is added successfully!\n";
return 0;
}
};
int main(){
vector<Patient> patients = {
Patient(1, "Rahul", 20, "Fewer"),
Patient(2, "Ramesh", 56, "Diabetes"),
Patient(3, "Ajay", 70, "Apetite")
};
// vector<Doctor> doctors = {
// Doctor(1,"Mukesh Gupta", "Pharmacy",1),
// Doctor(1,"Mahesh Sharma", "Biomecs",2),
// Doctor(1,"Sidhart", "Surgery",2),
// Doctor(1,"Ajay raj", "Liver",3)
// };
Management system;
int choice;
do{
cout<<"1. View Patients\n";
cout<<"2. Add Patients\n";
// cout<<"3. View Doctors\n";
cout<<"3. Exit\n";
cout<<"Enter a Number : ";
cin>>choice;
switch(choice){
case 1:
system.viewPatients(patients);
cout<<"===============================================================\n";
break;
case 2:
system.addPatient(patients);
cout<<"===============================================================\n";
break;
// case 3:
// system.viewDoctors(doctors);
// cout<<"===============================================================\n";
// break;
case 3:
cout<<"-------------- Thank You for the visit --------------";
break;
default:
cout<<"Invalid Number\n";
cout<<"---------TRY AGAIN---------\n";
cout<<"===============================================================\n";
}
}while(choice!=3);
return 0;
}