修改一版
This commit is contained in:
@@ -116,10 +116,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public class GetReadingReportEvaluationOutDto
|
||||
{
|
||||
public string TumorEvaluate { get; set; }
|
||||
|
||||
|
||||
public string IsExistDisease { get; set; }
|
||||
public object ReportCalculateResult{ get; set; }
|
||||
|
||||
public object CalculateResult { get; set; }
|
||||
public ReadingTaskState ReadingTaskState { get; set; }
|
||||
|
||||
public List<VisitTaskInfo> VisitTaskList { get; set; }
|
||||
@@ -1051,13 +1051,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public Func<ReadingCalculateDto, Task<string>> Fun { get; set; }
|
||||
}
|
||||
|
||||
public class VerifyVisitTaskQuestionsOutDto
|
||||
public class GetReportVerifyInDto
|
||||
{
|
||||
public bool IsVerified { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
public Guid VisitTaskId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class VerifyVisitTaskQuestionsInDto
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2022-08-22 09:33:28
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// IReadingCalculateService
|
||||
/// </summary>
|
||||
public interface IReadingCalculateService
|
||||
{
|
||||
Task CalculateTask(CalculateTaskInDto inDto);
|
||||
|
||||
|
||||
Task<VerifyVisitTaskQuestionsOutDto> VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto);
|
||||
|
||||
Task<string> GetReportTumor(Guid visitTaskId);
|
||||
|
||||
Task<string> GetReportIsExistDisease(Guid visitTaskId);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,81 +0,0 @@
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 阅片验证
|
||||
/// </summary>
|
||||
[NonDynamicWebApi]
|
||||
public partial class ReadingCalculateService : BaseService, IReadingCalculateService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 标准验证
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task CriterionVerify(Guid visitTaskId)
|
||||
{
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
ReadingCalculateDto readingData = await GetReadingCalculateDto(visitTaskId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// RECIST 1.1验证
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task RECIST1Point1Verify(ReadingCalculateDto inDto)
|
||||
{
|
||||
var tableAnswerList = inDto.QuestionInfo.SelectMany(x => x.TableRowInfoList).SelectMany(x=>x.TableQuestionList).ToList();
|
||||
|
||||
List<string> errorList = new List<string>();
|
||||
|
||||
// 判断是否为基线
|
||||
if (inDto.IsBaseLine)
|
||||
{
|
||||
// 不能有状态为 无法评估 消失 太小 显著增大 疑似的病灶
|
||||
List<string> targetStates = new List<string>() {
|
||||
TargetState.TooSmall.GetEnumInt(),
|
||||
TargetState.Loss.GetEnumInt(),
|
||||
TargetState.UnableEvaluate.GetEnumInt(),
|
||||
};
|
||||
|
||||
if (tableAnswerList.Any(x => x.QuestionMark == QuestionMark.State && targetStates.Contains(x.Answer)))
|
||||
{
|
||||
errorList.Add("基线不能有状态为 无法评估 消失 太小 显著增大 疑似的病灶!");
|
||||
|
||||
}
|
||||
|
||||
if (inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList).Count() > 0)
|
||||
{
|
||||
errorList.Add($"基线不能有新病灶!");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (errorList.Count > 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException(string.Join(',',errorList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -391,103 +391,6 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加基线表格数据到其他任务
|
||||
/// </summary>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
private async Task<bool> AddBaseLineAnswerToOtherTask(Guid visitTaskId)
|
||||
{
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).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)))
|
||||
{
|
||||
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit&&x.SubjectId==taskinfo.SubjectId&&x.ReadingTaskState==ReadingTaskState.HaveSigned &&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,
|
||||
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;
|
||||
});
|
||||
|
||||
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,
|
||||
});
|
||||
|
||||
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask()
|
||||
{
|
||||
ReadingTaskState = ReadingTaskState.Reading,
|
||||
|
||||
});
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
{
|
||||
x.MergeRow = null;
|
||||
x.SplitRow = null;
|
||||
});
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableRowAnswers);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return taskinfo.SourceSubjectVisitId == baseLineVisitId;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片报告
|
||||
/// </summary>
|
||||
@@ -498,8 +401,10 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||
|
||||
result.TumorEvaluate = await _readingCalculateService.GetReportTumor(indto.VisitTaskId);
|
||||
result.IsExistDisease= await _readingCalculateService.GetReportIsExistDisease(indto.VisitTaskId);
|
||||
result.CalculateResult = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto() {
|
||||
VisitTaskId=indto.VisitTaskId
|
||||
});
|
||||
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
var taskInfoList = await _visitTaskRepository.Where(x => (x.SubjectId == visitTaskInfo.SubjectId && x.TaskState == TaskState.Effect
|
||||
@@ -665,8 +570,11 @@ namespace IRaCIS.Application.Services
|
||||
[HttpGet]
|
||||
public async Task<List<GetTableAnswerRowInfoOutDto>> GetTableAnswerRowInfoList(GetTableAnswerRowInfoInDto inDto)
|
||||
{
|
||||
await this.AddBaseLineAnswerToOtherTask(inDto.VisitTaskId);
|
||||
var result= await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId)
|
||||
await _readingCalculateService.AddTaskLesionAnswerFromLastTask(new AddTaskLesionAnswerFromLastTaskInDto()
|
||||
{
|
||||
VisitTaskId = inDto.VisitTaskId
|
||||
});
|
||||
var result = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId)
|
||||
.WhereIf(inDto.QuestionId != null, x => x.QuestionId == inDto.QuestionId)
|
||||
.ProjectTo<GetTableAnswerRowInfoOutDto>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex)
|
||||
.ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user