Exemple #1
0
        public Result <PatientDeseaseScreeningDto> GetPatientDeseaseScreenings(int patientId)
        {
            Result <PatientDeseaseScreeningDto> response = new Result <PatientDeseaseScreeningDto>();

            using (UnitOfWork unitOfWork = new UnitOfWork())
            {
                IEnumerable <DeseaseScreening>        DeseaseScreenings        = unitOfWork.DeseaseScreeningRepository.GetEntities();
                IEnumerable <PatientDeseaseScreening> patientDeseaseScreenings = unitOfWork.PatientDeseaseScreeningRepository.GetEntities(item => item.PatientId == patientId, p => p.OrderBy(o => o.DeseaseScreening.SortKey));

                foreach (DeseaseScreening DeseaseScreening in DeseaseScreenings)
                {
                    DeseaseScreeningDto     DeseaseScreeningDto     = _DeseaseScreeningMapper.MapToDeseaseScreeningDto(DeseaseScreening);
                    PatientDeseaseScreening patientDeseaseScreening = patientDeseaseScreenings.Where(item => item.DeseaseScreeningId == DeseaseScreening.DeseaseScreeningId).FirstOrDefault();

                    PatientDeseaseScreeningDto patientDeseaseScreeningDto = new PatientDeseaseScreeningDto()
                    {
                        PatientDeseaseScreeningId = patientDeseaseScreening == null ? default(int?) : patientDeseaseScreening.PatientDeseaseScreeningId,
                        PatientId        = patientId,
                        DeseaseScreening = DeseaseScreeningDto,
                        YearOfScreening  = patientDeseaseScreening == null ? default(int?) : patientDeseaseScreening.YearOfScreening,
                        Value            = patientDeseaseScreening == null ? null : patientDeseaseScreening.Value,
                        SelectedInd      = patientDeseaseScreening == null ? false : true
                    };

                    response.Models.Add(patientDeseaseScreeningDto);
                }
            }

            return(response);
        }
Exemple #2
0
        public DeseaseScreeningDto MapToDeseaseScreeningDto(DeseaseScreening deseaseScreening)
        {
            if (deseaseScreening == null)
            {
                return(null);
            }

            DeseaseScreeningDto deseaseScreeningDto = new DeseaseScreeningDto();

            deseaseScreeningDto.DeseaseScreeningId = deseaseScreening.DeseaseScreeningId;
            deseaseScreeningDto.Name    = deseaseScreening.Name;
            deseaseScreeningDto.SortKey = deseaseScreening.SortKey;

            return(deseaseScreeningDto);
        }
Exemple #3
0
        public DeseaseScreening MapToDeseaseScreening(DeseaseScreeningDto deseaseScreeningDto)
        {
            if (deseaseScreeningDto == null)
            {
                return(null);
            }

            DeseaseScreening DeseaseScreening = new DeseaseScreening();

            if (deseaseScreeningDto.DeseaseScreeningId != null)
            {
                DeseaseScreening.DeseaseScreeningId = deseaseScreeningDto.DeseaseScreeningId.Value;
            }

            DeseaseScreening.Name    = deseaseScreeningDto.Name;
            DeseaseScreening.SortKey = deseaseScreeningDto.SortKey;

            return(DeseaseScreening);
        }