复制其他访视的项目阅片标准裁判规则配置
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
c35ec016dd
commit
bc8aeb8d7c
|
|
@ -29,6 +29,22 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||||
public List<TrialQuestionVisitJudgeRuleItemDto> QuestionList { get; set; } = new List<TrialQuestionVisitJudgeRuleItemDto>();
|
public List<TrialQuestionVisitJudgeRuleItemDto> QuestionList { get; set; } = new List<TrialQuestionVisitJudgeRuleItemDto>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CopyTrialQuestionVisitJudgeRuleInDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialReadingCriterionId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 来源访视
|
||||||
|
/// </summary>
|
||||||
|
public decimal SourceVisitNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标访视
|
||||||
|
/// </summary>
|
||||||
|
public decimal TargetVisitNum { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class TrialQuestionVisitJudgeRuleItemDto
|
public class TrialQuestionVisitJudgeRuleItemDto
|
||||||
{
|
{
|
||||||
public Guid ReadingQuestionTrialId { get; set; }
|
public Guid ReadingQuestionTrialId { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
#region 项目访视裁判规则
|
#region 项目访视裁判规则
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取项目阅片标准各访视的裁判规则配置。
|
/// 获取项目阅片标准各访视的裁判规则配置。
|
||||||
/// 未配置规则的访视问题也会返回,供前端直接进行配置。
|
/// 未配置规则的访视问题也会返回,供前端直接进行配置。
|
||||||
|
|
@ -132,6 +135,54 @@ namespace IRaCIS.Core.Application.Service
|
||||||
return ResponseOutput.Result(await _readingQuestionVisitJudgeRuleRepository.SaveChangesAsync());
|
return ResponseOutput.Result(await _readingQuestionVisitJudgeRuleRepository.SaveChangesAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复制其他访视的项目阅片标准裁判规则配置。
|
||||||
|
/// 目标访视不适用的问题保留其已有的不适用规则,不参与复制。
|
||||||
|
/// </summary>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IResponseOutput> CopyTrialQuestionVisitJudgeRule(CopyTrialQuestionVisitJudgeRuleInDto inDto)
|
||||||
|
{
|
||||||
|
var targetQuestionIds = await _readingQuestionTrialRepository
|
||||||
|
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId && x.IsJudgeQuestion)
|
||||||
|
.Where(x => x.LimitShow == LimitShow.AllShow
|
||||||
|
|| (x.LimitShow == LimitShow.BaseLineShow && inDto.TargetVisitNum == 0)
|
||||||
|
|| (x.LimitShow == LimitShow.FollowShow && inDto.TargetVisitNum != 0)
|
||||||
|
|| (x.LimitShow == LimitShow.ExcludeSomeVisits && !x.ExcludeShowVisitList.Contains(inDto.TargetVisitNum)))
|
||||||
|
.Select(x => x.Id)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
if (targetQuestionIds.Count == 0)
|
||||||
|
{
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
var sourceRules = await _readingQuestionVisitJudgeRuleRepository
|
||||||
|
.Where(x => x.VisitNum == inDto.SourceVisitNum && targetQuestionIds.Contains(x.ReadingQuestionId))
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
await _readingQuestionVisitJudgeRuleRepository.BatchDeleteNoTrackingAsync(x =>
|
||||||
|
x.VisitNum == inDto.TargetVisitNum && targetQuestionIds.Contains(x.ReadingQuestionId));
|
||||||
|
|
||||||
|
var targetRules = sourceRules.Select(rule => new ReadingQuestionVisitJudgeRule
|
||||||
|
{
|
||||||
|
Id = NewId.NextGuid(),
|
||||||
|
ReadingQuestionId = rule.ReadingQuestionId,
|
||||||
|
VisitNum = inDto.TargetVisitNum,
|
||||||
|
AnswerGroup = rule.AnswerGroup,
|
||||||
|
AnswerCombination = rule.AnswerCombination,
|
||||||
|
JudgeType = rule.JudgeType,
|
||||||
|
JudgeDifferenceValue = rule.JudgeDifferenceValue,
|
||||||
|
JudgeDifferenceType = rule.JudgeDifferenceType,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
if (targetRules.Count > 0)
|
||||||
|
{
|
||||||
|
await _readingQuestionVisitJudgeRuleRepository.AddRangeAsync(targetRules);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseOutput.Result(await _readingQuestionVisitJudgeRuleRepository.SaveChangesAsync());
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue