修改一版
parent
e1f3e20962
commit
25584cda9e
|
@ -106,6 +106,21 @@ namespace IRaCIS.Core.API.Controllers
|
|||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交全局阅片任务
|
||||
/// </summary>
|
||||
/// <param name="opt"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Inspection/ReadingImageTask/SubmitGlobalReadingInfo")]
|
||||
[UnitOfWork]
|
||||
public async Task<IResponseOutput> SubmitGlobalReadingInfo(DataInspectionDto<SaveGlobalReadingInfoInDto> opt)
|
||||
{
|
||||
|
||||
var singid = await _inspectionService.RecordSing(opt.SignInfo);
|
||||
var result = await _iReadingImageTaskService.SubmitGlobalReadingInfo(opt.Data);
|
||||
await _inspectionService.CompletedSign(singid, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -48,6 +48,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public class GetGlobalReadingInfoInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当新答案为空的时候 是否是有原数据
|
||||
/// </summary>
|
||||
public bool UsingOriginalData { get; set; } = false;
|
||||
}
|
||||
|
||||
public class GetGlobalReadingInfoOutDto
|
||||
|
@ -81,6 +86,21 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public string Answer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 答案分组
|
||||
/// </summary>
|
||||
public string AnswerGroup { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 答案组合
|
||||
/// </summary>
|
||||
public string AnswerCombination { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 裁判类型
|
||||
/// </summary>
|
||||
public JudgeTypeEnum JudgeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型值
|
||||
/// </summary>
|
||||
|
@ -355,7 +375,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public JudgeTypeEnum JudgeType { get; set; }
|
||||
|
||||
public List<TaskAnswerDto> TaskAnswerList { get; set; }
|
||||
public List<string> TaskAnswerList { get; set; }
|
||||
}
|
||||
|
||||
public class TaskGroupAnswer
|
||||
{
|
||||
public string Answer { get; set; }
|
||||
}
|
||||
|
||||
public class AnswerGroup
|
||||
|
|
|
@ -17,5 +17,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
|
||||
void FindChildQuestion(GetTrialReadingQuestionOutDto trialReadingQuestion, List<GetTrialReadingQuestionOutDto> questionlists);
|
||||
|
||||
Task<IResponseOutput> SubmitGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto);
|
||||
}
|
||||
}
|
|
@ -166,6 +166,9 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
QuestionName = y.ReadingQuestionTrial.QuestionName,
|
||||
AnswerGroup=y.ReadingQuestionTrial.AnswerGroup,
|
||||
AnswerCombination=y.ReadingQuestionTrial.AnswerCombination,
|
||||
JudgeType=y.ReadingQuestionTrial.JudgeType,
|
||||
Type = y.ReadingQuestionTrial.Type,
|
||||
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
||||
Answer = y.Answer
|
||||
|
@ -184,10 +187,13 @@ namespace IRaCIS.Application.Services
|
|||
, (l, r) => new { question = l, global = r })
|
||||
.SelectMany(lr => lr.global.DefaultIfEmpty(), (lr, r) => new GlobalQuestionInfo
|
||||
{
|
||||
Answer = lr.global == null ? string.Empty : lr.global.Select(x => x.Answer).FirstOrDefault(),
|
||||
Answer = lr.global == null ? (inDto.UsingOriginalData?lr.question.Answer: string.Empty) : lr.global.Select(x => x.Answer).FirstOrDefault(),
|
||||
QuestionId = lr.question.QuestionId,
|
||||
QuestionName = lr.question.QuestionName,
|
||||
Type = lr.question.Type,
|
||||
AnswerGroup = lr.question.AnswerGroup,
|
||||
AnswerCombination = lr.question.AnswerCombination,
|
||||
JudgeType = lr.question.JudgeType,
|
||||
TypeValue = lr.question.TypeValue,
|
||||
|
||||
}).ToList();
|
||||
|
@ -800,7 +806,11 @@ namespace IRaCIS.Application.Services
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 签名提交任务修改状态
|
||||
/// </summary>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
private async Task SubmitTaskChangeState(Guid visitTaskId)
|
||||
{
|
||||
// 触裁判任务
|
||||
|
@ -861,7 +871,7 @@ namespace IRaCIS.Application.Services
|
|||
#endregion
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
List<ReadingGenerataTaskDTO> needReadList = new List<ReadingGenerataTaskDTO>();
|
||||
if (!await _visitTaskRepository.Where(x => x.Id== visitTaskId).Select(x=>x.IsAnalysisCreate).FirstOrDefaultAsync())
|
||||
if (!taskInfo.IsAnalysisCreate)
|
||||
{
|
||||
// 任务类型
|
||||
switch (taskInfo.ReadingCategory)
|
||||
|
@ -903,14 +913,19 @@ namespace IRaCIS.Application.Services
|
|||
ReadModuleId = x.Id,
|
||||
ReadingCategory = typeChangeDic[x.ModuleType],
|
||||
}).ToListAsync();
|
||||
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
|
||||
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
||||
if (taskInfo.JudgeVisitTaskId == null)
|
||||
{
|
||||
// 有裁判要等裁判完成之后才进行添加
|
||||
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
||||
{
|
||||
|
||||
ReadingCategory = GenerateTaskCategory.Oncology,
|
||||
TrialId = taskInfo.TrialId,
|
||||
ReadingGenerataTaskList = needReadList
|
||||
});
|
||||
ReadingCategory = GenerateTaskCategory.Oncology,
|
||||
TrialId = taskInfo.TrialId,
|
||||
ReadingGenerataTaskList = needReadList
|
||||
});
|
||||
}
|
||||
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -919,6 +934,35 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 全局阅片裁判触发
|
||||
/// </summary>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
private async Task GlobalTriggerJudgeQuestion(Guid visitTaskId)
|
||||
{
|
||||
List<Guid> visitTaskids = new List<Guid>();
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
|
||||
// 判断是否是一致性分析产生的
|
||||
if (taskInfo.IsAnalysisCreate)
|
||||
{
|
||||
if (taskInfo.ConsistentAnalysisOriginalTaskId != null)
|
||||
{
|
||||
visitTaskids.Add(visitTaskId);
|
||||
visitTaskids.Add(taskInfo.ConsistentAnalysisOriginalTaskId.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
visitTaskids = await _visitTaskRepository.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReadingCategory != ReadingCategory.Judge
|
||||
|
||||
&& x.ReReadingApplyState != ReReadingApplyState.Agree && x.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId && x.SouceReadModuleId == taskInfo.SouceReadModuleId).Select(x => x.Id).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -929,154 +973,280 @@ namespace IRaCIS.Application.Services
|
|||
private async Task TriggerJudgeQuestion(Guid visitTaskId)
|
||||
{
|
||||
List<Guid> visitTaskids = new List<Guid>();
|
||||
//x.ReReadingApplyState!=ReReadingApplyState.Agree 排除重阅的
|
||||
|
||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).AsNoTracking().FirstNotNullAsync();
|
||||
|
||||
// 判断是否是一致性核查产生
|
||||
if (visitTask.IsAnalysisCreate&& visitTask.ConsistentAnalysisOriginalTaskId!=null)
|
||||
{
|
||||
visitTaskids.Add(visitTask.Id);
|
||||
if (visitTask.ConsistentAnalysisOriginalTaskId != null)
|
||||
{
|
||||
visitTaskids.Add(visitTask.ConsistentAnalysisOriginalTaskId.Value);
|
||||
}
|
||||
|
||||
// 这种情况是新产生的阅片期
|
||||
if (visitTask.SouceReadModuleId != null)
|
||||
{
|
||||
var visitNum = await _readModuleRepository.Where(x => x.Id == visitTask.SouceReadModuleId).Select(x => x.VisitNum).FirstOrDefaultAsync();
|
||||
var lastVisitId = await _visitTaskRepository.Where(x => !x.IsAnalysisCreate&&x.ArmEnum== visitTask.ArmEnum && x.SouceReadModuleId == visitTask.SouceReadModuleId && x.ReadModule.VisitNum <= visitNum).OrderByDescending(x => x.ReadModule.VisitNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
visitTaskids.Add(lastVisitId);
|
||||
}
|
||||
visitTaskids.Add(visitTask.ConsistentAnalysisOriginalTaskId.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 这里是非一致性分析产生的
|
||||
visitTaskids = await _visitTaskRepository.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReadingCategory != ReadingCategory.Judge
|
||||
&&x.IsAnalysisCreate==false
|
||||
&& x.ReReadingApplyState != ReReadingApplyState.Agree && x.SourceSubjectVisitId == visitTask.SourceSubjectVisitId && x.SouceReadModuleId == visitTask.SouceReadModuleId).Select(x => x.Id).ToListAsync();
|
||||
}
|
||||
|
||||
var trialInfo = await _trialRepository.Where(x => x.Id == visitTask.TrialId).Select(x=> new {
|
||||
x.IsArbitrationReading,
|
||||
x.ArbitrationRule
|
||||
|
||||
}).FirstNotNullAsync();
|
||||
|
||||
if (visitTaskids.Count == 2&& (trialInfo.IsArbitrationReading??false))
|
||||
var noteEqual = false;
|
||||
|
||||
// 判断项目是否设置了裁判
|
||||
if (trialInfo.IsArbitrationReading ?? false)
|
||||
{
|
||||
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
|
||||
// 判断数量是否为2 是否仲裁
|
||||
if (visitTaskids.Count == 2)
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination=x.Key.AnswerCombination,
|
||||
JudgeType=x.Key.JudgeType,
|
||||
TaskAnswerList = x.ToList(),
|
||||
}).ToList();
|
||||
|
||||
var noteEqual = false;
|
||||
foreach (var item in groupTasks)
|
||||
{
|
||||
if (item.TaskAnswerList.Count() != 2)
|
||||
switch (visitTask.ReadingCategory)
|
||||
{
|
||||
noteEqual = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskAnswer1 = item.TaskAnswerList[0];
|
||||
var taskAnswer2 = item.TaskAnswerList[1];
|
||||
if (taskAnswer1.Answer != taskAnswer2.Answer)
|
||||
{
|
||||
|
||||
switch (item.JudgeType)
|
||||
{
|
||||
case JudgeTypeEnum.AnswerDisaffinity:
|
||||
noteEqual = true;
|
||||
break;
|
||||
case JudgeTypeEnum.AnswerGroup:
|
||||
var answerGroupList = JsonConvert.DeserializeObject<List<string>>(item.AnswerGroup).Select(x => new AnswerGroup()
|
||||
{
|
||||
GroupId = NewId.NextGuid(),
|
||||
GroupValue = x
|
||||
}).ToList();
|
||||
var itemAnswerGroupsitem1 = answerGroupList.Where(x => x.GroupValue.Contains($"|{taskAnswer1.Answer}|"));
|
||||
var itemAnswerGroupsitem2 = answerGroupList.Where(x => x.GroupValue.Contains($"|{taskAnswer2.Answer}|"));
|
||||
var unionList = itemAnswerGroupsitem1.Intersect(itemAnswerGroupsitem2).ToList();
|
||||
if (unionList.Count < 1)
|
||||
{
|
||||
noteEqual =true;
|
||||
}
|
||||
break;
|
||||
case JudgeTypeEnum.AnswerCombination:
|
||||
var answerCombinationList = JsonConvert.DeserializeObject<List<AnswerCombinationDto>>(item.AnswerCombination == string.Empty ? "[]" : item.AnswerCombination).ToList();
|
||||
answerCombinationList.ForEach(x =>
|
||||
{
|
||||
if (x.AnswerGroupA.Contains(taskAnswer1.Answer) && x.AnswerGroupB.Contains(taskAnswer2.Answer))
|
||||
// 访视
|
||||
case ReadingCategory.Visit:
|
||||
// 查找两个 访视的阅片答案
|
||||
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()
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
if (x.AnswerGroupB.Contains(taskAnswer1.Answer) && x.AnswerGroupA.Contains(taskAnswer2.Answer))
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (noteEqual)
|
||||
{
|
||||
if (visitTask.IsAnalysisCreate)
|
||||
{
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x=>x.Id==visitTaskId, x => new VisitTask()
|
||||
{
|
||||
IsAnalysisDiffToOriginalData = true
|
||||
});
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
Answer = questionAnswet.Answer,
|
||||
AnswerGroup = question.AnswerGroup,
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
};
|
||||
var questionAnswerlist = await query.ToListAsync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ((visitTask.SourceSubjectVisitId != null && trialInfo.ArbitrationRule == ArbitrationRule.Visit) || (visitTask.SouceReadModuleId != null && trialInfo.ArbitrationRule == ArbitrationRule.Reading))
|
||||
{
|
||||
await this.SaveJudgeTask(new SaveJudgeTaskDto()
|
||||
// 将答案进行分组
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
VisitTaskIds = visitTaskids,
|
||||
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()
|
||||
{
|
||||
UsingOriginalData = true,
|
||||
VisitTaskId = visitTaskids[0]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var taskTwoInfo = await this.GetGlobalReadingInfo(new GetGlobalReadingInfoInDto()
|
||||
{
|
||||
UsingOriginalData = true,
|
||||
VisitTaskId = visitTaskids[1]
|
||||
});
|
||||
|
||||
// 判断两个任务是否
|
||||
if (taskOneInfo.TaskList.Count() != taskTwoInfo.TaskList.Count())
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in taskOneInfo.TaskList)
|
||||
{
|
||||
GlobalVisitInfo twoItem = taskTwoInfo.TaskList.Where(x => x.VisitId == item.VisitId).FirstOrDefault();
|
||||
|
||||
if (twoItem == null)
|
||||
{
|
||||
noteEqual = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newlist = item.AfterQuestionList.Where(x => x.QuestionId != null).ToList().Union(
|
||||
twoItem.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
||||
).ToList();
|
||||
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId.Value,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (visitTask.IsAnalysisCreate)
|
||||
// 这里判断一致性分析产生的全局阅片
|
||||
if (visitTask.ReadingCategory == ReadingCategory.Global && visitTask.IsAnalysisCreate)
|
||||
{
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == visitTaskId, x => new VisitTask()
|
||||
var taskOneInfo = await this.GetGlobalReadingInfo(new GetGlobalReadingInfoInDto()
|
||||
{
|
||||
IsAnalysisDiffToOriginalData = false
|
||||
UsingOriginalData = true,
|
||||
VisitTaskId = visitTask.Id
|
||||
});
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
// 找到最后一个任务ID
|
||||
var lastTask = taskOneInfo.TaskList.Last();
|
||||
|
||||
if (lastTask == null)
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
else {
|
||||
var query = from questionAnswet in _readingTaskQuestionAnswerRepository.Where(x =>
|
||||
x.VisitTask.IsAnalysisCreate==false&&
|
||||
x.VisitTask.DoctorUserId==visitTask.DoctorUserId&&
|
||||
x.VisitTask.TaskState== TaskState.Effect&&
|
||||
(x.VisitTask.SourceSubjectVisitId??default(Guid))== lastTask.VisitId)
|
||||
join question in _readingQuestionTrialRepository.Where(x => x.IsJudgeQuestion) on new { ReadingQuestionTrialId = questionAnswet.ReadingQuestionTrialId } equals new { ReadingQuestionTrialId = question.Id }
|
||||
select new GlobalQuestionInfo()
|
||||
{
|
||||
Answer = questionAnswet.Answer,
|
||||
AnswerGroup = question.AnswerGroup,
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
|
||||
};
|
||||
|
||||
var visitTaskQuestions =await query.ToListAsync();
|
||||
|
||||
var newlist = visitTaskQuestions.Where(x => x.QuestionId != null).ToList().Union(
|
||||
lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
||||
).ToList();
|
||||
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId.Value,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (noteEqual)
|
||||
{
|
||||
if (visitTask.IsAnalysisCreate)
|
||||
{
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == visitTaskId, x => new VisitTask()
|
||||
{
|
||||
IsAnalysisDiffToOriginalData = true
|
||||
});
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ((visitTask.SourceSubjectVisitId != null && trialInfo.ArbitrationRule == ArbitrationRule.Visit) || (visitTask.SouceReadModuleId != null && trialInfo.ArbitrationRule == ArbitrationRule.Reading))
|
||||
{
|
||||
await this.SaveJudgeTask(new SaveJudgeTaskDto()
|
||||
{
|
||||
VisitTaskIds = visitTaskids,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (visitTask.IsAnalysisCreate)
|
||||
{
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == visitTaskId, x => new VisitTask()
|
||||
{
|
||||
IsAnalysisDiffToOriginalData = false
|
||||
});
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算返回的结果 为True表示不相等
|
||||
/// </summary>
|
||||
/// <param name="groupTasks"></param>
|
||||
/// <returns></returns>
|
||||
private bool ComputeJudgeResult(List<GroupTaskAnswerDto> groupTasks)
|
||||
{
|
||||
var noteEqual = false;
|
||||
foreach (var item in groupTasks)
|
||||
{
|
||||
if (item.TaskAnswerList.Count() != 2)
|
||||
{
|
||||
noteEqual = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskAnswer1 = item.TaskAnswerList[0];
|
||||
var taskAnswer2 = item.TaskAnswerList[1];
|
||||
if (taskAnswer1 != taskAnswer2)
|
||||
{
|
||||
|
||||
switch (item.JudgeType)
|
||||
{
|
||||
case JudgeTypeEnum.AnswerDisaffinity:
|
||||
noteEqual = true;
|
||||
break;
|
||||
case JudgeTypeEnum.AnswerGroup:
|
||||
var answerGroupList = JsonConvert.DeserializeObject<List<string>>(item.AnswerGroup).Select(x => new AnswerGroup()
|
||||
{
|
||||
GroupId = NewId.NextGuid(),
|
||||
GroupValue = x
|
||||
}).ToList();
|
||||
var itemAnswerGroupsitem1 = answerGroupList.Where(x => x.GroupValue.Contains($"|{taskAnswer1}|"));
|
||||
var itemAnswerGroupsitem2 = answerGroupList.Where(x => x.GroupValue.Contains($"|{taskAnswer2}|"));
|
||||
var unionList = itemAnswerGroupsitem1.Intersect(itemAnswerGroupsitem2).ToList();
|
||||
if (unionList.Count < 1)
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
break;
|
||||
case JudgeTypeEnum.AnswerCombination:
|
||||
var answerCombinationList = JsonConvert.DeserializeObject<List<AnswerCombinationDto>>(item.AnswerCombination == string.Empty ? "[]" : item.AnswerCombination).ToList();
|
||||
answerCombinationList.ForEach(x =>
|
||||
{
|
||||
if (x.AnswerGroupA.Contains(taskAnswer1) && x.AnswerGroupB.Contains(taskAnswer2))
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
if (x.AnswerGroupB.Contains(taskAnswer1) && x.AnswerGroupA.Contains(taskAnswer2))
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return noteEqual;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加裁判任务
|
||||
|
|
Loading…
Reference in New Issue