Uat_Study
parent
aa105f3f42
commit
8a4a9814fc
|
@ -261,6 +261,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid TrialId { get; set; }
|
||||
}
|
||||
|
||||
public class CopyTableAnswerRowInfo : ReadingTableAnswerRowInfo
|
||||
{
|
||||
public Guid OriginalId { get; set; }
|
||||
}
|
||||
public class CopyTableAnswerDto
|
||||
{
|
||||
public decimal RowIndex { get; set; }
|
||||
|
|
|
@ -823,7 +823,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var thisNum = await _subjectVisitRepository.Where(x => x.Id == inDto.SubjectVisitId).Select(x => x.VisitNum).FirstOrDefaultAsync();
|
||||
|
||||
// 先找到上一个访视
|
||||
var lastVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && x.VisitNum < thisNum).OrderByDescending(x => x.VisitNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
var lastVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && !x.IsLostVisit && x.VisitNum < thisNum).OrderByDescending(x => x.VisitNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
// 找到访视任务Id
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
rowAnswer.RowIndex = newRowIndex;
|
||||
rowAnswer.MergeRowId = null;
|
||||
rowAnswer.SplitOrMergeType = SplitOrMergeType.Split;
|
||||
rowAnswer.SplitRowId = rowAnswer.Id;
|
||||
rowAnswer.Id = NewId.NextGuid();
|
||||
tableAnswers.ForEach(x =>
|
||||
|
@ -146,11 +147,11 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
|
||||
|
||||
var rowsInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId&&(x.RowIndex == inDto.MainRowIndex || x.RowIndex == inDto.MergeRowIndex)).ToListAsync();
|
||||
var rowsInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId &&(x.RowIndex == inDto.MainRowIndex || x.RowIndex == inDto.MergeRowIndex)).ToListAsync();
|
||||
|
||||
if (rowsInfo.Count() != 2)
|
||||
{
|
||||
throw new BusinessValidationFailedException("合并的病灶并非同一个病灶类型");
|
||||
throw new BusinessValidationFailedException("合并的病灶并非同一个访视任务");
|
||||
}
|
||||
|
||||
|
||||
|
@ -161,6 +162,7 @@ namespace IRaCIS.Application.Services
|
|||
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
MergeRowId = minaid,
|
||||
SplitOrMergeType = SplitOrMergeType.Merge,
|
||||
});
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||
|
@ -330,10 +332,17 @@ namespace IRaCIS.Application.Services
|
|||
// 判断当前任务是是否有表格问题答案
|
||||
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||
{
|
||||
// 找到基线的任务Id
|
||||
var baseLineTaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == baseLineVisitId && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineTaskId).Select(x => new CopyTableAnswerDto() {
|
||||
|
||||
|
||||
|
||||
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&x.VisitTaskNum< taskinfo.VisitTaskNum&&x.TaskState==TaskState.Effect&&x.ArmEnum==taskinfo.ArmEnum
|
||||
).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,
|
||||
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
||||
|
@ -342,21 +351,21 @@ namespace IRaCIS.Application.Services
|
|||
TrialId = x.TrialId
|
||||
}).ToListAsync();
|
||||
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == baseLineTaskId).Select(x => new ReadingTableAnswerRowInfo() {
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
IsCurrentTaskAdd = false,
|
||||
QuestionId = x.QuestionId,
|
||||
RowIndex = x.RowIndex,
|
||||
TrialId = x.TrialId,
|
||||
VisitTaskId = visitTaskId,
|
||||
}).ToListAsync();
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
{
|
||||
x.IsCurrentTaskAdd = false;
|
||||
|
||||
x.Id = NewId.NextGuid();
|
||||
});
|
||||
|
||||
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,
|
||||
|
|
|
@ -52,6 +52,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<TumorAssessment, TumorAssessmentView>();
|
||||
|
||||
CreateMap<ReadingTableAnswerRowInfo, CopyTableAnswerRowInfo>()
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
#region 阅片问题
|
||||
|
||||
// 忽略列
|
||||
|
|
|
@ -16,6 +16,23 @@ namespace IRaCIS.Core.Domain.Share
|
|||
public static readonly string Group = "group";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 病灶分裂或合并
|
||||
/// </summary>
|
||||
public enum SplitOrMergeType
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 分裂
|
||||
/// </summary>
|
||||
Split = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 合并
|
||||
/// </summary>
|
||||
Merge = 1
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否存在或者NA
|
||||
/// </summary>
|
||||
|
|
|
@ -72,6 +72,9 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public Guid? MergeRowId { get; set; }
|
||||
|
||||
|
||||
public SplitOrMergeType? SplitOrMergeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CreateUserId
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue