修改一版
parent
fcf680d5a0
commit
9952ab7ed3
|
@ -1,14 +1,149 @@
|
||||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using MassTransit;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
{
|
{
|
||||||
public class PCWG3CalculateService : BaseService, ICriterionCalculateService
|
public class PCWG3CalculateService : BaseService, ICriterionCalculateService
|
||||||
{
|
{
|
||||||
|
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
|
||||||
|
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||||
|
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository;
|
||||||
|
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
||||||
|
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
|
||||||
|
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||||
|
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
|
private readonly IRepository<TumorAssessment> _tumorAssessmentRepository;
|
||||||
|
private readonly IGeneralCalculateService _generalCalculateService;
|
||||||
|
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
|
||||||
|
|
||||||
|
public PCWG3CalculateService(
|
||||||
|
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
|
||||||
|
IRepository<VisitTask> visitTaskRepository,
|
||||||
|
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
|
||||||
|
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
||||||
|
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
|
||||||
|
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
|
||||||
|
IRepository<SubjectVisit> subjectVisitRepository,
|
||||||
|
IRepository<TumorAssessment> tumorAssessmentRepository,
|
||||||
|
IGeneralCalculateService generalCalculateService,
|
||||||
|
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
|
||||||
|
this._visitTaskRepository = visitTaskRepository;
|
||||||
|
this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository;
|
||||||
|
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
||||||
|
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
|
||||||
|
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||||
|
this._subjectVisitRepository = subjectVisitRepository;
|
||||||
|
this._tumorAssessmentRepository = tumorAssessmentRepository;
|
||||||
|
this._generalCalculateService = generalCalculateService;
|
||||||
|
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 将上一次的病灶信息添加到这一次
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public async Task<AddTaskLesionAnswerFromLastTaskOutDto> AddTaskLesionAnswerFromLastTask(AddTaskLesionAnswerFromLastTaskInDto inDto)
|
public async Task<AddTaskLesionAnswerFromLastTaskOutDto> AddTaskLesionAnswerFromLastTask(AddTaskLesionAnswerFromLastTaskInDto inDto)
|
||||||
{
|
{
|
||||||
return new AddTaskLesionAnswerFromLastTaskOutDto();
|
return new AddTaskLesionAnswerFromLastTaskOutDto();
|
||||||
|
//var visitTaskId = inDto.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.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||||
|
// 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.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 new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||||
|
//{
|
||||||
|
|
||||||
|
// IsBaseLine = taskinfo.SourceSubjectVisitId == baseLineVisitId,
|
||||||
|
//};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CalculateTask(CalculateTaskInDto inDto)
|
public async Task CalculateTask(CalculateTaskInDto inDto)
|
||||||
|
|
|
@ -678,6 +678,16 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NewLesions = 2,
|
NewLesions = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 既往新病灶
|
||||||
|
/// </summary>
|
||||||
|
AlwaysNewLesions = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 基线病灶
|
||||||
|
/// </summary>
|
||||||
|
BaselineLesions=4,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue