/// <summary> /// return a new Treatment, fusion of both treatment /// </summary> /// <param name="???"></param> /// <returns></returns> public Treatment Merge(Treatment tr) { var newTr = new Treatment(); //merge fatal errors newTr.FatalErrors = FatalErrors.Union(tr.FatalErrors).ToList(); // Merge errors newTr.Errors = this.Errors.Union(tr.Errors).ToList(); // Merge Warnings newTr.Warnings = Warnings.Union(tr.Warnings).ToList(); // Merge info newTr.Info = Info.Union(tr.Info).ToList(); // Merge Objects newTr.Objects = Objects.Union(tr.Objects).ToList(); // newTr.Objects = Treatment.MergeObjects(Objects, tr.Objects); return(newTr); }
/// <summary> /// Get event by id /// </summary> /// <param name="id"></param> /// <param name="tr"></param> /// <returns></returns> public EventDto GetEventById(int?id, out Treatment tr) { tr = new Treatment(); if (!id.HasValue) { tr.AddFatalErrorWithCode(HttpStatusCode.BadRequest); return(null); } var foundEvent = _eventDao.GetEventById(id.Value); if (foundEvent == null) { tr.AddErrorWithCode(HttpStatusCode.NotFound); return(null); } var eventDto = EventDto.Extract(foundEvent); tr.AddObject(eventDto); return(eventDto); }
public SpecialistAppointment ScheduleSpecialistAppointment(Doctor specialist, String cause, Treatment treatment, ExamOperationRoom room, DateTime startDate, DateTime endDate) { SpecialistAppointment specialistAppointment = new SpecialistAppointment(cause, specialist); treatment.SpecialistAppointment = specialistAppointment; MedicalRecord medicalRecord = MedicalRecordRepository.Instance.GetMedicalRecordByTreatmentId(treatment.Id); Patient patient = medicalRecord.Patient; Appointment appointment = new Appointment(specialist, patient, room, TypeOfAppointment.EXAM, startDate, endDate); AppointmentRepository.Instance.Save(appointment); return(treatment.SpecialistAppointment); }
public Treatment GetTreatment(Treatment obj) { return(TreatmentRepository.Instance.GetTreatment(obj.Id)); }
public Treatment Create(Patient patient, Treatment obj) { MedicalRecordRepository.Instance.AddTreatmentToMedicalRecord(MedicalRecordRepository.Instance.GetMedicalRecordByPatient(patient), obj); return(TreatmentRepository.Instance.Save(obj)); }
public MedicalRecord AddTreatment(Treatment treatment, MedicalRecord medicalRecord) { return(MedicalRecordRepository.Instance.AddTreatmentToMedicalRecord(medicalRecord, treatment)); }