Compare commits
No commits in common. "34faaaf23101df64b9328554e27bc4ef642cd091" and "5b63e58c1df942dfe428f99ab9107bc7b84098cd" have entirely different histories.
34faaaf231
...
5b63e58c1d
|
@ -585,10 +585,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal?> GetEEM(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetEEM(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Count() == 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||||
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
||||||
|
|
||||||
|
@ -601,10 +597,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<decimal?> GetEEMLumenSum(ReadingCalculateDto inDto)
|
public async Task<decimal?> GetEEMLumenSum(ReadingCalculateDto inDto)
|
||||||
{
|
{
|
||||||
if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Count() == 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||||
.Where(x => x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
.Where(x => x.QuestionMark == QuestionMark.ElasticAreaDiffValue).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
||||||
|
|
||||||
|
@ -683,7 +675,97 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
var visitTaskId = inDto.VisitTaskId;
|
var visitTaskId = inDto.VisitTaskId;
|
||||||
|
|
||||||
|
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||||
|
|
||||||
|
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
// 判断当前任务是否是基线
|
||||||
|
if (taskinfo.SourceSubjectVisitId != baseLineVisitId)
|
||||||
|
{
|
||||||
|
|
||||||
|
// 判断当前任务是是否有表格问题答案
|
||||||
|
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||||
|
{
|
||||||
|
if (taskinfo.BeforeConvertedTaskId != null)
|
||||||
|
{
|
||||||
|
await _generalCalculateService.AddConvertedTaskFocus(taskinfo.Id, taskinfo.BeforeConvertedTaskId.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||||
|
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||||
|
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||||
|
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||||
|
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||||
|
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
|
||||||
|
&& x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect
|
||||||
|
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new CopyTableAnswerDto()
|
||||||
|
{
|
||||||
|
Answer = x.Answer,
|
||||||
|
QuestionId = x.QuestionId,
|
||||||
|
RowId = x.RowId,
|
||||||
|
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
||||||
|
TableQuestionId = x.TableQuestionId,
|
||||||
|
RowIndex = x.RowIndex,
|
||||||
|
TrialId = x.TrialId
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
tableRowAnswers.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.VisitTaskId = visitTaskId;
|
||||||
|
x.IsCurrentTaskAdd = false;
|
||||||
|
x.Id = NewId.NextGuid();
|
||||||
|
x.SeriesId = null;
|
||||||
|
x.InstanceId = null;
|
||||||
|
x.MeasureData = string.Empty;
|
||||||
|
x.PicturePath = string.Empty;
|
||||||
|
});
|
||||||
|
|
||||||
|
tableRowAnswers.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
|
||||||
|
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
|
||||||
|
{
|
||||||
|
QuestionMark.MajorAxis,
|
||||||
|
QuestionMark.ShortAxis,
|
||||||
|
QuestionMark.State,
|
||||||
|
};
|
||||||
|
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||||
|
{
|
||||||
|
Id = NewId.NextGuid(),
|
||||||
|
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
|
||||||
|
QuestionId = x.QuestionId,
|
||||||
|
RowIndex = x.RowIndex,
|
||||||
|
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TableQuestionId = x.TableQuestionId,
|
||||||
|
TrialId = x.TrialId,
|
||||||
|
VisitTaskId = visitTaskId,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||||
|
|
||||||
|
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
|
||||||
|
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||||
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||||
{
|
{
|
||||||
|
|
|
@ -660,6 +660,94 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
|
|
||||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
// 判断当前任务是否是基线
|
||||||
|
if (taskinfo.SourceSubjectVisitId != baseLineVisitId)
|
||||||
|
{
|
||||||
|
|
||||||
|
// 判断当前任务是是否有表格问题答案
|
||||||
|
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||||
|
{
|
||||||
|
if (taskinfo.BeforeConvertedTaskId != null)
|
||||||
|
{
|
||||||
|
await _generalCalculateService.AddConvertedTaskFocus(taskinfo.Id, taskinfo.BeforeConvertedTaskId.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||||
|
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||||
|
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||||
|
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||||
|
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||||
|
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == taskinfo.ArmEnum
|
||||||
|
&& x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect
|
||||||
|
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new CopyTableAnswerDto()
|
||||||
|
{
|
||||||
|
Answer = x.Answer,
|
||||||
|
QuestionId = x.QuestionId,
|
||||||
|
RowId = x.RowId,
|
||||||
|
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
||||||
|
TableQuestionId = x.TableQuestionId,
|
||||||
|
RowIndex = x.RowIndex,
|
||||||
|
TrialId = x.TrialId
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
tableRowAnswers.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.VisitTaskId = visitTaskId;
|
||||||
|
x.IsCurrentTaskAdd = false;
|
||||||
|
x.Id = NewId.NextGuid();
|
||||||
|
x.SeriesId = null;
|
||||||
|
x.InstanceId = null;
|
||||||
|
x.MeasureData = string.Empty;
|
||||||
|
x.PicturePath = string.Empty;
|
||||||
|
});
|
||||||
|
|
||||||
|
tableRowAnswers.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
|
||||||
|
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
|
||||||
|
{
|
||||||
|
QuestionMark.MajorAxis,
|
||||||
|
QuestionMark.ShortAxis,
|
||||||
|
QuestionMark.State,
|
||||||
|
};
|
||||||
|
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||||
|
{
|
||||||
|
Id = NewId.NextGuid(),
|
||||||
|
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
|
||||||
|
QuestionId = x.QuestionId,
|
||||||
|
RowIndex = x.RowIndex,
|
||||||
|
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
|
||||||
|
TableQuestionId = x.TableQuestionId,
|
||||||
|
TrialId = x.TrialId,
|
||||||
|
VisitTaskId = visitTaskId,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||||
|
|
||||||
|
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
|
||||||
|
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||||
|
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue