예제 #1
0
파일: Treatment.cs 프로젝트: ptitim/PuffMvc
        /// <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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
 public Treatment GetTreatment(Treatment obj)
 {
     return(TreatmentRepository.Instance.GetTreatment(obj.Id));
 }
예제 #5
0
 public Treatment Create(Patient patient, Treatment obj)
 {
     MedicalRecordRepository.Instance.AddTreatmentToMedicalRecord(MedicalRecordRepository.Instance.GetMedicalRecordByPatient(patient), obj);
     return(TreatmentRepository.Instance.Save(obj));
 }
예제 #6
0
 public MedicalRecord AddTreatment(Treatment treatment, MedicalRecord medicalRecord)
 {
     return(MedicalRecordRepository.Instance.AddTreatmentToMedicalRecord(medicalRecord, treatment));
 }