From 9a1ddb8450e9002e4f26074914666f9b4882d3b8 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Thu, 16 Jun 2022 13:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 48 +++++++++++-- .../Reading/Dto/ReadingQuestionViewModel.cs | 54 ++++++++++++++- .../Service/Reading/ReadingQuestionService.cs | 68 +++++++++++++++---- .../Service/Reading/_MapConfig.cs | 4 +- .../Reading/ReadingQuestionCriterionSystem.cs | 13 +++- .../Reading/ReadingQuestionCriterionTrial.cs | 10 +++ .../Reading/ReadingQuestionSystem.cs | 5 ++ 7 files changed, 182 insertions(+), 20 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 9a43d72f..cfe55a58 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1584,6 +1584,11 @@ 阅片期名称 + + + 排序 + + 标准 @@ -1614,6 +1619,11 @@ + + + 排序 + + @@ -1659,6 +1669,11 @@ 类型值 + + + 是否是裁判问题 + + Id @@ -1704,6 +1719,11 @@ 类型值 + + + 是否是裁判问题 + + 系统标准Id @@ -1804,6 +1824,11 @@ 父问题ID + + + 是否是裁判问题 + + 类型值 @@ -1819,6 +1844,11 @@ 系统标准Id + + + 是否是裁判问题 + + 类型 @@ -1874,6 +1904,11 @@ 是否启用 + + + 是否完成配置 + + 返回的对象 @@ -1894,6 +1929,11 @@ 是否启用 + + + 是否完成配置 + + 是否是系统数据 @@ -4244,9 +4284,9 @@ - + - 设置系统问题标准是否生效 + 设置系统问题标准是否完成配置 @@ -4317,9 +4357,9 @@ - + - 设置项目标准是否生效 + 设置项目标准是否完成配置 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 5e27a4cd..02873c18 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -15,6 +15,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto [NotDefault] public Guid TrialId { get; set; } + /// + /// 排序 + /// + public int ShowOrder { get; set; } + /// /// 标准 /// @@ -59,6 +64,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid Id { get; set; } public string Value { get; set; } + + /// + /// 排序 + /// + public int ShowOrder { get; set; } } public class SetSystemReadingQuestionCriterionIsIsEnable @@ -70,6 +80,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public bool IsEnable { get; set; } } + + public class SetSystemReadingQuestionCriterionIsIsCompleteConfig + { + [NotDefault] + public Guid Id { get; set; } + + + public bool IsCompleteConfig { get; set; } + } + /// /// /// @@ -133,6 +153,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public bool IsEnable { get; set; } public string ParentQuestionName { get; set; } + + /// + /// 是否是裁判问题 + /// + public bool IsJudgeQuestion { get; set; } } public class ReadingQuestionSystemView @@ -185,7 +210,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public string TypeValue { get; set; } - public bool IsEnable { get; set; } + //public bool IsEnable { get; set; } + + /// + /// 是否是裁判问题 + /// + public bool IsJudgeQuestion { get; set; } } @@ -322,6 +352,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid? ParentId { get; set; } + /// + /// 是否是裁判问题 + /// + public bool IsJudgeQuestion { get; set; } = false; + /// /// 类型值 @@ -348,6 +383,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public Guid ReadingQuestionCriterionTrialId { get; set; } + /// + /// 是否是裁判问题 + /// + public bool IsJudgeQuestion { get; set; } = false; + /// /// 类型 /// @@ -405,11 +445,18 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public string CriterionName { get; set; } + public int ShowOrder { get; set; } + /// /// 是否启用 /// public bool IsEnable { get; set; } + /// + /// 是否完成配置 + /// + public bool IsCompleteConfig { get; set; } + public int QuestionCount { get; set; } } @@ -436,6 +483,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public bool IsEnable { get; set; } + /// + /// 是否完成配置 + /// + public bool IsCompleteConfig { get; set; } + public int QuestionCount { get; set; } /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 43ea5504..93d2ffad 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -77,28 +77,53 @@ namespace IRaCIS.Application.Services await AddSystemQuestionCriterion(); var query= _readingQuestionCriterionSystemRepository.AsQueryable() .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) - .ProjectTo(_mapper.ConfigurationProvider); - return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? nameof(ReadingQuestionCriterionSystemView.CriterionName) : inDto.SortField, + .ProjectTo(_mapper.ConfigurationProvider) + .Where(x=>x.IsEnable); + return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField.IsNullOrEmpty() ? nameof(ReadingQuestionCriterionSystemView.ShowOrder) : inDto.SortField, inDto.Asc); } + ///// + ///// 设置系统问题标准是否生效 + ///// + ///// + ///// + //public async Task SetSystemReadingQuestionCriterionIsIsEnable(SetSystemReadingQuestionCriterionIsIsEnable inDto) + //{ + // await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() + // { + // IsEnable = inDto.IsEnable + // }); + + // var result =await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + + // return ResponseOutput.Ok(result); + //} + /// - /// 设置系统问题标准是否生效 + /// 设置系统问题标准是否完成配置 /// /// /// - public async Task SetSystemReadingQuestionCriterionIsIsEnable(SetSystemReadingQuestionCriterionIsIsEnable inDto) + public async Task SetSystemReadingQuestionCriterionIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) { - await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() + + if (!inDto.IsCompleteConfig && await _readingQuestionCriterionTrialRepository.AnyAsync(x => x.ReadingQuestionCriterionSystemId == inDto.Id)) { - IsEnable = inDto.IsEnable + ResponseOutput.NotOk("当前标准已经运用到项目,操作失败"); + } + + await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() + { + IsCompleteConfig = inDto.IsCompleteConfig }); - var result =await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + var result = await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); return ResponseOutput.Ok(result); } + /// /// 添加系统qc问题标准 /// @@ -112,7 +137,8 @@ namespace IRaCIS.Application.Services .Select(x => new CriterionList() { Id = x.Id, - Value = x.Value + Value = x.Value, + ShowOrder=x.ShowOrder, }).ToListAsync(); List needAddCriterionList = new List(); criterionList.ForEach(x => @@ -120,6 +146,7 @@ namespace IRaCIS.Application.Services needAddCriterionList.Add(new ReadingQuestionCriterionSystem() { CriterionId = x.Id, + ShowOrder=x.ShowOrder, CriterionName = x.Value, IsEnable = false, }); @@ -222,7 +249,7 @@ namespace IRaCIS.Application.Services { var trialUsrSystemIds = _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialId && x.ReadingQuestionCriterionSystemId != null) .Select(x => x.ReadingQuestionCriterionSystemId); - var needAddSystemDataList = await _readingQuestionCriterionSystemRepository.Where(x => !trialUsrSystemIds.Contains(x.Id)&&x.IsEnable).Include(x=>x.ReadingQuestionSystemList).ToListAsync(); + var needAddSystemDataList = await _readingQuestionCriterionSystemRepository.Where(x => !trialUsrSystemIds.Contains(x.Id)&&x.IsCompleteConfig).Include(x=>x.ReadingQuestionSystemList).ToListAsync(); List needAddCriterionList = new List(); List needAddQuestionList = new List(); needAddSystemDataList.ForEach(x => @@ -329,16 +356,33 @@ namespace IRaCIS.Application.Services } + ///// + ///// 设置项目标准是否生效 + ///// + ///// + ///// + //public async Task SetTrialReadingQuestionCriterionIsIsEnable(SetSystemReadingQuestionCriterionIsIsEnable inDto) + //{ + // await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() + // { + // IsEnable = inDto.IsEnable + // }); + + // var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); + + // return ResponseOutput.Ok(result); + //} + /// - /// 设置项目标准是否生效 + /// 设置项目标准是否完成配置 /// /// /// - public async Task SetTrialReadingQuestionCriterionIsIsEnable(SetSystemReadingQuestionCriterionIsIsEnable inDto) + public async Task SetTrialReadingQuestionCriterionIsIsCompleteConfig(SetSystemReadingQuestionCriterionIsIsCompleteConfig inDto) { await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionTrial() { - IsEnable = inDto.IsEnable + IsCompleteConfig = inDto.IsCompleteConfig }); var result = await _readingQuestionCriterionTrialRepository.SaveChangesAsync(); diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 6fc8555b..22e4b960 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -52,7 +52,9 @@ namespace IRaCIS.Core.Application.Service #region 阅片问题 CreateMap(); CreateMap() - .ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count())); + .ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count())) + .ForMember(d => d.IsEnable, u => u.MapFrom(s => s.Dictionary.IsEnable)) + .ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.Dictionary.ShowOrder)); CreateMap(); diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs index 778cb187..5ac5742c 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs @@ -30,6 +30,16 @@ namespace IRaCIS.Core.Domain.Models /// public bool IsEnable { get; set; } + /// + /// 排序 + /// + public int ShowOrder { get; set; } + + /// + /// 是否完成配置 + /// + public bool IsCompleteConfig { get; set; } + /// /// 创建时间 /// @@ -40,10 +50,9 @@ namespace IRaCIS.Core.Domain.Models /// public Guid CreateUserId { get; set; } - [ForeignKey("CriterionId")] public List ReadingQuestionSystemList { get; set; } = new List(); - + [ForeignKey("CriterionId")] public Dictionary Dictionary { get; set; } } diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs index c5d041fc..8192bca3 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionTrial.cs @@ -35,6 +35,16 @@ namespace IRaCIS.Core.Domain.Models /// public bool IsEnable { get; set; } + /// + /// 排序 + /// + public int ShowOrder { get; set; } + + /// + /// 是否完成配置 + /// + public bool IsCompleteConfig { get; set; } + /// /// 创建时间 /// diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs index f23a2920..41f0492d 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs @@ -65,6 +65,11 @@ namespace IRaCIS.Core.Domain.Models /// public DateTime CreateTime { get; set; } + /// + /// 是否是裁判问题 + /// + public bool IsJudgeQuestion { get; set; } + /// /// 创建人 ///