@@ -1,9 +1,4 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
@@ -14,34 +9,34 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public class CalculateTargetLesionStatusInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set;}
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public decimal RowNumber { get; set; }
|
||||
public decimal RowNumber { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class GetSplitPPdOutDto
|
||||
{
|
||||
public Guid RowId { get; set; }
|
||||
public class GetSplitPPdOutDto
|
||||
{
|
||||
public Guid RowId { get; set; }
|
||||
|
||||
public string RowIndex { get; set; }
|
||||
|
||||
public decimal AllPPD { get; set; }
|
||||
public decimal AllPPD { get; set; }
|
||||
|
||||
public decimal AllLDi { get; set; }
|
||||
public decimal AllLDi { get; set; }
|
||||
|
||||
public decimal AllSDi { get; set; }
|
||||
}
|
||||
public decimal AllSDi { get; set; }
|
||||
}
|
||||
|
||||
public class GetSplitPPdInDto
|
||||
public class GetSplitPPdInDto
|
||||
{
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
}
|
||||
public Guid VisitTaskId { get; set; }
|
||||
}
|
||||
|
||||
public class ReadingTaskQuestionAnswerDto : ReadingTaskQuestionAnswer
|
||||
public class ReadingTaskQuestionAnswerDto : ReadingTaskQuestionAnswer
|
||||
{
|
||||
public QuestionType QuestionType { get; set; }
|
||||
}
|
||||
@@ -59,7 +54,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
/// <summary>
|
||||
/// 靶病灶是否为IUPD或者ICPD
|
||||
/// </summary>
|
||||
public bool NewTargetLesionAssessmentIsIUorIC { get; set; }
|
||||
public bool NewTargetLesionAssessmentIsIUorIC { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +66,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public string Answer { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class VisitStudyTime
|
||||
@@ -103,7 +98,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
/// </summary>
|
||||
public DateTime? StudyTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AddTaskLesionAnswerFromLastTaskOutDto
|
||||
@@ -264,7 +259,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
/// <summary>
|
||||
/// 当有“存在”或“太小”状态的非淋巴结新靶病灶
|
||||
/// </summary>
|
||||
public bool ExixtsOrLessNoLymphTarget{ get; set; }
|
||||
public bool ExixtsOrLessNoLymphTarget { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -303,7 +298,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
///// </summary>
|
||||
//public class NewLesionAfterTriggeringiRECSITAssessmentDto
|
||||
//{
|
||||
|
||||
|
||||
//}
|
||||
|
||||
public class IRECISTNewNoTargetLesionDto
|
||||
|
||||
+46
-48
@@ -3,11 +3,7 @@ using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -57,11 +53,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <param name="lesionName"></param>
|
||||
/// <param name="lesionType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task LogRecord(ReadingCalculateDto inDto,string lesionName, LesionType lesionType)
|
||||
public async Task LogRecord(ReadingCalculateDto inDto, string lesionName, LesionType lesionType)
|
||||
{
|
||||
// 这里是记录日志 不需要国际化
|
||||
var criterionInfo =await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync();
|
||||
var taskInfo= await _visitTaskRepository.Where(x=>x.Id==inDto.VisitTaskId).Include(x=>x.Subject).Include(x=>x.DoctorUser).FirstNotNullAsync();
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).Include(x => x.Trial).FirstNotNullAsync();
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.DoctorUser).FirstNotNullAsync();
|
||||
|
||||
//错误级别日志:项目、标准、受试者、阅片人、任务。输出其它既往新病灶数据:
|
||||
|
||||
@@ -85,7 +81,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
lesionInfo.TableRowInfoList.OrderBy(x => x.RowIndex).ForEach(x =>
|
||||
{
|
||||
builder.AppendLine(@$"【病灶编号】:【{x.RowIndex.ToString()}】,
|
||||
【病灶长径】:【{x.TableQuestionList.Where(y=>y.QuestionMark==QuestionMark.MajorAxis).Select(y=>y.Answer).FirstIsNullReturnEmpty()}】,
|
||||
【病灶长径】:【{x.TableQuestionList.Where(y => y.QuestionMark == QuestionMark.MajorAxis).Select(y => y.Answer).FirstIsNullReturnEmpty()}】,
|
||||
【病灶短径】:【{x.TableQuestionList.Where(y => y.QuestionMark == QuestionMark.ShortAxis).Select(y => y.Answer).FirstIsNullReturnEmpty()}】,
|
||||
【病灶状态】:【{x.TableQuestionList.Where(y => y.QuestionMark == QuestionMark.State).Select(y => y.Answer).FirstIsNullReturnEmpty()}】");
|
||||
|
||||
@@ -122,7 +118,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
LesionType = x.LesionType,
|
||||
QuestionId = x.Id,
|
||||
QuesionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
OrderMark=x.OrderMark,
|
||||
OrderMark = x.OrderMark,
|
||||
QuestionType = x.QuestionType,
|
||||
ValueType = x.ValueType,
|
||||
}).ToListAsync();
|
||||
@@ -136,7 +132,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var tableQuestion = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x => x.ReadingTableQuestionTrial).Select(x => new TableQuestionInfo()
|
||||
{
|
||||
Answer = x.Answer,
|
||||
AnswerId=x.Id,
|
||||
AnswerId = x.Id,
|
||||
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
||||
TableQuestionId = x.TableQuestionId,
|
||||
QuestionId = x.QuestionId,
|
||||
@@ -159,7 +155,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
RowIndex = x.RowIndex,
|
||||
MeasureData = x.MeasureData,
|
||||
OtherMeasureData = x.OtherMeasureData,
|
||||
FristAddTaskNum =x.FristAddTaskNum,
|
||||
FristAddTaskNum = x.FristAddTaskNum,
|
||||
TableQuestionList = tableQuestion.Where(y => y.QuestionId == item.QuestionId && y.RowId == x.Id).ToList(),
|
||||
|
||||
}).ToList();
|
||||
@@ -169,20 +165,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
}
|
||||
|
||||
ReadingCalculateDto readingData = new ReadingCalculateDto()
|
||||
{
|
||||
SubjectId = visitTask.SubjectId,
|
||||
TaskBlindName = visitTask.TaskBlindName,
|
||||
IsConvertedTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync(),
|
||||
BeforeConvertedTaskId = visitTask.BeforeConvertedTaskId,
|
||||
VisitTaskId = visitTaskId,
|
||||
SubjectVisitId = visitTask.SourceSubjectVisitId!.Value,
|
||||
QuestionInfo = questionInfos,
|
||||
CriterionId = visitTask.TrialReadingCriterionId,
|
||||
TrialId = visitTask.TrialId,
|
||||
IsAnalysisCreate = visitTask.IsAnalysisCreate,
|
||||
IsSelfAnalysis = visitTask.IsSelfAnalysis,
|
||||
IsBaseLine = subjectVisit!.IsBaseLine,
|
||||
ReadingCalculateDto readingData = new ReadingCalculateDto()
|
||||
{
|
||||
SubjectId = visitTask.SubjectId,
|
||||
TaskBlindName = visitTask.TaskBlindName,
|
||||
IsConvertedTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync(),
|
||||
BeforeConvertedTaskId = visitTask.BeforeConvertedTaskId,
|
||||
VisitTaskId = visitTaskId,
|
||||
SubjectVisitId = visitTask.SourceSubjectVisitId!.Value,
|
||||
QuestionInfo = questionInfos,
|
||||
CriterionId = visitTask.TrialReadingCriterionId,
|
||||
TrialId = visitTask.TrialId,
|
||||
IsAnalysisCreate = visitTask.IsAnalysisCreate,
|
||||
IsSelfAnalysis = visitTask.IsSelfAnalysis,
|
||||
IsBaseLine = subjectVisit!.IsBaseLine,
|
||||
DoctorUserId = visitTask.DoctorUserId,
|
||||
TrialReadingCriterionId = visitTask.TrialReadingCriterionId,
|
||||
BaseLineTaskId = baseLinetaskId,
|
||||
@@ -190,7 +186,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
VisitName = subjectVisit.VisitName,
|
||||
BlindName = subjectVisit.BlindName,
|
||||
VisitTaskNum = visitTask.VisitTaskNum,
|
||||
DigitPlaces= criterionInfo.DigitPlaces??2,
|
||||
DigitPlaces = criterionInfo.DigitPlaces ?? 2,
|
||||
};
|
||||
|
||||
return readingData;
|
||||
@@ -207,9 +203,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
var originalTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
|
||||
var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == beforeConvertedTaskId &&x.ReadingQuestionTrial.QuestionType!=QuestionType.AdjustReason && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().AsNoTracking().ToListAsync();
|
||||
var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == beforeConvertedTaskId && x.ReadingQuestionTrial.QuestionType != QuestionType.AdjustReason && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().AsNoTracking().ToListAsync();
|
||||
|
||||
taskAnswer.ForEach(x => {
|
||||
taskAnswer.ForEach(x =>
|
||||
{
|
||||
|
||||
x.VisitTaskId = visitTaskId;
|
||||
|
||||
@@ -223,7 +220,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
x.VisitTaskId = visitTaskId;
|
||||
x.IsCurrentTaskAdd = false;
|
||||
x.FristAddTaskId = x.FristAddTaskId== beforeConvertedTaskId? visitTaskId : x.FristAddTaskId;
|
||||
x.FristAddTaskId = x.FristAddTaskId == beforeConvertedTaskId ? visitTaskId : x.FristAddTaskId;
|
||||
x.Id = NewId.NextGuid();
|
||||
});
|
||||
|
||||
@@ -295,7 +292,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
addrowInfo.ForEach(x =>
|
||||
{
|
||||
|
||||
|
||||
if (needRowIds.Contains(x.Id))
|
||||
{
|
||||
index++;
|
||||
@@ -303,11 +300,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
x.RowMark = otherLesionQuestion.OrderMark + x.RowIndex.GetLesionMark();
|
||||
var fristAddTaskId = x.FristAddTaskId.Clone();
|
||||
x.FromMark = fristAddTaskId == beforeConvertedTaskId ? string.Empty : x.RowMark;
|
||||
x.FristAddTaskId = fristAddTaskId == beforeConvertedTaskId? visitTaskId: fristAddTaskId;
|
||||
x.FristAddTaskId = fristAddTaskId == beforeConvertedTaskId ? visitTaskId : fristAddTaskId;
|
||||
x.QuestionId = otherLesionQuestion.Id;
|
||||
x.OrderMark = otherLesionQuestion.OrderMark;
|
||||
x.ReportMark = x.RowMark;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +344,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswer);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片报告任务List
|
||||
/// </summary>
|
||||
@@ -355,47 +352,47 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
public async Task<List<VisitTaskInfo>> GetReadingReportTaskList(Guid visitTaskId)
|
||||
{
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
|
||||
|
||||
var isAdditionalQuestionId = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == visitTaskInfo.TrialReadingCriterionId && x.IsAdditional).IgnoreQueryFilters().Select(x => x.Id).ToListAsync();
|
||||
|
||||
var taskquery = _visitTaskRepository
|
||||
.Where(x => (x.SubjectId == visitTaskInfo.SubjectId
|
||||
&& (x.TaskState == TaskState.Effect||x.TaskState==TaskState.Freeze)
|
||||
.Where(x => (x.SubjectId == visitTaskInfo.SubjectId
|
||||
&& (x.TaskState == TaskState.Effect || x.TaskState == TaskState.Freeze)
|
||||
&& x.IsAnalysisCreate == visitTaskInfo.IsAnalysisCreate
|
||||
&& x.DoctorUserId == visitTaskInfo.DoctorUserId
|
||||
&& x.IsSelfAnalysis == visitTaskInfo.IsSelfAnalysis
|
||||
&& x.VisitTaskNum <= visitTaskInfo.VisitTaskNum
|
||||
&& x.ArmEnum == visitTaskInfo.ArmEnum
|
||||
&& x.TrialReadingCriterionId == visitTaskInfo.TrialReadingCriterionId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && x.ReadingTaskState == ReadingTaskState.HaveSigned) ||x.Id == visitTaskId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && x.ReadingTaskState == ReadingTaskState.HaveSigned) || x.Id == visitTaskId
|
||||
);
|
||||
if(visitTaskInfo.ReadingTaskState==ReadingTaskState.HaveSigned)
|
||||
if (visitTaskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||
{
|
||||
taskquery = _visitTaskRepository.Where(x => visitTaskInfo.ReportRelatedTaskIdList.Contains(x.Id)||x.Id==visitTaskInfo.Id);
|
||||
taskquery = _visitTaskRepository.Where(x => visitTaskInfo.ReportRelatedTaskIdList.Contains(x.Id) || x.Id == visitTaskInfo.Id);
|
||||
}
|
||||
if (visitTaskInfo.TrialReadingCriterion.IsReadingTaskViewInOrder != ReadingOrder.InOrder)
|
||||
{
|
||||
taskquery = _visitTaskRepository.Where(x => x.Id == visitTaskInfo.Id);
|
||||
taskquery = _visitTaskRepository.Where(x => x.Id == visitTaskInfo.Id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var taskInfoList = await taskquery.OrderBy(x => x.VisitTaskNum).Select(x => new VisitTaskInfo()
|
||||
{
|
||||
BlindName = x.TaskBlindName,
|
||||
IsBaseLine = x.SourceSubjectVisit.IsBaseLine,
|
||||
VisitTaskId = x.Id,
|
||||
TaskState= x.TaskState,
|
||||
TaskState = x.TaskState,
|
||||
TaskName = x.TaskName,
|
||||
LatestScanDate= x.SourceSubjectVisit!=null?x.SourceSubjectVisit.LatestScanDate : null,
|
||||
LatestScanDate = x.SourceSubjectVisit != null ? x.SourceSubjectVisit.LatestScanDate : null,
|
||||
VisitTaskNum = x.VisitTaskNum,
|
||||
IsConvertedTask=x.IsConvertedTask,
|
||||
BeforeConvertedTaskId=x.BeforeConvertedTaskId,
|
||||
IsConvertedTask = x.IsConvertedTask,
|
||||
BeforeConvertedTaskId = x.BeforeConvertedTaskId,
|
||||
//CrterionDictionaryGroup = x.CrterionDictionaryGroup,
|
||||
IsCurrentTask = x.Id == visitTaskId,
|
||||
|
||||
}).OrderBy(x=>x.VisitTaskNum).ThenByDescending(x=>x.TaskState).ToListAsync();
|
||||
|
||||
}).OrderBy(x => x.VisitTaskNum).ThenByDescending(x => x.TaskState).ToListAsync();
|
||||
|
||||
|
||||
taskInfoList.ForEach(x =>
|
||||
@@ -407,7 +404,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var isHaveAdditionalTaskIds = await _readingTaskQuestionAnswerRepository.Where(x => taskIds.Contains(x.VisitTaskId) && isAdditionalQuestionId.Contains(x.ReadingQuestionTrialId)).Select(x => x.VisitTaskId).Distinct().ToListAsync();
|
||||
|
||||
taskInfoList.ForEach(x => {
|
||||
taskInfoList.ForEach(x =>
|
||||
{
|
||||
x.IsHaveAdditionalQuestion = isHaveAdditionalTaskIds.Contains(x.VisitTaskId);
|
||||
});
|
||||
return taskInfoList;
|
||||
|
||||
+45
-45
@@ -1,10 +1,9 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
[ApiExplorerSettings(GroupName = "Image")]
|
||||
@@ -121,59 +120,59 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
var service = await this.GetService(inDto.VisitTaskId);
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
var service = await this.GetService(inDto.VisitTaskId);
|
||||
|
||||
return await service.GetReadingCalculationData(inDto);
|
||||
}
|
||||
return await service.GetReadingCalculationData(inDto);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将上一次的访视病灶添加到这一次
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AddTaskLesionAnswerFromLastTaskOutDto> AddTaskLesionAnswerFromLastTask(AddTaskLesionAnswerFromLastTaskInDto inDto)
|
||||
/// <summary>
|
||||
/// 将上一次的访视病灶添加到这一次
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AddTaskLesionAnswerFromLastTaskOutDto> AddTaskLesionAnswerFromLastTask(AddTaskLesionAnswerFromLastTaskInDto inDto)
|
||||
{
|
||||
var service = await this.GetService(inDto.VisitTaskId);
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var result = new AddTaskLesionAnswerFromLastTaskOutDto();
|
||||
var readingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
if (service != null && visitTaskInfo.SourceSubjectVisitId != null)
|
||||
var result = new AddTaskLesionAnswerFromLastTaskOutDto();
|
||||
var readingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
if (service != null && visitTaskInfo.SourceSubjectVisitId != null)
|
||||
{
|
||||
if (readingTaskState == ReadingTaskState.WaitReading)
|
||||
{
|
||||
if (visitTaskInfo.ReadingCategory == ReadingCategory.Visit)
|
||||
{
|
||||
result = await service.AddTaskLesionAnswerFromLastTask(inDto);
|
||||
await service.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
IsChangeOtherTask = false,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
ComputationTrigger = ComputationTrigger.InitialCalculation,
|
||||
});
|
||||
}
|
||||
result = await service.AddTaskLesionAnswerFromLastTask(inDto);
|
||||
await service.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
IsChangeOtherTask = false,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
ComputationTrigger = ComputationTrigger.InitialCalculation,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (readingTaskState == ReadingTaskState.WaitReading)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
ReadingTaskState = ReadingTaskState.Reading,
|
||||
},true);
|
||||
}
|
||||
if (readingTaskState == ReadingTaskState.WaitReading)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
ReadingTaskState = ReadingTaskState.Reading,
|
||||
}, true);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取报告验证的信息(这里每个标准可能不一样 返回用object)
|
||||
@@ -213,7 +212,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
// 这里统一处理字典
|
||||
|
||||
Dictionary<Guid,List<CrterionDictionaryGroup>> dictionaryGroup = result.VisitTaskList.ToDictionary(x => x.VisitTaskId, x => x.CrterionDictionaryGroup);
|
||||
Dictionary<Guid, List<CrterionDictionaryGroup>> dictionaryGroup = result.VisitTaskList.ToDictionary(x => x.VisitTaskId, x => x.CrterionDictionaryGroup);
|
||||
|
||||
result.TaskQuestions.ForEach(y =>
|
||||
{
|
||||
@@ -245,13 +244,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
});
|
||||
|
||||
item.Childrens.ForEach(x => {
|
||||
item.Childrens.ForEach(x =>
|
||||
{
|
||||
|
||||
SetCrterionDictionaryGroup(x, dictionaryGroup);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -274,5 +274,5 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+384
-389
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,9 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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 Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -32,22 +24,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository,
|
||||
ILogger<IRECIST1Point1CalculateService> _logger) : BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
|
||||
/// <summary>
|
||||
/// 获取Sod的值
|
||||
@@ -98,23 +90,23 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||
{
|
||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||
var isConvertTask = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||
var isConvertTask = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||
{
|
||||
VisitTaskId = indto.VisitTaskId,
|
||||
IsConvertTask= isConvertTask,
|
||||
BeforeConvertedTaskId =visitTaskInfo.BeforeConvertedTaskId,
|
||||
});
|
||||
IsConvertTask = isConvertTask,
|
||||
BeforeConvertedTaskId = visitTaskInfo.BeforeConvertedTaskId,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
|
||||
|
||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId);
|
||||
|
||||
result.VisitTaskList = taskInfoList;
|
||||
@@ -122,12 +114,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||
|
||||
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId&&x.ShowQuestion!= ShowQuestion.Hide)
|
||||
.WhereIf(isConvertTask,x=>x.ConvertShowType==ConvertShowType.All||x.ConvertShowType==ConvertShowType.AfterShow)
|
||||
.WhereIf(!isConvertTask, x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.BeforeShow)
|
||||
.ToListAsync();
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId && x.ShowQuestion != ShowQuestion.Hide)
|
||||
.WhereIf(isConvertTask, x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.AfterShow)
|
||||
.WhereIf(!isConvertTask, x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.BeforeShow)
|
||||
.ToListAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
result.LesionCountList = tableAnsweRowInfos.GroupBy(x => x.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
@@ -135,7 +127,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Count = x.ToList().Count()
|
||||
}).ToList();
|
||||
|
||||
var lesionsIndexs = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).GroupBy(x => new { x.QuestionId }).Select(x => new lesionsIndexDto()
|
||||
var lesionsIndexs = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).GroupBy(x => new { x.QuestionId }).Select(x => new lesionsIndexDto()
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
Rowindexs = x.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList()
|
||||
@@ -144,14 +136,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
@@ -168,10 +160,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId=x.GroupId,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -182,8 +174,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
ReportLayType= ReportLayType.Group,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
@@ -191,12 +183,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId==item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -209,7 +201,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -221,17 +213,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer==null?string.Empty:answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -260,8 +252,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
}) ;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +268,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId=row.RowId,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
@@ -313,13 +305,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer= organInfo.TULOCEN;
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,7 +322,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -346,7 +338,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -406,7 +398,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
await ReadingCalculate(readingData, new List<QuestionType>() { type.Value });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -431,9 +423,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
public async Task<GetReportVerifyOutDto> GetReportVerify(GetReportVerifyInDto inDto)
|
||||
{
|
||||
return new GetReportVerifyOutDto()
|
||||
return new GetReportVerifyOutDto()
|
||||
{
|
||||
TumorEvaluate =string.Empty,
|
||||
TumorEvaluate = string.Empty,
|
||||
IsExistDisease = string.Empty,
|
||||
|
||||
};
|
||||
@@ -470,7 +462,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
// 总动脉粥样硬化体积(NTAV)
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.NTAV,GetDecimalNullFun=GetNTAV},
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -480,7 +472,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var calculate in calculateList)
|
||||
{
|
||||
@@ -489,57 +481,57 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item != null)
|
||||
{
|
||||
//计算答案
|
||||
|
||||
|
||||
#region 计算答案
|
||||
if (calculate.GetDecimalFun != null)
|
||||
{
|
||||
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
||||
|
||||
}
|
||||
else if (calculate.GetDecimalNullFun != null)
|
||||
{
|
||||
var value = await calculate.GetDecimalNullFun(inDto);
|
||||
item.Answer = value == null ? string.Empty : value.Value.ToString();
|
||||
}
|
||||
else if (calculate.GetStringFun != null)
|
||||
{
|
||||
item.Answer = await calculate.GetStringFun(inDto);
|
||||
}
|
||||
#endregion
|
||||
// 修改修约小数位数
|
||||
#region 计算答案
|
||||
if (calculate.GetDecimalFun != null)
|
||||
{
|
||||
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
||||
|
||||
List<ValueOfType?> valueOfTypes = new List<ValueOfType?>() {
|
||||
}
|
||||
else if (calculate.GetDecimalNullFun != null)
|
||||
{
|
||||
var value = await calculate.GetDecimalNullFun(inDto);
|
||||
item.Answer = value == null ? string.Empty : value.Value.ToString();
|
||||
}
|
||||
else if (calculate.GetStringFun != null)
|
||||
{
|
||||
item.Answer = await calculate.GetStringFun(inDto);
|
||||
}
|
||||
#endregion
|
||||
// 修改修约小数位数
|
||||
|
||||
List<ValueOfType?> valueOfTypes = new List<ValueOfType?>() {
|
||||
|
||||
ValueOfType.Decimals,
|
||||
ValueOfType.Percentage
|
||||
};
|
||||
|
||||
if (inDto.DigitPlaces != -1)
|
||||
if (inDto.DigitPlaces != -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
|
||||
if (valueOfTypes.Contains(item.ValueType))
|
||||
{
|
||||
|
||||
if (valueOfTypes.Contains(item.ValueType))
|
||||
{
|
||||
item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
|
||||
item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
catch (Exception)
|
||||
{
|
||||
Answer = item.Answer,
|
||||
ReadingQuestionTrialId = item.QuestionId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
ReadingQuestionTrialId = item.QuestionId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -589,7 +581,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
|
||||
|
||||
}
|
||||
@@ -641,7 +633,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
var eEMSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
|
||||
|
||||
if (eEMSum == 0)
|
||||
{
|
||||
return null;
|
||||
@@ -661,8 +653,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
var result = await GetNTAVEEMLumenSumOrRetraceImageCount(inDto);
|
||||
|
||||
var medianFrame= inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.MedianFrame).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
if (result == null|| medianFrame==0)
|
||||
var medianFrame = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.MedianFrame).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
if (result == null || medianFrame == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-8
@@ -1,11 +1,5 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
@@ -60,8 +54,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <returns></returns>
|
||||
|
||||
Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
+15
-20
@@ -1,26 +1,21 @@
|
||||
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);
|
||||
public interface ILuganoCalculateService
|
||||
{
|
||||
/// <summary>
|
||||
/// 计算靶病灶状态
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
Task CalculateTargetLesionStatus(CalculateTargetLesionStatusInDto inDto);
|
||||
|
||||
/// <summary>
|
||||
/// 计算靶病灶融合后状态
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
Task CalculateMergeTargetLesionStatus(CalculateTargetLesionStatusInDto inDto);
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算靶病灶融合后状态
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
Task CalculateMergeTargetLesionStatus(CalculateTargetLesionStatusInDto inDto);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-6
@@ -1,10 +1,5 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
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
|
||||
{
|
||||
@@ -59,5 +54,5 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <returns></returns>
|
||||
Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+375
-380
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,9 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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 Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -32,22 +24,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository,
|
||||
ILogger<IRECIST1Point1CalculateService> _logger) : BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
|
||||
/// <summary>
|
||||
/// 获取Sod的值
|
||||
@@ -98,23 +90,23 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||
{
|
||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||
var isConvertTask = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||
var isConvertTask = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||
{
|
||||
VisitTaskId = indto.VisitTaskId,
|
||||
IsConvertTask= isConvertTask,
|
||||
BeforeConvertedTaskId =visitTaskInfo.BeforeConvertedTaskId,
|
||||
});
|
||||
IsConvertTask = isConvertTask,
|
||||
BeforeConvertedTaskId = visitTaskInfo.BeforeConvertedTaskId,
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
|
||||
|
||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId);
|
||||
|
||||
result.VisitTaskList = taskInfoList;
|
||||
@@ -122,12 +114,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||
|
||||
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId&&x.ShowQuestion!= ShowQuestion.Hide)
|
||||
.WhereIf(isConvertTask,x=>x.ConvertShowType==ConvertShowType.All||x.ConvertShowType==ConvertShowType.AfterShow)
|
||||
.WhereIf(!isConvertTask, x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.BeforeShow)
|
||||
.ToListAsync();
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId && x.ShowQuestion != ShowQuestion.Hide)
|
||||
.WhereIf(isConvertTask, x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.AfterShow)
|
||||
.WhereIf(!isConvertTask, x => x.ConvertShowType == ConvertShowType.All || x.ConvertShowType == ConvertShowType.BeforeShow)
|
||||
.ToListAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
result.LesionCountList = tableAnsweRowInfos.GroupBy(x => x.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
@@ -135,7 +127,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Count = x.ToList().Count()
|
||||
}).ToList();
|
||||
|
||||
var lesionsIndexs = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).GroupBy(x => new { x.QuestionId }).Select(x => new lesionsIndexDto()
|
||||
var lesionsIndexs = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).GroupBy(x => new { x.QuestionId }).Select(x => new lesionsIndexDto()
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
Rowindexs = x.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList()
|
||||
@@ -144,14 +136,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
@@ -168,10 +160,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId=x.GroupId,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -182,8 +174,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
ReportLayType= ReportLayType.Group,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
@@ -191,12 +183,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId==item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -209,7 +201,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -221,17 +213,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer==null?string.Empty:answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -260,8 +252,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
}) ;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +268,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId=row.RowId,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
@@ -313,13 +305,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer= organInfo.TULOCEN;
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -330,7 +322,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -346,7 +338,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -407,7 +399,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
await ReadingCalculate(readingData, new List<QuestionType>() { type.Value });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -432,9 +424,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
public async Task<GetReportVerifyOutDto> GetReportVerify(GetReportVerifyInDto inDto)
|
||||
{
|
||||
return new GetReportVerifyOutDto()
|
||||
return new GetReportVerifyOutDto()
|
||||
{
|
||||
TumorEvaluate =string.Empty,
|
||||
TumorEvaluate = string.Empty,
|
||||
IsExistDisease = string.Empty,
|
||||
|
||||
};
|
||||
@@ -585,7 +577,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
public async Task<decimal?> GetAllMinFCT(ReadingCalculateDto inDto)
|
||||
{
|
||||
|
||||
|
||||
var allMinFCT = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
|
||||
.Where(x => x.QuestionMark == QuestionMark.MinFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).MinOrDefault();
|
||||
if (allMinFCT == 0)
|
||||
@@ -608,7 +600,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return allMinFCT.Average();;
|
||||
return allMinFCT.Average(); ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -30,33 +25,33 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository)
|
||||
: BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
|
||||
|
||||
private List<SiteVisitForTumor> siteVisitForTumorList;
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 删除病灶获取起始病灶序号
|
||||
/// <summary>
|
||||
/// 删除病灶获取起始病灶序号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<int> GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto)
|
||||
#region 删除病灶获取起始病灶序号
|
||||
/// <summary>
|
||||
/// 删除病灶获取起始病灶序号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<int> GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto)
|
||||
{
|
||||
var rowInfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).Include(x => x.ReadingQuestionTrial).FirstNotNullAsync();
|
||||
if (rowInfo.ReadingQuestionTrial.LesionType == LesionType.NewLesions)
|
||||
{
|
||||
var minIndex= await _readingTableAnswerRowInfoRepository.Where(x => x.QuestionId == rowInfo.QuestionId && x.VisitTaskId == inDto.VisitTaskId).OrderBy(x => x.RowIndex).Select(x=>x.RowIndex).FirstOrDefaultAsync();
|
||||
var minIndex = await _readingTableAnswerRowInfoRepository.Where(x => x.QuestionId == rowInfo.QuestionId && x.VisitTaskId == inDto.VisitTaskId).OrderBy(x => x.RowIndex).Select(x => x.RowIndex).FirstOrDefaultAsync();
|
||||
return (int)minIndex;
|
||||
}
|
||||
else
|
||||
@@ -64,7 +59,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -98,7 +93,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId && x.ShowQuestion != ShowQuestion.Hide)
|
||||
//.Where(x => x.LesionType != LesionType.BaselineLesions)
|
||||
.Where(x=>x.QuestionType!=QuestionType.TherapeuticEffectEvaluationGroup)
|
||||
.Where(x => x.QuestionType != QuestionType.TherapeuticEffectEvaluationGroup)
|
||||
.ToListAsync();
|
||||
|
||||
// 新病灶
|
||||
@@ -107,7 +102,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId))
|
||||
.Where(x => x.ReadingQuestionTrialId != questionNewLesions.Id||x.VisitTaskId== visitTaskInfo.Id)
|
||||
.Where(x => x.ReadingQuestionTrialId != questionNewLesions.Id || x.VisitTaskId == visitTaskInfo.Id)
|
||||
.ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId))
|
||||
.Where(x => x.QuestionId != questionNewLesions.Id || x.VisitTaskId == visitTaskInfo.Id)
|
||||
@@ -133,10 +128,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId=x.GroupId,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -146,9 +141,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType=ReportLayType.Group,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
@@ -157,10 +152,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
foreach (var item in questions)
|
||||
{
|
||||
// 问题
|
||||
item.Childrens = questionList.Where(x => x.GroupId==item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
@@ -175,7 +170,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -206,7 +201,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.OrderBy(x=>x.RowIndex).Select(x => new ReadingReportDto()
|
||||
question.Childrens = rowlist.OrderBy(x => x.RowIndex).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
@@ -215,9 +210,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
RowId =x.Id,
|
||||
RowId = x.Id,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
FristAddTaskNum= x.FristAddTaskNum,
|
||||
FristAddTaskNum = x.FristAddTaskNum,
|
||||
}).ToList();
|
||||
|
||||
|
||||
@@ -240,10 +235,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
RowId=row.RowId,
|
||||
RowId = row.RowId,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
FristAddTaskNum= row.FristAddTaskNum,
|
||||
FristAddTaskNum = row.FristAddTaskNum,
|
||||
}).ToList();
|
||||
|
||||
|
||||
@@ -366,7 +361,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId ==taskinfo.DoctorUserId &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
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();
|
||||
@@ -402,7 +397,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
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?>()
|
||||
@@ -428,13 +423,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
// 新病灶外层问题
|
||||
var newLesionQuestion = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.NewLesions && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
|
||||
// 既往病灶外层问题
|
||||
var alwaysNewLesionsQuestion = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.AlwaysNewLesions && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
|
||||
// 新病灶表格问题
|
||||
var newLesionTableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == newLesionQuestion.Id).ToListAsync();
|
||||
|
||||
|
||||
// 既往病灶表格问题
|
||||
var alwaysNewLesionsTableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == alwaysNewLesionsQuestion.Id).ToListAsync();
|
||||
|
||||
@@ -449,17 +444,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
);
|
||||
});
|
||||
|
||||
foreach (var item in tableRowAnswers.Where(x => x.QuestionId == newLesionQuestion.Id).OrderBy(x=>x.RowIndex))
|
||||
foreach (var item in tableRowAnswers.Where(x => x.QuestionId == newLesionQuestion.Id).OrderBy(x => x.RowIndex))
|
||||
{
|
||||
|
||||
|
||||
item.QuestionId = alwaysNewLesionsQuestion.Id;
|
||||
|
||||
|
||||
|
||||
foreach (var tableAnswer in tableAnswers.Where(y => y.RowId == item.Id))
|
||||
{
|
||||
tableAnswer.QuestionId = alwaysNewLesionsQuestion.Id;
|
||||
tableAnswer.TableQuestionId = alwaysTableQuestionIdDic[tableAnswer.TableQuestionId];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +465,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingCalculate_Abnormal"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
@@ -558,7 +553,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var calculate in calculateList)
|
||||
{
|
||||
@@ -572,7 +567,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
#region 计算答案
|
||||
|
||||
|
||||
|
||||
|
||||
switch (calculate.QuestionType)
|
||||
{
|
||||
@@ -581,7 +576,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
break;
|
||||
|
||||
case QuestionType.NewLesionsCount:
|
||||
|
||||
|
||||
if (inDto.VisitTaskNum >= 1)
|
||||
{
|
||||
item.Answer = (await calculate.GetIntFun(inDto)).ToString();
|
||||
@@ -592,7 +587,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
break;
|
||||
case QuestionType.AlwaysNewLesionsCount:
|
||||
if (inDto.VisitTaskNum >1)
|
||||
if (inDto.VisitTaskNum > 1)
|
||||
{
|
||||
item.Answer = (await calculate.GetIntFun(inDto)).ToString();
|
||||
}
|
||||
@@ -606,9 +601,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
item.Answer = (await calculate.GetIntFun(inDto)).ToString();
|
||||
|
||||
if (item.Answer=="-1")
|
||||
if (item.Answer == "-1")
|
||||
{
|
||||
item.Answer = nameof(YesOrNoOrNa.NA);
|
||||
item.Answer = nameof(YesOrNoOrNa.NA);
|
||||
}
|
||||
break;
|
||||
case QuestionType.DaysBetween:
|
||||
@@ -618,7 +613,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
item.Answer = await calculate.GetStringFun(inDto);
|
||||
break;
|
||||
default:
|
||||
item.Answer =string.Empty;
|
||||
item.Answer = string.Empty;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -635,13 +630,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
if (valueOfTypes.Contains(item.ValueType))
|
||||
{
|
||||
item.Answer = decimal.Round(decimal.Parse(item.Answer.IsNullOrEmpty() ? "0": item.Answer), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
item.Answer = decimal.Round(decimal.Parse(item.Answer.IsNullOrEmpty() ? "0" : item.Answer), inDto.DigitPlaces).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
{
|
||||
@@ -701,12 +696,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
.Sum(x => x.TableQuestionList.Where(y => y.QuestionMark == QuestionMark.LesionNumber).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0()));
|
||||
}
|
||||
catch
|
||||
catch
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -720,7 +715,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task<int> GetNewLesionsCount(ReadingCalculateDto inDto)
|
||||
{
|
||||
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList)
|
||||
.Where(x=>x.TableQuestionList.Any(y=>y.QuestionMark==QuestionMark.State&&y.Answer== EvaluationOfState.Exists.GetEnumInt()))
|
||||
.Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.State && y.Answer == EvaluationOfState.Exists.GetEnumInt()))
|
||||
.Count();
|
||||
}
|
||||
|
||||
@@ -756,7 +751,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var result = 0;
|
||||
var findindex = taskList.OrderBy(x => x.VisitTaskNum).ToList().FindIndex(x => x.VisitTaskId == inDto.VisitTaskId);
|
||||
|
||||
|
||||
|
||||
if (findindex < 3)
|
||||
{
|
||||
return -1;
|
||||
@@ -769,12 +764,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
result = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.AlwaysNewLesions).SelectMany(x => x.TableRowInfoList)
|
||||
.Where(x => x.FristAddTaskNum >= twoindex.VisitTaskNum && x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.State && y.Answer == EvaluationOfState.Exists.GetEnumInt())).Count();
|
||||
|
||||
//+ inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList)
|
||||
// .Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.State && y.Answer == EvaluationOfState.Exists.GetEnumInt()))
|
||||
// .Count();
|
||||
//+ inDto.QuestionInfo.Where(x => x.LesionType == LesionType.NewLesions).SelectMany(x => x.TableRowInfoList)
|
||||
// .Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.State && y.Answer == EvaluationOfState.Exists.GetEnumInt()))
|
||||
// .Count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
@@ -797,11 +792,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var taskList = await GetSiteVisitForTumorList(inDto);
|
||||
var lastTask = taskList.Where(x => x.VisitTaskNum < taskinfo.VisitTaskNum&&x.VisitTaskId!=inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var lastTask = taskList.Where(x => x.VisitTaskNum < taskinfo.VisitTaskNum && x.VisitTaskId != inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
if (lastTask != null)
|
||||
{
|
||||
var thisTask = taskList.FirstOrDefault();
|
||||
if (thisTask!=null&& thisTask.StudyTime != null && lastTask.StudyTime != null)
|
||||
if (thisTask != null && thisTask.StudyTime != null && lastTask.StudyTime != null)
|
||||
{
|
||||
return (int)Math.Floor((thisTask.StudyTime.Value - lastTask.StudyTime.Value).TotalDays);
|
||||
}
|
||||
@@ -810,7 +805,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -830,7 +825,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetSiteVisitForTumorEvaluation(ReadingCalculateDto inDto)
|
||||
{
|
||||
if(inDto.IsBaseLine)
|
||||
if (inDto.IsBaseLine)
|
||||
{
|
||||
return VisitTumorEvaluation.NA.GetEnumInt();
|
||||
}
|
||||
@@ -840,7 +835,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var isPD= await ChangeLastTaskSiteVisitForTumorEvaluation(inDto);
|
||||
var isPD = await ChangeLastTaskSiteVisitForTumorEvaluation(inDto);
|
||||
var newLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
var baseLineLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.BaseLineLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
var alwaysNewLesionsCount = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.AlwaysNewLesionsCount).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
|
||||
@@ -848,7 +843,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (isPD)
|
||||
{
|
||||
return VisitTumorEvaluation.PD.GetEnumInt();
|
||||
}else if (newLesionsCount == 0 &&
|
||||
}
|
||||
else if (newLesionsCount == 0 &&
|
||||
baseLineLesionsCount == 0 &&
|
||||
alwaysNewLesionsCount == 0)
|
||||
{
|
||||
@@ -868,8 +864,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task<bool> ChangeLastTaskSiteVisitForTumorEvaluation(ReadingCalculateDto inDto)
|
||||
{
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var taskList =await GetSiteVisitForTumorList(inDto);
|
||||
var lastTask = taskList.Where(x => x.VisitTaskNum < taskinfo.VisitTaskNum&&x.VisitTaskId!=inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var taskList = await GetSiteVisitForTumorList(inDto);
|
||||
var lastTask = taskList.Where(x => x.VisitTaskNum < taskinfo.VisitTaskNum && x.VisitTaskId != inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var baseLineTask = taskList.OrderBy(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var newLesionsCountQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.NewLesionsCount).Select(x => x.QuestionId).FirstOrDefault();
|
||||
@@ -884,7 +880,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
|
||||
var firstVisit = taskList.FirstOrDefault();
|
||||
if (baseLineTask!=null&&baseLineTask.StudyTime != null)
|
||||
if (baseLineTask != null && baseLineTask.StudyTime != null)
|
||||
{
|
||||
//基线后第二个访视(应满足访视间隔6周以上,否则顺延)
|
||||
var secondVisit = taskList.Where(x => x.VisitTaskNum >= 2 && x.StudyTime >= baseLineTask.StudyTime.Value.AddDays(42)).FirstOrDefault();
|
||||
@@ -920,22 +916,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var thisVisitTask = taskList.LastOrDefault();
|
||||
|
||||
if (thisVisitTask!=null &&thisVisitTask.StudyTime!=null&&lastTask.StudyTime!=null&&
|
||||
|
||||
|
||||
if (thisVisitTask != null && thisVisitTask.StudyTime != null && lastTask.StudyTime != null &&
|
||||
|
||||
|
||||
lastTasknewLesionsCount >= 2 && thisVisitTaskNewLesionsCount >= 2 && lastTask.StudyTime.Value.AddDays(42) <= thisVisitTask.StudyTime)
|
||||
{
|
||||
isPDResult = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (isPDResult)
|
||||
{
|
||||
var visitForTumorEvaluationQuestionId = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.SiteVisitForTumorEvaluation).Select(x => x.QuestionId).FirstOrDefault();
|
||||
|
||||
if(lastTask!=null)
|
||||
|
||||
if (lastTask != null)
|
||||
{
|
||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == lastTask.VisitTaskId && x.ReadingQuestionTrialId == visitForTumorEvaluationQuestionId, x => new ReadingTaskQuestionAnswer
|
||||
{
|
||||
@@ -964,14 +960,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
siteVisitForTumorList = await _visitTaskRepository.Where(x => (x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.DoctorUserId== taskinfo.DoctorUserId&&
|
||||
x.IsAnalysisCreate==inDto.IsAnalysisCreate&&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsAnalysisCreate == inDto.IsAnalysisCreate &&
|
||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum <= taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
||||
)||x.Id== inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).Select(x => new SiteVisitForTumor()
|
||||
) || x.Id == inDto.VisitTaskId).OrderByDescending(x => x.VisitTaskNum).Select(x => new SiteVisitForTumor()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
VisitTaskNum = x.VisitTaskNum,
|
||||
SubjectVisitId=x.SourceSubjectVisitId,
|
||||
SubjectVisitId = x.SourceSubjectVisitId,
|
||||
}).ToListAsync();
|
||||
|
||||
var visitIds = siteVisitForTumorList.Select(x => x.SubjectVisitId).ToList();
|
||||
@@ -984,9 +980,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}).ToListAsync();
|
||||
|
||||
visitStudies.AddRange(
|
||||
await _noneDicomStudyRepository.Where(x => visitIds.Contains(x.SubjectVisitId)&&x.Modality== "BoneScan").Select(x => new VisitStudyTime() {
|
||||
SubjectVisitId = x.SubjectVisitId,
|
||||
StudyTime = x.ImageDate
|
||||
await _noneDicomStudyRepository.Where(x => visitIds.Contains(x.SubjectVisitId) && x.Modality == "BoneScan").Select(x => new VisitStudyTime()
|
||||
{
|
||||
SubjectVisitId = x.SubjectVisitId,
|
||||
StudyTime = x.ImageDate
|
||||
|
||||
}).ToListAsync()
|
||||
);
|
||||
@@ -1008,8 +1005,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
public async Task<GetReportVerifyOutDto> GetReportVerify(GetReportVerifyInDto inDto)
|
||||
{
|
||||
return new GetReportVerifyOutDto() {
|
||||
|
||||
return new GetReportVerifyOutDto()
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1037,7 +1035,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
string errorMassage = string.Empty;
|
||||
|
||||
var rowAnswerList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId &&x.ReadingQuestionTrial.LesionType!=LesionType.BaselineLesions&& (x.MeasureData == string.Empty || x.MeasureData == null))
|
||||
var rowAnswerList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.ReadingQuestionTrial.LesionType != LesionType.BaselineLesions && (x.MeasureData == string.Empty || x.MeasureData == null))
|
||||
.Select(x => new
|
||||
{
|
||||
x.ReadingQuestionTrial.OrderMark,
|
||||
@@ -1065,7 +1063,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
if (measureDataList.Count() > 0)
|
||||
{
|
||||
errorMassage += _localizer["ReadingCalculate_NoMarker", string.Join(',', measureDataList)]+",";
|
||||
errorMassage += _localizer["ReadingCalculate_NoMarker", string.Join(',', measureDataList)] + ",";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -30,22 +25,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository)
|
||||
: BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
|
||||
/// <summary>
|
||||
/// 获取Sod的值
|
||||
@@ -96,21 +91,21 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId && x.ShowQuestion != ShowQuestion.Hide).ToListAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
result.LesionCountList = tableAnsweRowInfos.GroupBy(x => x.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
LesionType = x.Key!.Value,
|
||||
Count = x.ToList().Count()
|
||||
}).ToList();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
result.LesionCountList = tableAnsweRowInfos.GroupBy(x => x.LesionType).Select(x => new LesionDto
|
||||
{
|
||||
LesionType = x.Key!.Value,
|
||||
Count = x.ToList().Count()
|
||||
}).ToList();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
@@ -127,10 +122,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId=x.GroupId,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -141,21 +136,21 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
ReportLayType= ReportLayType.Group,
|
||||
HighlightAnswer=x.HighlightAnswer,
|
||||
HighlightAnswerList=x.HighlightAnswerList,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId==item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -168,7 +163,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -180,17 +175,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer==null?string.Empty:answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -225,7 +220,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId=row.RowId,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
@@ -262,13 +257,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer= organInfo.TULOCEN;
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -279,7 +274,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -295,7 +290,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,7 +340,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
||||
{
|
||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||
await ReadingCalculate(readingData,new List<QuestionType>() { type});
|
||||
await ReadingCalculate(readingData, new List<QuestionType>() { type });
|
||||
}
|
||||
|
||||
|
||||
@@ -385,7 +380,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="calculateType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType>? calculateType=null)
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||
{
|
||||
|
||||
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
||||
@@ -458,7 +453,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList();
|
||||
|
||||
|
||||
var isNeedDeleteIds = inDto.QuestionInfo.Where(x =>x.QuestionType!=null&& isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
|
||||
var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer
|
||||
{
|
||||
@@ -470,7 +465,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -524,7 +519,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
else
|
||||
|
||||
{
|
||||
item.Answer = value==null?string.Empty: value.Value.ToString();
|
||||
item.Answer = value == null ? string.Empty : value.Value.ToString();
|
||||
}
|
||||
}
|
||||
else if (calculate.GetStringFun != null)
|
||||
@@ -556,7 +551,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
@@ -692,7 +687,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 将上一次的访视病灶添加到这一次
|
||||
|
||||
@@ -718,9 +713,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate== taskinfo.IsAnalysisCreate&&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis== taskinfo.IsSelfAnalysis &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
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();
|
||||
|
||||
@@ -748,7 +743,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
x.SeriesId = null;
|
||||
x.InstanceId = null;
|
||||
x.MeasureData = string.Empty;
|
||||
x.PicturePath= string.Empty;
|
||||
x.PicturePath = string.Empty;
|
||||
});
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
@@ -778,20 +773,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var addList= _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
|
||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
|
||||
addList.ForEach(x =>
|
||||
{
|
||||
x.MergeRow = null;
|
||||
x.SplitRow = null;
|
||||
addList.ForEach(x =>
|
||||
{
|
||||
x.MergeRow = null;
|
||||
x.SplitRow = null;
|
||||
|
||||
});
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
});
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1224,7 +1219,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
// 找到所有访视任务的Id
|
||||
|
||||
var visitTaskIds = await _visitTaskRepository.Where(x => x.IsAnalysisCreate == inDto.IsAnalysisCreate &&
|
||||
var visitTaskIds = await _visitTaskRepository.Where(x => x.IsAnalysisCreate == inDto.IsAnalysisCreate &&
|
||||
x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == inDto.calculateDto.TrialReadingCriterionId &&
|
||||
x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == inDto.calculateDto.ArmEnum).Select(x => x.Id).ToListAsync();
|
||||
@@ -1267,7 +1262,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
private async Task<decimal> GetBaseLineSOD(ReadingCalculateDto inDto)
|
||||
{
|
||||
if (await _visitTaskRepository.AnyAsync(x => x.Id == inDto.VisitTaskId && x.SourceSubjectVisit.IsBaseLine && x.IsAnalysisCreate==inDto.IsAnalysisCreate && x.ArmEnum == inDto.ArmEnum))
|
||||
if (await _visitTaskRepository.AnyAsync(x => x.Id == inDto.VisitTaskId && x.SourceSubjectVisit.IsBaseLine && x.IsAnalysisCreate == inDto.IsAnalysisCreate && x.ArmEnum == inDto.ArmEnum))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1276,9 +1271,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var baseLineTaskId = await _visitTaskRepository.Where(x => x.SubjectId == inDto.SubjectId && x.ReadingCategory == ReadingCategory.Visit
|
||||
&& x.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
|
||||
|
||||
x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect &&
|
||||
x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect &&
|
||||
x.IsAnalysisCreate == inDto.IsAnalysisCreate
|
||||
&&x.DoctorUserId==inDto.DoctorUserId
|
||||
&& x.DoctorUserId == inDto.DoctorUserId
|
||||
&& x.IsSelfAnalysis == inDto.IsSelfAnalysis && x.ArmEnum == inDto.ArmEnum)
|
||||
.Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
@@ -1328,7 +1323,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
visitTaskAnswerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId != inDto.VisitTaskId && x.VisitTask.ReadingCategory == ReadingCategory.Visit
|
||||
&& x.VisitTask.IsAnalysisCreate == inDto.IsAnalysisCreate
|
||||
&& x.VisitTask.IsSelfAnalysis == inDto.IsSelfAnalysis
|
||||
&&x.VisitTask.VisitTaskNum<inDto.VisitTaskNum
|
||||
&& x.VisitTask.VisitTaskNum < inDto.VisitTaskNum
|
||||
&& x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId
|
||||
&& x.SubjectId == inDto.SubjectId && x.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTask.ArmEnum == inDto.ArmEnum && x.VisitTask.TaskState == TaskState.Effect && x.ReadingQuestionTrial.QuestionType == QuestionType.SOD)
|
||||
.Select(x => new VisitTaskAnswerInfo
|
||||
@@ -1347,7 +1342,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
visitTaskAnswerList.Add(new VisitTaskAnswerInfo()
|
||||
{
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
BlindName=inDto.TaskBlindName,
|
||||
BlindName = inDto.TaskBlindName,
|
||||
QuestionId = visitTaskAnswerList[0].QuestionId,
|
||||
VisitName = inDto.VisitName,
|
||||
SOD = (await GetSODData(inDto)).ToString().IsNullOrEmptyReturn0(),
|
||||
@@ -1379,7 +1374,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
x.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.IsAnalysisCreate == inDto.IsAnalysisCreate
|
||||
&& x.SourceSubjectVisitId == lastVisitId && x.ArmEnum==inDto.ArmEnum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
&& x.SourceSubjectVisitId == lastVisitId && x.ArmEnum == inDto.ArmEnum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
return LastVisitTaskId;
|
||||
}
|
||||
@@ -1535,7 +1530,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes)))
|
||||
{
|
||||
// 淋巴结非靶病灶状态全部为消失
|
||||
resultData.NonTargetStateIsLoss = resultData.NonTargetStateIsLoss&& item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Answer).FirstOrDefault()== NoTargetState.Loss.GetEnumInt();
|
||||
resultData.NonTargetStateIsLoss = resultData.NonTargetStateIsLoss && item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Answer).FirstOrDefault() == NoTargetState.Loss.GetEnumInt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1545,10 +1540,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes)))
|
||||
{
|
||||
// 淋巴结的短径
|
||||
resultData.DiameterLessThan10 = resultData.DiameterLessThan10&&(item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() < 10;
|
||||
resultData.DiameterLessThan10 = resultData.DiameterLessThan10 && (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() < 10;
|
||||
|
||||
var shortIsBigger10 = (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() >= 10;
|
||||
resultData.CurrenShortBigger10= resultData.CurrenShortBigger10|| shortIsBigger10;
|
||||
resultData.CurrenShortBigger10 = resultData.CurrenShortBigger10 || shortIsBigger10;
|
||||
|
||||
if (shortIsBigger10)
|
||||
{
|
||||
@@ -1561,7 +1556,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && !x.Answer.EqEnum(YesOrNoOrNa.Yes)))
|
||||
{
|
||||
// 当前访视点非淋巴结病灶至少一个非淋巴结靶病灶的长径
|
||||
resultData.CurrentMajoreBigger0 = resultData.CurrentMajoreBigger0|| (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() > 0;
|
||||
resultData.CurrentMajoreBigger0 = resultData.CurrentMajoreBigger0 || (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1626,7 +1621,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
//if (当前访视点淋巴结病灶,至少一个淋巴结靶病灶短径≥10 mm 并且该淋巴结靶病灶短径绝对增加值≥5 mm)
|
||||
// 换句话说 就是 短径≥10 的病灶 和 短径增加值≥5的病灶 的交集数量大于0
|
||||
if (resultData.ShortBigger10Indexs.Intersect(resultData.AddFiveIndexs).ToList().Count()>0)
|
||||
if (resultData.ShortBigger10Indexs.Intersect(resultData.AddFiveIndexs).ToList().Count() > 0)
|
||||
{
|
||||
//靶病灶疗效为 PD
|
||||
result = TargetAssessment.PD;
|
||||
@@ -1740,11 +1735,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
result = NoTargetAssessment.NN;
|
||||
}
|
||||
//所有单个病灶/病灶组状态评估状态为“消失”
|
||||
else if (tableQuestions.Count(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Loss))== tableQuestions.Count(x=> x.QuestionMark == QuestionMark.State) && tableQuestions.Count(x => x.QuestionMark == QuestionMark.State)>0)
|
||||
else if (tableQuestions.Count(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Loss)) == tableQuestions.Count(x => x.QuestionMark == QuestionMark.State) && tableQuestions.Count(x => x.QuestionMark == QuestionMark.State) > 0)
|
||||
{
|
||||
result = NoTargetAssessment.CR;
|
||||
}
|
||||
|
||||
|
||||
// 基线时没有非靶病灶
|
||||
else if (tableQuestions.Count() == 0)
|
||||
{
|
||||
@@ -1800,7 +1795,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
result = NewLesionAssessment.Suspected;
|
||||
}
|
||||
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
result = NewLesionAssessment.No;
|
||||
|
||||
+71
-76
@@ -1,15 +1,10 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -30,22 +25,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository)
|
||||
: BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
#region 临时对象 单个请求的生命周期 避免重复查询数据库
|
||||
|
||||
private List<VisitTaskAnswerInfo> visitTaskAnswerList;
|
||||
|
||||
/// <summary>
|
||||
/// 获取Sod的值
|
||||
@@ -99,14 +94,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
@@ -123,10 +118,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId=x.GroupId,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -137,8 +132,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
ReportLayType= ReportLayType.Group,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
@@ -146,12 +141,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId==item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
@@ -164,7 +159,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -176,17 +171,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer==null?string.Empty:answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -221,7 +216,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId=row.RowId,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
@@ -258,13 +253,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer= organInfo.TULOCEN;
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -275,7 +270,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -291,7 +286,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -341,7 +336,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
||||
{
|
||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||
await ReadingCalculate(readingData,new List<QuestionType>() { type});
|
||||
await ReadingCalculate(readingData, new List<QuestionType>() { type });
|
||||
}
|
||||
|
||||
|
||||
@@ -381,7 +376,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="calculateType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto,List<QuestionType>? calculateType=null)
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||
{
|
||||
|
||||
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
|
||||
@@ -454,7 +449,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var isNeedDeleteTypes = calculateList.Where(x => !questionTypes.Contains(x.QuestionType)).Select(x => x.QuestionType).ToList();
|
||||
|
||||
|
||||
var isNeedDeleteIds = inDto.QuestionInfo.Where(x =>x.QuestionType!=null&& isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
|
||||
var isNeedDeleteIds = inDto.QuestionInfo.Where(x => x.QuestionType != null && isNeedDeleteTypes.Contains(x.QuestionType.Value)).Select(x => x.QuestionId).ToList();
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && isNeedDeleteIds.Contains(x.ReadingQuestionTrialId), x => new ReadingTaskQuestionAnswer
|
||||
{
|
||||
@@ -466,7 +461,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
calculateList = calculateList.Where(x => questionTypes.Contains(x.QuestionType)).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -520,7 +515,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
else
|
||||
|
||||
{
|
||||
item.Answer = value==null?string.Empty: value.ToString();
|
||||
item.Answer = value == null ? string.Empty : value.ToString();
|
||||
}
|
||||
}
|
||||
else if (calculate.GetStringFun != null)
|
||||
@@ -552,7 +547,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
@@ -698,7 +693,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 将上一次的访视病灶添加到这一次
|
||||
|
||||
@@ -724,9 +719,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate== taskinfo.IsAnalysisCreate&&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis== taskinfo.IsSelfAnalysis &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
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();
|
||||
|
||||
@@ -754,7 +749,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
x.SeriesId = null;
|
||||
x.InstanceId = null;
|
||||
x.MeasureData = string.Empty;
|
||||
x.PicturePath= string.Empty;
|
||||
x.PicturePath = string.Empty;
|
||||
});
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
@@ -784,10 +779,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var addList= _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
|
||||
var addList = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addList);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
@@ -1223,7 +1218,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
// 找到所有访视任务的Id
|
||||
|
||||
var visitTaskIds = await _visitTaskRepository.Where(x => x.IsAnalysisCreate == inDto.IsAnalysisCreate &&
|
||||
var visitTaskIds = await _visitTaskRepository.Where(x => x.IsAnalysisCreate == inDto.IsAnalysisCreate &&
|
||||
x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == inDto.calculateDto.TrialReadingCriterionId &&
|
||||
x.TaskState == TaskState.Effect && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ArmEnum == inDto.calculateDto.ArmEnum).Select(x => x.Id).ToListAsync();
|
||||
@@ -1266,7 +1261,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
/// <returns></returns>
|
||||
private async Task<decimal> GetBaseLineSOD(ReadingCalculateDto inDto)
|
||||
{
|
||||
if (await _visitTaskRepository.AnyAsync(x => x.Id == inDto.VisitTaskId && x.SourceSubjectVisit.IsBaseLine && x.IsAnalysisCreate==inDto.IsAnalysisCreate && x.ArmEnum == inDto.ArmEnum))
|
||||
if (await _visitTaskRepository.AnyAsync(x => x.Id == inDto.VisitTaskId && x.SourceSubjectVisit.IsBaseLine && x.IsAnalysisCreate == inDto.IsAnalysisCreate && x.ArmEnum == inDto.ArmEnum))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1275,9 +1270,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
var baseLineTaskId = await _visitTaskRepository.Where(x => x.SubjectId == inDto.SubjectId && x.ReadingCategory == ReadingCategory.Visit
|
||||
&& x.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
|
||||
|
||||
x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect &&
|
||||
x.SourceSubjectVisit.IsBaseLine && x.TaskState == TaskState.Effect &&
|
||||
x.IsAnalysisCreate == inDto.IsAnalysisCreate
|
||||
&&x.DoctorUserId==inDto.DoctorUserId
|
||||
&& x.DoctorUserId == inDto.DoctorUserId
|
||||
&& x.IsSelfAnalysis == inDto.IsSelfAnalysis && x.ArmEnum == inDto.ArmEnum)
|
||||
.Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
@@ -1328,7 +1323,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
&& x.VisitTask.IsAnalysisCreate == inDto.IsAnalysisCreate
|
||||
&& x.VisitTask.IsSelfAnalysis == inDto.IsSelfAnalysis
|
||||
&& x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId
|
||||
&& x.VisitTask.VisitTaskNum<inDto.VisitTaskNum
|
||||
&& x.VisitTask.VisitTaskNum < inDto.VisitTaskNum
|
||||
&& x.SubjectId == inDto.SubjectId && x.VisitTask.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTask.ArmEnum == inDto.ArmEnum && x.VisitTask.TaskState == TaskState.Effect && x.ReadingQuestionTrial.QuestionType == QuestionType.SOD)
|
||||
.Select(x => new VisitTaskAnswerInfo
|
||||
{
|
||||
@@ -1346,7 +1341,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
visitTaskAnswerList.Add(new VisitTaskAnswerInfo()
|
||||
{
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
BlindName=inDto.TaskBlindName,
|
||||
BlindName = inDto.TaskBlindName,
|
||||
QuestionId = visitTaskAnswerList[0].QuestionId,
|
||||
VisitName = inDto.VisitName,
|
||||
SOD = (await GetSODData(inDto)).ToString().IsNullOrEmptyReturn0(),
|
||||
@@ -1378,7 +1373,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
x.TrialReadingCriterionId == inDto.TrialReadingCriterionId &&
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.IsAnalysisCreate == inDto.IsAnalysisCreate
|
||||
&& x.SourceSubjectVisitId == lastVisitId && x.ArmEnum==inDto.ArmEnum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
&& x.SourceSubjectVisitId == lastVisitId && x.ArmEnum == inDto.ArmEnum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
return LastVisitTaskId;
|
||||
}
|
||||
@@ -1468,7 +1463,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
PresentSod = (await GetSODData(inDto)) ?? 0,
|
||||
|
||||
//非淋巴结靶病灶长径之和 decimal
|
||||
SumOfDiameter = (await GetSumOfDiameter(inDto))??0,
|
||||
SumOfDiameter = (await GetSumOfDiameter(inDto)) ?? 0,
|
||||
|
||||
//所有淋巴结靶病灶的短径小于10mm bool
|
||||
DiameterLessThan10 = true,
|
||||
@@ -1528,7 +1523,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes)))
|
||||
{
|
||||
// 淋巴结非靶病灶状态全部为消失
|
||||
resultData.NonTargetStateIsLoss = resultData.NonTargetStateIsLoss&& item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Answer).FirstOrDefault()== NoTargetState.Loss.GetEnumInt();
|
||||
resultData.NonTargetStateIsLoss = resultData.NonTargetStateIsLoss && item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.State).Select(x => x.Answer).FirstOrDefault() == NoTargetState.Loss.GetEnumInt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1538,10 +1533,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && x.Answer.EqEnum(YesOrNoOrNa.Yes)))
|
||||
{
|
||||
// 淋巴结的短径
|
||||
resultData.DiameterLessThan10 = resultData.DiameterLessThan10&&(item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() < 10;
|
||||
resultData.DiameterLessThan10 = resultData.DiameterLessThan10 && (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() < 10;
|
||||
|
||||
var shortIsBigger10 = (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.ShortAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() >= 10;
|
||||
resultData.CurrenShortBigger10= resultData.CurrenShortBigger10|| shortIsBigger10;
|
||||
resultData.CurrenShortBigger10 = resultData.CurrenShortBigger10 || shortIsBigger10;
|
||||
|
||||
if (shortIsBigger10)
|
||||
{
|
||||
@@ -1554,7 +1549,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
if (item.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsLymph && !x.Answer.EqEnum(YesOrNoOrNa.Yes)))
|
||||
{
|
||||
// 当前访视点非淋巴结病灶至少一个非淋巴结靶病灶的长径
|
||||
resultData.CurrentMajoreBigger0 = resultData.CurrentMajoreBigger0|| (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() > 0;
|
||||
resultData.CurrentMajoreBigger0 = resultData.CurrentMajoreBigger0 || (item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MajorAxis).Select(x => x.Answer).FirstOrDefault()).IsNullOrEmptyReturn0() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1727,11 +1722,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
result = NoTargetAssessment.NN;
|
||||
}
|
||||
//所有单个病灶/病灶组状态评估状态为“消失”
|
||||
else if (tableQuestions.Count(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Loss))== tableQuestions.Count(x=> x.QuestionMark == QuestionMark.State) && tableQuestions.Count(x => x.QuestionMark == QuestionMark.State)>0)
|
||||
else if (tableQuestions.Count(x => x.QuestionMark == QuestionMark.State && x.Answer.EqEnum(NoTargetState.Loss)) == tableQuestions.Count(x => x.QuestionMark == QuestionMark.State) && tableQuestions.Count(x => x.QuestionMark == QuestionMark.State) > 0)
|
||||
{
|
||||
result = NoTargetAssessment.CR;
|
||||
}
|
||||
|
||||
|
||||
// 基线时没有非靶病灶
|
||||
else if (tableQuestions.Count() == 0)
|
||||
{
|
||||
@@ -1787,7 +1782,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
result = NewLesionAssessment.Suspected;
|
||||
}
|
||||
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
result = NewLesionAssessment.No;
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
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.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
@@ -31,28 +25,28 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository)
|
||||
: BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
|
||||
private List<SiteVisitForTumor> siteVisitForTumorList = new List<SiteVisitForTumor>() ;
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
private List<SiteVisitForTumor> siteVisitForTumorList = new List<SiteVisitForTumor>();
|
||||
|
||||
#region 删除病灶获取起始病灶序号
|
||||
/// <summary>
|
||||
/// 删除病灶获取起始病灶序号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<int> GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto)
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 删除病灶获取起始病灶序号
|
||||
/// <summary>
|
||||
/// 删除病灶获取起始病灶序号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<int> GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto)
|
||||
{
|
||||
return 1;
|
||||
|
||||
@@ -101,14 +95,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
@@ -127,22 +121,22 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId=x.GroupId,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupId = x.GroupId,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionType = x.QuestionType,
|
||||
DataSource= x.DataSource,
|
||||
DataSource = x.DataSource,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
LimitEdit= x.LimitEdit,
|
||||
MaxAnswerLength=x.MaxAnswerLength,
|
||||
FileType=x.FileType,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -151,7 +145,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId==item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.Id,
|
||||
@@ -160,10 +154,10 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
LesionType = x.LesionType,
|
||||
DataSource = x.DataSource,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
GroupEnName=x.GroupEnName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength=x.MaxAnswerLength,
|
||||
FileType=x.FileType,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
@@ -172,7 +166,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
@@ -184,15 +178,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
@@ -215,17 +209,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo!=null? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName):string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType):null,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition):false,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
@@ -240,18 +234,18 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength=x.MaxAnswerLength,
|
||||
FileType=x.FileType,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
RowId=row.RowId,
|
||||
RowId = row.RowId,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit=x.CustomUnit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
@@ -363,11 +357,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
var visitTaskId = inDto.VisitTaskId;
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
var isReadingTaskViewInOrder =await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync();
|
||||
var isReadingTaskViewInOrder = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync();
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
// 判断当前任务是否是基线
|
||||
if (taskinfo.SourceSubjectVisitId != baseLineVisitId&& isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
if (taskinfo.SourceSubjectVisitId != baseLineVisitId && isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
// 判断当前任务是是否有表格问题答案
|
||||
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||
@@ -383,7 +377,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
|
||||
|
||||
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId&&x.ReadingQuestionTrial.IsCopyLesions).Select(x => new CopyTableAnswerDto()
|
||||
var copyTableAnswers = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.ReadingQuestionTrial.IsCopyLesions).Select(x => new CopyTableAnswerDto()
|
||||
{
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.QuestionId,
|
||||
@@ -391,11 +385,11 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
QuestionMark = x.ReadingTableQuestionTrial.QuestionMark,
|
||||
TableQuestionId = x.TableQuestionId,
|
||||
RowIndex = x.RowIndex,
|
||||
IsCopy=x.ReadingTableQuestionTrial.IsCopy,
|
||||
IsCopy = x.ReadingTableQuestionTrial.IsCopy,
|
||||
TrialId = x.TrialId,
|
||||
}).ToListAsync();
|
||||
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId&&x.ReadingQuestionTrial.IsCopyLesions).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.ReadingQuestionTrial.IsCopyLesions).ProjectTo<CopyTableAnswerRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
@@ -416,12 +410,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
Answer = x.IsCopy ? x.Answer:string.Empty ,
|
||||
Answer = x.IsCopy ? x.Answer : string.Empty,
|
||||
QuestionId = x.QuestionId,
|
||||
RowIndex = x.RowIndex,
|
||||
RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault(),
|
||||
@@ -488,27 +482,28 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
//var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == inDto.CriterionId && x.CustomCalculateMark != null).ToListAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<GetReportVerifyOutDto> GetReportVerify(GetReportVerifyInDto inDto)
|
||||
{
|
||||
return new GetReportVerifyOutDto() {
|
||||
|
||||
return new GetReportVerifyOutDto()
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public async Task VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user