Uat_Study
he 2022-09-29 17:27:13 +08:00
parent c55ee17729
commit e73a27b619
5 changed files with 107 additions and 10 deletions

View File

@ -162,11 +162,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public decimal RowIndex { get; set; }
public string MeasureData { get; set; }
public List<TableQuestionInfo> TableQuestionList { get; set; } = new List<TableQuestionInfo>();
}
public class TableQuestionInfo
{
public Guid RowId { get; set; }
/// <summary>
/// 答案
/// </summary>
@ -186,6 +191,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public QuestionMark? QuestionMark { get; set; }
public QuestionType? QuestionType { get; set; }
}

View File

@ -22,12 +22,13 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
[ApiExplorerSettings(GroupName = "Reading")]
public class ReadingCalculateService : BaseService, IReadingCalculateService
public partial class ReadingCalculateService : BaseService, IReadingCalculateService
{
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
private readonly IRepository<VisitTask> _visitTaskRepository;
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository;
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
private readonly IRepository<TumorAssessment> _tumorAssessmentRepository;
@ -38,6 +39,7 @@ namespace IRaCIS.Core.Application.Service
IRepository<VisitTask> visitTaskRepository,
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
IRepository<SubjectVisit> subjectVisitRepository,
IRepository<TumorAssessment> tumorAssessmentRepository,
@ -48,6 +50,7 @@ namespace IRaCIS.Core.Application.Service
this._visitTaskRepository = visitTaskRepository;
this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository;
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
this._subjectVisitRepository = subjectVisitRepository;
this._tumorAssessmentRepository = tumorAssessmentRepository;
@ -303,6 +306,7 @@ namespace IRaCIS.Core.Application.Service
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == visitTask.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).ToListAsync();
var baseLinetaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == baseLineVisitId && x.TaskState == TaskState.Effect && x.ArmEnum == visitTask.ArmEnum).Select(x => x.Id).FirstOrDefaultAsync();
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == visitTask.TrialId && x.IsConfirm).Select(x => x.Id).FirstOrDefaultAsync();
@ -326,22 +330,31 @@ namespace IRaCIS.Core.Application.Service
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
TableQuestionId = x.TableQuestionId,
QuestionId = x.QuestionId,
QuestionType=x.ReadingQuestionTrial.QuestionType,
RowIndex = x.RowIndex,
RowId=x.RowId,
}).ToListAsync();
foreach (var item in questionInfos)
{
item.Answer = questionAnswers.Where(y => y.ReadingQuestionTrialId == item.QuestionId).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
var thisItemRowInfo = rowInfoList.Where(x => x.QuestionId == item.QuestionId).ToList();
var thisItemTableQuestions = tableQuestion.Where(x => x.QuestionId == item.QuestionId).ToList();
item.TableRowInfoList = thisItemTableQuestions.GroupBy(x => new { x.RowIndex })
.Select(g => new TableRowInfo()
{
RowIndex = g.Key.RowIndex,
TableQuestionList = g.ToList()
}).ToList();
item.TableRowInfoList = thisItemRowInfo.Select(x => new TableRowInfo()
{
RowIndex = x.RowIndex,
MeasureData = x.MeasureData,
TableQuestionList = tableQuestion.Where(y => y.QuestionId == item.QuestionId && y.RowId == x.Id).ToList(),
}).ToList();
}
ReadingCalculateDto readingData = new ReadingCalculateDto()

View File

@ -0,0 +1,77 @@
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using Panda.DynamicWebApi.Attributes;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using Microsoft.Extensions.Caching.Memory;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Infrastructure;
namespace IRaCIS.Core.Application.Service
{
/// <summary>
/// 阅片验证
/// </summary>
[NonDynamicWebApi]
public partial class ReadingCalculateService : BaseService, IReadingCalculateService
{
/// <summary>
/// 标准验证
/// </summary>
/// <returns></returns>
public async Task CriterionVerify(Guid visitTaskId)
{
ReadingCalculateDto readingData = await GetReadingCalculateDto(visitTaskId);
}
/// <summary>
/// RECIST 1.1验证
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task RECIST1Point1Verify(ReadingCalculateDto inDto)
{
var tableAnswerList = inDto.QuestionInfo.SelectMany(x => x.TableRowInfoList).SelectMany(x=>x.TableQuestionList).ToList();
List<string> errorList = new List<string>();
// 判断是否为基线
if (inDto.IsBaseLine)
{
// 不能有状态为 无法评估 消失 太小 显著增大 疑似的病灶
List<string> targetStates = new List<string>() {
TargetState.TooSmall.GetEnumInt(),
TargetState.Loss.GetEnumInt(),
TargetState.UnableEvaluate.GetEnumInt(),
};
if (tableAnswerList.Any(x => x.QuestionMark == QuestionMark.State && targetStates.Contains(x.Answer)))
{
errorList.Add("基线不能有状态为 无法评估 消失 太小 显著增大 疑似的病灶!");
}
if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).Count() > 0)
{
errorList.Add($"基线不能有新病灶!");
}
}
else
{
}
if (errorList.Count > 0)
{
throw new BusinessValidationFailedException(string.Join(',',errorList));
}
}
}
}

View File

@ -238,7 +238,7 @@ namespace IRaCIS.Application.Services
{
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
GetReadingToolOutDto result = new GetReadingToolOutDto();
result.ReadingTool = await _trialRepository.Where(x => x.Id == visitTaskInfo.TrialId).Select(x => x.ReadingTool).FirstNotNullAsync();
result.ReadingTool = await _trialRepository.Where(x => x.Id == visitTaskInfo.TrialId).Select(x => x.ReadingTool).FirstOrDefaultAsync();
return result;
}

View File

@ -276,7 +276,7 @@ namespace IRaCIS.Core.Domain.Share
/// <summary>
/// 非病灶状态
/// 非病灶状态
/// </summary>
public enum NoTargetState
{