修改一版
parent
e1f3e20962
commit
25584cda9e
|
@ -106,6 +106,21 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
#endregion
|
#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>
|
/// <summary>
|
||||||
|
|
|
@ -48,6 +48,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public class GetGlobalReadingInfoInDto
|
public class GetGlobalReadingInfoInDto
|
||||||
{
|
{
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当新答案为空的时候 是否是有原数据
|
||||||
|
/// </summary>
|
||||||
|
public bool UsingOriginalData { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetGlobalReadingInfoOutDto
|
public class GetGlobalReadingInfoOutDto
|
||||||
|
@ -81,6 +86,21 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
|
|
||||||
public string Answer { get; set; }
|
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>
|
||||||
/// 类型值
|
/// 类型值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -355,7 +375,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
|
|
||||||
public JudgeTypeEnum JudgeType { get; set; }
|
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
|
public class AnswerGroup
|
||||||
|
|
|
@ -17,5 +17,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
|
|
||||||
void FindChildQuestion(GetTrialReadingQuestionOutDto trialReadingQuestion, List<GetTrialReadingQuestionOutDto> questionlists);
|
void FindChildQuestion(GetTrialReadingQuestionOutDto trialReadingQuestion, List<GetTrialReadingQuestionOutDto> questionlists);
|
||||||
|
|
||||||
|
Task<IResponseOutput> SubmitGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -166,6 +166,9 @@ namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
QuestionId = y.ReadingQuestionTrialId,
|
QuestionId = y.ReadingQuestionTrialId,
|
||||||
QuestionName = y.ReadingQuestionTrial.QuestionName,
|
QuestionName = y.ReadingQuestionTrial.QuestionName,
|
||||||
|
AnswerGroup=y.ReadingQuestionTrial.AnswerGroup,
|
||||||
|
AnswerCombination=y.ReadingQuestionTrial.AnswerCombination,
|
||||||
|
JudgeType=y.ReadingQuestionTrial.JudgeType,
|
||||||
Type = y.ReadingQuestionTrial.Type,
|
Type = y.ReadingQuestionTrial.Type,
|
||||||
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
||||||
Answer = y.Answer
|
Answer = y.Answer
|
||||||
|
@ -184,10 +187,13 @@ namespace IRaCIS.Application.Services
|
||||||
, (l, r) => new { question = l, global = r })
|
, (l, r) => new { question = l, global = r })
|
||||||
.SelectMany(lr => lr.global.DefaultIfEmpty(), (lr, r) => new GlobalQuestionInfo
|
.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,
|
QuestionId = lr.question.QuestionId,
|
||||||
QuestionName = lr.question.QuestionName,
|
QuestionName = lr.question.QuestionName,
|
||||||
Type = lr.question.Type,
|
Type = lr.question.Type,
|
||||||
|
AnswerGroup = lr.question.AnswerGroup,
|
||||||
|
AnswerCombination = lr.question.AnswerCombination,
|
||||||
|
JudgeType = lr.question.JudgeType,
|
||||||
TypeValue = lr.question.TypeValue,
|
TypeValue = lr.question.TypeValue,
|
||||||
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
@ -800,7 +806,11 @@ namespace IRaCIS.Application.Services
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签名提交任务修改状态
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitTaskId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private async Task SubmitTaskChangeState(Guid visitTaskId)
|
private async Task SubmitTaskChangeState(Guid visitTaskId)
|
||||||
{
|
{
|
||||||
// 触裁判任务
|
// 触裁判任务
|
||||||
|
@ -861,7 +871,7 @@ namespace IRaCIS.Application.Services
|
||||||
#endregion
|
#endregion
|
||||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||||
List<ReadingGenerataTaskDTO> needReadList = new List<ReadingGenerataTaskDTO>();
|
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)
|
switch (taskInfo.ReadingCategory)
|
||||||
|
@ -903,7 +913,9 @@ namespace IRaCIS.Application.Services
|
||||||
ReadModuleId = x.Id,
|
ReadModuleId = x.Id,
|
||||||
ReadingCategory = typeChangeDic[x.ModuleType],
|
ReadingCategory = typeChangeDic[x.ModuleType],
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
|
if (taskInfo.JudgeVisitTaskId == null)
|
||||||
|
{
|
||||||
|
// 有裁判要等裁判完成之后才进行添加
|
||||||
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -911,6 +923,9 @@ namespace IRaCIS.Application.Services
|
||||||
TrialId = taskInfo.TrialId,
|
TrialId = taskInfo.TrialId,
|
||||||
ReadingGenerataTaskList = needReadList
|
ReadingGenerataTaskList = needReadList
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
|
||||||
|
|
||||||
break;
|
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>
|
/// <summary>
|
||||||
|
@ -929,119 +973,184 @@ namespace IRaCIS.Application.Services
|
||||||
private async Task TriggerJudgeQuestion(Guid visitTaskId)
|
private async Task TriggerJudgeQuestion(Guid visitTaskId)
|
||||||
{
|
{
|
||||||
List<Guid> visitTaskids = new List<Guid>();
|
List<Guid> visitTaskids = new List<Guid>();
|
||||||
//x.ReReadingApplyState!=ReReadingApplyState.Agree 排除重阅的
|
|
||||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).AsNoTracking().FirstNotNullAsync();
|
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).AsNoTracking().FirstNotNullAsync();
|
||||||
|
|
||||||
// 判断是否是一致性核查产生
|
// 判断是否是一致性核查产生
|
||||||
if (visitTask.IsAnalysisCreate&& visitTask.ConsistentAnalysisOriginalTaskId!=null)
|
if (visitTask.IsAnalysisCreate&& visitTask.ConsistentAnalysisOriginalTaskId!=null)
|
||||||
{
|
{
|
||||||
visitTaskids.Add(visitTask.Id);
|
visitTaskids.Add(visitTask.Id);
|
||||||
if (visitTask.ConsistentAnalysisOriginalTaskId != null)
|
|
||||||
{
|
|
||||||
visitTaskids.Add(visitTask.ConsistentAnalysisOriginalTaskId.Value);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// 这里是非一致性分析产生的
|
||||||
visitTaskids = await _visitTaskRepository.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReadingCategory != ReadingCategory.Judge
|
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();
|
&& 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 {
|
var trialInfo = await _trialRepository.Where(x => x.Id == visitTask.TrialId).Select(x=> new {
|
||||||
x.IsArbitrationReading,
|
x.IsArbitrationReading,
|
||||||
x.ArbitrationRule
|
x.ArbitrationRule
|
||||||
|
|
||||||
}).FirstNotNullAsync();
|
}).FirstNotNullAsync();
|
||||||
|
|
||||||
if (visitTaskids.Count == 2&& (trialInfo.IsArbitrationReading??false))
|
var noteEqual = false;
|
||||||
|
|
||||||
|
// 判断项目是否设置了裁判
|
||||||
|
if (trialInfo.IsArbitrationReading ?? false)
|
||||||
{
|
{
|
||||||
|
// 判断数量是否为2 是否仲裁
|
||||||
|
if (visitTaskids.Count == 2)
|
||||||
|
{
|
||||||
|
switch (visitTask.ReadingCategory)
|
||||||
|
{
|
||||||
|
// 访视
|
||||||
|
case ReadingCategory.Visit:
|
||||||
|
// 查找两个 访视的阅片答案
|
||||||
var query = from questionAnswet in _readingTaskQuestionAnswerRepository.Where(x => visitTaskids.Contains(x.VisitTaskId))
|
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 }
|
join question in _readingQuestionTrialRepository.Where(x => x.IsJudgeQuestion) on new { ReadingQuestionTrialId = questionAnswet.ReadingQuestionTrialId } equals new { ReadingQuestionTrialId = question.Id }
|
||||||
select new TaskAnswerDto()
|
select new TaskAnswerDto()
|
||||||
{
|
{
|
||||||
Answer = questionAnswet.Answer,
|
Answer = questionAnswet.Answer,
|
||||||
AnswerGroup = question.AnswerGroup,
|
AnswerGroup = question.AnswerGroup,
|
||||||
AnswerCombination=question.AnswerCombination,
|
AnswerCombination = question.AnswerCombination,
|
||||||
JudgeType=question.JudgeType,
|
JudgeType = question.JudgeType,
|
||||||
QuestionId = question.Id,
|
QuestionId = question.Id,
|
||||||
VisitTaskId = questionAnswet.VisitTaskId,
|
VisitTaskId = questionAnswet.VisitTaskId,
|
||||||
};
|
};
|
||||||
|
|
||||||
var questionAnswerlist = await query.ToListAsync();
|
var questionAnswerlist = await query.ToListAsync();
|
||||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup,x.JudgeType,x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
|
||||||
|
// 将答案进行分组
|
||||||
|
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||||
{
|
{
|
||||||
QuestionId = x.Key.QuestionId,
|
QuestionId = x.Key.QuestionId,
|
||||||
AnswerGroup = x.Key.AnswerGroup,
|
AnswerGroup = x.Key.AnswerGroup,
|
||||||
AnswerCombination=x.Key.AnswerCombination,
|
AnswerCombination = x.Key.AnswerCombination,
|
||||||
JudgeType=x.Key.JudgeType,
|
JudgeType = x.Key.JudgeType,
|
||||||
TaskAnswerList = x.ToList(),
|
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
noteEqual = ComputeJudgeResult(groupTasks);
|
||||||
var noteEqual = false;
|
break;
|
||||||
foreach (var item in groupTasks)
|
case ReadingCategory.Global:
|
||||||
|
var taskOneInfo = await this.GetGlobalReadingInfo(new GetGlobalReadingInfoInDto()
|
||||||
{
|
{
|
||||||
if (item.TaskAnswerList.Count() != 2)
|
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;
|
noteEqual = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var taskAnswer1 = item.TaskAnswerList[0];
|
var newlist = item.AfterQuestionList.Where(x => x.QuestionId != null).ToList().Union(
|
||||||
var taskAnswer2 = item.TaskAnswerList[1];
|
twoItem.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
||||||
if (taskAnswer1.Answer != taskAnswer2.Answer)
|
).ToList();
|
||||||
{
|
|
||||||
|
|
||||||
switch (item.JudgeType)
|
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||||
{
|
{
|
||||||
case JudgeTypeEnum.AnswerDisaffinity:
|
QuestionId = x.Key.QuestionId.Value,
|
||||||
noteEqual = true;
|
AnswerGroup = x.Key.AnswerGroup,
|
||||||
break;
|
AnswerCombination = x.Key.AnswerCombination,
|
||||||
case JudgeTypeEnum.AnswerGroup:
|
JudgeType = x.Key.JudgeType,
|
||||||
var answerGroupList = JsonConvert.DeserializeObject<List<string>>(item.AnswerGroup).Select(x => new AnswerGroup()
|
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||||
{
|
|
||||||
GroupId = NewId.NextGuid(),
|
|
||||||
GroupValue = x
|
|
||||||
}).ToList();
|
}).ToList();
|
||||||
var itemAnswerGroupsitem1 = answerGroupList.Where(x => x.GroupValue.Contains($"|{taskAnswer1.Answer}|"));
|
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||||
var itemAnswerGroupsitem2 = answerGroupList.Where(x => x.GroupValue.Contains($"|{taskAnswer2.Answer}|"));
|
}
|
||||||
var unionList = itemAnswerGroupsitem1.Intersect(itemAnswerGroupsitem2).ToList();
|
|
||||||
if (unionList.Count < 1)
|
}
|
||||||
{
|
|
||||||
noteEqual =true;
|
|
||||||
}
|
}
|
||||||
break;
|
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))
|
|
||||||
{
|
|
||||||
noteEqual = true;
|
|
||||||
}
|
}
|
||||||
if (x.AnswerGroupB.Contains(taskAnswer1.Answer) && x.AnswerGroupA.Contains(taskAnswer2.Answer))
|
|
||||||
{
|
|
||||||
noteEqual = true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 这里判断一致性分析产生的全局阅片
|
||||||
|
if (visitTask.ReadingCategory == ReadingCategory.Global && visitTask.IsAnalysisCreate)
|
||||||
|
{
|
||||||
|
var taskOneInfo = await this.GetGlobalReadingInfo(new GetGlobalReadingInfoInDto()
|
||||||
|
{
|
||||||
|
UsingOriginalData = true,
|
||||||
|
VisitTaskId = visitTask.Id
|
||||||
});
|
});
|
||||||
break;
|
|
||||||
}
|
// 找到最后一个任务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 (noteEqual)
|
||||||
{
|
{
|
||||||
if (visitTask.IsAnalysisCreate)
|
if (visitTask.IsAnalysisCreate)
|
||||||
{
|
{
|
||||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x=>x.Id==visitTaskId, x => new VisitTask()
|
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == visitTaskId, x => new VisitTask()
|
||||||
{
|
{
|
||||||
IsAnalysisDiffToOriginalData = true
|
IsAnalysisDiffToOriginalData = true
|
||||||
});
|
});
|
||||||
|
@ -1075,8 +1184,69 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <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>
|
/// <summary>
|
||||||
/// 添加裁判任务
|
/// 添加裁判任务
|
||||||
|
|
Loading…
Reference in New Issue