Exemple #1
0
RoomChangeHistory RoomChangeHistory::searchRoomHistoryForPatient(Patient p)
{
	RoomChangeHistory result;
	for (int i = 0; i<count; i++)
	{
		if (room_change_history[i].patient_id == p.patient_id)
		{
			result.insertRoomChange(room_change_history[i]);
		}
	}
	return result;
}
Exemple #2
0
void FileHandler::saveRoomChangeHistory(string fname, RoomChangeHistory& rc_history)
{
	// open file
	ofstream fout;
	fout.open(fname);
	if (!fout)
	{
		cerr << "\n" << "can't open " << fname << "!!";
		exit(1);
	}

	// save data into file
	int count = rc_history.getCount();
	for (int i = 0; i<count; i++) 
	{
		RoomChange rc = rc_history.getRoomChange(i);
		fout << rc.patient_id << rc.change_date << rc.before_room << rc.after_room;
	}

	// close file
	fout.close();
}
Exemple #3
0
void FileHandler::loadRoomChangeHistory(string fname, RoomChangeHistory& rc_history)
{
	// open file
	ifstream fin;
	fin.open(fname);
	if (!fin) 
	{
		cerr << "\n" << "can't open " << fname << "!!";
		return;
	}

	// read data from file
	RoomChange rc;
	while (!fin.eof())	// read data
	{
		fin >> rc.patient_id >> rc.change_date >> rc.before_room >> rc.after_room;
		rc_history.insertRoomChange(rc);
	}

	// close file
	fin.close();
}