private void AddPriorityPopulation(LookupValueDto priorityPopulationDto, ClinicalCase clinicalCase)
        {
            var priorityPopulation             = _mappingHelper.MapLookupField <PriorityPopulation> (priorityPopulationDto);
            var clinicalCasePriorityPopulation = new ClinicalCasePriorityPopulation(priorityPopulation);

            clinicalCase.AddPriorityPopulation(clinicalCasePriorityPopulation);
        }
Example #2
0
        private void AddStaffLanguage(StaffLanguageDto staffLanguageDto, Staff staff)
        {
            var language        = _mappingHelper.MapLookupField <Language> (staffLanguageDto.Language);
            var languageFluency = _mappingHelper.MapLookupField <LanguageFluency> (staffLanguageDto.LanguageFluency);

            staff.AddLanguage(new StaffLanguage(language, languageFluency));
        }
Example #3
0
        private void AddStaffCertification(StaffCertificationDto dto, Staff staff)
        {
            var certification      = _mappingHelper.MapLookupField <Certification> (dto.Certification);
            var staffCertification = new StaffCertification(certification, new DateRange(dto.StartDate, dto.EndDate));

            staff.AddCertification(staffCertification);
        }
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="patientOtherConsiderationsDto">The patient other considerations dto.</param>
        /// <param name="patient">The patient.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(PatientOtherConsiderationsDto patientOtherConsiderationsDto, Patient patient)
        {
            var language      = _mappingHelper.MapLookupField <Language> (patientOtherConsiderationsDto.Language);
            var smokingStatus = _mappingHelper.MapLookupField <SmokingStatus> (patientOtherConsiderationsDto.SmokingStatus);

            patient.ReviseLanguage(new PatientLanguage(language, patientOtherConsiderationsDto.InterpreterNeededIndicator));
            patient.ReviseSmokingStatus(smokingStatus);
            patient.ReviseNotes(patientOtherConsiderationsDto.Note);
            patient.RevisePaperRecord(patientOtherConsiderationsDto.PaperFileIndicator);

            // Process Disabilities
            var patientDisabilityResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, Patient, PatientDisability> (
                patientOtherConsiderationsDto.Disabilities,
                patient,
                patient.Disabilities)
                                          .MapAddedItem(AddPatientDisability)
                                          .MapRemovedItem((raceDto, localPatient, patientDisability) => localPatient.RemovePatientDisabilility(patientDisability))
                                          .FindCollectionEntity((pr, key) => patient.Disabilities.FirstOrDefault(r => r.Disability.Key == key))
                                          .Map();

            // Process Special Needs
            var patientSpecialNeedResult = new AggregateNodeLookupCollectionMapper <LookupValueDto, Patient, PatientSpecialNeed> (
                patientOtherConsiderationsDto.SpecialNeeds,
                patient,
                patient.SpecialNeeds)
                                           .MapAddedItem(AddPatientSpecialNeed)
                                           .MapRemovedItem((raceDto, localPatient, patientSpecialNeed) => localPatient.RemovePatientSpecialNeed(patientSpecialNeed))
                                           .FindCollectionEntity((pr, key) => patient.SpecialNeeds.FirstOrDefault(r => r.SpecialNeed.Key == key))
                                           .Map();

            return(patientDisabilityResult && patientSpecialNeedResult);
        }
Example #5
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="patient">The patient.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(PatientProfileDto dto, Patient patient)
        {
            var name = new PersonNameBuilder()
                       .WithFirst(dto.FirstName)
                       .WithMiddle(dto.MiddleName)
                       .WithLast(dto.LastName)
                       .WithSuffix(dto.SuffixName)
                       .Build();

            if (patient.Name != name)
            {
                patient.Rename(name);
            }

            var patientGender     = (dto.PatientGender == null) ? null : _mappingHelper.MapLookupField <PatientGender> (dto.PatientGender);
            var contactPreference = _mappingHelper.MapLookupField <ContactPreference> (dto.ContactPreference);

            var patientProfile = new PatientProfileBuilder()
                                 .WithPatientGender(patientGender)
                                 .WithBirthDate(dto.BirthDate)
                                 .WithDeathDate(dto.DeathDate)
                                 .WithContactPreference(contactPreference)
                                 .WithEmailAddress(string.IsNullOrWhiteSpace(dto.EmailAddress) ? null : new EmailAddress(dto.EmailAddress))
                                 .Build();

            patient.ReviseProfile(patientProfile);

            return(true);
        }
Example #6
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);
        }
Example #7
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="patientDemographicDetailsDto">The patient demographic details dto.</param>
        /// <param name="patient">The patient.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(PatientDemographicDetailsDto patientDemographicDetailsDto, Patient patient)
        {
            var stateProvince      = _mappingHelper.MapLookupField <StateProvince> (patientDemographicDetailsDto.BirthStateProvince);
            var birthCountyArea    = _mappingHelper.MapLookupField <CountyArea> (patientDemographicDetailsDto.BirthCountyArea);
            var countyArea         = _mappingHelper.MapLookupField <CountyArea> (patientDemographicDetailsDto.CountyArea);
            var geographicalRegion = _mappingHelper.MapLookupField <GeographicalRegion> (patientDemographicDetailsDto.GeographicalRegion);

            PatientBirthInfo patientBirthInfo = new PatientBirthInfoBuilder()
                                                .WithBirthCityName(patientDemographicDetailsDto.BirthCityName)
                                                .WithBirthCountyArea(birthCountyArea)
                                                .WithBirthFirstName(patientDemographicDetailsDto.BirthFirstName)
                                                .WithBirthLastName(patientDemographicDetailsDto.BirthLastName)
                                                .WithBirthStateProvince(stateProvince);

            patient.ReviseBirthInfo(patientBirthInfo);

            var motherName = new MotherName(patientDemographicDetailsDto.MotherFirstName, patientDemographicDetailsDto.MotherMaidenName);

            patient.ReviseMotherName(motherName);

            var assignedPostalCode = string.IsNullOrWhiteSpace(patientDemographicDetailsDto.ZipCode)
                                                ? null
                                                : new PostalCode(patientDemographicDetailsDto.ZipCode);

            var patientAssignedArea = new PatientAssignedArea(countyArea, geographicalRegion, assignedPostalCode);

            patient.ReviseAssignedArea(patientAssignedArea);

            return(true);
        }
Example #8
0
        private bool MappingProperties(GpraInterviewInformationDto gpraInterviewInformationDto, Domain.Clinical.GpraModule.GpraInterview gpraInterview)
        {
            var gpraPatientType   = _mappingHelper.MapLookupField <GpraPatientType> (gpraInterviewInformationDto.GpraPatientType);
            var gpraInterviewType = _mappingHelper.MapLookupField <GpraInterviewType> (gpraInterviewInformationDto.GpraInterviewType);

            gpraInterview.ReviseGpraInterviewInformation(
                new GpraInterviewInformation(
                    gpraInterviewType,
                    gpraPatientType,
                    gpraInterviewInformationDto.SbirtSbiPositiveIndicator,
                    gpraInterviewInformationDto.SbirtWillingIndicator,
                    gpraInterviewInformationDto.AuditCScore,
                    gpraInterviewInformationDto.CageScore,
                    gpraInterviewInformationDto.DastScore,
                    gpraInterviewInformationDto.Dast10Score,
                    gpraInterviewInformationDto.NiaaaGuideScore,
                    gpraInterviewInformationDto.AssistAlcoholSubScore,
                    gpraInterviewInformationDto.OtherScore,
                    gpraInterviewInformationDto.OtherSpecificationDescription,
                    gpraInterviewInformationDto.ContractGrantIdentifier,
                    gpraInterviewInformationDto.ConductedInterviewIndicator,
                    gpraInterviewInformationDto.CooccuringMhSaScreenerIndicator,
                    gpraInterviewInformationDto.PositiveCooccuringMhSaScreenerIndicator
                    ));

            return(true);
        }
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="entity">The entity.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(MedicationDto dto, Medication entity)
        {
            CodedConcept medicationCode = null;

            if (dto.MedicationCodeCodedConcept != null)
            {
                medicationCode = new CodedConceptBuilder().WithCodedConceptDto(dto.MedicationCodeCodedConcept);
            }

            CodedConcept rootMedicationCode = null;

            if (dto.RootMedicationCodedConcept != null)
            {
                rootMedicationCode = new CodedConceptBuilder().WithCodedConceptDto(dto.RootMedicationCodedConcept);
            }

            var discontinuedReason = _mappingHelper.MapLookupField <DiscontinuedReason> (dto.DiscontinuedReason);
            var medicationStatus   = _mappingHelper.MapLookupField <MedicationStatus> (dto.MedicationStatus);

            entity.ReviseOverTheCounterIndicator(dto.OverTheCounterIndicator);
            entity.RevisePrescribingPhysicianName(dto.PrescribingPhysicianName);
            entity.ReviseUsageDateRange(new DateRange(dto.StartDate, dto.EndDate));
            entity.ReviseDiscontinuedByPhysicianName(dto.DiscontinuedByPhysicianName);
            entity.ReviseDiscontinuedReason(discontinuedReason);
            entity.ReviseDiscontinuedReasonOtherDescription(dto.DiscontinuedReasonOtherDescription);
            entity.ReviseFrequencyDescription(dto.FrequencyDescription);
            entity.ReviseInstructionsNote(dto.InstructionsNote);
            entity.ReviseMedicationStatus(medicationStatus);
            entity.ReviseMedicationCodeCodedConcept(medicationCode);
            entity.ReviseRootMedicationCodedConcept(rootMedicationCode);

            return(true);
        }
Example #10
0
        /// <summary>
        /// Creates the new.
        /// </summary>
        /// <param name="dto">The data transfer object.</param>
        /// <returns>A <see cref="Rem.Domain.Clinical.PatientModule.PatientDocument"/></returns>
        protected override PatientDocument CreateNew(PatientDocumentDto dto)
        {
            var patient             = _patientRepository.GetByKey(dto.PatientKey);
            var patientDocumentType = _mappingHelper.MapLookupField <PatientDocumentType> (dto.PatientDocumentType);
            var entity = _patientDocumentFactory.CreatePatientDocument(patient, patientDocumentType, dto.Document, dto.FileName);

            return(entity);
        }
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="patient">The patient.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(PatientLegalStatusDto dto, Patient patient)
        {
            var citizenshipCountry = _mappingHelper.MapLookupField <Country> (dto.CitizenshipCountry);
            var immigrationStatus  = _mappingHelper.MapLookupField <ImmigrationStatus> (dto.ImmigrationStatus);
            var custodialStatus    = _mappingHelper.MapLookupField <CustodialStatus> (dto.CustodialStatus);

            var patientLegalInfo = new PatientLegalInfo(citizenshipCountry, immigrationStatus, custodialStatus);

            patient.ReviseLegalInfo(patientLegalInfo);

            return(true);
        }
        /// <summary>
        /// Creates the new.
        /// </summary>
        /// <param name="dto">The dto to create new for.</param>
        /// <returns>A new <see cref="Rem.Domain.Clinical.PatientModule.SelfPayment"/>.</returns>
        protected SelfPayment CreateNew(SelfPaymentDto dto)
        {
            var currency      = _mappingHelper.MapLookupField <Currency> (dto.CurrencyWellKnownName);
            var paymentMethod = _mappingHelper.MapLookupField <PaymentMethod> (dto.PaymentMethod);

            var patient = _patientRepository.GetByKeyOrThrow(dto.PatientKey, "Patient");
            var staff   = _staffRepository.GetByKeyOrThrow(dto.CollectedByStaffKey, "Staff");

            var selfPayment = _selfPaymentFactory.CreateSelfPayment(
                patient, staff, new Money(currency, dto.Amount), paymentMethod, dto.CollectedDate);

            return(selfPayment);
        }
Example #13
0
        private void AddStaffAddress(StaffAddressDto staffAddressDto, Staff staff)
        {
            var addressType         = _mappingHelper.MapLookupField <StaffAddressType> (staffAddressDto.StaffAddressType);
            var countyAreaLookup    = _mappingHelper.MapLookupField <CountyArea> (staffAddressDto.CountyArea);
            var stateProvinceLookup = _mappingHelper.MapLookupField <StateProvince> (staffAddressDto.StateProvince);

            var staffAddress =
                new StaffAddressBuilder().WithStaffAddressType(addressType).WithAddress(
                    new AddressBuilder().WithFirstStreetAddress(staffAddressDto.FirstStreetAddress).WithSecondStreetAddress(
                        staffAddressDto.SecondStreetAddress).WithCityName(staffAddressDto.CityName).WithCountyArea(countyAreaLookup)
                    .WithStateProvince(stateProvinceLookup).WithPostalCode(new PostalCode(staffAddressDto.PostalCode)));

            staff.AddAddress(staffAddress);
        }
Example #14
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="location">The location.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(LocationProfileDto dto, Location location)
        {
            var geographicalRegion = _mappingHelper.MapLookupField <GeographicalRegion> (dto.GeographicalRegion);

            location.ReviseLocationProfile(
                new LocationProfileBuilder().WithLocationName(
                    new LocationNameBuilder().WithName(dto.Name).WithDisplayName(dto.DisplayName).Build()).WithEffectiveDateRange(
                    new DateRange(dto.StartDate, dto.EndDate)).WithWebsiteUrlName(dto.WebsiteUrlName).WithGeographicalRegion(
                    geographicalRegion).Build());

            _mappingResult &= MapEmailAddresses(location, dto);

            return(_mappingResult);
        }
        private void MapPhoneProperties(
            PatientContactPhoneDto patientContactPhoneDto, PatientContact patientContact, PatientContactPhone patientContactPhone)
        {
            var result = new PropertyMapper <PatientContactPhone> (patientContactPhone, patientContactPhoneDto)
                         .MapProperty(p => p.PhoneNumber, patientContactPhoneDto.PhoneNumber)
                         .MapProperty(p => p.PhoneExtensionNumber, patientContactPhoneDto.PhoneExtensionNumber)
                         .MapProperty(
                p => p.PatientContactPhoneType,
                _mappingHelper.MapLookupField <PatientContactPhoneType> (patientContactPhoneDto.PatientContactPhoneType))
                         .MapProperty(p => p.ConfidentialIndicator, patientContactPhoneDto.ConfidentialIndicator)
                         .Map();

            _mappingResult &= result;
        }
Example #16
0
        private bool MapProperties(CdsRule cdsRule, CdsRuleDto cdsRuleDto)
        {
            CodedConcept medicationCodedConcept = null;

            if (cdsRuleDto.MedicationCodedConcept != null)
            {
                medicationCodedConcept = new CodedConceptBuilder().WithCodedConceptDto(cdsRuleDto.MedicationCodedConcept);
            }

            CodedConcept problemCodedConcept = null;

            if (cdsRuleDto.ProblemCodedConcept != null)
            {
                problemCodedConcept = new CodedConceptBuilder().WithCodedConceptDto(cdsRuleDto.ProblemCodedConcept.ProblemCodeCodedConcept);
            }

            var labTestName = _dtoToDomainMappingHelper.MapLookupField <LabTestName> (cdsRuleDto.LabTestName);

            cdsRule.Rename(cdsRuleDto.Name);
            cdsRule.ReviseRecommendationNote(cdsRuleDto.RecommendationNote);
            cdsRule.ReviseMedicationCodedConcept(medicationCodedConcept);
            cdsRule.ReviseProblemCodedConcept(problemCodedConcept);
            cdsRule.ReviseLabTestName(labTestName);
            cdsRule.ReviseAge(cdsRuleDto.Age);
            cdsRule.ReviseValidLabOrderMonthCount(cdsRuleDto.ValidLabOrderMonthCount);

            return(true);
        }
        /// <summary>
        /// Handles the request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        protected override void HandleRequest(CreateNewPatientRequest request, CreateNewPatientResponse response)
        {
            var session = SessionProvider.GetSession();
            var agency  = session.Load <Agency> (request.AgencyKey);

            var name = new PersonNameBuilder()
                       .WithFirst(request.FirstName)
                       .WithMiddle(request.MiddleName)
                       .WithLast(request.LastName)
                       .WithSuffix(request.Suffix == null ? null : request.Suffix.Name)
                       .Build();

            PatientGender patientGender = null;

            if (request.Gender != null)
            {
                patientGender = _mappingHelper.MapLookupField <PatientGender> (request.Gender);
            }

            var patientProfile = new PatientProfileBuilder()
                                 .WithPatientGender(patientGender)
                                 .WithBirthDate(request.BirthDate)
                                 .Build();

            var patient = _patientFactory.CreatePatient(agency, name, patientProfile);

            if (Success)
            {
                response.PatientDto = Mapper.Map <Patient, PatientDto> (patient);
            }
        }
        /// <summary>
        /// Processes the specified vital sign dto.
        /// </summary>
        /// <param name="vitalSignDto">The vital sign dto.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool Process(VitalSignDto vitalSignDto)
        {
            var vitalSign = Session.Get <VitalSign> (vitalSignDto.Key);

            var vitalSignPhysicalExamNotDoneReason =
                _mappingHelper.MapLookupField <VitalSignPhysicalExamNotDoneReason> (vitalSignDto.VitalSignPhysicalExamNotDoneReason);

            vitalSign.ReviseHeight(new Height(vitalSignDto.HeightFeetMeasure, vitalSignDto.HeightInchesMeasure));
            vitalSign.ReviseWeight(vitalSignDto.WeightLbsMeasure);
            vitalSign.ReviseDietaryConsultationOrderIndicator(vitalSignDto.DietaryConsultationOrderIndicator);
            vitalSign.ReviseBmiFollowUpPlanIndicator(vitalSignDto.BmiFollowUpPlanIndicator);
            vitalSign.ReviseVitalSignPhysicalExamNotDoneReason(vitalSignPhysicalExamNotDoneReason);

            _mappingResult &=
                new AggregateNodeCollectionMapper <BloodPressureDto, VitalSign, BloodPressure> (
                    vitalSignDto.BloodPressures, vitalSign, vitalSign.BloodPressures)
                .MapRemovedItem(RemoveBloodPressure)
                .MapAddedItem(AddBloodPressure)
                .MapChangedItem(ChangeBloodPressure)
                .Map();

            _mappingResult &=
                new AggregateNodeCollectionMapper <HeartRateDto, VitalSign, HeartRate> (vitalSignDto.HeartRates, vitalSign, vitalSign.HeartRates)
                .MapRemovedItem(RemoveHeartRate)
                .MapAddedItem(AddHeartRate)
                .MapChangedItem(ChangeHeartRate)
                .Map();

            return(true);
        }
Example #19
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="socialHistoryDto">The social history dto.</param>
        /// <param name="socialHistory">The social history.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(SocialHistoryDto socialHistoryDto, SocialHistory socialHistory)
        {
            // register for various 'created' events
            DomainEvent.Register <Phq9CreatedEvent> (e => _isPhq9Created     = true);
            DomainEvent.Register <AuditCCreatedEvent> (e => _isAuditCCreated = true);
            DomainEvent.Register <Dast10CreatedEvent> (e => _isDast10Created = true);

            var socialHistoryPhq2 = new SocialHistoryPhq2(
                socialHistoryDto.Phq2LittleInterestInDoingThingsAnswerNumber,
                socialHistoryDto.Phq2FeelingDownAnswerNumber,
                socialHistoryDto.Phq2Score);

            socialHistory.ReviseSocialHistoryPhq2(socialHistoryPhq2);

            var socialHistoryAuditC = new SocialHistoryAuditC(
                socialHistoryDto.AuditCDrinkBeerWineOrOtherAlcoholicBeveragesIndicator);

            socialHistory.ReviseSocialHistoryAuditC(socialHistoryAuditC);

            var socialHistoryDast10 = new SocialHistoryDast10(
                socialHistoryDto.Dast10TimesPastYearUsedIllegalDrugOrPrescriptionMedicationForNonMedicalReasonsNumber);

            socialHistory.ReviseSocialHistoryDast10(socialHistoryDast10);

            var smokingStatus        = _mappingHelper.MapLookupField <SmokingStatus> (socialHistoryDto.SmokingStatus);
            var socialHistorySmoking = new SocialHistorySmoking(
                smokingStatus,
                socialHistoryDto.SmokingStatusAreYouWillingToQuitIndicator,
                socialHistoryDto.SmokingStatusAreYouWillingToQuitDate);

            socialHistory.ReviseSocialHistorySmoking(socialHistorySmoking);

            return(true);
        }
        private void AddPayorPhone(PayorPhoneDto payorPhoneDto, Payor payor)
        {
            var phoneType = _mappingHelper.MapLookupField <PayorPhoneType> (payorPhoneDto.PayorPhoneType);

            var phoneNumber = new PayorPhone(phoneType, new Phone(payorPhoneDto.PhoneNumber, payorPhoneDto.PhoneExtensionNumber));

            payor.AddPayorPhoneNumber(phoneNumber);
        }
        private void AddLocationIdentifier(LocationIdentifierDto dto, Location location)
        {
            var locationIdentifierType = _mappingHelper.MapLookupField <LocationIdentifierType> (dto.LocationIdentifierType);

            location.AddIdentifier(
                new LocationIdentifierBuilder().WithLocationIdentifierType(locationIdentifierType).WithIdentifierNumber(dto.IdentifierNumber)
                .WithEffectiveDateRange(new DateRange(dto.StartDate, dto.EndDate)));
        }
Example #22
0
        private void AddStaffIdentifier(StaffIdentifierDto staffIdentifierDto, Staff staff)
        {
            var staffIdentifierType = _mappingHelper.MapLookupField <StaffIdentifierType> (staffIdentifierDto.StaffIdentifierType);
            var staffIdentifier     = new StaffIdentifier(
                staffIdentifierType, staffIdentifierDto.IdentifierNumber, new DateRange(staffIdentifierDto.StartDate, staffIdentifierDto.EndDate));

            staff.AddIdentifier(staffIdentifier);
        }
        private Patient SavePatient(PatientSearchResultDto patientSearchResult, long agencyKey)
        {
            CheckPhoneAndAddressRequiredFields(patientSearchResult);

            var agency = _agencyRepository.GetByKey(agencyKey);

            var personName = new PersonName(
                patientSearchResult.PrefixName,
                patientSearchResult.FirstName,
                patientSearchResult.MiddleName,
                patientSearchResult.LastName,
                patientSearchResult.SuffixName);

            var patientGender = (patientSearchResult.PatientGender == null)
                                    ? null
                                    : _mappingHelper.MapLookupField <PatientGender> (patientSearchResult.PatientGender);
            var patientProfile = new PatientProfileBuilder()
                                 .WithBirthDate(patientSearchResult.BirthDate)
                                 .WithPatientGender(patientGender)
                                 .Build();

            var patient = _patientFactory.CreatePatient(agency, personName, patientProfile);

            PopulatePatientAddresses(patient, patientSearchResult);
            PopulatePatientPhones(patient, patientSearchResult);

            _patientRepository.MakePersistent(patient);

            return(patient);
        }
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(ClinicalCaseStatusDto dto, ClinicalCase clinicalCase)
        {
            var clinicalCaseStatus = _mappingHelper.MapLookupField <ClinicalCaseStatus> (dto.ClinicalCaseStatus);

            clinicalCase.UpdateStatus(clinicalCaseStatus);
            clinicalCase.Close(new ClinicalCaseCloseInfo(dto.ClinicalCaseCloseDate, dto.ClinicalCaseClosingNote));

            return(true);
        }
        private void AddAllergy(AllergyDto allergyDto)
        {
            var patient       = Session.Get <Patient> (_patientKey);
            var allergyStatus = _mappingHelper.MapLookupField <AllergyStatus> (allergyDto.AllergyStatus);

            CodedConcept allergen = null;

            if (allergyDto.AllergenCodedConcept != null)
            {
                allergen = new CodedConceptBuilder().WithCodedConceptDto(allergyDto.AllergenCodedConcept);
            }

            var allergy = _allergyFactory.CreateAllergy(patient, allergyStatus, allergen);

            var mapResult = MapAllergyProperties(allergyDto, allergy);

            _mappingResult &= mapResult;
        }
        private void AddStaffPhone(StaffPhoneNumberDto staffPhoneDto, Staff staff)
        {
            var staffPhoneType = _mappingHelper.MapLookupField <StaffPhoneType> (staffPhoneDto.StaffPhoneType);
            var staffPhone     = new StaffPhone(
                staffPhoneType,
                new PhoneBuilder().WithPhoneNumber(staffPhoneDto.PhoneNumber).WithPhoneExtensionNumber(staffPhoneDto.PhoneExtensionNumber),
                false);

            staff.AddPhone(staffPhone);
        }
        private bool MapProperties(PatientContact patientContact, PatientContactProfileDto patientContactDto)
        {
            patientContact.RenamePatientContact(patientContactDto.FirstName, patientContactDto.MiddleName, patientContactDto.LastName);
            patientContact.ReviseCanContactIndicator(patientContactDto.CanContactIndicator);
            patientContact.ReviseConsentExpirationDate(patientContactDto.ConsentExpirationDate);
            patientContact.ReviseConsentOnFileIndicator(patientContactDto.ConsentOnFileIndicator);
            patientContact.ReviseLegalAuthorizationType(
                _mappingHelper.MapLookupField <LegalAuthorizationType> (patientContactDto.LegalAuthorizationType));
            patientContact.ReviseNote(patientContactDto.Note);
            patientContact.RevisePrimaryIndicator(patientContactDto.PrimaryIndicator);
            patientContact.RevisePatientContactRelationshipType(_mappingHelper.MapLookupField <PatientContactRelationshipType> (patientContactDto.PatientContactRelationshipType));
            patientContact.ReviseSocialSecurityNumber(patientContactDto.SocialSecurityNumber);
            patientContact.ReviseEmergencyIndicator(patientContactDto.EmergencyIndicator);
            patientContact.ReviseDesignatedFollowUpIndicator(patientContactDto.DesignatedFollowUpIndicator);
            patientContact.ReviseGender(_mappingHelper.MapLookupField <Gender> (patientContactDto.Gender));
            patientContact.ReviseBirthDate(patientContactDto.BirthDate);

            return(true);
        }
        /// <summary>
        /// Creates the new.
        /// </summary>
        /// <param name="dto">The data transfer object.</param>
        /// <returns>A <see cref="Rem.Domain.Clinical.PatientModule.PatientDocument"/></returns>
        protected override PatientDocument CreateNew(MailAttachmentPatientDocumentDto dto)
        {
            var message = _imapMessageFetcher.FetchMessage(dto.MailFolderName, dto.MailId);

            if (message == null || message.Attachments.Count == 0)
            {
                throw new ApplicationException("Couldn't find the attachment.");
            }

            //TODO: Right now, only get the first attachment
            dto.Document = message.Attachments[0].ContentBytes;
            dto.FileName = message.Attachments[0].FileName;

            var patient             = _patientRepository.GetByKey(dto.PatientKey);
            var patientDocumentType = _mappingHelper.MapLookupField <PatientDocumentType> (dto.PatientDocumentType);
            var entity = _patientDocumentFactory.CreatePatientDocument(patient, patientDocumentType, dto.Document, dto.FileName);

            return(entity);
        }
Example #29
0
        /// <summary>
        /// Processes the specified radiology order dto.
        /// </summary>
        /// <param name="radiologyOrderDto">The radiology order dto.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool Process(RadiologyOrderDto radiologyOrderDto)
        {
            var radiologyOrder    = Session.Get <RadiologyOrder> (radiologyOrderDto.Key);
            var radiologyTestType = _mappingHelper.MapLookupField <RadiologyTestType> (radiologyOrderDto.RadiologyTestType);

            radiologyOrder.ReviseRadiologyTestType(radiologyTestType);
            radiologyOrder.ReviseNote(radiologyOrderDto.Note);

            return(true);
        }
Example #30
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto to process.</param>
        /// <param name="staff">The staff.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(StaffHRDto dto, Staff staff)
        {
            var supervisorStaff = dto.SupervisorStaff == null ? null : Session.Get <Staff> (dto.SupervisorStaff.Key);
            var employmentType  = _mappingHelper.MapLookupField <EmploymentType> (dto.EmploymentType);

            staff.ReviseStaffHr(
                new StaffHrBuilder().WithEmploymentType(employmentType).WithTitleName(dto.TitleName).WithSupervisorStaff(supervisorStaff)
                .WithConfidentialNote(dto.ConfidentialNote));

            _mappingResult &=
                new AggregateNodeCollectionMapper <StaffChecklistItemDto, Staff, StaffChecklistItem> (
                    dto.StaffChecklist, staff, staff.StaffChecklist).MapChangedItem(ChangeStaffChecklistItem).Map();

            _mappingResult &=
                new AggregateNodeCollectionMapper <StaffEventDto, Staff, StaffEvent> (dto.StaffEvents, staff, staff.StaffEvents).MapChangedItem(
                    ChangeStaffEvent).Map();

            return(_mappingResult);
        }