代码整理
parent
e907a3e89b
commit
3c4a8534f0
|
@ -105,112 +105,8 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 病灶的拆分与合并
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 拆分病灶
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task SplitLesion(SplitLesionInDto inDto)
|
|
||||||
{
|
|
||||||
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
|
|
||||||
var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).AsNoTracking().FirstNotNullAsync();
|
|
||||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == rowAnswer.RowIndex && x.QuestionId == inDto.QuestionId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
|
||||||
var maxRowIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowIndex < Math.Floor(rowAnswer.RowIndex + 1)).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync();
|
|
||||||
var newRowIndex = maxRowIndex + (decimal)0.01;
|
|
||||||
|
|
||||||
rowAnswer.RowIndex = newRowIndex;
|
|
||||||
rowAnswer.MergeRowId = null;
|
|
||||||
rowAnswer.SplitOrMergeType = SplitOrMergeType.Split;
|
|
||||||
rowAnswer.SplitRowId = rowAnswer.Id;
|
|
||||||
rowAnswer.Id = NewId.NextGuid();
|
|
||||||
rowAnswer.InstanceId = null;
|
|
||||||
rowAnswer.SeriesId = null;
|
|
||||||
rowAnswer.IsCurrentTaskAdd = true;
|
|
||||||
rowAnswer.MeasureData = string.Empty;
|
|
||||||
|
|
||||||
List<QuestionMark?> needRemoveMark = new List<QuestionMark?>()
|
|
||||||
{
|
|
||||||
QuestionMark.MajorAxis,
|
|
||||||
QuestionMark.ShortAxis,
|
|
||||||
};
|
|
||||||
|
|
||||||
tableAnswers.ForEach(x =>
|
|
||||||
{
|
|
||||||
x.Id = NewId.NextGuid();
|
|
||||||
x.RowIndex = newRowIndex;
|
|
||||||
x.VisitTaskId = inDto.VisitTaskId;
|
|
||||||
x.RowId = rowAnswer.Id;
|
|
||||||
x.Answer = needRemoveMark.Contains(x.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : x.Answer;
|
|
||||||
x.ReadingTableQuestionTrial = null;
|
|
||||||
});
|
|
||||||
await _readingTableAnswerRowInfoRepository.AddAsync(rowAnswer);
|
|
||||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
|
||||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 合并病灶
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task MergeLesion(MergeLesionInDto inDto)
|
|
||||||
{
|
|
||||||
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
|
|
||||||
|
|
||||||
var rowsInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && (x.Id == inDto.MainRowId || x.Id == inDto.MergeRowId)).ToListAsync();
|
|
||||||
|
|
||||||
if (rowsInfo.Count() != 2)
|
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException("合并的病灶并非同一个访视任务");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var minaid = rowsInfo.Where(x => x.Id == inDto.MainRowId).Select(x => x.Id).FirstOrDefault();
|
|
||||||
var mergeid = rowsInfo.Where(x => x.Id == inDto.MergeRowId).Select(x => x.Id).FirstOrDefault();
|
|
||||||
|
|
||||||
List<QuestionMark?> needRemoveMark = new List<QuestionMark?>()
|
|
||||||
{
|
|
||||||
QuestionMark.MajorAxis,
|
|
||||||
QuestionMark.ShortAxis,
|
|
||||||
};
|
|
||||||
|
|
||||||
var mainAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.RowId == minaid).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
|
||||||
|
|
||||||
foreach (var item in mainAnswer)
|
|
||||||
{
|
|
||||||
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.RowId == mergeid && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer()
|
|
||||||
{
|
|
||||||
Answer = needRemoveMark.Contains(item.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : item.Answer,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo()
|
|
||||||
{
|
|
||||||
MergeRowId = minaid,
|
|
||||||
SplitOrMergeType = SplitOrMergeType.Merge,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo()
|
|
||||||
{
|
|
||||||
MergeRowId = minaid,
|
|
||||||
SplitOrMergeType = SplitOrMergeType.Merge,
|
|
||||||
});
|
|
||||||
|
|
||||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 阅片期 -全局和肿瘤学任务的生成
|
#region 阅片期 -全局和肿瘤学任务的生成
|
||||||
|
@ -451,8 +347,6 @@ namespace IRaCIS.Application.Services
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 表格问题相关
|
#region 表格问题相关
|
||||||
|
|
||||||
|
|
||||||
|
@ -974,7 +868,6 @@ namespace IRaCIS.Application.Services
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 访视任务 - Dicom 阅片
|
#region 访视任务 - Dicom 阅片
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1193,6 +1086,115 @@ namespace IRaCIS.Application.Services
|
||||||
return ResponseOutput.Ok(true);
|
return ResponseOutput.Ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 访视任务 - Dicom 阅片 表格问题 病灶的拆分与合并
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拆分病灶
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task SplitLesion(SplitLesionInDto inDto)
|
||||||
|
{
|
||||||
|
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
|
||||||
|
var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).AsNoTracking().FirstNotNullAsync();
|
||||||
|
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == rowAnswer.RowIndex && x.QuestionId == inDto.QuestionId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
||||||
|
var maxRowIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowIndex < Math.Floor(rowAnswer.RowIndex + 1)).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync();
|
||||||
|
var newRowIndex = maxRowIndex + (decimal)0.01;
|
||||||
|
|
||||||
|
rowAnswer.RowIndex = newRowIndex;
|
||||||
|
rowAnswer.MergeRowId = null;
|
||||||
|
rowAnswer.SplitOrMergeType = SplitOrMergeType.Split;
|
||||||
|
rowAnswer.SplitRowId = rowAnswer.Id;
|
||||||
|
rowAnswer.Id = NewId.NextGuid();
|
||||||
|
rowAnswer.InstanceId = null;
|
||||||
|
rowAnswer.SeriesId = null;
|
||||||
|
rowAnswer.IsCurrentTaskAdd = true;
|
||||||
|
rowAnswer.MeasureData = string.Empty;
|
||||||
|
|
||||||
|
List<QuestionMark?> needRemoveMark = new List<QuestionMark?>()
|
||||||
|
{
|
||||||
|
QuestionMark.MajorAxis,
|
||||||
|
QuestionMark.ShortAxis,
|
||||||
|
};
|
||||||
|
|
||||||
|
tableAnswers.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.Id = NewId.NextGuid();
|
||||||
|
x.RowIndex = newRowIndex;
|
||||||
|
x.VisitTaskId = inDto.VisitTaskId;
|
||||||
|
x.RowId = rowAnswer.Id;
|
||||||
|
x.Answer = needRemoveMark.Contains(x.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : x.Answer;
|
||||||
|
x.ReadingTableQuestionTrial = null;
|
||||||
|
});
|
||||||
|
await _readingTableAnswerRowInfoRepository.AddAsync(rowAnswer);
|
||||||
|
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||||
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 合并病灶
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task MergeLesion(MergeLesionInDto inDto)
|
||||||
|
{
|
||||||
|
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
|
||||||
|
|
||||||
|
var rowsInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && (x.Id == inDto.MainRowId || x.Id == inDto.MergeRowId)).ToListAsync();
|
||||||
|
|
||||||
|
if (rowsInfo.Count() != 2)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("合并的病灶并非同一个访视任务");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var minaid = rowsInfo.Where(x => x.Id == inDto.MainRowId).Select(x => x.Id).FirstOrDefault();
|
||||||
|
var mergeid = rowsInfo.Where(x => x.Id == inDto.MergeRowId).Select(x => x.Id).FirstOrDefault();
|
||||||
|
|
||||||
|
List<QuestionMark?> needRemoveMark = new List<QuestionMark?>()
|
||||||
|
{
|
||||||
|
QuestionMark.MajorAxis,
|
||||||
|
QuestionMark.ShortAxis,
|
||||||
|
};
|
||||||
|
|
||||||
|
var mainAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.RowId == minaid).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
||||||
|
|
||||||
|
foreach (var item in mainAnswer)
|
||||||
|
{
|
||||||
|
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.RowId == mergeid && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer()
|
||||||
|
{
|
||||||
|
Answer = needRemoveMark.Contains(item.ReadingTableQuestionTrial.QuestionMark) ? string.Empty : item.Answer,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo()
|
||||||
|
{
|
||||||
|
MergeRowId = minaid,
|
||||||
|
SplitOrMergeType = SplitOrMergeType.Merge,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo()
|
||||||
|
{
|
||||||
|
MergeRowId = minaid,
|
||||||
|
SplitOrMergeType = SplitOrMergeType.Merge,
|
||||||
|
});
|
||||||
|
|
||||||
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue