/// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The teds discharge interview dto.</param>
        /// <param name="tedsDischargeInterview">The teds discharge interview.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(TedsDischargeInterviewDto dto, TedsDischargeInterview tedsDischargeInterview)
        {
            tedsDischargeInterview.ReviseLastFaceToFaceContactDate(dto.LastFaceToFaceContactDate);

            tedsDischargeInterview.ReviseTedsDischargeReason(
                TedsAnswerMapper.MapToTedsAnswer <TedsDischargeReason, TedsLookupBaseDto>(dto.TedsDischargeReason, _mappingHelper));

            var primarySubstance   = CreateSubstanceUsage(dto.PrimarySubstanceProblemType, dto.PrimaryUseFrequencyType);
            var secondarySubstance = CreateSubstanceUsage(dto.SecondarySubstanceProblemType, dto.SecondaryUseFrequencyType);
            var tertiarySubstance  = CreateSubstanceUsage(dto.TertiarySubstanceProblemType, dto.TertiaryUseFrequencyType);

            tedsDischargeInterview.ReviseTedsDischargeInterviewSubstanceUsages(primarySubstance, secondarySubstance, tertiarySubstance);

            tedsDischargeInterview.ReviseLivingArrangementsType(
                TedsAnswerMapper.MapToTedsAnswer <LivingArrangementsType, TedsLookupBaseDto>(dto.LivingArrangementsType, _mappingHelper));

            var employmentStatusInformation = CreateTedsEmploymentStatusInformation(dto);

            tedsDischargeInterview.ReviseTedsEmploymentStatusInformation(employmentStatusInformation);

            tedsDischargeInterview.ReviseArrestsInThirtyDaysNumber(
                TedsAnswerMapper.MapToTedsAnswer <int?>(dto.ArrestsInPastThirtyDaysCount, _mappingHelper));

            tedsDischargeInterview.ReviseFrequencyOfAttendanceAtSelfHelpProgramsType(
                TedsAnswerMapper.MapToTedsAnswer <ParticipatedSelfHelpGroupInPastThirtyDaysType, TedsLookupBaseDto>(dto.ParticipatedSelfHelpGroupInPastThirtyDaysType, _mappingHelper));

            return(true);
        }
        private TedsDischargeInterviewSubstanceUsage CreateSubstanceUsage(TedsAnswerDto <SubstanceProblemTypeDto> substanceProblemType, TedsAnswerDto <TedsLookupBaseDto> useFrequencyType)
        {
            TedsDischargeInterviewSubstanceUsage substanceUsage = null;

            var problem   = TedsAnswerMapper.MapToTedsAnswer <SubstanceProblemType, SubstanceProblemTypeDto> (substanceProblemType, _mappingHelper);
            var frequency = TedsAnswerMapper.MapToTedsAnswer <UseFrequencyType, TedsLookupBaseDto>(useFrequencyType, _mappingHelper);

            if (problem != null || frequency != null)
            {
                var problemAndFrequency = new SubstanceProblemAndFrequency(problem, frequency);
                substanceUsage = new TedsDischargeInterviewSubstanceUsage(problemAndFrequency);
            }

            return(substanceUsage);
        }
        private TedsEmploymentStatusInformation CreateTedsEmploymentStatusInformation(TedsDischargeInterviewDto dto)
        {
            TedsEmploymentStatusInformation employmentStatusInformation = null;

            var employmentStatus = TedsAnswerMapper.MapToTedsAnswer <TedsEmploymentStatus, TedsLookupBaseDto> (
                dto.TedsEmploymentStatus, _mappingHelper);
            var notInLaborForce = TedsAnswerMapper.MapToTedsAnswer <DetailedNotInLaborForce, TedsLookupBaseDto>(
                dto.DetailedNotInLaborForce, _mappingHelper);

            if (employmentStatus != null || notInLaborForce != null)
            {
                employmentStatusInformation = new TedsEmploymentStatusInformation(employmentStatus, notInLaborForce);
            }

            return(employmentStatusInformation);
        }
示例#4
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="dto">The dto.</param>
        /// <param name="tedsAdmissionInterview">The teds admission interview.</param>
        /// <returns>A bool.</returns>
        protected override bool ProcessSingleAggregate(TedsAdmissionInterviewDto dto, TedsAdmissionInterview tedsAdmissionInterview)
        {
            tedsAdmissionInterview.ReviseArrestsInPastThirtyDaysCount(TedsAnswerMapper.MapToTedsAnswer(dto.ArrestsInPastThirtyDaysCount, _mappingHelper));
            tedsAdmissionInterview.ReviseCoDependentIndicator(dto.CoDependentIndicator);

            //TedsAnswer<DsmDiagnosisResponse> dsmDiagnosis = null;
            //if (dto.DsmDiagnosis != null)
            //{
            //    if (dto.DsmDiagnosis.Response != null || dto.DsmDiagnosis.TedsNonResponse != null)
            //    {
            //        dsmDiagnosis = dto.DsmDiagnosis.TedsNonResponse != null
            //                     ? new TedsAnswer<DsmDiagnosisResponse>(
            //                           _mappingHelper.MapLookupField<TedsNonResponse>(dto.DsmDiagnosis.TedsNonResponse))
            //                     : new TedsAnswer<DsmDiagnosisResponse>(new DsmDiagnosisResponse(dto.DsmDiagnosis.Response));
            //    }
            //}
            //tedsAdmissionInterview.ReviseDsmDiagnosis(dsmDiagnosis);

            tedsAdmissionInterview.ReviseIncomeSourceType(TedsAnswerMapper.MapToTedsAnswer <IncomeSourceType>(dto.IncomeSourceType, _mappingHelper));

            tedsAdmissionInterview.ReviseLivingArrangementsType(TedsAnswerMapper.MapToTedsAnswer <LivingArrangementsType>(dto.LivingArrangementsType, _mappingHelper));

            tedsAdmissionInterview.ReviseVeteranStatusIndicator(TedsAnswerMapper.MapToTedsAnswer(dto.VeteranStatusIndicator, _mappingHelper));

            tedsAdmissionInterview.ReviseMedicationAssistedOpioidTherapyIndicator(TedsAnswerMapper.MapToTedsAnswer(dto.MedicationAssistedOpioidTherapyIndicator, _mappingHelper));

            tedsAdmissionInterview.ReviseOtherPsychiatricProblemIndicator(TedsAnswerMapper.MapToTedsAnswer(dto.OtherPsychiatricProblemIndicator, _mappingHelper));

            tedsAdmissionInterview.ReviseParticipatedSelfHelpGroupInPastThirtyDaysType(TedsAnswerMapper.MapToTedsAnswer <ParticipatedSelfHelpGroupInPastThirtyDaysType>(dto.ParticipatedSelfHelpGroupInPastThirtyDaysType, _mappingHelper));

            tedsAdmissionInterview.RevisePrimaryPaymentSourceType(TedsAnswerMapper.MapToTedsAnswer <PrimaryPaymentSourceType>(dto.PrimaryPaymentSourceType, _mappingHelper));

            tedsAdmissionInterview.RevisePriorTreatmentEpisodesCount(TedsAnswerMapper.MapToTedsAnswer(dto.PriorTreatmentEpisodesCount, _mappingHelper));

            TedsAdmissionInterviewSubstanceUsage primaryTedsAdmissionInterviewSubstanceUsage = null;
            var primarySubstanceProblemType         = TedsAnswerMapper.MapToTedsAnswer <SubstanceProblemType> (dto.PrimarySubstanceProblemType, _mappingHelper);
            var primaryUseFrequencyType             = TedsAnswerMapper.MapToTedsAnswer <UseFrequencyType> (dto.PrimaryUseFrequencyType, _mappingHelper);
            var primaryFirstUseAge                  = TedsAnswerMapper.MapToTedsAnswer(dto.PrimaryFirstUseAge, _mappingHelper);
            var primaryUsualAdministrationRouteType = TedsAnswerMapper.MapToTedsAnswer <UsualAdministrationRouteType> (dto.PrimaryUsualAdministrationRouteType, _mappingHelper);
            var primaryDetailedDrugCode             = TedsAnswerMapper.MapToTedsAnswer <DetailedDrugCode, DetailedDrugCodeDto> (dto.PrimaryDetailedDrugCode, _mappingHelper);

            if (primarySubstanceProblemType != null || primaryUseFrequencyType != null || primaryFirstUseAge != null || primaryUsualAdministrationRouteType != null || primaryDetailedDrugCode != null)
            {
                primaryTedsAdmissionInterviewSubstanceUsage =
                    new TedsAdmissionInterviewSubstanceUsage(new SubstanceUsageAtAdmission(new SubstanceProblemAndFrequency(primarySubstanceProblemType, primaryUseFrequencyType), primaryUsualAdministrationRouteType, primaryFirstUseAge, primaryDetailedDrugCode));
            }

            TedsAdmissionInterviewSubstanceUsage secondaryTedsAdmissionInterviewSubstanceUsage = null;
            var secondarySubstanceProblemType         = TedsAnswerMapper.MapToTedsAnswer <SubstanceProblemType>(dto.SecondarySubstanceProblemType, _mappingHelper);
            var secondaryUseFrequencyType             = TedsAnswerMapper.MapToTedsAnswer <UseFrequencyType>(dto.SecondaryUseFrequencyType, _mappingHelper);
            var secondaryFirstUseAge                  = TedsAnswerMapper.MapToTedsAnswer(dto.SecondaryFirstUseAge, _mappingHelper);
            var secondaryUsualAdministrationRouteType = TedsAnswerMapper.MapToTedsAnswer <UsualAdministrationRouteType>(dto.SecondaryUsualAdministrationRouteType, _mappingHelper);
            var secondaryDetailedDrugCode             = TedsAnswerMapper.MapToTedsAnswer <DetailedDrugCode, DetailedDrugCodeDto>(dto.SecondaryDetailedDrugCode, _mappingHelper);

            if (secondarySubstanceProblemType != null || secondaryUseFrequencyType != null || secondaryFirstUseAge != null || secondaryUsualAdministrationRouteType != null || secondaryDetailedDrugCode != null)
            {
                secondaryTedsAdmissionInterviewSubstanceUsage =
                    new TedsAdmissionInterviewSubstanceUsage(new SubstanceUsageAtAdmission(new SubstanceProblemAndFrequency(secondarySubstanceProblemType, secondaryUseFrequencyType), secondaryUsualAdministrationRouteType, secondaryFirstUseAge, secondaryDetailedDrugCode));
            }

            TedsAdmissionInterviewSubstanceUsage tertiaryTedsAdmissionInterviewSubstanceUsage = null;
            var tertiarySubstanceProblemType         = TedsAnswerMapper.MapToTedsAnswer <SubstanceProblemType>(dto.TertiarySubstanceProblemType, _mappingHelper);
            var tertiaryUseFrequencyType             = TedsAnswerMapper.MapToTedsAnswer <UseFrequencyType>(dto.TertiaryUseFrequencyType, _mappingHelper);
            var tertiaryFirstUseAge                  = TedsAnswerMapper.MapToTedsAnswer(dto.TertiaryFirstUseAge, _mappingHelper);
            var tertiaryUsualAdministrationRouteType = TedsAnswerMapper.MapToTedsAnswer <UsualAdministrationRouteType>(dto.TertiaryUsualAdministrationRouteType, _mappingHelper);
            var tertiaryDetailedDrugCode             = TedsAnswerMapper.MapToTedsAnswer <DetailedDrugCode, DetailedDrugCodeDto>(dto.TertiaryDetailedDrugCode, _mappingHelper);

            if (tertiarySubstanceProblemType != null || tertiaryUseFrequencyType != null || tertiaryFirstUseAge != null || tertiaryUsualAdministrationRouteType != null || tertiaryDetailedDrugCode != null)
            {
                tertiaryTedsAdmissionInterviewSubstanceUsage =
                    new TedsAdmissionInterviewSubstanceUsage(new SubstanceUsageAtAdmission(new SubstanceProblemAndFrequency(tertiarySubstanceProblemType, tertiaryUseFrequencyType), tertiaryUsualAdministrationRouteType, tertiaryFirstUseAge, tertiaryDetailedDrugCode));
            }

            tedsAdmissionInterview.ReviseTedsAdmissionInterviewSubstanceUsages(primaryTedsAdmissionInterviewSubstanceUsage, secondaryTedsAdmissionInterviewSubstanceUsage, tertiaryTedsAdmissionInterviewSubstanceUsage);

            tedsAdmissionInterview.ReviseTedsEducationYearCount(TedsAnswerMapper.MapToTedsAnswer(dto.TedsEducationYearCount, _mappingHelper));

            var tedsEmploymentStatus    = TedsAnswerMapper.MapToTedsAnswer <TedsEmploymentStatus>(dto.TedsEmploymentStatusInformationTedsEmploymentStatus, _mappingHelper);
            var detailedNotInLaborForce = TedsAnswerMapper.MapToTedsAnswer <DetailedNotInLaborForce>(dto.TedsEmploymentStatusInformationDetailedNotInLaborForce, _mappingHelper);

            if (tedsEmploymentStatus != null || detailedNotInLaborForce != null)
            {
                tedsAdmissionInterview.ReviseTedsEmploymentStatusInformation(new TedsEmploymentStatusInformation(tedsEmploymentStatus, detailedNotInLaborForce));
            }
            else
            {
                tedsAdmissionInterview.ReviseTedsEmploymentStatusInformation(null);
            }

            tedsAdmissionInterview.ReviseTedsEthnicity(TedsAnswerMapper.MapToTedsAnswer <TedsEthnicity>(dto.TedsEthnicity, _mappingHelper));

            var tedsGender        = TedsAnswerMapper.MapToTedsAnswer <TedsGender>(dto.TedsGenderInformationTedsGender, _mappingHelper);
            var pregnantIndicator = TedsAnswerMapper.MapToTedsAnswer(dto.TedsGenderInformationPregnantIndicator, _mappingHelper);

            if (tedsGender != null || pregnantIndicator != null)
            {
                tedsAdmissionInterview.ReviseTedsGenderInformation(new TedsGenderInformation(tedsGender, pregnantIndicator));
            }
            else
            {
                tedsAdmissionInterview.ReviseTedsGenderInformation(null);
            }

            tedsAdmissionInterview.ReviseTedsRace(TedsAnswerMapper.MapToTedsAnswer <TedsRace>(dto.TedsRace, _mappingHelper));

            tedsAdmissionInterview.ReviseTedsMartialStatus(TedsAnswerMapper.MapToTedsAnswer <MaritalStatus>(dto.MaritalStatus, _mappingHelper));

            return(true);
        }