添加标记

This commit is contained in:
he
2023-09-22 13:33:05 +08:00
parent 3c23dfd792
commit 4a482adefe
5 changed files with 110 additions and 23 deletions
@@ -23,6 +23,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
private readonly IRepository<VisitTask> _visitTaskRepository;
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository;
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
private readonly IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMarkRepository;
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
private readonly IRepository<OrganInfo> _organInfoRepository;
@@ -36,6 +37,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository<VisitTask> visitTaskRepository,
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
IRepository<ReadingTaskQuestionMark> readingTaskQuestionMarkRepository,
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
IRepository<OrganInfo> organInfoRepository,
@@ -49,6 +51,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
this._visitTaskRepository = visitTaskRepository;
this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository;
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
this._readingTaskQuestionMarkRepository = readingTaskQuestionMarkRepository;
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
this._organInfoRepository = organInfoRepository;
@@ -880,6 +883,47 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
QuestionMark.State,
};
var rowIndexList = copyTableAnswers.Select(x => x.RowIndex).Distinct().ToList();
// 找到靶病灶问题Id
var questionId=await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.TargetLesion).Select(x => x.Id).FirstNotNullAsync();
foreach (var item in rowIndexList)
{
var lowPPD =await this.GetLowPPDInfo(new GetPPDInfoInDto() {
VisitTaskId= visitTaskId,
QuestionId= questionId,
RowIndex=item
});
copyTableAnswers.Where(x => x.RowIndex == item).ForEach(x =>
{
switch (x.QuestionMark)
{
case QuestionMark.LowPPDLDi:
x.Answer = lowPPD.LowPPDLDi.ToString();
break;
case QuestionMark.LowPPDSDi:
x.Answer = lowPPD.LowPPDSDi.ToString();
break;
case QuestionMark.NadirPPD:
x.Answer = lowPPD.NadirPPD.ToString();
break;
case QuestionMark.LowPPDVisit:
x.Answer = lowPPD.LowPPDVisit.ToString();
break;
}
});
}
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
{
Id = NewId.NextGuid(),
@@ -893,10 +937,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
});
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new ReadingTaskQuestionMark()
{
VisitTaskId= visitTaskId,
FirstAddTaskId=x.FirstAddTaskId,
QuestionId=x.QuestionId,
}).ToListAsync();
questionMarkList.ForEach(x => {
x.Id = NewId.NextGuid();
});
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
await _readingTaskQuestionMarkRepository.AddRangeAsync(questionMarkList);
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();