public override TestResult GetTestResults(long customerId, long eventId, bool isNewResultFlow) { List <CustomerEventScreeningTestsEntity> customerEventScreeningTests = GetTestResultsByTestId(customerId, eventId, (int)TestType.AwvCarotid); var testResult = _testResultFactory.CreateTestResults(customerEventScreeningTests).SingleOrDefault(); if (testResult == null) { return(null); } AwvCarotidTestResult awvCarotidTestResult = (AwvCarotidTestResult)testResult; if (awvCarotidTestResult.ResultImages != null) { GetFileDataforResultmedia(awvCarotidTestResult.ResultImages); } awvCarotidTestResult.IsNewResultFlow = isNewResultFlow; return(awvCarotidTestResult); }
public PcpResultExportModel SetAwvCarotidData(PcpResultExportModel model, AwvCarotidTestResult testResult, bool useBlankValue = false) { if (testResult.RightResultReadings != null) { if (testResult.RightResultReadings.Finding != null) { model.CarotidRightResult = testResult.RightResultReadings.Finding.Label; } //CCA Proximal if (testResult.RightResultReadings.CCAProximalPSV != null && testResult.RightResultReadings.CCAProximalPSV.Reading != null) { model.CarotidRightCcaProximalPsv = testResult.RightResultReadings.CCAProximalPSV.Reading.Value.ToString("00.00"); } if (testResult.RightResultReadings.CCAProximalEDV != null && testResult.RightResultReadings.CCAProximalEDV.Reading != null) { model.CarotidRightCcaProximalEdv = testResult.RightResultReadings.CCAProximalEDV.Reading.Value.ToString("00.00"); } //CCA Distal if (testResult.RightResultReadings.CCADistalPSV != null && testResult.RightResultReadings.CCADistalPSV.Reading != null) { model.CarotidRightCcaDistalPsv = testResult.RightResultReadings.CCADistalPSV.Reading.Value.ToString("00.00"); } if (testResult.RightResultReadings.CCADistalEDV != null && testResult.RightResultReadings.CCADistalEDV.Reading != null) { model.CarotidRightCcaDistalEdv = testResult.RightResultReadings.CCADistalEDV.Reading.Value.ToString("00.00"); } //Bulb if (testResult.RightResultReadings.BulbPSV != null && testResult.RightResultReadings.BulbPSV.Reading != null) { model.CarotidRightBulbPsv = testResult.RightResultReadings.BulbPSV.Reading.Value.ToString("00.00"); } if (testResult.RightResultReadings.BulbEDV != null && testResult.RightResultReadings.BulbEDV.Reading != null) { model.CarotidRightBulbEdv = testResult.RightResultReadings.BulbEDV.Reading.Value.ToString("00.00"); } //Ext Carotid Art if (testResult.RightResultReadings.ExtCarotidArtPSV != null && testResult.RightResultReadings.ExtCarotidArtPSV.Reading != null) { model.CarotidRightExtCarotidArtPsv = testResult.RightResultReadings.ExtCarotidArtPSV.Reading.Value.ToString("00.00"); } //ICA Proximal if (testResult.RightResultReadings.ICAProximalPSV != null && testResult.RightResultReadings.ICAProximalPSV.Reading != null) { model.CarotidRightIcaProximalPsv = testResult.RightResultReadings.ICAProximalPSV.Reading.Value.ToString("00.00"); } if (testResult.RightResultReadings.ICAProximalEDV != null && testResult.RightResultReadings.ICAProximalEDV.Reading != null) { model.CarotidRightIcaProximalEdv = testResult.RightResultReadings.ICAProximalEDV.Reading.Value.ToString("00.00"); } //ICA Distal if (testResult.RightResultReadings.ICADistalPSV != null && testResult.RightResultReadings.ICADistalPSV.Reading != null) { model.CarotidRightIcaDistalPsv = testResult.RightResultReadings.ICADistalPSV.Reading.Value.ToString("00.00"); } if (testResult.RightResultReadings.ICADistalEDV != null && testResult.RightResultReadings.ICADistalEDV.Reading != null) { model.CarotidRightIcaDistalEdv = testResult.RightResultReadings.ICADistalEDV.Reading.Value.ToString("00.00"); } //Vertebral Art if (testResult.RightResultReadings.VertebralArtPSV != null && testResult.RightResultReadings.VertebralArtPSV.Reading != null) { model.CarotidRightVertebralArtPsv = testResult.RightResultReadings.VertebralArtPSV.Reading.Value.ToString("00.00"); } if (testResult.RightResultReadings.VertebralArtEDV != null && testResult.RightResultReadings.VertebralArtEDV.Reading != null) { model.CarotidRightVertebralArtEdv = testResult.RightResultReadings.VertebralArtEDV.Reading.Value.ToString("00.00"); } } if (testResult.LeftResultReadings != null) { if (testResult.LeftResultReadings.Finding != null) { model.CarotidLeftResult = testResult.LeftResultReadings.Finding.Label; } //CCA Proximal if (testResult.LeftResultReadings.CCAProximalPSV != null && testResult.LeftResultReadings.CCAProximalPSV.Reading != null) { model.CarotidLeftCcaProximalPsv = testResult.LeftResultReadings.CCAProximalPSV.Reading.Value.ToString("00.00"); } if (testResult.LeftResultReadings.CCAProximalEDV != null && testResult.LeftResultReadings.CCAProximalEDV.Reading != null) { model.CarotidLeftCcaProximalEdv = testResult.LeftResultReadings.CCAProximalEDV.Reading.Value.ToString("00.00"); } //CCA Distal if (testResult.LeftResultReadings.CCADistalPSV != null && testResult.LeftResultReadings.CCADistalPSV.Reading != null) { model.CarotidLeftCcaDistalPsv = testResult.LeftResultReadings.CCADistalPSV.Reading.Value.ToString("00.00"); } if (testResult.LeftResultReadings.CCADistalEDV != null && testResult.LeftResultReadings.CCADistalEDV.Reading != null) { model.CarotidLeftCcaDistalEdv = testResult.LeftResultReadings.CCADistalEDV.Reading.Value.ToString("00.00"); } //Bulb if (testResult.LeftResultReadings.BulbPSV != null && testResult.LeftResultReadings.BulbPSV.Reading != null) { model.CarotidLeftBulbPsv = testResult.LeftResultReadings.BulbPSV.Reading.Value.ToString("00.00"); } if (testResult.LeftResultReadings.BulbEDV != null && testResult.LeftResultReadings.BulbEDV.Reading != null) { model.CarotidLeftBulbEdv = testResult.LeftResultReadings.BulbEDV.Reading.Value.ToString("00.00"); } //Ext Carotid Art if (testResult.LeftResultReadings.ExtCarotidArtPSV != null && testResult.LeftResultReadings.ExtCarotidArtPSV.Reading != null) { model.CarotidLeftExtCarotidArtPsv = testResult.LeftResultReadings.ExtCarotidArtPSV.Reading.Value.ToString("00.00"); } //ICA Proximal if (testResult.LeftResultReadings.ICAProximalPSV != null && testResult.LeftResultReadings.ICAProximalPSV.Reading != null) { model.CarotidLeftIcaProximalPsv = testResult.LeftResultReadings.ICAProximalPSV.Reading.Value.ToString("00.00"); } if (testResult.LeftResultReadings.ICAProximalEDV != null && testResult.LeftResultReadings.ICAProximalEDV.Reading != null) { model.CarotidLeftIcaProximalEdv = testResult.LeftResultReadings.ICAProximalEDV.Reading.Value.ToString("00.00"); } //ICA Distal if (testResult.LeftResultReadings.ICADistalPSV != null && testResult.LeftResultReadings.ICADistalPSV.Reading != null) { model.CarotidLeftIcaDistalPsv = testResult.LeftResultReadings.ICADistalPSV.Reading.Value.ToString("00.00"); } if (testResult.LeftResultReadings.ICADistalEDV != null && testResult.LeftResultReadings.ICADistalEDV.Reading != null) { model.CarotidLeftIcaDistalEdv = testResult.LeftResultReadings.ICADistalEDV.Reading.Value.ToString("00.00"); } //Vertebral Art if (testResult.LeftResultReadings.VertebralArtPSV != null && testResult.LeftResultReadings.VertebralArtPSV.Reading != null) { model.CarotidLeftVertebralArtPsv = testResult.LeftResultReadings.VertebralArtPSV.Reading.Value.ToString("00.00"); } if (testResult.LeftResultReadings.VertebralArtEDV != null && testResult.LeftResultReadings.VertebralArtEDV.Reading != null) { model.CarotidLeftVertebralArtEdv = testResult.LeftResultReadings.VertebralArtEDV.Reading.Value.ToString("00.00"); } } model.CarotidLowVelocityRica = testResult.LowVelocityRica != null ? PcpResultExportHelper.YesString : (useBlankValue ? "" : PcpResultExportHelper.NoString); model.CarotidLowVelocityLica = testResult.LowVelocityLica != null ? PcpResultExportHelper.YesString : (useBlankValue ? "" : PcpResultExportHelper.NoString); model.CarotidTechnicallyLimitedButReadable = PcpResultExportHelper.GetOutputFromBoolTypeResultReading(testResult.TechnicallyLimitedbutReadable, useBlankValue); model.CarotidRepeatStudyUnreadable = PcpResultExportHelper.GetOutputFromBoolTypeResultReading(testResult.RepeatStudy, useBlankValue); model.CarotidUnabletoScreen = 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.CarotidCritical = PcpResultExportHelper.YesString; } else if (!useBlankValue) { model.CarotidCritical = PcpResultExportHelper.NoString; } if (testResult.PhysicianInterpretation != null) { model.CarotidPhysicianNotes = testResult.PhysicianInterpretation.Remarks; } return(model); }
public AwvCarotidTestResult MapXmlToDomainObject(string filePathtoXml) { var testResult = new AwvCarotidTestResult(); var xDoc = XDocument.Load(filePathtoXml); testResult.LeftResultReadings = GetAwvCarotidTestReadings(xDoc, SideToCheckLeft); testResult.RightResultReadings = GetAwvCarotidTestReadings(xDoc, SideToCheckRight); if (testResult.LeftResultReadings != null) { if (testResult.LeftResultReadings.CCAProximalPSV != null) { testResult.LeftResultReadings.CCAProximalPSV.Label = ReadingLabels.LCCAProximalPSV; } if (testResult.LeftResultReadings.CCAProximalEDV != null) { testResult.LeftResultReadings.CCAProximalEDV.Label = ReadingLabels.LCCAProximalEDV; } if (testResult.LeftResultReadings.CCADistalPSV != null) { testResult.LeftResultReadings.CCADistalPSV.Label = ReadingLabels.LCCADistalPSV; } if (testResult.LeftResultReadings.CCADistalEDV != null) { testResult.LeftResultReadings.CCADistalEDV.Label = ReadingLabels.LCCADistalEDV; } if (testResult.LeftResultReadings.BulbPSV != null) { testResult.LeftResultReadings.BulbPSV.Label = ReadingLabels.LBulbPSV; } if (testResult.LeftResultReadings.BulbEDV != null) { testResult.LeftResultReadings.BulbEDV.Label = ReadingLabels.LBulbEDV; } if (testResult.LeftResultReadings.ExtCarotidArtPSV != null) { testResult.LeftResultReadings.ExtCarotidArtPSV.Label = ReadingLabels.LExtCarotidArtPSV; } if (testResult.LeftResultReadings.ICAProximalPSV != null) { testResult.LeftResultReadings.ICAProximalPSV.Label = ReadingLabels.LICAPSV; } if (testResult.LeftResultReadings.ICAProximalEDV != null) { testResult.LeftResultReadings.ICAProximalEDV.Label = ReadingLabels.LICAEDV; } if (testResult.LeftResultReadings.ICADistalPSV != null) { testResult.LeftResultReadings.ICADistalPSV.Label = ReadingLabels.LICADistalPSV; } if (testResult.LeftResultReadings.ICADistalEDV != null) { testResult.LeftResultReadings.ICADistalEDV.Label = ReadingLabels.LICADistalEDV; } if (testResult.LeftResultReadings.VertebralArtPSV != null) { testResult.LeftResultReadings.VertebralArtPSV.Label = ReadingLabels.LVertebralArtPSV; } if (testResult.LeftResultReadings.VertebralArtEDV != null) { testResult.LeftResultReadings.VertebralArtEDV.Label = ReadingLabels.LVertebralArtEDV; } } if (testResult.RightResultReadings != null) { if (testResult.RightResultReadings.CCAProximalPSV != null) { testResult.RightResultReadings.CCAProximalPSV.Label = ReadingLabels.LCCAProximalPSV; } if (testResult.RightResultReadings.CCAProximalEDV != null) { testResult.RightResultReadings.CCAProximalEDV.Label = ReadingLabels.LCCAProximalEDV; } if (testResult.RightResultReadings.CCADistalPSV != null) { testResult.RightResultReadings.CCADistalPSV.Label = ReadingLabels.LCCADistalPSV; } if (testResult.RightResultReadings.CCADistalEDV != null) { testResult.RightResultReadings.CCADistalEDV.Label = ReadingLabels.LCCADistalEDV; } if (testResult.RightResultReadings.BulbPSV != null) { testResult.RightResultReadings.BulbPSV.Label = ReadingLabels.LBulbPSV; } if (testResult.RightResultReadings.BulbEDV != null) { testResult.RightResultReadings.BulbEDV.Label = ReadingLabels.LBulbEDV; } if (testResult.RightResultReadings.ExtCarotidArtPSV != null) { testResult.RightResultReadings.ExtCarotidArtPSV.Label = ReadingLabels.LExtCarotidArtPSV; } if (testResult.RightResultReadings.ICAProximalPSV != null) { testResult.RightResultReadings.ICAProximalPSV.Label = ReadingLabels.RICAPSV; } if (testResult.RightResultReadings.ICAProximalEDV != null) { testResult.RightResultReadings.ICAProximalEDV.Label = ReadingLabels.RICAEDV; } if (testResult.RightResultReadings.ICADistalPSV != null) { testResult.RightResultReadings.ICADistalPSV.Label = ReadingLabels.LICADistalPSV; } if (testResult.RightResultReadings.ICADistalEDV != null) { testResult.RightResultReadings.ICADistalEDV.Label = ReadingLabels.LICADistalEDV; } if (testResult.RightResultReadings.VertebralArtPSV != null) { testResult.RightResultReadings.VertebralArtPSV.Label = ReadingLabels.LVertebralArtPSV; } if (testResult.RightResultReadings.VertebralArtEDV != null) { testResult.RightResultReadings.VertebralArtEDV.Label = ReadingLabels.LVertebralArtEDV; } } bool isExceptionCaused; testResult.ResultImages = _mediaHelper.GetMediaSortedByDecimalValue(Directory.GetParent(filePathtoXml).FullName, _mediaLocation, TestType.AwvCarotid.ToString(), out isExceptionCaused).ToList(); if (isExceptionCaused) { _errorSummary += "Media Extraction Failed. "; } return(testResult); }
public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestsEntity) { var customerEventReadingEntities = customerEventScreeningTestsEntity.CustomerEventReading.ToList(); var testResult = new AwvCarotidTestResult(customerEventScreeningTestsEntity.CustomerEventScreeningTestId) { LeftResultReadings = new AwvCarotidTestReadings(), RightResultReadings = new AwvCarotidTestReadings() }; var standardFindingEntities = customerEventScreeningTestsEntity.StandardFindingTestReadingCollectionViaCustomerEventTestStandardFinding.ToList(); if (standardFindingEntities.Count > 0) { var customerEventStandardFindingEntities = customerEventScreeningTestsEntity.CustomerEventTestStandardFinding.ToList(); var leftFindingEntity = standardFindingEntities.Find(entity => entity.ReadingId.Value == (int)ReadingLabels.Left); var rightFindingEntity = standardFindingEntities.Find(entity => entity.ReadingId.Value == (int)ReadingLabels.Right); var velocityFindingLica = standardFindingEntities.Find(entity => entity.ReadingId == (int)ReadingLabels.LICAPSV); var velocityFindingRica = standardFindingEntities.Find(entity => entity.ReadingId == (int)ReadingLabels.RICAPSV); if (leftFindingEntity != null) { testResult.LeftResultReadings.Finding = new TestResultService().GetAllStandardFindings <decimal>((int)TestType.AwvCarotid, (int)ReadingLabels.Left). FirstOrDefault(standardFinding => standardFinding.Id == leftFindingEntity.StandardFindingId); if (testResult.LeftResultReadings.Finding != null) { testResult.LeftResultReadings.Finding.CustomerEventStandardFindingId = customerEventStandardFindingEntities.Find(standardFindingEntity => standardFindingEntity.StandardFindingTestReadingId == leftFindingEntity.StandardFindingTestReadingId).CustomerEventTestStandardFindingId; } } if (rightFindingEntity != null) { testResult.RightResultReadings.Finding = new TestResultService().GetAllStandardFindings <decimal>((int)TestType.AwvCarotid, (int)ReadingLabels.Right). FirstOrDefault(standardFinding => standardFinding.Id == rightFindingEntity.StandardFindingId); if (testResult.RightResultReadings.Finding != null) { testResult.RightResultReadings.Finding.CustomerEventStandardFindingId = customerEventStandardFindingEntities.Find(standardFindingEntity => standardFindingEntity.StandardFindingTestReadingId == rightFindingEntity.StandardFindingTestReadingId).CustomerEventTestStandardFindingId; } } if (velocityFindingLica != null) { testResult.LowVelocityLica = new TestResultService().GetAllStandardFindings <int>((int)TestType.AwvCarotid, (int)ReadingLabels.LICAPSV). Find(standardFinding => standardFinding.Id == velocityFindingLica.StandardFindingId); testResult.LowVelocityLica.CustomerEventStandardFindingId = customerEventStandardFindingEntities.Find(standardFindingEntity => standardFindingEntity.StandardFindingTestReadingId == velocityFindingLica.StandardFindingTestReadingId).CustomerEventTestStandardFindingId; } if (velocityFindingRica != null) { testResult.LowVelocityRica = new TestResultService().GetAllStandardFindings <int>((int)TestType.AwvCarotid, (int)ReadingLabels.RICAPSV). Find(standardFinding => standardFinding.Id == velocityFindingRica.StandardFindingId); testResult.LowVelocityRica.CustomerEventStandardFindingId = customerEventStandardFindingEntities.Find(standardFindingEntity => standardFindingEntity.StandardFindingTestReadingId == velocityFindingRica.StandardFindingTestReadingId).CustomerEventTestStandardFindingId; } } testResult.LeftResultReadings.CCAProximalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LCCAProximalPSV, customerEventReadingEntities); testResult.LeftResultReadings.CCAProximalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LCCAProximalEDV, customerEventReadingEntities); testResult.LeftResultReadings.CCADistalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LCCADistalPSV, customerEventReadingEntities); testResult.LeftResultReadings.CCADistalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LCCADistalEDV, customerEventReadingEntities); testResult.LeftResultReadings.BulbPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LBulbPSV, customerEventReadingEntities); testResult.LeftResultReadings.BulbEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LBulbEDV, customerEventReadingEntities); testResult.LeftResultReadings.ExtCarotidArtPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LExtCarotidArtPSV, customerEventReadingEntities); testResult.LeftResultReadings.ICAProximalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LICAPSV, customerEventReadingEntities); testResult.LeftResultReadings.ICAProximalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LICAEDV, customerEventReadingEntities); testResult.LeftResultReadings.ICADistalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LICADistalPSV, customerEventReadingEntities); testResult.LeftResultReadings.ICADistalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LICADistalEDV, customerEventReadingEntities); testResult.LeftResultReadings.VertebralArtPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LVertebralArtPSV, customerEventReadingEntities); testResult.LeftResultReadings.VertebralArtEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.LVertebralArtEDV, customerEventReadingEntities); testResult.RightResultReadings.CCAProximalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RCCAProximalPSV, customerEventReadingEntities); testResult.RightResultReadings.CCAProximalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RCCAProximalEDV, customerEventReadingEntities); testResult.RightResultReadings.CCADistalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RCCADistalPSV, customerEventReadingEntities); testResult.RightResultReadings.CCADistalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RCCADistalEDV, customerEventReadingEntities); testResult.RightResultReadings.BulbPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RBulbPSV, customerEventReadingEntities); testResult.RightResultReadings.BulbEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RBulbEDV, customerEventReadingEntities); testResult.RightResultReadings.ExtCarotidArtPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RExtCarotidArtPSV, customerEventReadingEntities); testResult.RightResultReadings.ICAProximalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RICAPSV, customerEventReadingEntities); testResult.RightResultReadings.ICAProximalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RICAEDV, customerEventReadingEntities); testResult.RightResultReadings.ICADistalPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RICADistalPSV, customerEventReadingEntities); testResult.RightResultReadings.ICADistalEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RICADistalEDV, customerEventReadingEntities); testResult.RightResultReadings.VertebralArtPSV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RVertebralArtPSV, customerEventReadingEntities); testResult.RightResultReadings.VertebralArtEDV = CreateResultReadingforNullableDecimal((int)ReadingLabels.RVertebralArtEDV, customerEventReadingEntities); testResult.TechnicallyLimitedbutReadable = CreateResultReading((int)ReadingLabels.TechnicallyLimitedbutReadable, customerEventReadingEntities); testResult.RepeatStudy = CreateResultReading((int)ReadingLabels.RepeatStudy, customerEventReadingEntities); var testImages = customerEventScreeningTestsEntity.TestMedia.ToList(); var fileEntityCollection = customerEventScreeningTestsEntity.FileCollectionViaTestMedia.ToList(); if (testImages.Count > 0) { var resultImages = new List <ResultMedia>(); testImages.ForEach(testMedia => resultImages.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.ResultImages = resultImages; } return(testResult); }