IMPROVED Health Care Management System IMPROVE your already existing Health-Care Management System: (from the earlier assignment- file is attached below) This time you MUST use class to define your...

1 answer below »

IMPROVED Health Care Management System


IMPROVE your already existing Health-Care Management System: (from the earlier assignment- file is attached below)
This time you MUST use class to define your data structure, and have instance(s) of the class.
Create a data structure (class) called "Patient"
Have "Patient" include member data: patientnumber first name, last name, gender , condition , etc.
(condition can be things like "healthy", "flu", "tuberculosis" , "corona" , "chickenpox", etc. etc.)
Have a Constructor function that does something of your own choosing.
Have a member function of the class Patient that is update condition (that updates the condition status).
Have at least one other member function.
Extra credit: Make patient a base class, and have derived class(es)
Have a menu that looks like this:
Health Records System
---------------------------------
1)Add New Patient
2)List All Patient Records
3) [you decide]
4)[you decide]
5)quit


Have FILE I/O as part of your system (save patient records to file, load records from file)





Answered Same DayMay 21, 2021

Answer To: IMPROVED Health Care Management System IMPROVE your already existing Health-Care Management System:...

Aditya answered on May 31 2021
142 Votes
#include
#include
#include
#include
#include
#include
using namespace std;
class Patient
{
private :
string firstName;
string lastName;
int age;
string gender;
string condition;
public:
Patient()
{
}
Patient(string firstName,string lastName,int age,string g
ender,string condition)
{
this->firstName = firstName;
this->lastName = lastName;
this->age = age;
this->gender = gender;
this->condition = condition;
addPatient();
}
void addPatient()
{
bool check = ifAlreadyRegistered();
if(check == true)
{
cout<<"Patient With This Data Is Already Registered"< }
else
{
ofstream myfile;
myfile.open ("data.txt",ios::app);
myfile << firstName<<" "< myfile.close();
cout<<"New Patient Have Been Added"< }
}
bool ifAlreadyRegistered()
{
string line;
string FirstName;
string LastName;
int Age;
string Gender;
string Condition;
int countPatient =0;
ifstream myfile ("data.txt");
if (myfile.is_open())
{
while(getline(myfile,line))
{
istringstream ss(line);
string word;
ss >> FirstName;
ss >> LastName;
ss >> Age;
ss >> Gender;
ss>> Condition;
if((firstName == FirstName)&&(lastName == LastName)&&(age==Age)&&(gender==Gender)&&(condition == Condition))
{
return true;
}
}
myfile.close();
}
else
{
cout << "Unable to open file"< }
return false;
}
void showData()
{
string line;
ifstream myfile ("data.txt");
if (myfile.is_open())
{
while ( getline (myfile,line) )
{
cout << line << '\n';
}
myfile.close();
}
else
cout << "Unable to open file"< }
void updateCondition(string FirstName,string LastName,int Age,string Gender)
{
int counter =0;
string line;
ifstream myfile2;
myfile2.open("data.txt");
ofstream temp;
temp.open("temp.txt");
while (getline(myfile2, line))
{
istringstream ss(line);
string word;
ss >> firstName;
ss >> lastName;
ss >> age;
ss >> gender;
ss>> condition;
if((firstName == FirstName)&&(lastName == LastName)&&(age==Age)&&(gender==Gender))
{
cout<<"Enter The New Condition Of Patient"< cin>>condition;
transform(condition.begin(), condition.end(), condition.begin(), ::toupper);
temp< cout<<"Condition have been updated for the patient"< counter = counter +1;
}
else
{
temp< }
}
myfile2.close();
temp.close();
remove("data.txt");
rename("temp.txt", "data.txt");
if(counter == 0)
{
cout<<"No Patient Exits With The Details You Entered"< }
}
void deletePatient(string FirstName,string LastName,int Age,string Gender,string Condtion)
{
int counter =0;
string line;
ifstream myfile2;
myfile2.open("data.txt");
ofstream...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here