public Result <PatientClinicalExaminationDto> GetPatientClinicalExaminations(int patientConsultationId)
        {
            Result <PatientClinicalExaminationDto> response = new Result <PatientClinicalExaminationDto>();

            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                IEnumerable <ClinicalExamination>        ClinicalExaminations        = unitOfWork.ClinicalExaminationRepository.GetEntities();
                IEnumerable <PatientClinicalExamination> patientClinicalExaminations = unitOfWork.PatientClinicalExaminationRepository.GetEntities(item => item.PatientConsultationId == patientConsultationId, p => p.OrderBy(o => o.ClinicalExamination.SortKey));

                foreach (ClinicalExamination ClinicalExamination in ClinicalExaminations)
                {
                    ClinicalExaminationDto     ClinicalExaminationDto     = _ClinicalExaminationMapper.MapToClinicalExaminationDto(ClinicalExamination);
                    PatientClinicalExamination patientClinicalExamination = patientClinicalExaminations.Where(item => item.ClinicalExaminationId == ClinicalExamination.ClinicalExaminationId).FirstOrDefault();

                    PatientClinicalExaminationDto patientClinicalExaminationDto = new PatientClinicalExaminationDto()
                    {
                        PatientClinicalExaminationId = patientClinicalExamination == null ? default(int?) : patientClinicalExamination.PatientClinicalExaminationId,
                        PatientConsultationId        = patientConsultationId,
                        ClinicalExamination          = ClinicalExaminationDto,
                        Value = patientClinicalExamination == null ? null : patientClinicalExamination.Value
                    };

                    response.Models.Add(patientClinicalExaminationDto);
                }
            }

            return(response);
        }
Beispiel #2
0
        public ClinicalExaminationDto MapToClinicalExaminationDto(ClinicalExamination clinicalExamination)
        {
            if (clinicalExamination == null)
            {
                return(null);
            }

            ClinicalExaminationDto clinicalExaminationDto = new ClinicalExaminationDto();

            clinicalExaminationDto.ClinicalExaminationId = clinicalExamination.ClinicalExaminationId;
            clinicalExaminationDto.Name    = clinicalExamination.Name;
            clinicalExaminationDto.SortKey = clinicalExamination.SortKey;

            return(clinicalExaminationDto);
        }
Beispiel #3
0
        public ClinicalExamination MapToClinicalExamination(ClinicalExaminationDto clinicalExaminationDto)
        {
            if (clinicalExaminationDto == null)
            {
                return(null);
            }

            ClinicalExamination clinicalExamination = new ClinicalExamination();

            if (clinicalExaminationDto.ClinicalExaminationId != null)
            {
                clinicalExamination.ClinicalExaminationId = clinicalExaminationDto.ClinicalExaminationId.Value;
            }

            clinicalExamination.Name    = clinicalExaminationDto.Name;
            clinicalExamination.SortKey = clinicalExaminationDto.SortKey;

            return(clinicalExamination);
        }