添加报表图表
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3971e65482
commit
f7525942e7
|
|
@ -537,6 +537,42 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public new decimal? RowIndex { get; set; }
|
||||
}
|
||||
|
||||
public class GetReportsChartDataOutDto
|
||||
{
|
||||
public List<string> VisitTaskNameList { get; set; }
|
||||
|
||||
public List<DateTime?> LatestScanDateList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public ValueUnit? Unit { get; set; }
|
||||
|
||||
public List<ReportChartData> ChartDataList { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ReportChartData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public List<string> Value { get; set; }
|
||||
}
|
||||
|
||||
public class GetReportsChartDataInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? QuestionId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
public decimal? RowIndex { get; set; }
|
||||
|
||||
public ReportChartType? ReportChartTypeEnum { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class GetPreviousOtherPicturePathInDto
|
||||
|
|
|
|||
|
|
@ -78,6 +78,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告图表数据
|
||||
/// </summary>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<GetReportsChartDataOutDto> GetReportsChartData(GetReportsChartDataInDto inDto)
|
||||
{
|
||||
return await _readingCalculateService.GetReportsChartData(inDto);
|
||||
}
|
||||
|
||||
#region 计算
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using IRaCIS.Core.Application.Service.Reading.Dto;
|
|||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
|
@ -42,7 +43,173 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
{CriterionType.mRECISTHCC,typeof(MRECISTHCCCalculateService) },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告图表数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<GetReportsChartDataOutDto> GetReportsChartData(GetReportsChartDataInDto inDto)
|
||||
{
|
||||
var criterionId = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var criterionType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterionId).Select(x => x.CriterionType).FirstOrDefaultAsync();
|
||||
|
||||
var data = await GetReadingReportEvaluation(new GetReadingReportEvaluationInDto()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
});
|
||||
|
||||
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto()
|
||||
{
|
||||
VisitTaskNameList = data.VisitTaskList.Select(x => x.BlindName).ToList(),
|
||||
LatestScanDateList = data.VisitTaskList.Select(x => x.LatestScanDate).ToList(),
|
||||
ChartDataList = new List<ReportChartData>() { },
|
||||
};
|
||||
|
||||
|
||||
result.VisitTaskNameList = data.VisitTaskList.Select(x => x.BlindName).ToList();
|
||||
|
||||
if (inDto.ReportChartTypeEnum != null)
|
||||
{
|
||||
switch (inDto.ReportChartTypeEnum)
|
||||
{
|
||||
case ReportChartType.Target:
|
||||
{
|
||||
// 这是病灶
|
||||
var target = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.LesionType == LesionType.TargetLesion).SelectMany(x => x.Childrens)
|
||||
.ToList();
|
||||
|
||||
|
||||
foreach (var item in target)
|
||||
{
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = item.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
|
||||
for (var i = 0; i < result.VisitTaskNameList.Count; i++)
|
||||
{
|
||||
|
||||
switch (criterionType)
|
||||
{
|
||||
case CriterionType.RECIST1Point1:
|
||||
case CriterionType.RECIST1Pointt1_MB:
|
||||
case CriterionType.mRECISTHCC:
|
||||
case CriterionType.IRECIST1Point1:
|
||||
// 淋巴结的短径
|
||||
if (item.Childrens.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer[i].Answer.EqEnum(ReadingYesOrNo.Yes)))
|
||||
{
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Unit).FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Unit).FirstOrDefault();
|
||||
}
|
||||
break;
|
||||
|
||||
case CriterionType.Lugano2014:
|
||||
case CriterionType.Lugano2014WithoutPET:
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.PPD).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.PPD).Select(x => x.Unit).FirstOrDefault();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case ReportChartType.BaseLineTarget:
|
||||
// 这是病灶
|
||||
var baseTarget = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.LesionType == LesionType.BaselineLesions).SelectMany(x => x.Childrens)
|
||||
.ToList();
|
||||
|
||||
foreach (var item in baseTarget)
|
||||
{
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = item.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
|
||||
for (var i = 0; i < result.VisitTaskNameList.Count; i++)
|
||||
{
|
||||
|
||||
chartData.Value.Add(item.Childrens.Where(x => x.QuestionMark == QuestionMark.LesionNumber).Select(x => x.Answer[i].Answer).FirstOrDefault());
|
||||
result.Unit = item.Childrens.Where(x => x.QuestionMark == QuestionMark.LesionNumber).Select(x => x.Unit).FirstOrDefault();
|
||||
|
||||
|
||||
}
|
||||
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (inDto.QuestionId != null)
|
||||
{
|
||||
var question = data.TaskQuestions.SelectMany(x => x.Childrens)
|
||||
.Where(x => x.QuestionId == inDto.QuestionId.Value).FirstOrDefault();
|
||||
if (question != null)
|
||||
{
|
||||
result.Unit = question.Unit;
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = question.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
foreach (var answer in question.Answer)
|
||||
{
|
||||
chartData.Value.Add(answer.Answer);
|
||||
}
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var lesion = data.TaskQuestions
|
||||
// 问题 靶病灶
|
||||
.SelectMany(x => x.Childrens)
|
||||
// 病灶
|
||||
.SelectMany(x => x.Childrens).Where(x => x.RowIndex == inDto.RowIndex)
|
||||
// 表格问题
|
||||
.SelectMany(x => x.Childrens).Where(x => x.TableQuestionId == inDto.TableQuestionId)
|
||||
|
||||
.FirstOrDefault();
|
||||
|
||||
if (lesion != null)
|
||||
{
|
||||
result.Unit = lesion.Unit;
|
||||
ReportChartData chartData = new ReportChartData()
|
||||
{
|
||||
Name = lesion.QuestionName,
|
||||
Value = new List<string>(),
|
||||
};
|
||||
foreach (var answer in lesion.Answer)
|
||||
{
|
||||
chartData.Value.Add(answer.Answer);
|
||||
}
|
||||
result.ChartDataList.Add(chartData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 阅片导入
|
||||
|
|
|
|||
|
|
@ -14,8 +14,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <returns></returns>
|
||||
Task CalculateTask(CalculateTaskInDto inDto);
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告图表数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
Task<GetReportsChartDataOutDto> GetReportsChartData(GetReportsChartDataInDto inDto);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 验证访视提交
|
||||
|
|
|
|||
|
|
@ -621,6 +621,24 @@ namespace IRaCIS.Core.Domain.Share
|
|||
Min = 9
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 阅片图表类型
|
||||
/// </summary>
|
||||
public enum ReportChartType
|
||||
{
|
||||
/// <summary>
|
||||
/// 靶病灶
|
||||
/// </summary>
|
||||
Target = 0,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 基线病灶
|
||||
/// </summary>
|
||||
BaseLineTarget = 1,
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数值单位
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue