public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestEntity) { var customerEventReadingEntities = customerEventScreeningTestEntity.CustomerEventReading.ToList(); var testResult = new DiabeticNeuropathyTestResult(customerEventScreeningTestEntity.CustomerEventScreeningTestId); var customerEventTestStandardFindingEntities = customerEventScreeningTestEntity.CustomerEventTestStandardFinding.ToList(); var standardFindingTestReadingEntities = customerEventScreeningTestEntity.StandardFindingTestReadingCollectionViaCustomerEventTestStandardFinding.ToList(); if (customerEventTestStandardFindingEntities.Count() > 0) { var testResultService = new TestResultService(); var standardFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.DiabeticNeuropathy); customerEventTestStandardFindingEntities.ForEach(customerEventTestStandardFindingEntity => { var standardFindingTestReadingEntity = standardFindingTestReadingEntities.Find(entity => entity.StandardFindingTestReadingId == customerEventTestStandardFindingEntity.StandardFindingTestReadingId); if (standardFindingTestReadingEntity == null) { return; } var finding = CreateFindingObject(customerEventTestStandardFindingEntity, standardFindings, standardFindingTestReadingEntity, null); if (finding != null) { testResult.Finding = finding; return; } }); } testResult.Amplitude = CreateResultReadingforNullableDecimal((int)ReadingLabels.Amplitude, customerEventReadingEntities); testResult.ConductionVelocity = CreateResultReadingforNullableDecimal((int)ReadingLabels.ConductionVelocity, customerEventReadingEntities); testResult.RightLeg = CreateResultReadingforNullableBool((int)ReadingLabels.RightLeg, customerEventReadingEntities); testResult.LeftLeg = CreateResultReadingforNullableBool((int)ReadingLabels.LeftLeg, customerEventReadingEntities); testResult.TechnicallyLimitedbutReadable = CreateResultReading((int)ReadingLabels.TechnicallyLimitedbutReadable, customerEventReadingEntities); testResult.RepeatStudy = CreateResultReading((int)ReadingLabels.RepeatStudy, customerEventReadingEntities); return(testResult); }
public PcpResultExportModel SetDiabeticNeuropathyData(PcpResultExportModel model, DiabeticNeuropathyTestResult testResult, bool useBlankValue = false) { if (testResult.Finding != null) { model.DiabeticNeuropathyResult = testResult.Finding.Label; } model.DiabeticNeuropathyAmplitude = testResult.Amplitude != null ? testResult.Amplitude.Reading != null?testResult.Amplitude.Reading.ToString() : "" : ""; model.DiabeticNeuropathyConductionVelocity = testResult.ConductionVelocity != null ? testResult.ConductionVelocity.Reading != null?testResult.ConductionVelocity.Reading.ToString() : "" : ""; model.DiabeticNeuropathyRightLeg = PcpResultExportHelper.GetOutputFromNullableBoolTypeResultReading(testResult.RightLeg, useBlankValue); model.DiabeticNeuropathyLeftLeg = PcpResultExportHelper.GetOutputFromNullableBoolTypeResultReading(testResult.LeftLeg, useBlankValue); model.DiabeticNeuropathyUnabletoScreen = testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 ? PcpResultExportHelper.YesString : (useBlankValue ? "" : PcpResultExportHelper.NoString); model.DiabeticNeuropathyTechnicallyLimitedButReadable = PcpResultExportHelper.GetOutputFromBoolTypeResultReading(testResult.TechnicallyLimitedbutReadable, useBlankValue); model.DiabeticNeuropathyRepeatStudyUnreadable = PcpResultExportHelper.GetOutputFromBoolTypeResultReading(testResult.RepeatStudy, useBlankValue); if ((testResult.ResultStatus != null && testResult.ResultStatus.SelfPresent) || (testResult.PhysicianInterpretation != null && testResult.PhysicianInterpretation.IsCritical)) { model.DiabeticNeuropathyCritical = PcpResultExportHelper.YesString; } else if (!useBlankValue) { model.DiabeticNeuropathyCritical = PcpResultExportHelper.NoString; } return(model); }