Uat_Study
parent
cfef211808
commit
b313a89dd6
|
@ -191,6 +191,19 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public bool IsCurrentTask { get; set; }
|
||||
}
|
||||
|
||||
public class MergeLesionInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public decimal MainRowIndex { get; set; }
|
||||
|
||||
public decimal MergeRowIndex { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class SplitLesionInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
|
|
@ -53,12 +53,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<List<OrganDictionary>> GetCriterionLesionType(GetCriterionLesionTypeInDto inDto)
|
||||
{
|
||||
var dicNums = new List<string>();
|
||||
|
||||
|
||||
dicNums = await _criterionNidusRepository.Where(x => x.CriterionId == inDto.CriterionId).Select(x => ((int)x.LesionType).ToString()).Distinct().ToListAsync();
|
||||
|
||||
|
||||
|
||||
var dictionaryId = await _dictionaryRepository.Where(x => x.Code == "LesionType").Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
var result = await _dictionaryRepository.Where(x => x.ParentId == dictionaryId && dicNums.Contains(x.Code)).ProjectTo<OrganDictionary>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
@ -122,16 +117,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<List<OrganInfoView>> GetOrganInfoList(OrganInfoQuery inQuery)
|
||||
{
|
||||
|
||||
|
||||
List<OrganType> organs = new List<OrganType>();
|
||||
|
||||
if (inQuery.LesionType != null)
|
||||
{
|
||||
organs =await _criterionNidusRepository.Where(x => x.CriterionId == inQuery.SystemCriterionId && x.LesionType == inQuery.LesionType)
|
||||
.Select(x => x.OrganType).ToListAsync();
|
||||
}
|
||||
|
||||
var organInfoQueryable = _organInfoRepository
|
||||
.Where(x=>x.SystemCriterionId==inQuery.SystemCriterionId)
|
||||
.WhereIf(inQuery.LesionType != null, x => organs.Contains(x.OrganType))
|
||||
|
@ -206,7 +197,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
OrganInfoId=x,
|
||||
TrialId=inDto.TrialId,
|
||||
|
||||
//OrganType=inDto.OrganType,
|
||||
}).ToList();
|
||||
|
||||
|
@ -249,12 +239,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
.Select(x => x.OrganType).ToListAsync();
|
||||
}
|
||||
|
||||
var organInfoQueryable = from data in _organInfoRepository.WhereIf(inDto.OrganType != null, x => x.OrganType == inDto.OrganType)
|
||||
.WhereIf(inDto.IsLymphNodes!=null,x=>x.IsLymphNodes==inDto.IsLymphNodes)
|
||||
var organInfoQueryable = from data in _organInfoRepository
|
||||
.WhereIf(inDto.OrganType != null, x => x.OrganType == inDto.OrganType)
|
||||
.WhereIf(inDto.IsLymphNodes!=null,x=>x.IsLymphNodes==inDto.IsLymphNodes)
|
||||
.WhereIf(inDto.LesionType != null, x => organs.Contains(x.OrganType))
|
||||
join trialData in _organTrialInfoRepository.WhereIf(inDto.IsEnable != null, x => x.IsEnable == inDto.IsEnable)
|
||||
.WhereIf(inDto.LesionType != null, x => organs.Contains(x.OrganType))
|
||||
.WhereIf(inDto.IsEnable != null, x => x.IsEnable == inDto.IsEnable)
|
||||
.Where(x => x.TrialId == inDto.TrialId)
|
||||
|
||||
.WhereIf(inDto.IsEnable != null, x => x.IsEnable == inDto.IsEnable)
|
||||
.Where(x => x.TrialId == inDto.TrialId)
|
||||
on data.Id equals trialData.OrganInfoId
|
||||
select new GetTrialOrganListOutDto()
|
||||
{
|
||||
|
@ -266,7 +258,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IsLymphNodes = data.IsLymphNodes,
|
||||
|
||||
IsEnable= trialData.IsEnable,
|
||||
OrganType = trialData.OrganType,
|
||||
OrganType = data.OrganType,
|
||||
};
|
||||
|
||||
|
||||
|
@ -316,7 +308,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<IResponseOutput> SynchronizeSystemOrganToTrial(SynchronizeSystemOrganToTrialInDto inDto)
|
||||
{
|
||||
|
||||
// 选中的标准进行修改
|
||||
var readingQuestionCriterionTrial = await _readingQuestionCriterionTrial.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm).FirstOrDefaultAsync();
|
||||
|
||||
if (readingQuestionCriterionTrial != null)
|
||||
|
@ -346,7 +338,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var originalIds = criterionNidusList.Select(x => x.OriginalId).Distinct().ToList();
|
||||
List<OrganTrialInfo> organTrialInfoList = await _organInfoRepository.Where(x =>x.SystemCriterionId== inDto.SystemCriterionId).Select(x => new OrganTrialInfo()
|
||||
{
|
||||
OrganType=x.OrganType,
|
||||
//OrganType=x.OrganType,
|
||||
Id = x.Id,
|
||||
IsEnable = true,
|
||||
TrialCriterionId= readingQuestionCriterionTrial.Id,
|
||||
|
|
|
@ -109,10 +109,83 @@ namespace IRaCIS.Application.Services
|
|||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||
}
|
||||
|
||||
|
||||
public async Task SplitLesion()
|
||||
/// <summary>
|
||||
/// 拆分病灶
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task SplitLesion(SplitLesionInDto inDto)
|
||||
{
|
||||
|
||||
await this.VerifyIsBaseLineTask(inDto.VisitTaskId);
|
||||
var rowAnswer = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).FirstNotNullAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.RowIndex == inDto.RowIndex && x.QuestionId == inDto.QuestionId).ToListAsync();
|
||||
var maxRowIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId).OrderByDescending(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync();
|
||||
var newRowIndex = maxRowIndex + (decimal)0.01;
|
||||
|
||||
rowAnswer.RowIndex = newRowIndex;
|
||||
rowAnswer.MergeRowId = null;
|
||||
rowAnswer.SplitRowId = rowAnswer.Id;
|
||||
rowAnswer.Id = NewId.NextGuid();
|
||||
tableAnswers.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
x.RowIndex = newRowIndex;
|
||||
});
|
||||
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.QuestionId == inDto.QuestionId&&(x.RowIndex == inDto.MainRowIndex || x.RowIndex == inDto.MergeRowIndex)).ToListAsync();
|
||||
|
||||
if (rowsInfo.Count() != 2)
|
||||
{
|
||||
throw new BusinessValidationFailedException("合并的病灶并非同一个病灶类型");
|
||||
}
|
||||
|
||||
|
||||
var minaid = rowsInfo.Where(x => x.RowIndex == inDto.MainRowIndex).Select(x => x.Id).FirstOrDefault();
|
||||
var mergeid = rowsInfo.Where(x => x.RowIndex == inDto.MergeRowIndex).Select(x => x.Id).FirstOrDefault();
|
||||
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(mergeid, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
MergeRowId = minaid,
|
||||
});
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证是否为基线访视任务
|
||||
/// </summary>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
private async Task VerifyIsBaseLineTask(Guid visitTaskId)
|
||||
{
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
if (taskinfo.ReadingCategory!=ReadingCategory.Visit)
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前任务不是访视任务");
|
||||
}
|
||||
|
||||
if (!(await _subjectVisitRepository.AnyAsync(x => x.Id == taskinfo.SourceSubjectVisitId && x.IsBaseLine)))
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前不是基线任务");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -39,10 +39,10 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public Guid CreateUserId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 病灶类型
|
||||
/// </summary>
|
||||
public OrganType OrganType { get; set; }
|
||||
///// <summary>
|
||||
///// 病灶类型 项目自定义标准 可能会更改
|
||||
///// </summary>
|
||||
//public OrganType OrganType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准Id
|
||||
|
|
|
@ -61,6 +61,17 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public bool IsCurrentTaskAdd { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// SplitRowId
|
||||
/// </summary>
|
||||
public Guid? SplitRowId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MergeRowId
|
||||
/// </summary>
|
||||
public Guid? MergeRowId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CreateUserId
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue