Reception شغل عمكم عطا

mail@pastecode.io avatar
unknown
plain_text
2 months ago
7.2 kB
13
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 AdministrativeSection : public Hospital
{
private:
	string office1 = "Hospital manager";
	string office2 = "Nursing manager";

};

class MedicalSection : public Hospital
{

};

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

class XraysSection : public MedicalSection
{
private:
	string RoomXr = "Xrays room";
};

class IcuSection : public MedicalSection
{
private:
	string RoomIcu = "ICU room";
};

class SurgicalSection : public MedicalSection
{
private:
	string Room1Sl = "Males surgical room";
	string Room2Sl = "Males surgical room";
	string Room3Sl = "Females surgical room";
	string Room4Sl = "Females surgical room";
	// sl = surgical

};

class CareSection : public MedicalSection
{
private:
	int RoomsCare = 60;
	int BedsCare = 120;    // 2 bed in each room
};

class MainPharmacy : public MedicalSection
{

};

class InternalSection : public MedicalSection
{
private:
	string TnRoom1 = "Males internal room";
	string TnRoom2 = "Females internal room";
};

class ChildrenSection : public MedicalSection
{

};

class MaternitySection : public MedicalSection
{

};

class Reception
{
private:
	int MaxPatientNum; // The max number of patients the hosoital can handle
	int PatientNumber; // Number of the current patient
	string PatientCheckIn; // When did the patient enter the hospital .. for example "11:11 pm"
	string PatientCheckOut; // When did the patient get out of the hospital .. for example "4:59 am"
	float PatientBill; // How much the treatment cost the patient
	int PatientAge; // Age of patient
	string PatientName; // Name of patient

public:
	void DisplayAvailableSpace() // Display the number of available spaces in the hospital
	{
		int availableSpace = MaxPatientNum - PatientNumber;
		std::cout << "Available hospital space: " << availableSpace << " patients." << endl;
	}

	void CheckAvailableSpace() // A system that checks if there is an available space in the hospital for new patients
	{
		if (PatientNumber <= MaxPatientNum)
		{
			cout << "There is an available space." << endl;
		}

		else
		{
			cout << "There is no space available right now." << endl;
		}
	}

	float OldPatientsDiscount() // A system that makes discounts depending on patients age
	{
		if (PatientAge >= 50) // 10% if age is 50 or above
		{
			return PatientBill * 0.1;
		}

		else if (PatientAge >= 60) // 20% if age is 60 or above
		{
			return PatientBill * 0.2;
		}

		else if (PatientAge >= 70 || PatientAge >= 80 || PatientAge >= 90) // 30% starting for age 70 and all above.
		{
			return PatientBill * 0.3;
		}

		else // No discount
		{
			return PatientBill ;
		}
	}

	void DisplayPatientDetails() // Display details of the current patient
	{
		std::cout << "Patient name is: " << PatientName << endl;
		std::cout << "Patient age is: " << PatientAge << endl;
		std::cout << "Patient checked in at: " << PatientCheckIn << endl;
		std::cout << "Patient checked out at: " << PatientCheckOut << endl;
		std::cout << "Patient treatment costs: " << PatientBill << endl;
		std::cout << "Patients treatment costs after discount (if patient meets the requirments): " << OldPatientsDiscount << endl;

	}


};

Leave a Comment