病灶分裂计算
parent
98839b15dc
commit
3a710e1e50
|
@ -17,6 +17,7 @@ using IRaCIS.Core.Application.Filter;
|
|||
using DocumentFormat.OpenXml.Drawing;
|
||||
using EasyCaching.Core;
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -48,6 +49,7 @@ namespace IRaCIS.Application.Services
|
|||
private readonly IRepository<TrialDocument> _trialDocumentRepository;
|
||||
private readonly IRepository<User> _userRepository;
|
||||
private readonly IEasyCachingProvider _provider;
|
||||
private readonly ILuganoCalculateService _luganoCalculateService;
|
||||
private readonly IRepository<ReadingCustomTag> _readingCustomTagRepository;
|
||||
private readonly IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMarkRepository;
|
||||
private readonly IRepository<ReadingSystemCriterionDictionary> _readingCriterionDictionaryRepository;
|
||||
|
@ -88,6 +90,7 @@ namespace IRaCIS.Application.Services
|
|||
IRepository<TrialDocument> trialDocumentRepository,
|
||||
IRepository<User> userRepository,
|
||||
IEasyCachingProvider provider,
|
||||
ILuganoCalculateService luganoCalculateService,
|
||||
IRepository<ReadingCustomTag> readingCustomTagRepository,
|
||||
IRepository<ReadingTaskQuestionMark> readingTaskQuestionMarkRepository,
|
||||
IRepository<ReadingSystemCriterionDictionary> readingCriterionDictionaryRepository,
|
||||
|
@ -126,6 +129,7 @@ namespace IRaCIS.Application.Services
|
|||
this._trialDocumentRepository = trialDocumentRepository;
|
||||
this._userRepository = userRepository;
|
||||
this._provider = provider;
|
||||
this._luganoCalculateService = luganoCalculateService;
|
||||
this._readingCustomTagRepository = readingCustomTagRepository;
|
||||
this._readingTaskQuestionMarkRepository = readingTaskQuestionMarkRepository;
|
||||
this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
|
||||
|
@ -1808,9 +1812,7 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<SubmitTableQuestionOutDto> SubmitTableQuestion(SubmitTableQuestionInDto inDto)
|
||||
{
|
||||
SubmitTableQuestionOutDto result = new SubmitTableQuestionOutDto();
|
||||
|
||||
await VerifyTaskIsSign(inDto.VisitTaskId);
|
||||
|
||||
if (inDto.InstanceId != null && inDto.IsDicomReading)
|
||||
{
|
||||
if (!(await _dicomInstanceRepository.AnyAsync(x => x.Id == inDto.InstanceId && x.SeriesId == inDto.SeriesId)))
|
||||
|
@ -1968,24 +1970,20 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.Id == inDto.QuestionId).FirstNotNullAsync();
|
||||
var criterionId = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.TrialReadingCriterionId).FirstOrDefaultAsync();
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterionId).FirstNotNullAsync();
|
||||
var tableQuestionIds = inDto.AnswerList.Select(x => x.TableQuestionId).ToList();
|
||||
var tableAnswerList = await _readingTableQuestionAnswerRepository.Where(x => x.RowId == inDto.RowId).ToListAsync();
|
||||
|
||||
var tableQuestionIdGroup = tableQuestionIds.GroupBy(x => new { TableQuestionId = x }).Select(x => new TableQuestionData
|
||||
{
|
||||
TableQuestionId = x.Key.TableQuestionId,
|
||||
Count = x.Count()
|
||||
}).ToList();
|
||||
|
||||
if (tableQuestionIdGroup.Any(x => x.Count > 1))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_Twice"]);
|
||||
}
|
||||
|
||||
if (inDto.RowIndex % 1 == 0)
|
||||
{
|
||||
|
||||
|
@ -2105,15 +2103,11 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
isCurrentTaskAdd = isCurrentTaskAddList[0];
|
||||
}
|
||||
|
||||
|
||||
ReadingTableAnswerRowInfo? rowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == (inDto.RowId ?? default(Guid))).IgnoreAutoIncludes().FirstOrDefaultAsync();
|
||||
|
||||
rowInfo = rowInfo == null ? new ReadingTableAnswerRowInfo() : rowInfo;
|
||||
|
||||
//await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.RowId == (inDto.RowId ?? default(Guid)));
|
||||
//await _readingTableAnswerRowInfoRepository.BatchDeleteNoTrackingAsync(x => x.Id == (inDto.RowId ?? default(Guid)));
|
||||
|
||||
_mapper.Map(inDto, rowInfo);
|
||||
rowInfo.Id = inDto.RowId == null ? NewId.NextGuid() : inDto.RowId.Value;
|
||||
result.RowId = rowInfo.Id;
|
||||
|
@ -2145,7 +2139,6 @@ namespace IRaCIS.Application.Services
|
|||
await _readingTableQuestionAnswerRepository.AddRangeAsync(answerList);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
await _readingTableAnswerRowInfoRepository.UpdateFromDTOAsync(inDto) ;
|
||||
|
@ -2180,7 +2173,6 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
|
||||
}
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
||||
await this._readingCalculateService.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
|
@ -2189,8 +2181,21 @@ namespace IRaCIS.Application.Services
|
|||
ComputationTrigger = ComputationTrigger.Lesion,
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 保存完了计算疾病进展
|
||||
switch (taskinfo.TrialReadingCriterion.CriterionType)
|
||||
{
|
||||
case CriterionType.Lugano2014:
|
||||
if (inDto.RowIndex % 1 != 0)
|
||||
{
|
||||
await _luganoCalculateService.CalculateTargetLesionStatus(new CalculateTargetLesionStatusInDto()
|
||||
{
|
||||
QuestionId = inDto.QuestionId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
RowNumber = inDto.RowIndex
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
using IRaCIS.Core.Application.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate.Interface
|
||||
{
|
||||
public interface ILuganoCalculateService
|
||||
{
|
||||
/// <summary>
|
||||
/// 计算靶病灶状态
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
Task CalculateTargetLesionStatus(CalculateTargetLesionStatusInDto inDto);
|
||||
}
|
||||
}
|
|
@ -14,12 +14,14 @@ using System.Reflection.Metadata.Ecma335;
|
|||
using System.Linq;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class LuganoCalculateService : BaseService, ICriterionCalculateService
|
||||
public class LuganoCalculateService : BaseService, ICriterionCalculateService, ILuganoCalculateService
|
||||
{
|
||||
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
|
||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||
|
|
Loading…
Reference in New Issue