Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
5.2 kB
10
Indexable
Never
#include<iostream>
using namespace std;

struct Date {
	int day = 1;
	int month = 1;
	int year = 1900;
	int get_days() {
		return day + (month * 30) + year * 365;
	}
	//Date get_age() {
	//	return between(now(), this);
	//}

	//Date between(Date other) {
	//	return between(this, other);
	//}

	void print() {
		std::cout << "Year(s): " << year << ", Month(s): " << month << ", Day(s): " << day << std::endl;
	}
	static Date between(Date date, Date other) {
		return date - other;
	}
	static Date now() {
		return Date();
	}
protected:
	Date operator-(const Date& other) {
		Date result;
		result.day = abs(this->day - other.day);
		result.month = abs(this->month - other.month);
		result.year = abs(this->year - other.year);
		return result;
	}
};

enum class Gender {
	UNKNOWN,
	MALE,
	FEMALE
};

class Person {
private:
	const char* firstName;
	const char* lastName;
	const char* nickName;
	Date birthday;
	Gender gender;
	double weight;
	double height;
public:
	Person() {
		throw std::exception("Please specify first and last name.");
	}

	Person(const char* firstName, const char* lastName) {
		this->firstName = firstName;
		this->lastName = lastName;
		this->nickName = nullptr;
		this->gender = Gender::UNKNOWN;
		this->birthday = Date();
		this->height = 0;
		this->weight = 0;

	}

	constexpr const char* getFirstName() {
		return firstName;
	}
	constexpr const char* getLastName() {
		return lastName;
	}
	constexpr const char* getNickName() {
		return nickName;
	}

	void setWeight(double weight) {
		this->weight = weight;
	}
	void setHeight(double height) {
		this->height = height;
	}
	void setBirthday(int year, int month, int day) {
		birthday.year = year;
		birthday.month = month;
		birthday.day = day;
	}
	void setGender(Gender& gender) {
		this->gender = gender;
	}

	void setNickName(const char* nickName) {
		this->nickName = nickName;
	}

	Date getAge() const {
		return 	Date::between(birthday, Date::now());;
	}
	int getWeight() const {
		return weight;
	}
	int getHeight() const {
		return height;
	}
	int print() const {
		Date::between(birthday, Date());
	}

};

enum class BloodType {
	UNKNOWN,
	A,
	B,
	AB,
	O,
	A_NEGATIVE,
	B_NEGATIVE,
	AB_NEGATIVE,
	O_NEGATIVE
	
};




class Patient : public Person {
	int id;
private:
	BloodType bloodType = BloodType::UNKNOWN;
public:

	Patient() : Patient("First Name", "Last Name") {

	}
	Patient(const char* firstName, const char* lastName) : Person(firstName, lastName) {
		this->bloodType = bloodType;
	}

	BloodType getBloodType() {
		return bloodType;
	}

	void help() {

	}
};


enum class MedicalSpeciality {

};
class Doctor : public Person {

private:
	MedicalSpeciality speciallity;
public:
	Doctor(const char* firstName, const char* lastName) : Person(firstName, lastName) {

	}

	void check(Patient& patient) {

	}
	void giveMedicalExamine(Patient& patient) {

	}

};

#include <list>
class HospitalException : protected std::exception {
private:
	const char* message;

public:
	HospitalException(const char* message) : std::exception(message) {
		this->message = message;
	}

	constexpr const char* getMessage() {
		return message;
	}

	void print() {
		std::cerr << message << std::endl;
	}
};

class Hospital                              
{ 
private:
	const int HOSPITAL_SIZE = 1024;
public:
	std::list<Patient> patients = {};

	void checkIn(Patient& patient) throw() {
		if (isFull()) {
			throw HospitalException("Hospital is full!");
		}
		patients.push_front(patient);
	}

	int getPatientsCount() {
		return patients.size();
	}

	bool isFull() {
		return patients.size() >= HOSPITAL_SIZE;
	}
};

class Administrative_section : public Hospital
{
private:
	string office1 = "Hospital manager";
	string office2 = "nursing_manager";

};

class Medical_section : public Hospital          
{
											
};

class Emergency_section : public Medical_section     
{
private:
	string room1_EM = "distribution room";
	string room2_EM = "CPR room";        //cpr it means : resuscitation room.      Em = Emergency.
	string room3_EM = "Treatment room";
};

class Xrays_section : public Medical_section
{
private:
	string room_xr = "Xrays room";
};

class ICU_section : public Medical_section
{
private:
	string room_ICU = "ICU room";
};

class Surgical_section : public Medical_section
{
private:
	string room1_sl = "males surgical room";
	string room2_sl = "males surgical room";
	string room3_sl = "females surgical room";
	string room4_sl = "females surgical room";
	// sl = surgical

};

class care_section : public Medical_section
{
private:
	int rooms_care = 60;
	int beds_care = 120;    // 2 bed in each room
};

class Main_pharmacy : public Medical_section
{

};

class Internal_section : public Medical_section
{
private:
	string TN_room1 = "males internal room";
	string TN_room2 = "females internal room";
};

class children_section : public Medical_section
{

};

class Maternity_section : public Medical_section
{

};


Leave a Comment