private void AddPatientPhone(PatientPhoneDto patientPhoneDto, Patient patient)
        {
            var patientPhoneType = _mappingHelper.MapLookupField <PatientPhoneType> (patientPhoneDto.PatientPhoneType);

            var patientPhone = new PatientPhone(
                patientPhoneType,
                patientPhoneDto.PhoneNumber,
                patientPhoneDto.PhoneExtensionNumber,
                patientPhoneDto.ConfidentialIndicator);

            patient.AddPhoneNumber(patientPhone);
        }
 private void ChangePatientPhone(PatientPhoneDto patientPhoneDto, Patient patient, PatientPhone patientPhone)
 {
     RemovePatientPhone(patientPhoneDto, patient, patientPhone);
     AddPatientPhone(patientPhoneDto, patient);
 }
 private static void RemovePatientPhone(PatientPhoneDto patientPhoneDto, Patient patient, PatientPhone patientPhone)
 {
     patient.RemovePhoneNumber(patientPhone);
 }
Example #4
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);
        }