|
|
@ -133,12 +133,12 @@ namespace IRaCIS.Application.Services
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
/// <param name="inDto"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
public async Task<(List<TrialAdditionaQuestion>,bool)> GetTaskAdditionalQuestion(GetTaskAdditionalQuestionInDto inDto)
|
|
|
|
public async Task<(List<TrialAdditionaQuestion>, bool)> GetTaskAdditionalQuestion(GetTaskAdditionalQuestionInDto inDto)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).IgnoreAutoIncludes().ToListAsync();
|
|
|
|
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).IgnoreAutoIncludes().ToListAsync();
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => inDto.VisitTaskId == x.Id).FirstNotNullAsync();
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => inDto.VisitTaskId == x.Id).FirstNotNullAsync();
|
|
|
|
var result= await _readingQuestionTrialRepository.Where(x => x.IsAdditional && x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId).IgnoreAutoIncludes().IgnoreQueryFilters().ProjectTo<TrialAdditionaQuestion>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
var result = await _readingQuestionTrialRepository.Where(x => x.IsAdditional && x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId).IgnoreAutoIncludes().IgnoreQueryFilters().ProjectTo<TrialAdditionaQuestion>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
result.ForEach(x =>
|
|
|
|
result.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -223,7 +223,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
relatedIds = JsonConvert.DeserializeObject<List<Guid>>(item.RelatedVisitTaskIds)?? new List<Guid>();
|
|
|
|
relatedIds = JsonConvert.DeserializeObject<List<Guid>>(item.RelatedVisitTaskIds) ?? new List<Guid>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception)
|
|
|
|
catch (Exception)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -270,7 +270,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
var questionAnswerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
|
|
|
var questionAnswerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var tableQuestionAnswerList= await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
|
|
|
var tableQuestionAnswerList = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
|
|
|
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
@ -286,13 +286,14 @@ namespace IRaCIS.Application.Services
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _readingTaskQuestionAnswerRepository.AddAsync(new ReadingTaskQuestionAnswer() {
|
|
|
|
await _readingTaskQuestionAnswerRepository.AddAsync(new ReadingTaskQuestionAnswer()
|
|
|
|
Answer=item.Answer,
|
|
|
|
{
|
|
|
|
ReadingQuestionCriterionTrialId= visitTask.TrialReadingCriterionId,
|
|
|
|
Answer = item.Answer,
|
|
|
|
ReadingQuestionTrialId= item.QuestionId,
|
|
|
|
ReadingQuestionCriterionTrialId = visitTask.TrialReadingCriterionId,
|
|
|
|
SubjectId= visitTask.SubjectId,
|
|
|
|
ReadingQuestionTrialId = item.QuestionId,
|
|
|
|
VisitTaskId=inDto.VisitTaskId,
|
|
|
|
SubjectId = visitTask.SubjectId,
|
|
|
|
TrialId= visitTask.TrialId
|
|
|
|
VisitTaskId = inDto.VisitTaskId,
|
|
|
|
|
|
|
|
TrialId = visitTask.TrialId
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -302,7 +303,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
foreach (var item in inDto.TableQuestionAnswer)
|
|
|
|
foreach (var item in inDto.TableQuestionAnswer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (tableQuestionAnswerList.Any(x => x.QuestionId == item.QuestionId&&x.RowId==item.RowId&&x.TableQuestionId==item.TableQuestionId))
|
|
|
|
if (tableQuestionAnswerList.Any(x => x.QuestionId == item.QuestionId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer()
|
|
|
|
await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId, x => new ReadingTableQuestionAnswer()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -312,15 +313,15 @@ namespace IRaCIS.Application.Services
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var rowInfo = rowInfoList.Where(x => x.Id == item.RowId).FirstOrDefault()??new ReadingTableAnswerRowInfo ();
|
|
|
|
var rowInfo = rowInfoList.Where(x => x.Id == item.RowId).FirstOrDefault() ?? new ReadingTableAnswerRowInfo();
|
|
|
|
|
|
|
|
|
|
|
|
await _readingTableQuestionAnswerRepository.AddAsync(new ReadingTableQuestionAnswer()
|
|
|
|
await _readingTableQuestionAnswerRepository.AddAsync(new ReadingTableQuestionAnswer()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Answer = item.Answer,
|
|
|
|
Answer = item.Answer,
|
|
|
|
QuestionId=item.QuestionId,
|
|
|
|
QuestionId = item.QuestionId,
|
|
|
|
TableQuestionId=item.TableQuestionId,
|
|
|
|
TableQuestionId = item.TableQuestionId,
|
|
|
|
RowIndex= rowInfo.RowIndex,
|
|
|
|
RowIndex = rowInfo.RowIndex,
|
|
|
|
RowId=rowInfo.Id,
|
|
|
|
RowId = rowInfo.Id,
|
|
|
|
VisitTaskId = inDto.VisitTaskId,
|
|
|
|
VisitTaskId = inDto.VisitTaskId,
|
|
|
|
TrialId = visitTask.TrialId
|
|
|
|
TrialId = visitTask.TrialId
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -431,7 +432,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
|
|
|
|
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
taskQuery = _visitTaskRepository.Where(x => taskInfo.RelatedVisitTaskIdList.Contains(x.Id)||x.Id== taskInfo.Id);
|
|
|
|
taskQuery = _visitTaskRepository.Where(x => taskInfo.RelatedVisitTaskIdList.Contains(x.Id) || x.Id == taskInfo.Id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = await taskQuery
|
|
|
|
var result = await taskQuery
|
|
|
@ -489,12 +490,13 @@ namespace IRaCIS.Application.Services
|
|
|
|
taskQuery = _visitTaskRepository.Where(x => taskInfo.PastResultTaskIdList.Contains(x.Id));
|
|
|
|
taskQuery = _visitTaskRepository.Where(x => taskInfo.PastResultTaskIdList.Contains(x.Id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var readingPastResultList = await taskQuery.Select(x => new GetReadingPastResultListOutDto() {
|
|
|
|
var readingPastResultList = await taskQuery.Select(x => new GetReadingPastResultListOutDto()
|
|
|
|
|
|
|
|
{
|
|
|
|
VisitTaskId = x.Id,
|
|
|
|
VisitTaskId = x.Id,
|
|
|
|
TaskBlindName = x.TaskBlindName,
|
|
|
|
TaskBlindName = x.TaskBlindName,
|
|
|
|
TaskName = x.TaskName,
|
|
|
|
TaskName = x.TaskName,
|
|
|
|
VisitTaskNum = x.VisitTaskNum,
|
|
|
|
VisitTaskNum = x.VisitTaskNum,
|
|
|
|
JudgeResultArm = x.JudgeResultTask == null?null:x.JudgeResultTask.ArmEnum,
|
|
|
|
JudgeResultArm = x.JudgeResultTask == null ? null : x.JudgeResultTask.ArmEnum,
|
|
|
|
|
|
|
|
|
|
|
|
}).OrderBy(x => x.VisitTaskNum).ToListAsync();
|
|
|
|
}).OrderBy(x => x.VisitTaskNum).ToListAsync();
|
|
|
|
return readingPastResultList;
|
|
|
|
return readingPastResultList;
|
|
|
@ -623,8 +625,9 @@ namespace IRaCIS.Application.Services
|
|
|
|
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
.WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
.WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
|
|
|
|
|
|
|
|
|
|
|
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider,new{
|
|
|
|
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider, new
|
|
|
|
isEn_Us=_userInfo.IsEn_Us
|
|
|
|
{
|
|
|
|
|
|
|
|
isEn_Us = _userInfo.IsEn_Us
|
|
|
|
|
|
|
|
|
|
|
|
}).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
}).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
@ -643,7 +646,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var crterionDictionaryGroup= new List<CrterionDictionaryGroup>() { CrterionDictionaryGroup.General, CrterionDictionaryGroup.BeforeConvert };
|
|
|
|
var crterionDictionaryGroup = new List<CrterionDictionaryGroup>() { CrterionDictionaryGroup.General, CrterionDictionaryGroup.BeforeConvert };
|
|
|
|
questions.ForEach(x =>
|
|
|
|
questions.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
x.CrterionDictionaryGroup = crterionDictionaryGroup;
|
|
|
|
x.CrterionDictionaryGroup = crterionDictionaryGroup;
|
|
|
@ -666,11 +669,11 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item, List<DicomReadingQuestionAnswer> questions, List<ReadingTaskQuestionAnswer> answers)
|
|
|
|
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item, List<DicomReadingQuestionAnswer> questions, List<ReadingTaskQuestionAnswer> answers)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var answer= answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
|
|
|
var answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
|
|
|
item.Answer = answer.IsNullOrEmpty() ? item.DefaultValue : answer;
|
|
|
|
item.Answer = answer.IsNullOrEmpty() ? item.DefaultValue : answer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.Childrens = questions.Where(x => x.ParentId == item.Id || (x.GroupId==item.Id&&x.ParentId==null)).ToList();
|
|
|
|
item.Childrens = questions.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList();
|
|
|
|
if (item.Childrens != null && item.Childrens.Count > 0)
|
|
|
|
if (item.Childrens != null && item.Childrens.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var question in item.Childrens)
|
|
|
|
foreach (var question in item.Childrens)
|
|
|
@ -711,6 +714,29 @@ namespace IRaCIS.Application.Services
|
|
|
|
.WhereIf(inDto.QuestionId != null, x => x.QuestionId == inDto.QuestionId)
|
|
|
|
.WhereIf(inDto.QuestionId != null, x => x.QuestionId == inDto.QuestionId)
|
|
|
|
.ProjectTo<GetTableAnswerRowInfoOutDto>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex)
|
|
|
|
.ProjectTo<GetTableAnswerRowInfoOutDto>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex)
|
|
|
|
.ToListAsync();
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taskInfo.IsConvertedTask &&
|
|
|
|
|
|
|
|
!(await _visitTaskRepository.AnyAsync(x => x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
|
|
|
|
|
|
|
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
|
|
|
|
|
|
|
|
&& x.VisitTaskNum < taskInfo.VisitTaskNum
|
|
|
|
|
|
|
|
&& x.DoctorUserId == taskInfo.DoctorUserId
|
|
|
|
|
|
|
|
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
|
|
|
|
|
|
|
&& !x.IsConvertedTask
|
|
|
|
|
|
|
|
&& x.SubjectId == taskInfo.SubjectId
|
|
|
|
|
|
|
|
&& x.ArmEnum == taskInfo.ArmEnum &&
|
|
|
|
|
|
|
|
x.TaskState == TaskState.Effect))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.ForEach(x =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.IsFirstChangeTask = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.ForEach(x =>
|
|
|
|
result.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -753,13 +779,14 @@ namespace IRaCIS.Application.Services
|
|
|
|
var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
|
|
|
var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
|
|
|
var questionPage = await GetReadingTableQuestion(
|
|
|
|
var questionPage = await GetReadingTableQuestion(
|
|
|
|
|
|
|
|
|
|
|
|
new GetReadingTableQuestionOrAnswerInDto() {
|
|
|
|
new GetReadingTableQuestionOrAnswerInDto()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
TrialReadingCriterionId = taskinfo.TrialReadingCriterionId,
|
|
|
|
TrialReadingCriterionId = taskinfo.TrialReadingCriterionId,
|
|
|
|
TaskId = inDto.VisitTaskId,
|
|
|
|
TaskId = inDto.VisitTaskId,
|
|
|
|
TableAnswers = tableAnswers,
|
|
|
|
TableAnswers = tableAnswers,
|
|
|
|
TableAnsweRowInfos = tableAnsweRowInfos,
|
|
|
|
TableAnsweRowInfos = tableAnsweRowInfos,
|
|
|
|
OrganInfos= organList,
|
|
|
|
OrganInfos = organList,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -792,7 +819,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
//await _readingCalculateService.AddTaskLesionAnswerFromLastTask(new AddTaskLesionAnswerFromLastTaskInDto() {
|
|
|
|
//await _readingCalculateService.AddTaskLesionAnswerFromLastTask(new AddTaskLesionAnswerFromLastTaskInDto() {
|
|
|
|
//VisitTaskId=inDto.VisitTaskId
|
|
|
|
//VisitTaskId=inDto.VisitTaskId
|
|
|
|
//});
|
|
|
|
//});
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.SourceSubjectVisit).FirstNotNullAsync();
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.SourceSubjectVisit).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var tableAnswers = await _readingTableQuestionAnswerRepository
|
|
|
|
var tableAnswers = await _readingTableQuestionAnswerRepository
|
|
|
|
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
|
|
|
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
|
|
@ -811,12 +838,13 @@ namespace IRaCIS.Application.Services
|
|
|
|
TableAnswers = tableAnswers,
|
|
|
|
TableAnswers = tableAnswers,
|
|
|
|
TableAnsweRowInfos = tableAnsweRowInfos,
|
|
|
|
TableAnsweRowInfos = tableAnsweRowInfos,
|
|
|
|
IsGetallQuestion = true,
|
|
|
|
IsGetallQuestion = true,
|
|
|
|
OrganInfos= organList
|
|
|
|
OrganInfos = organList
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
),new {
|
|
|
|
), new
|
|
|
|
IsBaseline= taskInfo.SourceSubjectVisit!=null&&taskInfo.SourceSubjectVisit.IsBaseLine,
|
|
|
|
{
|
|
|
|
ReadingTaskState= taskInfo.ReadingTaskState
|
|
|
|
IsBaseline = taskInfo.SourceSubjectVisit != null && taskInfo.SourceSubjectVisit.IsBaseLine,
|
|
|
|
|
|
|
|
ReadingTaskState = taskInfo.ReadingTaskState
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -831,15 +859,16 @@ namespace IRaCIS.Application.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
|
|
|
|
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider,new {
|
|
|
|
var qusetionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider, new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
isEn_Us=_userInfo.IsEn_Us
|
|
|
|
isEn_Us = _userInfo.IsEn_Us
|
|
|
|
|
|
|
|
|
|
|
|
}).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
}).OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
|
|
|
|
var taskInfo = new VisitTask();
|
|
|
|
if (inDto.TaskId != null)
|
|
|
|
if (inDto.TaskId != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
|
|
|
|
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
qusetionList.ForEach(x =>
|
|
|
|
qusetionList.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -873,8 +902,15 @@ namespace IRaCIS.Application.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
qusetionList = qusetionList.Where(x => x.IsShowInDicom && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToList();
|
|
|
|
qusetionList = qusetionList.Where(x => x.IsShowInDicom && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inDto.TaskId != null && !taskInfo.IsConvertedTask)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
qusetionList = qusetionList.Where(x => x.QuestionType != QuestionType.IsConverted).OrderBy(x => x.ShowOrder).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var usedGuropIds = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupId).ToList();
|
|
|
|
var usedGuropIds = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupId).ToList();
|
|
|
|
qusetionList = qusetionList.Where(x => usedGuropIds.Contains(x.Id)|| usedGuropIds.Contains(x.GroupId)).ToList();
|
|
|
|
qusetionList = qusetionList.Where(x => usedGuropIds.Contains(x.Id) || usedGuropIds.Contains(x.GroupId)).ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -893,9 +929,10 @@ namespace IRaCIS.Application.Services
|
|
|
|
var qusetionIds = qusetionList.Select(x => x.Id).ToList();
|
|
|
|
var qusetionIds = qusetionList.Select(x => x.Id).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => qusetionIds.Contains(x.ReadingQuestionId))
|
|
|
|
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => qusetionIds.Contains(x.ReadingQuestionId))
|
|
|
|
.ProjectTo<TableQuestionTrial>(_mapper.ConfigurationProvider,new {
|
|
|
|
.ProjectTo<TableQuestionTrial>(_mapper.ConfigurationProvider, new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
isEn_Us=_userInfo.IsEn_Us
|
|
|
|
isEn_Us = _userInfo.IsEn_Us
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
.OrderBy(x => x.ShowOrder).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
@ -904,9 +941,11 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
List<ReadingTableQuestionAnswer> baseLineTableAnswer = new List<ReadingTableQuestionAnswer>();
|
|
|
|
List<ReadingTableQuestionAnswer> baseLineTableAnswer = new List<ReadingTableQuestionAnswer>();
|
|
|
|
|
|
|
|
|
|
|
|
if(inDto.TaskId!=null)
|
|
|
|
bool isFirstChangeTask = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (inDto.TaskId != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
|
|
|
|
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
|
|
|
|
// 取基线
|
|
|
|
// 取基线
|
|
|
|
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskInfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstNotNullAsync();
|
|
|
|
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskInfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
@ -915,11 +954,28 @@ namespace IRaCIS.Application.Services
|
|
|
|
&& x.DoctorUserId == taskInfo.DoctorUserId
|
|
|
|
&& x.DoctorUserId == taskInfo.DoctorUserId
|
|
|
|
&& x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
|
|
|
&& x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
|
|
|
&& x.TaskState == TaskState.Effect
|
|
|
|
&& x.TaskState == TaskState.Effect
|
|
|
|
&&x.TrialReadingCriterionId== taskInfo.TrialReadingCriterionId
|
|
|
|
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
|
|
|
).Select(x => x.Id).FirstNotNullAsync();
|
|
|
|
).Select(x => x.Id).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
baseLineTableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == baselineTaskId).Include(x=>x.ReadingTableQuestionTrial).ToListAsync();
|
|
|
|
baseLineTableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == baselineTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taskInfo.IsConvertedTask &&
|
|
|
|
|
|
|
|
!(await _visitTaskRepository.AnyAsync(x => x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
|
|
|
|
|
|
|
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
|
|
|
|
|
|
|
|
&& x.VisitTaskNum < taskInfo.VisitTaskNum
|
|
|
|
|
|
|
|
&& x.DoctorUserId == taskInfo.DoctorUserId
|
|
|
|
|
|
|
|
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
|
|
|
|
|
|
|
&& !x.IsConvertedTask
|
|
|
|
|
|
|
|
&& x.SubjectId == taskInfo.SubjectId
|
|
|
|
|
|
|
|
&& x.ArmEnum == taskInfo.ArmEnum &&
|
|
|
|
|
|
|
|
x.TaskState == TaskState.Effect))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
isFirstChangeTask = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (criterionInfo.FormType == FormType.MultiplePage)
|
|
|
|
if (criterionInfo.FormType == FormType.MultiplePage)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -939,7 +995,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
|
|
|
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
|
|
|
pageGroupList.ForEach(x =>
|
|
|
|
pageGroupList.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos,inDto.OrganInfos, baseLineTableAnswer);
|
|
|
|
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
|
|
|
|
page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
|
|
|
@ -956,7 +1012,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
|
|
|
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
|
|
|
groupList.ForEach(x =>
|
|
|
|
groupList.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer);
|
|
|
|
this.FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
|
|
|
|
groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
|
|
|
@ -976,9 +1032,9 @@ namespace IRaCIS.Application.Services
|
|
|
|
/// <param name="item"></param>
|
|
|
|
/// <param name="item"></param>
|
|
|
|
/// <param name="questionlists"></param>
|
|
|
|
/// <param name="questionlists"></param>
|
|
|
|
/// <param name="tableQuestionLists"></param>
|
|
|
|
/// <param name="tableQuestionLists"></param>
|
|
|
|
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos,List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer)
|
|
|
|
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer,bool isFirstChangeTask)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.Childrens = questionlists.Where(x => x.ParentId == item.Id ||x.GroupId==item.Id).ToList();
|
|
|
|
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || x.GroupId == item.Id).ToList();
|
|
|
|
item.TableQuestions = new TrialReadTableQuestion();
|
|
|
|
item.TableQuestions = new TrialReadTableQuestion();
|
|
|
|
|
|
|
|
|
|
|
|
item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x => x.ShowOrder).ToList();
|
|
|
|
item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x => x.ShowOrder).ToList();
|
|
|
@ -1030,7 +1086,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault();
|
|
|
|
var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault();
|
|
|
|
var rowAnswer = thisAnswer.Where(y => y.RowId == rowInfo.Id).OrderBy(y => y.ShowOrder).ToList();
|
|
|
|
var rowAnswer = thisAnswer.Where(y => y.RowId == rowInfo.Id).OrderBy(y => y.ShowOrder).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var organInfo = organInfos.Where(x=>x.Id== rowInfo.OrganInfoId).FirstOrDefault();
|
|
|
|
var organInfo = organInfos.Where(x => x.Id == rowInfo.OrganInfoId).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
rowAnswer.ForEach(z =>
|
|
|
|
rowAnswer.ForEach(z =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1099,6 +1155,8 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
answers.Add("BlindName", rowInfo.BlindName);
|
|
|
|
answers.Add("BlindName", rowInfo.BlindName);
|
|
|
|
|
|
|
|
answers.Add("IsFirstChangeTask", isFirstChangeTask.ToString());
|
|
|
|
|
|
|
|
answers.Add("FromMark", rowInfo.FromMark);
|
|
|
|
answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString());
|
|
|
|
answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString());
|
|
|
|
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
|
|
|
|
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
|
|
|
|
answers.Add("RowIndex", x.ToString());
|
|
|
|
answers.Add("RowIndex", x.ToString());
|
|
|
@ -1113,7 +1171,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
answers.Add("SplitOrMergeType", rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString());
|
|
|
|
answers.Add("SplitOrMergeType", rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString());
|
|
|
|
if (rowInfo.LesionType == LesionType.BaselineLesions)
|
|
|
|
if (rowInfo.LesionType == LesionType.BaselineLesions)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
answers.Add("BaseLineLesionNumber", baseLineTableAnswer.Where(n=>n.ReadingTableQuestionTrial.QuestionMark==QuestionMark.LesionNumber&&n.RowIndex==rowInfo.RowIndex).Select(x=>x.Answer).FirstIsNullReturnEmpty());
|
|
|
|
answers.Add("BaseLineLesionNumber", baseLineTableAnswer.Where(n => n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.LesionNumber && n.RowIndex == rowInfo.RowIndex).Select(x => x.Answer).FirstIsNullReturnEmpty());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1124,7 +1182,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.Childrens.ForEach(x =>
|
|
|
|
item.Childrens.ForEach(x =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer);
|
|
|
|
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1338,16 +1396,17 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
IsDeleted = true
|
|
|
|
IsDeleted = true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.RowId,x=>new ReadingTableAnswerRowInfo() {
|
|
|
|
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.RowId, x => new ReadingTableAnswerRowInfo()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
IsDeleted=true
|
|
|
|
IsDeleted = true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
|
|
|
await _readingTableAnswerRowInfoRepository.SaveChangesAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId,true).Include(x => x.ReadingQuestionTrial).OrderBy(x => x.RowIndex).ToListAsync();
|
|
|
|
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId, true).Include(x => x.ReadingQuestionTrial).OrderBy(x => x.RowIndex).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var answerlist = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId,true).ToListAsync();
|
|
|
|
var answerlist = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId, true).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1363,7 +1422,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var answerItem in answerlist.Where(x=>x.RowIndex== item.RowIndex))
|
|
|
|
foreach (var answerItem in answerlist.Where(x => x.RowIndex == item.RowIndex))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
answerItem.RowIndex = index;
|
|
|
|
answerItem.RowIndex = index;
|
|
|
@ -1458,7 +1517,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
await VerifyTaskIsSign(inDto.VisitTaskId);
|
|
|
|
await VerifyTaskIsSign(inDto.VisitTaskId);
|
|
|
|
|
|
|
|
|
|
|
|
if (inDto.InstanceId != null&&inDto.IsDicomReading)
|
|
|
|
if (inDto.InstanceId != null && inDto.IsDicomReading)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!(await _dicomInstanceRepository.AnyAsync(x => x.Id == inDto.InstanceId && x.SeriesId == inDto.SeriesId)))
|
|
|
|
if (!(await _dicomInstanceRepository.AnyAsync(x => x.Id == inDto.InstanceId && x.SeriesId == inDto.SeriesId)))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1479,19 +1538,19 @@ namespace IRaCIS.Application.Services
|
|
|
|
case CriterionType.RECIST1Point1:
|
|
|
|
case CriterionType.RECIST1Point1:
|
|
|
|
var lastTaskinfo = await _visitTaskRepository
|
|
|
|
var lastTaskinfo = await _visitTaskRepository
|
|
|
|
.Where(x => x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
|
|
|
.Where(x => x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
|
|
|
x.SubjectId==taskinfo.SubjectId&&
|
|
|
|
x.SubjectId == taskinfo.SubjectId &&
|
|
|
|
x.ReadingCategory == taskinfo.ReadingCategory &&
|
|
|
|
x.ReadingCategory == taskinfo.ReadingCategory &&
|
|
|
|
x.DoctorUserId == taskinfo.DoctorUserId &&
|
|
|
|
x.DoctorUserId == taskinfo.DoctorUserId &&
|
|
|
|
x.ArmEnum == taskinfo.ArmEnum &&
|
|
|
|
x.ArmEnum == taskinfo.ArmEnum &&
|
|
|
|
x.TrialReadingCriterionId==taskinfo.TrialReadingCriterionId&&
|
|
|
|
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
|
|
|
x.ReadingTaskState==ReadingTaskState.HaveSigned&&
|
|
|
|
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
|
|
|
x.TaskState == TaskState.Effect &&
|
|
|
|
x.TaskState == TaskState.Effect &&
|
|
|
|
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
|
|
|
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
|
|
|
x.VisitTaskNum < taskinfo.VisitTaskNum
|
|
|
|
x.VisitTaskNum < taskinfo.VisitTaskNum
|
|
|
|
).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync();
|
|
|
|
).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync();
|
|
|
|
if (lastTaskinfo != null)
|
|
|
|
if (lastTaskinfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var tablequestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == taskinfo.TrialReadingCriterionId&&x.ReadingQuestionTrial.LesionType==LesionType.NonTargetLesions).ToListAsync();
|
|
|
|
var tablequestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == taskinfo.TrialReadingCriterionId && x.ReadingQuestionTrial.LesionType == LesionType.NonTargetLesions).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1504,7 +1563,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
if (stateQuestion != null)
|
|
|
|
if (stateQuestion != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 判断是否为非靶病灶
|
|
|
|
// 判断是否为非靶病灶
|
|
|
|
if (inDto.QuestionId == tablequestionList[0].ReadingQuestionId && inDto.AnswerList.Any(x => x.TableQuestionId== stateQuestion.Id&&x.Answer.EqEnum(NoTargetState.Increase)))
|
|
|
|
if (inDto.QuestionId == tablequestionList[0].ReadingQuestionId && inDto.AnswerList.Any(x => x.TableQuestionId == stateQuestion.Id && x.Answer.EqEnum(NoTargetState.Increase)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var lymphQuestion = tablequestionList.Where(x => x.QuestionMark == QuestionMark.IsLymph).FirstOrDefault();
|
|
|
|
var lymphQuestion = tablequestionList.Where(x => x.QuestionMark == QuestionMark.IsLymph).FirstOrDefault();
|
|
|
|
if (lymphQuestion != null)
|
|
|
|
if (lymphQuestion != null)
|
|
|
@ -1614,7 +1673,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
if (inDto.RowIndex % 1 == 0)
|
|
|
|
if (inDto.RowIndex % 1 == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (questionInfo.MaxQuestionCount != null && questionInfo.MaxQuestionCount != 0&& inDto.RowId==null)
|
|
|
|
if (questionInfo.MaxQuestionCount != null && questionInfo.MaxQuestionCount != 0 && inDto.RowId == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (questionInfo.MaxQuestionCount <
|
|
|
|
if (questionInfo.MaxQuestionCount <
|
|
|
|
(
|
|
|
|
(
|
|
|
@ -1651,9 +1710,9 @@ namespace IRaCIS.Application.Services
|
|
|
|
{CriterionType.PCWG3, _localizer["ReadingImage_PCWGMaximum", item.MaxRowCount.Value]},
|
|
|
|
{CriterionType.PCWG3, _localizer["ReadingImage_PCWGMaximum", item.MaxRowCount.Value]},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var rowCount = 0;
|
|
|
|
var rowCount = 0;
|
|
|
|
if ((item.QuestionMark == QuestionMark.Part|| item.QuestionMark == QuestionMark.Organ) &&inDto.OrganInfoId!=null)
|
|
|
|
if ((item.QuestionMark == QuestionMark.Part || item.QuestionMark == QuestionMark.Organ) && inDto.OrganInfoId != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var organIds= await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && ((x.RowIndex % 1) == 0) && x.OrganInfoId != null && x.RowIndex != inDto.RowIndex).Select(x=>x.OrganInfoId).ToListAsync();
|
|
|
|
var organIds = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && ((x.RowIndex % 1) == 0) && x.OrganInfoId != null && x.RowIndex != inDto.RowIndex).Select(x => x.OrganInfoId).ToListAsync();
|
|
|
|
organIds.Add(inDto.OrganInfoId);
|
|
|
|
organIds.Add(inDto.OrganInfoId);
|
|
|
|
|
|
|
|
|
|
|
|
var orginInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
|
|
|
var orginInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
|
|
@ -1661,14 +1720,14 @@ namespace IRaCIS.Application.Services
|
|
|
|
List<OrganInfo?> orginInfoList = new List<OrganInfo?>();
|
|
|
|
List<OrganInfo?> orginInfoList = new List<OrganInfo?>();
|
|
|
|
foreach (var organId in organIds)
|
|
|
|
foreach (var organId in organIds)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
orginInfoList.Add(orginInfos.Where(x=>x.Id==organId).FirstOrDefault());
|
|
|
|
orginInfoList.Add(orginInfos.Where(x => x.Id == organId).FirstOrDefault());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var currentOrginInfo = orginInfos.Where(x => x.Id == inDto.OrganInfoId).FirstOrDefault()??new OrganInfo ();
|
|
|
|
var currentOrginInfo = orginInfos.Where(x => x.Id == inDto.OrganInfoId).FirstOrDefault() ?? new OrganInfo();
|
|
|
|
|
|
|
|
|
|
|
|
if (item.QuestionMark == QuestionMark.Part)
|
|
|
|
if (item.QuestionMark == QuestionMark.Part)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
rowCount = orginInfoList.Where(x=>x.Part== currentOrginInfo.Part).Count();
|
|
|
|
rowCount = orginInfoList.Where(x => x.Part == currentOrginInfo.Part).Count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1677,7 +1736,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
|
|
|
|
|
|
|
|
if (rowCount > item.MaxRowCount.Value)
|
|
|
|
if (rowCount > item.MaxRowCount.Value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (rowCount > item.MaxRowCount.Value )
|
|
|
|
if (rowCount > item.MaxRowCount.Value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1751,6 +1810,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
rowInfo.FristAddTaskId = inDto.VisitTaskId;
|
|
|
|
rowInfo.FristAddTaskId = inDto.VisitTaskId;
|
|
|
|
rowInfo.PicturePath = inDto.PicturePath;
|
|
|
|
rowInfo.PicturePath = inDto.PicturePath;
|
|
|
|
rowInfo.RowIndex = inDto.RowIndex;
|
|
|
|
rowInfo.RowIndex = inDto.RowIndex;
|
|
|
|
|
|
|
|
rowInfo.FromMark = inDto.FromMark;
|
|
|
|
rowInfo.OrganInfoId = inDto.OrganInfoId;
|
|
|
|
rowInfo.OrganInfoId = inDto.OrganInfoId;
|
|
|
|
rowInfo.InstanceId = inDto.InstanceId;
|
|
|
|
rowInfo.InstanceId = inDto.InstanceId;
|
|
|
|
rowInfo.SeriesId = inDto.SeriesId;
|
|
|
|
rowInfo.SeriesId = inDto.SeriesId;
|
|
|
@ -1806,7 +1866,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
VisitTaskId = rowInfo.VisitTaskId,
|
|
|
|
VisitTaskId = rowInfo.VisitTaskId,
|
|
|
|
StudyId = rowInfo.StudyId,
|
|
|
|
StudyId = rowInfo.StudyId,
|
|
|
|
IsCanEditPosition = rowInfo.IsCanEditPosition,
|
|
|
|
IsCanEditPosition = rowInfo.IsCanEditPosition,
|
|
|
|
}) ;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in inDto.AnswerList)
|
|
|
|
foreach (var item in inDto.AnswerList)
|
|
|
@ -1945,19 +2005,19 @@ namespace IRaCIS.Application.Services
|
|
|
|
public async Task<IResponseOutput> VerifyDefaultQuestionBeAnswer(VerifyVisitTaskQuestionsInDto inDto)
|
|
|
|
public async Task<IResponseOutput> VerifyDefaultQuestionBeAnswer(VerifyVisitTaskQuestionsInDto inDto)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.TrialReadingCriterion).Include(x=>x.SourceSubjectVisit).FirstNotNullAsync();
|
|
|
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).Include(x => x.SourceSubjectVisit).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).FirstNotNullAsync();
|
|
|
|
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).FirstNotNullAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId)
|
|
|
|
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId)
|
|
|
|
.WhereIf(taskInfo.SourceSubjectVisit.IsBaseLine,x=> ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show)&&(x.LimitEdit==LimitEdit.None||x.LimitEdit==LimitEdit.OnlyBaseLine)))
|
|
|
|
.WhereIf(taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyBaseLine)))
|
|
|
|
.WhereIf(!taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyVisit)))
|
|
|
|
.WhereIf(!taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyVisit)))
|
|
|
|
.WhereIf(taskInfo.TrialReadingCriterion.CriterionType==CriterionType.PCWG3, x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation)
|
|
|
|
.WhereIf(taskInfo.TrialReadingCriterion.CriterionType == CriterionType.PCWG3, x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation)
|
|
|
|
|
|
|
|
|
|
|
|
//.WhereIf(!criterion.IseCRFShowInDicomReading,x=>x.IsShowInDicom)
|
|
|
|
//.WhereIf(!criterion.IseCRFShowInDicomReading,x=>x.IsShowInDicom)
|
|
|
|
.ToListAsync();
|
|
|
|
.ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
var answerQuestionIds = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId&&x.Answer!=string.Empty).Select(x => x.ReadingQuestionTrialId).ToListAsync();
|
|
|
|
var answerQuestionIds = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.Answer != string.Empty).Select(x => x.ReadingQuestionTrialId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
|
|
readingQuestionList = readingQuestionList.Where(x => !answerQuestionIds.Contains(x.Id)).ToList();
|
|
|
|
readingQuestionList = readingQuestionList.Where(x => !answerQuestionIds.Contains(x.Id)).ToList();
|
|
|
|
|
|
|
|
|
|
|
@ -2088,9 +2148,10 @@ namespace IRaCIS.Application.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TrialId = inDto.TrialId,
|
|
|
|
TrialId = inDto.TrialId,
|
|
|
|
TrialReadingCriterionId = trialReadingCriterionId.Value,
|
|
|
|
TrialReadingCriterionId = trialReadingCriterionId.Value,
|
|
|
|
Page=new PageInput() {
|
|
|
|
Page = new PageInput()
|
|
|
|
PageIndex=1,
|
|
|
|
{
|
|
|
|
PageSize=99999,
|
|
|
|
PageIndex = 1,
|
|
|
|
|
|
|
|
PageSize = 99999,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})).Item2;
|
|
|
|
})).Item2;
|
|
|
|
|
|
|
|
|
|
|
@ -2133,7 +2194,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
&& x.TaskState == TaskState.Effect).Select(x => new GetReadingTaskDto()
|
|
|
|
&& x.TaskState == TaskState.Effect).Select(x => new GetReadingTaskDto()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VisitTaskId = x.Id,
|
|
|
|
VisitTaskId = x.Id,
|
|
|
|
ArmEnum= x.ArmEnum,
|
|
|
|
ArmEnum = x.ArmEnum,
|
|
|
|
TaskBlindName = x.TaskBlindName,
|
|
|
|
TaskBlindName = x.TaskBlindName,
|
|
|
|
ReadingCategory = x.ReadingCategory,
|
|
|
|
ReadingCategory = x.ReadingCategory,
|
|
|
|
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
|
|
|
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
|
|
@ -2238,7 +2299,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
int timespanMin = (DateTime.Now - cacheDate).Minutes;
|
|
|
|
int timespanMin = (DateTime.Now - cacheDate).Minutes;
|
|
|
|
if (timespanMin > 120 && timespanMin < 140)
|
|
|
|
if (timespanMin > 120 && timespanMin < 140)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest",2,20]);
|
|
|
|
throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", 2, 20]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (timespanMin > 140)
|
|
|
|
else if (timespanMin > 140)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2406,7 +2467,7 @@ namespace IRaCIS.Application.Services
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost]
|
|
|
|
[HttpPost]
|
|
|
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
|
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
|
|
public async Task AddReadingTask(Guid visitTaskId,Guid? trialId=null)
|
|
|
|
public async Task AddReadingTask(Guid visitTaskId, Guid? trialId = null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********////
|
|
|
|
// ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********////
|
|
|
|
#region 建立关系
|
|
|
|
#region 建立关系
|
|
|
|