public override TestResult GetTestResults(long customerId, long eventId, bool isNewResultFlow) { List <CustomerEventScreeningTestsEntity> customerEventScreeningTests = GetTestResultsByTestId(customerId, eventId, (int)TestType.HCPEcho); var testResult = _testResultFactory.CreateTestResults(customerEventScreeningTests).SingleOrDefault(); if (testResult == null) { return(null); } HcpEchocardiogramTestResult hcpEchoTestResult = (HcpEchocardiogramTestResult)testResult; if (hcpEchoTestResult.Media != null) { GetFileDataforResultmedia(hcpEchoTestResult.Media); } hcpEchoTestResult.IsNewResultFlow = isNewResultFlow; return(hcpEchoTestResult); }
public TestResult Parse() { _errorSummary = string.Empty; MediaTestResult testResult = new EchocardiogramTestResult();; switch (_testType) { case TestType.PPEcho: testResult = new PpEchocardiogramTestResult(); break; case TestType.HCPEcho: testResult = new HcpEchocardiogramTestResult(); break; case TestType.AwvEcho: testResult = new AwvEchocardiogramTestResult(); break; } bool isExceptionCaused; testResult.Media = _mediaHelper.GetMediaSortedByDecimalValue(Directory.GetParent(_pathToReportXmlFile).FullName, _mediaLocation, "Echo", out isExceptionCaused).ToList(); if (isExceptionCaused) { _errorSummary += "Media Extraction Failed. "; } if (testResult.Media.Count < 1) { return(null); } return(testResult); }
public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestEntity) { var customerEventReadingEntities = customerEventScreeningTestEntity.CustomerEventReading.ToList(); var testResult = new HcpEchocardiogramTestResult(customerEventScreeningTestEntity.CustomerEventScreeningTestId); var customerEventTestStandardFindingEntities = customerEventScreeningTestEntity.CustomerEventTestStandardFinding.ToList(); var standardFindingTestReadingEntities = customerEventScreeningTestEntity.StandardFindingTestReadingCollectionViaCustomerEventTestStandardFinding.ToList(); { var testResultService = new TestResultService(); var standardFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho); var estimatedEjactionFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.EstimatedEjactionFraction); var aorticRegurgitationFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.Aortic); var mitralRegurgitationFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.Mitral); var pulmonicRegurgitationFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.Pulmonic); var tricuspidRegurgitationFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.Tricuspid); var aorticMorphologyFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.AorticMorphology); var mitralMorphologyFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.MitralMorphology); var pulmonicMorphologyFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.PulmonicMorphology); var tricuspidMorphologyFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.TricuspidMorphology); var distolicDysfunctionFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.DiastolicDysfunction); var pericardialEffusionFindings = testResultService.GetAllStandardFindings <int?>((int)TestType.HCPEcho, (int)ReadingLabels.PericardialEffusion); 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; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, estimatedEjactionFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.EstimatedEjactionFraction); if (finding != null) { testResult.EstimatedEjactionFraction = finding; return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, aorticRegurgitationFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.Aortic); if (finding != null) { testResult.AorticRegurgitation = finding; return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, mitralRegurgitationFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.Mitral); if (finding != null) { testResult.MitralRegurgitation = finding; return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, pulmonicRegurgitationFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.Pulmonic); if (finding != null) { testResult.PulmonicRegurgitation = finding; return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, tricuspidRegurgitationFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.Tricuspid); if (finding != null) { testResult.TricuspidRegurgitation = finding; return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, aorticMorphologyFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.AorticMorphology); if (finding != null) { if (testResult.AorticMorphology == null) { testResult.AorticMorphology = new List <StandardFinding <int> >(); } testResult.AorticMorphology.Add(finding); return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, mitralMorphologyFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.MitralMorphology); if (finding != null) { if (testResult.MitralMorphology == null) { testResult.MitralMorphology = new List <StandardFinding <int> >(); } testResult.MitralMorphology.Add(finding); return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, pulmonicMorphologyFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.PulmonicMorphology); if (finding != null) { if (testResult.PulmonicMorphology == null) { testResult.PulmonicMorphology = new List <StandardFinding <int> >(); } testResult.PulmonicMorphology.Add(finding); return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, tricuspidMorphologyFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.TricuspidMorphology); if (finding != null) { if (testResult.TricuspidMorphology == null) { testResult.TricuspidMorphology = new List <StandardFinding <int> >(); } testResult.TricuspidMorphology.Add(finding); return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, distolicDysfunctionFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.DiastolicDysfunction); if (finding != null) { testResult.DistolicDysfunctionFinding = finding; return; } finding = CreateFindingObject(customerEventTestStandardFindingEntity, pericardialEffusionFindings, standardFindingTestReadingEntity, (int?)ReadingLabels.PericardialEffusion); if (finding != null) { if (testResult.PericardialEffusionFinding == null) { testResult.PericardialEffusionFinding = new List <StandardFinding <int> >(); } testResult.PericardialEffusionFinding.Add(finding); return; } }); } testResult.DiastolicDysfunction = CreateResultReading((int)ReadingLabels.DiastolicDysfunction, customerEventReadingEntities); testResult.PericardialEffusion = CreateResultReading((int)ReadingLabels.PericardialEffusion, customerEventReadingEntities); testResult.Aortic = CreateResultReading((int)ReadingLabels.Aortic, customerEventReadingEntities); testResult.Mitral = CreateResultReading((int)ReadingLabels.Mitral, customerEventReadingEntities); testResult.Pulmonic = CreateResultReading((int)ReadingLabels.Pulmonic, customerEventReadingEntities); testResult.Tricuspid = CreateResultReading((int)ReadingLabels.Tricuspid, customerEventReadingEntities); testResult.VentricularEnlargement = CreateResultReading((int)ReadingLabels.VentricularEnlargement, customerEventReadingEntities); testResult.LeftVentricularEnlargment = CreateResultReading((int)ReadingLabels.LeftVentricularEnlargment, customerEventReadingEntities); testResult.RightVentricularEnlargment = CreateResultReading((int)ReadingLabels.RightVentricularEnlargment, customerEventReadingEntities); testResult.LeftVentricularEnlargmentValue = CreateResultReadingforInputValues((int)ReadingLabels.LeftVentricularEnlargmentValue, customerEventReadingEntities); testResult.RightVentricularEnlargmentValue = CreateResultReadingforInputValues((int)ReadingLabels.RightVentricularEnlargmentValue, customerEventReadingEntities); testResult.AorticRoot = CreateResultReading((int)ReadingLabels.AorticRoot, customerEventReadingEntities); testResult.Sclerotic = CreateResultReading((int)ReadingLabels.Sclerotic, customerEventReadingEntities); testResult.Calcified = CreateResultReading((int)ReadingLabels.Calcified, customerEventReadingEntities); testResult.EnlargedValue = CreateResultReadingforInputValues((int)ReadingLabels.EnlargedValue, customerEventReadingEntities); testResult.Enlarged = CreateResultReading((int)ReadingLabels.Enlarged, customerEventReadingEntities); testResult.VentricularHypertrophy = CreateResultReading((int)ReadingLabels.VentricularHypertrophy, customerEventReadingEntities); testResult.LeftVHypertrophy = CreateResultReading((int)ReadingLabels.LeftVHypertrophy, customerEventReadingEntities); testResult.RightVHypertrophy = CreateResultReading((int)ReadingLabels.RightVHypertrophy, customerEventReadingEntities); testResult.IvshHypertrophy = CreateResultReading((int)ReadingLabels.IVSHHypertrophy, customerEventReadingEntities); testResult.LeftVHypertrophyValue = CreateResultReadingforInputValues((int)ReadingLabels.LeftVHypertrophyValue, customerEventReadingEntities); testResult.RightVHypertrophyValue = CreateResultReadingforInputValues((int)ReadingLabels.RightVHypertrophyValue, customerEventReadingEntities); testResult.IvshHypertrophyValue = CreateResultReadingforInputValues((int)ReadingLabels.IVSHHypertrophyValue, customerEventReadingEntities); testResult.AtrialEnlargement = CreateResultReading((int)ReadingLabels.AtrialEnlargement, customerEventReadingEntities); testResult.LeftAtrialEnlargmentValue = CreateResultReadingforInputValues((int)ReadingLabels.LeftAtrialEnlargmentValue, customerEventReadingEntities); testResult.RightAtrialEnlargmentValue = CreateResultReadingforInputValues((int)ReadingLabels.RightAtrialEnlargmentValue, customerEventReadingEntities); testResult.LeftAtrialEnlargment = CreateResultReading((int)ReadingLabels.LeftAtrialEnlargment, customerEventReadingEntities); testResult.RightAtrialEnlargment = CreateResultReading((int)ReadingLabels.RightAtrialEnlargment, customerEventReadingEntities); testResult.RestrictedLeafletMotion = CreateResultReading((int)ReadingLabels.RestrictedLeafletMotion, customerEventReadingEntities); testResult.RestrictedLeafletMotionAortic = CreateResultReading((int)ReadingLabels.RestrictedLeafletMotionAortic, customerEventReadingEntities); testResult.RestrictedLeafletMotionMitral = CreateResultReading((int)ReadingLabels.RestrictedLeafletMotionMitral, customerEventReadingEntities); testResult.RestrictedLeafletMotionPulmonic = CreateResultReading((int)ReadingLabels.RestrictedLeafletMotionPulmonic, customerEventReadingEntities); testResult.RestrictedLeafletMotionTricuspid = CreateResultReading((int)ReadingLabels.RestrictedLeafletMotionTricuspid, customerEventReadingEntities); testResult.ASD = CreateResultReading((int)ReadingLabels.ASD, customerEventReadingEntities); testResult.PFO = CreateResultReading((int)ReadingLabels.PFO, customerEventReadingEntities); testResult.VSD = CreateResultReading((int)ReadingLabels.VSD, customerEventReadingEntities); testResult.FlailAS = CreateResultReading((int)ReadingLabels.FlailAS, customerEventReadingEntities); testResult.Arrythmia = CreateResultReading((int)ReadingLabels.Arrythmia, customerEventReadingEntities); testResult.AFib = CreateResultReading((int)ReadingLabels.AFib, customerEventReadingEntities); testResult.AFlutter = CreateResultReading((int)ReadingLabels.AFlutter, customerEventReadingEntities); testResult.PAC = CreateResultReading((int)ReadingLabels.PAC, customerEventReadingEntities); testResult.PVC = CreateResultReading((int)ReadingLabels.PVC, customerEventReadingEntities); testResult.SAM = CreateResultReading((int)ReadingLabels.SAM, customerEventReadingEntities); testResult.LVOTO = CreateResultReading((int)ReadingLabels.LVOTO, customerEventReadingEntities); testResult.MitralAnnularCa = CreateResultReading((int)ReadingLabels.MitralAnnularCa, customerEventReadingEntities); testResult.TechnicallyLimitedbutReadable = CreateResultReading((int)ReadingLabels.TechnicallyLimitedbutReadable, customerEventReadingEntities); testResult.RepeatStudyUnreadable = CreateResultReading((int)ReadingLabels.RepeatStudy, customerEventReadingEntities); testResult.Hypokinetic = CreateResultReading((int)ReadingLabels.Hypokinetic, customerEventReadingEntities); testResult.Akinetic = CreateResultReading((int)ReadingLabels.Akinetic, customerEventReadingEntities); testResult.Dyskinetic = CreateResultReading((int)ReadingLabels.Dyskinetic, customerEventReadingEntities); testResult.Anterior = CreateResultReading((int)ReadingLabels.Anterior, customerEventReadingEntities); testResult.Posterior = CreateResultReading((int)ReadingLabels.Posterior, customerEventReadingEntities); testResult.Apical = CreateResultReading((int)ReadingLabels.Apical, customerEventReadingEntities); testResult.Septal = CreateResultReading((int)ReadingLabels.Septal, customerEventReadingEntities); testResult.Lateral = CreateResultReading((int)ReadingLabels.Lateral, customerEventReadingEntities); testResult.Inferior = CreateResultReading((int)ReadingLabels.Inferior, customerEventReadingEntities); testResult.AoticVelocity = CreateResultReadingforInputValues((int)ReadingLabels.AoticVelocity, customerEventReadingEntities); testResult.MitralPT = CreateResultReadingforInputValues((int)ReadingLabels.MitralPT, customerEventReadingEntities); testResult.PulmonicVelocity = CreateResultReadingforInputValues((int)ReadingLabels.PulmonicVelocity, customerEventReadingEntities); testResult.TricuspidVelocity = CreateResultReadingforInputValues((int)ReadingLabels.TricuspidVelocity, customerEventReadingEntities); testResult.TricuspidPap = CreateResultReadingforInputValues((int)ReadingLabels.TricuspidPap, customerEventReadingEntities); testResult.MorphologyTricuspidHighOrGreater = CreateResultReading((int)ReadingLabels.High35MmHgOrGreater, customerEventReadingEntities); testResult.MorphologyTricuspidNormal = CreateResultReading((int)ReadingLabels.Normal, customerEventReadingEntities); var testMediaCollection = customerEventScreeningTestEntity.TestMedia.ToList(); var fileEntityCollection = customerEventScreeningTestEntity.FileCollectionViaTestMedia.ToList(); if (testMediaCollection.Count > 0) { var resultMedia = new List <ResultMedia>(); testMediaCollection.ForEach(testMedia => resultMedia.Add(new ResultMedia(testMedia.MediaId) { File = GetFileObjectfromEntity(testMedia.FileId, fileEntityCollection), Thumbnail = testMedia.ThumbnailFileId != null ? new File(testMedia.ThumbnailFileId.Value) : null, ReadingSource = testMedia.IsManual ? ReadingSource.Manual : ReadingSource.Automatic })); testResult.Media = resultMedia; } return(testResult); }