コード例 #1
0
        private void AddPatientAddress(PatientAddressDto patientAddressDto, Patient patient)
        {
            var addressType         = _mappingHelper.MapLookupField <PatientAddressType> (patientAddressDto.PatientAddressType);
            var countyAreaLookup    = _mappingHelper.MapLookupField <CountyArea> (patientAddressDto.CountyArea);
            var stateProvinceLookup = _mappingHelper.MapLookupField <StateProvince> (patientAddressDto.StateProvince);
            var countryLookup       = _mappingHelper.MapLookupField <Country> (patientAddressDto.Country);

            var address = new AddressBuilder()
                          .WithFirstStreetAddress(patientAddressDto.FirstStreetAddress)
                          .WithSecondStreetAddress(patientAddressDto.SecondStreetAddress)
                          .WithCityName(patientAddressDto.CityName)
                          .WithCountyArea(countyAreaLookup)
                          .WithStateProvince(stateProvinceLookup)
                          .WithCountry(countryLookup)
                          .WithPostalCode(
                string.IsNullOrWhiteSpace(patientAddressDto.PostalCode) ? null : new PostalCode(patientAddressDto.PostalCode))
                          .Build();

            var patientAddress = new PatientAddressBuilder()
                                 .WithPatientAddressType(addressType)
                                 .WithAddress(address)
                                 .WithConfidentialIndicator(patientAddressDto.ConfidentialIndicator)
                                 .WithYearsOfStayNumber(patientAddressDto.YearsOfStayNumber)
                                 .Build();

            patient.AddAddress(patientAddress);
        }
コード例 #2
0
        public void MapToPatientAddress(PatientAddress patientAddress, PatientAddressDto patientAddressDto)
        {
            if (patientAddressDto == null)
            {
                return;
            }

            patientAddress = patientAddress ?? new PatientAddress();

            patientAddress.Line1      = patientAddressDto.Line1;
            patientAddress.Line2      = patientAddressDto.Line2;
            patientAddress.Suburb     = patientAddressDto.Suburb;
            patientAddress.City       = patientAddressDto.City;
            patientAddress.PostalCode = patientAddressDto.PostalCode;
            patientAddress.ProvinceId = patientAddressDto.ProvinceId;
            patientAddress.CountryId  = patientAddressDto.CountryId;
        }
コード例 #3
0
        public PatientAddressDto MapToPatientAddressDto(PatientAddress patientAddress)
        {
            if (patientAddress == null)
            {
                return(null);
            }

            PatientAddressDto patientAddressDto = new PatientAddressDto();

            patientAddressDto.PatientAddressId = patientAddress.PatientAddressId;
            patientAddressDto.Line1            = patientAddress.Line1;
            patientAddressDto.Line2            = patientAddress.Line2;
            patientAddressDto.Suburb           = patientAddress.Suburb;
            patientAddressDto.City             = patientAddress.City;
            patientAddressDto.PostalCode       = patientAddress.PostalCode;
            patientAddressDto.ProvinceId       = patientAddress.ProvinceId;
            patientAddressDto.CountryId        = patientAddress.CountryId;

            return(patientAddressDto);
        }
コード例 #4
0
        public PatientAddressViewModel MapToPatientAddressViewModel(PatientAddressDto patientAddressDto)
        {
            if (patientAddressDto == null)
            {
                return(null);
            }

            PatientAddressViewModel patientAddressViewModel = new PatientAddressViewModel();

            patientAddressViewModel.PatientAddressId = patientAddressDto.PatientAddressId;
            patientAddressViewModel.Line1            = patientAddressDto.Line1;
            patientAddressViewModel.Line2            = patientAddressDto.Line2;
            patientAddressViewModel.Suburb           = patientAddressDto.Suburb;
            patientAddressViewModel.City             = patientAddressDto.City;
            patientAddressViewModel.ProvinceId       = patientAddressDto.ProvinceId;
            patientAddressViewModel.CountryId        = patientAddressDto.CountryId;
            patientAddressViewModel.PostalCode       = patientAddressDto.PostalCode;

            return(patientAddressViewModel);
        }
コード例 #5
0
        public PatientAddressDto MapToPatientAddressDto(PatientAddressViewModel patientAddressViewModel)
        {
            if (patientAddressViewModel == null ||
                (string.IsNullOrEmpty(patientAddressViewModel.Line1)) &&
                patientAddressViewModel.ProvinceId == null &&
                string.IsNullOrEmpty(patientAddressViewModel.PostalCode) &&
                string.IsNullOrEmpty(patientAddressViewModel.City))
            {
                return(null);
            }

            PatientAddressDto patientAddressDto = new PatientAddressDto();

            patientAddressDto.PatientAddressId = patientAddressViewModel.PatientAddressId;
            patientAddressDto.Line1            = patientAddressViewModel.Line1;
            patientAddressDto.Line2            = patientAddressViewModel.Line2;
            patientAddressDto.Suburb           = patientAddressViewModel.Suburb;
            patientAddressDto.City             = patientAddressViewModel.City;
            patientAddressDto.ProvinceId       = patientAddressViewModel.ProvinceId;
            patientAddressDto.CountryId        = patientAddressViewModel.CountryId;
            patientAddressDto.PostalCode       = patientAddressViewModel.PostalCode;

            return(patientAddressDto);
        }
コード例 #6
0
 private void ChangePatientAddress(PatientAddressDto patientAddressDto, Patient patient, PatientAddress patientAddress)
 {
     RemovePatientAddress(patientAddressDto, patient, patientAddress);
     AddPatientAddress(patientAddressDto, patient);
 }
コード例 #7
0
 private static void RemovePatientAddress(PatientAddressDto patientAddressDto, Patient patient, PatientAddress patientAddress)
 {
     patient.RemoveAddress(patientAddress);
 }
コード例 #8
0
        private PatientSearchResultDto CreatePatientSearchResultDtoFromQueryCriteria(PatientQueryCriteria queryCriteria)
        {
            var patientSearchResultDto = new PatientSearchResultDto
            {
                Addresses    = new SoftDeleteObservableCollection <PatientAddressDto> (),
                PhoneNumbers = new SoftDeleteObservableCollection <PatientPhoneDto> (),
                FirstName    = queryCriteria.FirstName,
                LastName     = queryCriteria.LastName,
                MiddleName   = queryCriteria.MiddleName,
                BirthDate    = queryCriteria.BirthDate
            };

            if (!string.IsNullOrEmpty(queryCriteria.GenderWellKnownName))
            {
                var patientGender = _lookupValueRepository.GetLookupByWellKnownName <PatientGender> (queryCriteria.GenderWellKnownName);
                if (patientGender != null)
                {
                    patientSearchResultDto.PatientGender = Mapper.Map <LookupBase, LookupValueDto> (patientGender);
                }
            }

            if (!string.IsNullOrEmpty(queryCriteria.Phone))
            {
                var patientPhoneType =
                    _lookupValueRepository.GetLookupByWellKnownName <PatientPhoneType> (WellKnownNames.PatientModule.PatientPhoneType.Other);
                var patietnPhoneTypeDto = Mapper.Map <LookupBase, LookupValueDto> (patientPhoneType);
                var patientPhoneDto     = new PatientPhoneDto
                {
                    PatientPhoneType = patietnPhoneTypeDto,
                    PhoneNumber      = queryCriteria.Phone
                };
                patientSearchResultDto.PhoneNumbers.Add(patientPhoneDto);
            }

            if (!string.IsNullOrEmpty(queryCriteria.AddressLineOne) || !string.IsNullOrEmpty(queryCriteria.City) ||
                !string.IsNullOrEmpty(queryCriteria.StateWellKnownName) || !string.IsNullOrEmpty(queryCriteria.ZipCode))
            {
                var patientAddressType =
                    _lookupValueRepository.GetLookupByWellKnownName <PatientAddressType> (WellKnownNames.PatientModule.PatientAddressType.Other);
                var patientAddressTypeDto = Mapper.Map <LookupBase, LookupValueDto> (patientAddressType);
                var patientAddressDto     = new PatientAddressDto
                {
                    FirstStreetAddress = queryCriteria.AddressLineOne,
                    PostalCode         = queryCriteria.ZipCode,
                    CityName           = queryCriteria.City,
                    PatientAddressType = patientAddressTypeDto
                };

                if (!string.IsNullOrEmpty(queryCriteria.StateWellKnownName))
                {
                    var state = _lookupValueRepository.GetLookupByWellKnownName <StateProvince> (queryCriteria.StateWellKnownName);
                    if (state != null)
                    {
                        patientAddressDto.StateProvince = Mapper.Map <LookupBase, LookupValueDto> (state);
                    }
                }

                patientSearchResultDto.Addresses.Add(patientAddressDto);
            }

            return(patientSearchResultDto);
        }