修改一版
parent
e461cef92e
commit
afc2b8b6b9
|
@ -25,9 +25,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
|
|
||||||
public ReadingCategory ReadingCategory { get; set; }
|
public ReadingCategory ReadingCategory { get; set; }
|
||||||
|
|
||||||
public decimal VisitNum{ get; set; }
|
public decimal VisitNum { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetReadingImgInDto
|
public class GetReadingImgInDto
|
||||||
{
|
{
|
||||||
|
@ -130,6 +130,23 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
// List<GetTrialReadingQuestionOutDto> Questions { get; set; }
|
// List<GetTrialReadingQuestionOutDto> Questions { get; set; }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
public class GroupTaskAnswerDto
|
||||||
|
{
|
||||||
|
public Guid QuestionId { get; set; }
|
||||||
|
|
||||||
|
public string AnswerGroup { get; set; }
|
||||||
|
|
||||||
|
public List<TaskAnswerDto> TaskAnswerList { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AnswerGroup
|
||||||
|
{
|
||||||
|
public Guid GroupId { get; set; }
|
||||||
|
|
||||||
|
public string GroupValue { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class TaskAnswerDto
|
public class TaskAnswerDto
|
||||||
{
|
{
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
|
@ -441,6 +441,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GroupName { get; set; }
|
public string GroupName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 答案分组
|
||||||
|
/// </summary>
|
||||||
|
public string AnswerGroup { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 类型
|
/// 类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -14,6 +14,7 @@ using Panda.DynamicWebApi.Attributes;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -310,9 +311,8 @@ namespace IRaCIS.Application.Services
|
||||||
private async Task TriggerJudgeQuestion(Guid VisitTaskId)
|
private async Task TriggerJudgeQuestion(Guid VisitTaskId)
|
||||||
{
|
{
|
||||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == VisitTaskId).FirstOrDefaultAsync();
|
var visitTask = await _visitTaskRepository.Where(x => x.Id == VisitTaskId).FirstOrDefaultAsync();
|
||||||
var visitTaskList = await _visitTaskRepository.Where(x =>x.ReadingTaskState== ReadingTaskState.HaveSigned&& x.SourceSubjectVisitId == visitTask.SourceSubjectVisitId && x.SouceReadModuleId == visitTask.SouceReadModuleId).ToListAsync();
|
var visitTaskids = await _visitTaskRepository.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.SourceSubjectVisitId == visitTask.SourceSubjectVisitId && x.SouceReadModuleId == visitTask.SouceReadModuleId).Select(x => x.Id).ToListAsync();
|
||||||
var visitTaskids = visitTaskList.Select(x => x.Id).ToList();
|
if (visitTaskids.Count == 2)
|
||||||
if (visitTaskList.Count == 2)
|
|
||||||
{
|
{
|
||||||
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 }
|
||||||
|
@ -323,10 +323,61 @@ namespace IRaCIS.Application.Services
|
||||||
QuestionId= question.Id,
|
QuestionId= question.Id,
|
||||||
VisitTaskId= questionAnswet.VisitTaskId,
|
VisitTaskId= questionAnswet.VisitTaskId,
|
||||||
};
|
};
|
||||||
|
var questionAnswerlist =await query.ToListAsync();
|
||||||
|
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup }).Select(x => new GroupTaskAnswerDto
|
||||||
|
{
|
||||||
|
QuestionId = x.Key.QuestionId,
|
||||||
|
AnswerGroup = x.Key.AnswerGroup,
|
||||||
|
TaskAnswerList = x.ToList(),
|
||||||
|
}).ToList();
|
||||||
|
var verificationResults = true;
|
||||||
|
foreach (var item in groupTasks)
|
||||||
|
{
|
||||||
|
if (item.TaskAnswerList.Count() != 2)
|
||||||
|
{
|
||||||
|
verificationResults = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var item1= item.TaskAnswerList[0];
|
||||||
|
var item2= item.TaskAnswerList[1];
|
||||||
|
if (item1.Answer != item2.Answer)
|
||||||
|
{
|
||||||
|
var answerGroup = JsonConvert.DeserializeObject<List<string>>(item.AnswerGroup).Select(x => new AnswerGroup()
|
||||||
|
{
|
||||||
|
GroupId = NewId.NextGuid(),
|
||||||
|
GroupValue = x
|
||||||
|
});
|
||||||
|
|
||||||
|
var itemAnswerGroupsitem1 = answerGroup.Where(x => x.GroupValue.Contains($"|{item1.Answer}|"));
|
||||||
|
var itemAnswerGroupsitem2 = answerGroup.Where(x => x.GroupValue.Contains($"|{item2.Answer}|"));
|
||||||
|
|
||||||
|
var unionList = itemAnswerGroupsitem1.Union(itemAnswerGroupsitem2).ToList();
|
||||||
|
if (unionList.Count < 1)
|
||||||
|
{
|
||||||
|
verificationResults = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!verificationResults)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加裁判任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task SaveJudgeTask()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue