访视裁判配置
parent
602cfe43d0
commit
6e0282ad18
|
|
@ -6,6 +6,43 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||
namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
|
||||
public class GetTrialQuestionVisitJudgeRuleInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
public Guid? ReadingQuestionId { get; set; }
|
||||
}
|
||||
|
||||
public class SetTrialQuestionVisitJudgeRuleInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
public List<TrialQuestionVisitJudgeRuleItemDto> QuestionList { get; set; } = new List<TrialQuestionVisitJudgeRuleItemDto>();
|
||||
}
|
||||
|
||||
public class TrialQuestionVisitJudgeRuleItemDto
|
||||
{
|
||||
public Guid ReadingQuestionId { get; set; }
|
||||
public string QuestionName { get; set; } = string.Empty;
|
||||
public int ShowOrder { get; set; }
|
||||
public List<string> AnswerGroup { get; set; } = new List<string>();
|
||||
public List<string> AnswerCombination { get; set; } = new List<string>();
|
||||
public JudgeTypeEnum JudgeType { get; set; }
|
||||
public decimal? JudgeDifferenceValue { get; set; }
|
||||
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class TumorAssessmentView : AddOrUpdateTumorAssessmentInDto
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,10 +33,91 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<OrganInfo> _organInfoRepository,
|
||||
IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository,
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswer,
|
||||
IRepository<PreviousPDF> _previousPDFRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IReadingQuestionService
|
||||
IRepository<PreviousPDF> _previousPDFRepository,
|
||||
IRepository<ReadingQuestionVisitJudgeRule> _readingQuestionVisitJudgeRuleRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IReadingQuestionService
|
||||
|
||||
{
|
||||
|
||||
#region 项目访视裁判规则
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目阅片标准各访视的裁判规则配置。
|
||||
/// 未配置规则的访视问题也会返回,供前端直接进行配置。
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<List<TrialQuestionVisitJudgeRuleItemDto>> GetTrialQuestionVisitJudgeRule(GetTrialQuestionVisitJudgeRuleInDto inDto)
|
||||
{
|
||||
var questionList = await _readingQuestionTrialRepository
|
||||
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId && x.IsJudgeQuestion)
|
||||
.WhereIf(inDto.ReadingQuestionId != null, x => x.Id == inDto.ReadingQuestionId)
|
||||
.OrderBy(x => x.ShowOrder)
|
||||
.Select(x => new TrialQuestionVisitJudgeRuleItemDto
|
||||
{
|
||||
ReadingQuestionId = x.Id,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var questionIds = questionList.Select(x => x.ReadingQuestionId).ToList();
|
||||
var ruleList = await _readingQuestionVisitJudgeRuleRepository
|
||||
.Where(x => x.VisitNum == inDto.VisitNum && questionIds.Contains(x.ReadingQuestionId))
|
||||
.ToListAsync();
|
||||
|
||||
return questionList.Select(question =>
|
||||
{
|
||||
var rule = ruleList.FirstOrDefault(x => x.ReadingQuestionId == question.ReadingQuestionId);
|
||||
return new TrialQuestionVisitJudgeRuleItemDto
|
||||
{
|
||||
ReadingQuestionId = question.ReadingQuestionId,
|
||||
QuestionName = question.QuestionName,
|
||||
ShowOrder = question.ShowOrder,
|
||||
AnswerGroup = rule?.AnswerGroup ?? new List<string>(),
|
||||
AnswerCombination = rule?.AnswerCombination ?? new List<string>(),
|
||||
JudgeType = rule?.JudgeType ?? JudgeTypeEnum.None,
|
||||
JudgeDifferenceValue = rule?.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = rule?.JudgeDifferenceType ?? default,
|
||||
};
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑项目阅片标准各访视的裁判规则配置。
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> SetTrialQuestionVisitJudgeRule(SetTrialQuestionVisitJudgeRuleInDto inDto)
|
||||
{
|
||||
var questionIds = await _readingQuestionTrialRepository
|
||||
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId && x.IsJudgeQuestion)
|
||||
.Select(x => x.Id)
|
||||
.ToListAsync();
|
||||
|
||||
await _readingQuestionVisitJudgeRuleRepository.BatchDeleteNoTrackingAsync(x =>
|
||||
x.VisitNum == inDto.VisitNum && questionIds.Contains(x.ReadingQuestionId));
|
||||
|
||||
var rules = inDto.QuestionList.Select(question => new ReadingQuestionVisitJudgeRule
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
ReadingQuestionId = question.ReadingQuestionId,
|
||||
VisitNum = inDto.VisitNum,
|
||||
AnswerGroup = question.AnswerGroup ?? new List<string>(),
|
||||
AnswerCombination = question.AnswerCombination ?? new List<string>(),
|
||||
JudgeType = question.JudgeType,
|
||||
JudgeDifferenceValue = question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
}).ToList();
|
||||
|
||||
if (rules.Count > 0)
|
||||
{
|
||||
await _readingQuestionVisitJudgeRuleRepository.AddRangeAsync(rules);
|
||||
}
|
||||
|
||||
return ResponseOutput.Result(await _readingQuestionVisitJudgeRuleRepository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取计算问题
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue