diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index db6ccf882..6d08c180f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -3016,11 +3016,6 @@ 修约小数点 - - - 标准ID - - 标准 @@ -3031,6 +3026,16 @@ 是否启用 + + + 排序 + + + + + 是否完成配置 + + @@ -3601,6 +3606,16 @@ 序号标记 + + + 返回的对象 + + + + + 标准 + + 返回的对象 @@ -7854,9 +7869,9 @@ - + - 设置系统标准被禁用 + 获取系统问题标准下拉 @@ -7881,10 +7896,11 @@ - + - 添加系统问题标准 + 新增修改系统问题标准 + diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index 4dc0c11c2..6dd7b8082 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -108,15 +108,15 @@ namespace IRaCIS.Application.Services VerifyMsg = $"已有{addOrEditBasic.Code}名称的字典", IsVerify= addOrEditBasic.ParentId ==null }; - // 验证阅片标准是否可禁用 - if (!addOrEditBasic.IsEnable&&addOrEditBasic.Id!=null) - { - var result = await _readingQuestionService.SetSystemCriterionDisable(addOrEditBasic.Id.Value,addOrEditBasic.ParentId); - if (!result.IsSuccess) - { - return result; - } - } + //// 验证阅片标准是否可禁用 + //if (!addOrEditBasic.IsEnable&&addOrEditBasic.Id!=null) + //{ + // var result = await _readingQuestionService.SetSystemCriterionDisable(addOrEditBasic.Id.Value,addOrEditBasic.ParentId); + // if (!result.IsSuccess) + // { + // return result; + // } + //} var entity = await _dicRepository.InsertOrUpdateAsync(addOrEditBasic, true, verifyExp1); return ResponseOutput.Ok(entity.Id.ToString()); } diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 558cc57ee..6f6e030ed 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -354,11 +354,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto { public Guid? Id { get; set; } - /// - /// 标准ID - /// - public Guid CriterionId { get; set; } - /// /// 标准 /// @@ -368,6 +363,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// 是否启用 /// public bool IsEnable { get; set; } + + /// + /// 排序 + /// + public int ShowOrder { get; set; } + + /// + /// 是否完成配置 + /// + public bool IsCompleteConfig { get; set; } = false; } /// @@ -1099,6 +1104,18 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public string OrderMark { get; set; } = string.Empty; } + public class GetSystemCriterionSelectDto + { + /// + /// 返回的对象 + /// + public Guid Id { get; set; } + + /// + /// 标准 + /// + public string CriterionName { get; set; } + } public class ReadingQuestionCriterionSystemView { diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingQuestionService.cs index 1c223cb32..2e5d26434 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IReadingQuestionService.cs @@ -11,7 +11,7 @@ namespace IRaCIS.Core.Application.Contracts { public interface IReadingQuestionService { - Task SetSystemCriterionDisable(Guid dictionaryId, Guid? parentId); + //Task SetSystemCriterionDisable(Guid dictionaryId, Guid? parentId); Task SynchronizeCriterion(SynchronizeCriterionInDto inDto); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 82934a0a9..f3d36feb1 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -675,7 +675,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto) { - await AddSystemQuestionCriterion(); + //await AddSystemQuestionCriterion(); var query= _readingQuestionCriterionSystemRepository.AsQueryable() .WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName)) .ProjectTo(_mapper.ConfigurationProvider) @@ -686,30 +686,48 @@ namespace IRaCIS.Application.Services /// - /// 设置系统标准被禁用 + /// 获取系统问题标准下拉 /// /// - [NonDynamicMethod] - public async Task SetSystemCriterionDisable(Guid dictionaryId, Guid? parentId) + [HttpPost] + public async Task> GetSystemCriterionSelectList() { - // 判断是否是阅片 - if (await _dictionaryRepository.AnyAsync(x => x.Id == parentId && x.Code == "ReadingStandard")) - { - // 判断当前阅片是否在项目里面存在 - var systemCriterion = await _readingQuestionCriterionSystemRepository.FirstOrDefaultAsync(x => x.CriterionId == dictionaryId); - if (systemCriterion != null) - { - var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == systemCriterion.Id).Select(x=>x.ReadingQuestionCriterionSystemId).ToListAsync(); - await _readingQuestionCriterionTrialRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == systemCriterion.Id); - await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId)); - return ResponseOutput.Ok(); - } - } - - return ResponseOutput.Ok(); + var criterionList = await _readingQuestionCriterionSystemRepository.AsQueryable() + .Select(x => new GetSystemCriterionSelectDto() + { + Id = x.Id, + CriterionName = x.CriterionName + }).ToListAsync(); + return criterionList; } - + + + ///// + ///// 设置系统标准被禁用 + ///// + ///// + //[NonDynamicMethod] + //public async Task SetSystemCriterionDisable(Guid dictionaryId, Guid? parentId) + //{ + // // 判断是否是阅片 + // if (await _dictionaryRepository.AnyAsync(x => x.Id == parentId && x.Code == "ReadingStandard")) + // { + // // 判断当前阅片是否在项目里面存在 + // var systemCriterion = await _readingQuestionCriterionSystemRepository.FirstOrDefaultAsync(x => x.CriterionId == dictionaryId); + // if (systemCriterion != null) + // { + // var trialCriterionIds = await _readingQuestionCriterionTrialRepository.Where(x => x.ReadingQuestionCriterionSystemId == systemCriterion.Id).Select(x=>x.ReadingQuestionCriterionSystemId).ToListAsync(); + // await _readingQuestionCriterionTrialRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == systemCriterion.Id); + // await _readingQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => trialCriterionIds.Contains(x.ReadingQuestionCriterionTrialId)); + // return ResponseOutput.Ok(); + // } + // } + + // return ResponseOutput.Ok(); + //} + + /// /// 设置系统问题标准是否完成配置 /// @@ -897,37 +915,58 @@ namespace IRaCIS.Application.Services /// - /// 添加系统问题标准 + /// 新增修改系统问题标准 /// + /// /// - [NonDynamicMethod] - private async Task AddSystemQuestionCriterion() + [HttpPost] + public async Task AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto) { - var useSystemQuestionCriterionIds = _readingQuestionCriterionSystemRepository.Select(x => x.CriterionId); - var dictionaryParentId =await _dictionaryRepository.Where(x => x.Code == "ReadingStandard").Select(x => x.Id).FirstOrDefaultAsync(); - var criterionList = await _dictionaryRepository.Where(x => x.ParentId == dictionaryParentId && !useSystemQuestionCriterionIds.Contains(x.Id)) - .Select(x => new CriterionList() - { - Id = x.Id, - Value = x.Value, - ShowOrder=x.ShowOrder, - }).ToListAsync(); - List needAddCriterionList = new List(); - criterionList.ForEach(x => + var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto, true); + + if (indto.Id != null) { - needAddCriterionList.Add(new ReadingQuestionCriterionSystem() - { - CriterionId = x.Id, - ShowOrder=x.ShowOrder, - CriterionName = x.Value, - IsEnable = false, + await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == indto.Id, x => new ReadingQuestionCriterionTrial() { + CriterionName=indto.CriterionName + }); - }); - await _readingQuestionCriterionSystemRepository.AddRangeAsync(needAddCriterionList); - await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + } + return ResponseOutput.Ok(entity.Id.ToString()); } + ///// + ///// 添加系统问题标准 + ///// + ///// + //[NonDynamicMethod] + //private async Task AddSystemQuestionCriterion() + //{ + // var useSystemQuestionCriterionIds = _readingQuestionCriterionSystemRepository.Select(x => x.CriterionId); + // var dictionaryParentId =await _dictionaryRepository.Where(x => x.Code == "ReadingStandard").Select(x => x.Id).FirstOrDefaultAsync(); + // var criterionList = await _dictionaryRepository.Where(x => x.ParentId == dictionaryParentId && !useSystemQuestionCriterionIds.Contains(x.Id)) + // .Select(x => new CriterionList() + // { + // Id = x.Id, + // Value = x.Value, + // ShowOrder=x.ShowOrder, + // }).ToListAsync(); + // List needAddCriterionList = new List(); + // criterionList.ForEach(x => + // { + // needAddCriterionList.Add(new ReadingQuestionCriterionSystem() + // { + // CriterionId = x.Id, + // ShowOrder=x.ShowOrder, + // CriterionName = x.Value, + // IsEnable = false, + // }); + // }); + // await _readingQuestionCriterionSystemRepository.AddRangeAsync(needAddCriterionList); + // await _readingQuestionCriterionSystemRepository.SaveChangesAsync(); + //} + + ///// ///// 删除系统问题标准 diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs index 22eacf91c..a20951b30 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs @@ -14,11 +14,6 @@ namespace IRaCIS.Core.Domain.Models [Table("ReadingQuestionCriterionSystem")] public class ReadingQuestionCriterionSystem : Entity, IAuditAdd { - /// - /// 标准ID - /// - public Guid CriterionId { get; set; } - /// /// 标准 ///