public MedicalAppointment(DateTime date, MedicalAppointmentType medicalAppointmentType, Customer customer, Doctor doctor) { Date = date; MedicalAppointmentType = medicalAppointmentType; Customer = customer; Doctor = doctor; }
//Cria nova entidade consulta e adiciona pelo metodo Add da tabela hash //Busca cliente com base no cpf //Remove médico da fila de agregamento de consultas e o coloca na última posição //Verifica a existência da consulta //Adiciona consulta a lista de consultas do médico e do cliente //Adiciona consulta à tabela hash public void AddMedicalAppointment(Cpf cpf, MedicalAppointmentType medicalAppointmentType, MedicalSpecialty medicalSpecialty, DateTime date) { var customer = GetCustomer(cpf); Crm crm = _lastDoctorAppointments[(int)medicalSpecialty].Dequeue(); _lastDoctorAppointments[(int)medicalSpecialty].Enqueue(crm); var doctor = GetDoctor(crm); var medicalAppointment = new MedicalAppointment(date, medicalAppointmentType, customer, doctor); if (!_medicalAppointmentHashs.Exist(date)) { _medicalAppointmentHashs.Add(date, new Hashtable <MedicalAppointment, MedicalAppointment>()); } var medicalAppointments = _medicalAppointmentHashs.Find(date); if (medicalAppointments.Exist(medicalAppointment)) { throw new InvalidOperationException("Consulta médica já existe."); } customer.AddMedicalAppointment(medicalAppointment); doctor.AddMedicalAppointment(medicalAppointment); medicalAppointments.Add(medicalAppointment, medicalAppointment); }
public MedicalAppointment(DateTime beginning, DateTime end, Room room, MedicalAppointmentType type, Guest patient, List <Doctor> doctors) : base(beginning, end, room) { Type = type; Patient = patient; Doctors = doctors; }
public MedicalAppointment(long id, DateTime beginning, DateTime end, Room room, MedicalAppointmentType type, Guest patient) : base(id, beginning, end, room) { Type = type; Patient = patient; Doctors = new List <Doctor>(); }
public MedicalAppointmentDTO(long id, DateTime beginning, DateTime end, RoomDTO room, MedicalAppointmentType type, GuestDTO patient, IEnumerable <DoctorDTO> doctors) : base(id, beginning, end, room) { Type = type; Patient = patient; Doctors = doctors; }
//Cria hashcode para consulta public override int GetHashCode() { var hashCode = 825685457; hashCode = hashCode * -1521134295 + Date.GetHashCode(); hashCode = hashCode * -1521134295 + MedicalAppointmentType.GetHashCode(); hashCode = hashCode * -1521134295 + CustomerCode.GetHashCode(); hashCode = hashCode * -1521134295 + DoctorCode.GetHashCode(); return(hashCode); }
public static void Should_get_medical_appoitment_value(decimal multiplier, MedicalAppointmentType type) { // arrange var doctor = new Doctor((Crm)"12345", "name", MedicalSpecialty.GeneralClinic); var customer = new Customer((Cpf)"123456789-10", "name", CustomerType.Normal); var medicalAppointment = new MedicalAppointment(DateTime.Now, type, customer, doctor); // act var result = medicalAppointment.Value; // assert Assert.Equal(doctor.MedicalSpecialtyValue * multiplier, result); }
private void SetMedicalAppointmentType(MedicalAppointmentType value) { _medicalAppointmentType = value; }
public override string ToString() { return($"Data: {Date:dd-MM-yyyy} - Tipo de consulta: {MedicalAppointmentType.GetDescription()} - Cliente: {CustomerCode} - Médico: {DoctorCode} - Especialidade Médica: {Doctor.MedicalSpecialty.GetDescription()} - Valor: {Value}"); }