public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestEntity) { var customerEventReadingEntities = customerEventScreeningTestEntity.CustomerEventReading.ToList(); var testResult = new MammogramTestResult(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.Mammogram); 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; } }); } if (customerEventScreeningTestEntity.TestMedia != null && customerEventScreeningTestEntity.TestMedia.Count > 0) { var fileEntityCollection = customerEventScreeningTestEntity.FileCollectionViaTestMedia.ToList(); var testMediaEntity = customerEventScreeningTestEntity.TestMedia.FirstOrDefault(); testResult.ResultImage = new ResultMedia(testMediaEntity.MediaId) { File = GetFileObjectfromEntity(testMediaEntity.FileId, fileEntityCollection), Thumbnail = testMediaEntity.ThumbnailFileId != null ? new File(testMediaEntity.ThumbnailFileId.Value) : null, ReadingSource = testMediaEntity.IsManual ? ReadingSource.Manual : ReadingSource.Automatic }; } testResult.TechnicallyLimitedbutReadable = CreateResultReading((int)ReadingLabels.TechnicallyLimitedbutReadable, customerEventReadingEntities); testResult.RepeatStudy = CreateResultReading((int)ReadingLabels.RepeatStudy, customerEventReadingEntities); return(testResult); }
public PcpResultExportModel SetMammographyData(PcpResultExportModel model, MammogramTestResult testResult, bool useBlankValue = false) { model.MammographyUnabletoScreen = testResult.UnableScreenReason != null && testResult.UnableScreenReason.Count > 0 ? PcpResultExportHelper.YesString : (useBlankValue ? "" : PcpResultExportHelper.NoString); if ((testResult.ResultStatus != null && testResult.ResultStatus.SelfPresent) || (testResult.PhysicianInterpretation != null && testResult.PhysicianInterpretation.IsCritical)) { model.MammographyCritical = PcpResultExportHelper.YesString; } else if (!useBlankValue) { model.MammographyCritical = PcpResultExportHelper.NoString; } if (testResult.Finding != null) { model.MammographyFinding = testResult.Finding.Label; } return(model); }