Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public Treatment GetTreatment(Treatment obj)
 {
     return(TreatmentRepository.Instance.GetTreatment(obj.Id));
 }
Esempio n. 5
0
 public Treatment Create(Patient patient, Treatment obj)
 {
     MedicalRecordRepository.Instance.AddTreatmentToMedicalRecord(MedicalRecordRepository.Instance.GetMedicalRecordByPatient(patient), obj);
     return(TreatmentRepository.Instance.Save(obj));
 }
Esempio n. 6
0
 public MedicalRecord AddTreatment(Treatment treatment, MedicalRecord medicalRecord)
 {
     return(MedicalRecordRepository.Instance.AddTreatmentToMedicalRecord(medicalRecord, treatment));
 }