Uat_Study
parent
a59f71a01e
commit
424174636e
|
@ -133,12 +133,12 @@ namespace IRaCIS.Application.Services
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[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 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 =>
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
try
|
||||
{
|
||||
relatedIds = JsonConvert.DeserializeObject<List<Guid>>(item.RelatedVisitTaskIds)?? new List<Guid>();
|
||||
relatedIds = JsonConvert.DeserializeObject<List<Guid>>(item.RelatedVisitTaskIds) ?? new List<Guid>();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -270,7 +270,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
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();
|
||||
|
||||
|
@ -286,13 +286,14 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
await _readingTaskQuestionAnswerRepository.AddAsync(new ReadingTaskQuestionAnswer() {
|
||||
Answer=item.Answer,
|
||||
ReadingQuestionCriterionTrialId= visitTask.TrialReadingCriterionId,
|
||||
ReadingQuestionTrialId= item.QuestionId,
|
||||
SubjectId= visitTask.SubjectId,
|
||||
VisitTaskId=inDto.VisitTaskId,
|
||||
TrialId= visitTask.TrialId
|
||||
await _readingTaskQuestionAnswerRepository.AddAsync(new ReadingTaskQuestionAnswer()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
ReadingQuestionCriterionTrialId = visitTask.TrialReadingCriterionId,
|
||||
ReadingQuestionTrialId = item.QuestionId,
|
||||
SubjectId = visitTask.SubjectId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
TrialId = visitTask.TrialId
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -302,7 +303,7 @@ namespace IRaCIS.Application.Services
|
|||
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()
|
||||
{
|
||||
|
@ -312,15 +313,15 @@ namespace IRaCIS.Application.Services
|
|||
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()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
QuestionId=item.QuestionId,
|
||||
TableQuestionId=item.TableQuestionId,
|
||||
RowIndex= rowInfo.RowIndex,
|
||||
RowId=rowInfo.Id,
|
||||
QuestionId = item.QuestionId,
|
||||
TableQuestionId = item.TableQuestionId,
|
||||
RowIndex = rowInfo.RowIndex,
|
||||
RowId = rowInfo.Id,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
TrialId = visitTask.TrialId
|
||||
});
|
||||
|
@ -431,7 +432,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
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
|
||||
|
@ -489,12 +490,13 @@ namespace IRaCIS.Application.Services
|
|||
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,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
TaskName = x.TaskName,
|
||||
VisitTaskNum = x.VisitTaskNum,
|
||||
JudgeResultArm = x.JudgeResultTask == null?null:x.JudgeResultTask.ArmEnum,
|
||||
JudgeResultArm = x.JudgeResultTask == null ? null : x.JudgeResultTask.ArmEnum,
|
||||
|
||||
}).OrderBy(x => x.VisitTaskNum).ToListAsync();
|
||||
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.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
|
||||
|
||||
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider,new{
|
||||
isEn_Us=_userInfo.IsEn_Us
|
||||
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider, new
|
||||
{
|
||||
isEn_Us = _userInfo.IsEn_Us
|
||||
|
||||
}).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
@ -643,7 +646,7 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
var crterionDictionaryGroup= new List<CrterionDictionaryGroup>() { CrterionDictionaryGroup.General, CrterionDictionaryGroup.BeforeConvert };
|
||||
var crterionDictionaryGroup = new List<CrterionDictionaryGroup>() { CrterionDictionaryGroup.General, CrterionDictionaryGroup.BeforeConvert };
|
||||
questions.ForEach(x =>
|
||||
{
|
||||
x.CrterionDictionaryGroup = crterionDictionaryGroup;
|
||||
|
@ -666,11 +669,11 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
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.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)
|
||||
{
|
||||
foreach (var question in item.Childrens)
|
||||
|
@ -776,13 +779,14 @@ namespace IRaCIS.Application.Services
|
|||
var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
var questionPage = await GetReadingTableQuestion(
|
||||
|
||||
new GetReadingTableQuestionOrAnswerInDto() {
|
||||
new GetReadingTableQuestionOrAnswerInDto()
|
||||
{
|
||||
|
||||
TrialReadingCriterionId = taskinfo.TrialReadingCriterionId,
|
||||
TaskId = inDto.VisitTaskId,
|
||||
TableAnswers = tableAnswers,
|
||||
TableAnsweRowInfos = tableAnsweRowInfos,
|
||||
OrganInfos= organList,
|
||||
OrganInfos = organList,
|
||||
}
|
||||
|
||||
|
||||
|
@ -815,7 +819,7 @@ namespace IRaCIS.Application.Services
|
|||
//await _readingCalculateService.AddTaskLesionAnswerFromLastTask(new AddTaskLesionAnswerFromLastTaskInDto() {
|
||||
//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
|
||||
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
||||
|
@ -834,12 +838,13 @@ namespace IRaCIS.Application.Services
|
|||
TableAnswers = tableAnswers,
|
||||
TableAnsweRowInfos = tableAnsweRowInfos,
|
||||
IsGetallQuestion = true,
|
||||
OrganInfos= organList
|
||||
OrganInfos = organList
|
||||
|
||||
}
|
||||
),new {
|
||||
IsBaseline= taskInfo.SourceSubjectVisit!=null&&taskInfo.SourceSubjectVisit.IsBaseLine,
|
||||
ReadingTaskState= taskInfo.ReadingTaskState
|
||||
), new
|
||||
{
|
||||
IsBaseline = taskInfo.SourceSubjectVisit != null && taskInfo.SourceSubjectVisit.IsBaseLine,
|
||||
ReadingTaskState = taskInfo.ReadingTaskState
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -854,9 +859,10 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
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();
|
||||
var taskInfo = new VisitTask();
|
||||
|
@ -898,13 +904,13 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
|
||||
if (inDto.TaskId != null&& !taskInfo.IsConvertedTask)
|
||||
if (inDto.TaskId != null && !taskInfo.IsConvertedTask)
|
||||
{
|
||||
qusetionList= qusetionList.Where(x=>x.QuestionType!=QuestionType.IsConverted).OrderBy(x => x.ShowOrder).ToList();
|
||||
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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -923,9 +929,10 @@ namespace IRaCIS.Application.Services
|
|||
var qusetionIds = qusetionList.Select(x => x.Id).ToList();
|
||||
|
||||
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();
|
||||
|
||||
|
@ -934,7 +941,9 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
List<ReadingTableQuestionAnswer> baseLineTableAnswer = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
if(inDto.TaskId!=null)
|
||||
bool isFirstChangeTask = false;
|
||||
|
||||
if (inDto.TaskId != null)
|
||||
{
|
||||
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
|
||||
// 取基线
|
||||
|
@ -945,11 +954,28 @@ namespace IRaCIS.Application.Services
|
|||
&& x.DoctorUserId == taskInfo.DoctorUserId
|
||||
&& x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&&x.TrialReadingCriterionId== taskInfo.TrialReadingCriterionId
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
).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)
|
||||
{
|
||||
|
@ -969,7 +995,7 @@ namespace IRaCIS.Application.Services
|
|||
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
||||
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();
|
||||
|
@ -986,7 +1012,7 @@ namespace IRaCIS.Application.Services
|
|||
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
||||
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();
|
||||
|
@ -1006,9 +1032,9 @@ namespace IRaCIS.Application.Services
|
|||
/// <param name="item"></param>
|
||||
/// <param name="questionlists"></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.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x => x.ShowOrder).ToList();
|
||||
|
@ -1060,7 +1086,7 @@ namespace IRaCIS.Application.Services
|
|||
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 organInfo = organInfos.Where(x=>x.Id== rowInfo.OrganInfoId).FirstOrDefault();
|
||||
var organInfo = organInfos.Where(x => x.Id == rowInfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
rowAnswer.ForEach(z =>
|
||||
{
|
||||
|
@ -1129,6 +1155,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
|
||||
answers.Add("BlindName", rowInfo.BlindName);
|
||||
answers.Add("IsFirstChangeTask", isFirstChangeTask.ToString());
|
||||
answers.Add("FromMark", rowInfo.FromMark);
|
||||
answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString());
|
||||
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
|
||||
|
@ -1144,7 +1171,7 @@ namespace IRaCIS.Application.Services
|
|||
answers.Add("SplitOrMergeType", rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString());
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1155,7 +1182,7 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
item.Childrens.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer);
|
||||
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1369,16 +1396,17 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
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();
|
||||
|
||||
|
||||
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();
|
||||
|
||||
|
||||
|
||||
|
@ -1394,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;
|
||||
|
@ -1489,7 +1517,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
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)))
|
||||
{
|
||||
|
@ -1510,19 +1538,19 @@ namespace IRaCIS.Application.Services
|
|||
case CriterionType.RECIST1Point1:
|
||||
var lastTaskinfo = await _visitTaskRepository
|
||||
.Where(x => x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.SubjectId==taskinfo.SubjectId&&
|
||||
x.SubjectId == taskinfo.SubjectId &&
|
||||
x.ReadingCategory == taskinfo.ReadingCategory &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.ArmEnum == taskinfo.ArmEnum &&
|
||||
x.TrialReadingCriterionId==taskinfo.TrialReadingCriterionId&&
|
||||
x.ReadingTaskState==ReadingTaskState.HaveSigned&&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
|
||||
x.TaskState == TaskState.Effect &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
x.VisitTaskNum < taskinfo.VisitTaskNum
|
||||
).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync();
|
||||
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();
|
||||
|
||||
|
||||
|
||||
|
@ -1535,7 +1563,7 @@ namespace IRaCIS.Application.Services
|
|||
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();
|
||||
if (lymphQuestion != null)
|
||||
|
@ -1645,7 +1673,7 @@ namespace IRaCIS.Application.Services
|
|||
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 <
|
||||
(
|
||||
|
@ -1682,9 +1710,9 @@ namespace IRaCIS.Application.Services
|
|||
{CriterionType.PCWG3, _localizer["ReadingImage_PCWGMaximum", item.MaxRowCount.Value]},
|
||||
};
|
||||
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);
|
||||
|
||||
var orginInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
@ -1692,14 +1720,14 @@ namespace IRaCIS.Application.Services
|
|||
List<OrganInfo?> orginInfoList = new List<OrganInfo?>();
|
||||
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)
|
||||
{
|
||||
rowCount = orginInfoList.Where(x=>x.Part== currentOrginInfo.Part).Count();
|
||||
rowCount = orginInfoList.Where(x => x.Part == currentOrginInfo.Part).Count();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1708,7 +1736,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
if (rowCount > item.MaxRowCount.Value)
|
||||
{
|
||||
if (rowCount > item.MaxRowCount.Value )
|
||||
if (rowCount > item.MaxRowCount.Value)
|
||||
{
|
||||
|
||||
|
||||
|
@ -1838,7 +1866,7 @@ namespace IRaCIS.Application.Services
|
|||
VisitTaskId = rowInfo.VisitTaskId,
|
||||
StudyId = rowInfo.StudyId,
|
||||
IsCanEditPosition = rowInfo.IsCanEditPosition,
|
||||
}) ;
|
||||
});
|
||||
|
||||
|
||||
foreach (var item in inDto.AnswerList)
|
||||
|
@ -1977,19 +2005,19 @@ namespace IRaCIS.Application.Services
|
|||
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 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.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)
|
||||
.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();
|
||||
|
||||
|
@ -2120,9 +2148,10 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
TrialId = inDto.TrialId,
|
||||
TrialReadingCriterionId = trialReadingCriterionId.Value,
|
||||
Page=new PageInput() {
|
||||
PageIndex=1,
|
||||
PageSize=99999,
|
||||
Page = new PageInput()
|
||||
{
|
||||
PageIndex = 1,
|
||||
PageSize = 99999,
|
||||
}
|
||||
})).Item2;
|
||||
|
||||
|
@ -2165,7 +2194,7 @@ namespace IRaCIS.Application.Services
|
|||
&& x.TaskState == TaskState.Effect).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum= x.ArmEnum,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
|
@ -2270,7 +2299,7 @@ namespace IRaCIS.Application.Services
|
|||
int timespanMin = (DateTime.Now - cacheDate).Minutes;
|
||||
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)
|
||||
{
|
||||
|
@ -2438,7 +2467,7 @@ namespace IRaCIS.Application.Services
|
|||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[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 建立关系
|
||||
|
|
Loading…
Reference in New Issue