访视全局阅片裁判
parent
c30d0be886
commit
e8b4b71499
|
@ -1307,6 +1307,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public List<JudgeQuestion> JudgeQuestionList { get; set; }
|
||||
}
|
||||
|
||||
public class GlobalVisitJudgeQuestion : JudgeQuestion
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int ShowOrder { get; set; }
|
||||
}
|
||||
|
||||
public class JudgeQuestion
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
@ -1314,6 +1324,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 问题类型
|
||||
|
@ -1522,6 +1534,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public decimal VisitTaskNum { get; set; }
|
||||
public string Answer { get; set; }
|
||||
|
||||
public string AnswerGroup { get; set; }
|
||||
|
|
|
@ -117,32 +117,106 @@ namespace IRaCIS.Application.Services
|
|||
switch (taskList[0].ReadingCategory)
|
||||
{
|
||||
case ReadingCategory.Visit:
|
||||
JudgeReadingInfoDto judgeReadingInfoDto = new JudgeReadingInfoDto()
|
||||
{
|
||||
VisitId = taskList[0].SourceSubjectVisitId.Value,
|
||||
VisitName = taskList[0].TaskBlindName,
|
||||
VisitTaskInfoList = new List<JudgeReadingQuestion>(),
|
||||
};
|
||||
|
||||
foreach (var item in taskList)
|
||||
// 判断是否是全局访视任务
|
||||
if (await VerifyIsGlobalVisitTask(taskList[0].Id))
|
||||
{
|
||||
judgeReadingInfoDto.VisitTaskInfoList.Add(new JudgeReadingQuestion()
|
||||
{
|
||||
ArmEnum = item.ArmEnum,
|
||||
VisitTaskId = item.Id,
|
||||
JudgeQuestionList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == item.Id && x.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(x => x.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(x => new JudgeQuestion()
|
||||
{
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.ReadingQuestionTrial.Id,
|
||||
QuestionName = x.ReadingQuestionTrial.QuestionName,
|
||||
QuestionGenre=x.ReadingQuestionTrial.QuestionGenre,
|
||||
DictionaryCode=x.ReadingQuestionTrial.DictionaryCode,
|
||||
|
||||
// 找到所有的的任务
|
||||
var globalVisitTasks = await _visitTaskRepository.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReadingCategory != ReadingCategory.Judge
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId == taskList[0].TrialReadingCriterionId
|
||||
&& x.IsAnalysisCreate == false
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && x.VisitTaskNum <= taskList[0].VisitTaskNum).Select(x => new {
|
||||
x.Id,
|
||||
x.ArmEnum,
|
||||
x.VisitTaskNum,
|
||||
x.SourceSubjectVisitId,
|
||||
x.TaskBlindName,
|
||||
} ).ToListAsync();
|
||||
|
||||
var globalVisitTaskIds = globalVisitTasks.Select(x => x.Id).ToList();
|
||||
|
||||
var taskNum = globalVisitTasks.Select(x => x.VisitTaskNum).Distinct().OrderBy(x=>x).ToList();
|
||||
|
||||
|
||||
var judgeQuestionAnswer = await _readingTaskQuestionAnswerRepository.Where(x => globalVisitTaskIds.Contains(x.VisitTaskId) && x.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(x => x.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(x => new GlobalVisitJudgeQuestion()
|
||||
{
|
||||
Answer = x.Answer,
|
||||
ShowOrder = x.ReadingQuestionTrial.ShowOrder,
|
||||
VisitTaskId = x.VisitTaskId,
|
||||
QuestionId = x.ReadingQuestionTrial.Id,
|
||||
QuestionName = x.ReadingQuestionTrial.QuestionName,
|
||||
QuestionGenre = x.ReadingQuestionTrial.QuestionGenre,
|
||||
DictionaryCode = x.ReadingQuestionTrial.DictionaryCode,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
foreach (var item in taskNum)
|
||||
{
|
||||
var globalTaskInfos = globalVisitTasks.Where(x => x.VisitTaskNum == item).OrderBy(x => x.ArmEnum).ToList();
|
||||
|
||||
JudgeReadingInfoDto judgeReadingInfoDto = new JudgeReadingInfoDto()
|
||||
{
|
||||
VisitId = globalTaskInfos[0].SourceSubjectVisitId.Value,
|
||||
VisitName = globalTaskInfos[0].TaskBlindName,
|
||||
VisitTaskInfoList = new List<JudgeReadingQuestion>(),
|
||||
};
|
||||
|
||||
foreach (var globalitem in globalTaskInfos)
|
||||
{
|
||||
judgeReadingInfoDto.VisitTaskInfoList.Add(new JudgeReadingQuestion()
|
||||
{
|
||||
ArmEnum = globalitem.ArmEnum,
|
||||
VisitTaskId = globalitem.Id,
|
||||
JudgeQuestionList = judgeQuestionAnswer.Where(x => x.VisitTaskId == globalitem.Id).OrderBy(x => x.ShowOrder)
|
||||
.Select(x => new JudgeQuestion()
|
||||
{
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.QuestionId,
|
||||
QuestionName = x.QuestionName,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
|
||||
}).ToList(),
|
||||
});
|
||||
}
|
||||
judgeInfo.VisitInfoList.Add(judgeReadingInfoDto);
|
||||
}
|
||||
|
||||
}).ToListAsync(),
|
||||
});
|
||||
}
|
||||
judgeInfo.VisitInfoList.Add(judgeReadingInfoDto);
|
||||
else
|
||||
{
|
||||
JudgeReadingInfoDto judgeReadingInfoDto = new JudgeReadingInfoDto()
|
||||
{
|
||||
VisitId = taskList[0].SourceSubjectVisitId.Value,
|
||||
VisitName = taskList[0].TaskBlindName,
|
||||
VisitTaskInfoList = new List<JudgeReadingQuestion>(),
|
||||
};
|
||||
|
||||
foreach (var item in taskList)
|
||||
{
|
||||
judgeReadingInfoDto.VisitTaskInfoList.Add(new JudgeReadingQuestion()
|
||||
{
|
||||
ArmEnum = item.ArmEnum,
|
||||
VisitTaskId = item.Id,
|
||||
JudgeQuestionList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == item.Id && x.ReadingQuestionTrial.IsJudgeQuestion).OrderBy(x => x.ReadingQuestionTrial.ShowOrder)
|
||||
.Select(x => new JudgeQuestion()
|
||||
{
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.ReadingQuestionTrial.Id,
|
||||
QuestionName = x.ReadingQuestionTrial.QuestionName,
|
||||
QuestionGenre = x.ReadingQuestionTrial.QuestionGenre,
|
||||
DictionaryCode = x.ReadingQuestionTrial.DictionaryCode,
|
||||
|
||||
}).ToListAsync(),
|
||||
});
|
||||
}
|
||||
judgeInfo.VisitInfoList.Add(judgeReadingInfoDto);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ReadingCategory.Global:
|
||||
|
@ -318,6 +392,35 @@ namespace IRaCIS.Application.Services
|
|||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断任务是否是全局访视任务
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> VerifyIsGlobalVisitTask(Guid visitTaskId)
|
||||
{
|
||||
// 任务
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
|
||||
if (taskinfo.ReadingCategory != ReadingCategory.Visit)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var readModule = await _readModuleRepository.Where(x => x.SubjectVisitId == taskinfo.SourceSubjectVisitId && x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId).FirstOrDefaultAsync();
|
||||
|
||||
if (criterion.IsGlobalReading && !criterion.IsGlobalTask && readModule != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发裁判任务(新)
|
||||
/// </summary>
|
||||
|
@ -369,29 +472,73 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
// 判断是单访视裁判还是全局访视裁判
|
||||
// 查找两个 访视的阅片答案
|
||||
var query = from questionAnswet in _readingTaskQuestionAnswerRepository.Where(x => visitTaskids.Contains(x.VisitTaskId))
|
||||
join question in _readingQuestionTrialRepository.Where(x => x.IsJudgeQuestion) on new { ReadingQuestionTrialId = questionAnswet.ReadingQuestionTrialId } equals new { ReadingQuestionTrialId = question.Id }
|
||||
select new TaskAnswerDto()
|
||||
{
|
||||
Answer = questionAnswet.Answer,
|
||||
AnswerGroup = question.AnswerGroup,
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
};
|
||||
var questionAnswerlist = await query.ToListAsync();
|
||||
|
||||
// 将答案进行分组
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
if (await VerifyIsGlobalVisitTask(visitTaskId))
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = ComputeJudgeResult(groupTasks);
|
||||
// 找到所有的的任务
|
||||
var GlobalVisitTaskIds = await _visitTaskRepository.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReadingCategory != ReadingCategory.Judge
|
||||
&& x.TaskState == TaskState.Effect
|
||||
&& x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId
|
||||
&& x.IsAnalysisCreate == false
|
||||
&& x.ReadingCategory == ReadingCategory.Visit && x.VisitTaskNum <= visitTask.VisitTaskNum).Select(x => x.Id).ToListAsync();
|
||||
|
||||
|
||||
var globalVisitQuestionQuery = from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x => GlobalVisitTaskIds.Contains(x.VisitTaskId))
|
||||
join question in _readingQuestionTrialRepository.Where(x => x.IsJudgeQuestion) on new { ReadingQuestionTrialId = questionAnswer.ReadingQuestionTrialId } equals new { ReadingQuestionTrialId = question.Id }
|
||||
select new TaskAnswerDto()
|
||||
{
|
||||
VisitTaskNum=questionAnswer.VisitTask.VisitTaskNum,
|
||||
Answer = questionAnswer.Answer,
|
||||
AnswerGroup = question.AnswerGroup,
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
VisitTaskId = questionAnswer.VisitTaskId,
|
||||
};
|
||||
var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync();
|
||||
|
||||
var taskNums = globalVisitAnswerlist.Select(x => x.VisitTaskNum).Distinct().OrderBy(x => x).ToList();
|
||||
|
||||
foreach (var item in taskNums)
|
||||
{
|
||||
List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x=>x.VisitTaskNum==item).GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(groupTasks);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var query = from questionAnswet in _readingTaskQuestionAnswerRepository.Where(x => visitTaskids.Contains(x.VisitTaskId))
|
||||
join question in _readingQuestionTrialRepository.Where(x => x.IsJudgeQuestion) on new { ReadingQuestionTrialId = questionAnswet.ReadingQuestionTrialId } equals new { ReadingQuestionTrialId = question.Id }
|
||||
select new TaskAnswerDto()
|
||||
{
|
||||
Answer = questionAnswet.Answer,
|
||||
AnswerGroup = question.AnswerGroup,
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
};
|
||||
var questionAnswerlist = await query.ToListAsync();
|
||||
|
||||
// 将答案进行分组
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = ComputeJudgeResult(groupTasks);
|
||||
}
|
||||
|
||||
break;
|
||||
case ReadingCategory.Global:
|
||||
var taskOneInfo = await this.GetGlobalReadingInfo(new GetGlobalReadingInfoInDto()
|
||||
|
|
Loading…
Reference in New Issue