diff --git a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs index 222bc563..6ff8ab0e 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs @@ -40,37 +40,6 @@ namespace IRaCIS.Application.Contracts public string ValueCN { get; set; } = string.Empty; } - public class GetTrialConfigDictionaryListInDto - { - [NotDefault] - public Guid TrialId { get; set; } - - public string ParentCode { get; set; } - - - } - - public class GetTrialConfigDictionarySelectOutDto: BasicDicView - { - public bool IsAdded { get; set; } - } - - public class GetTrialConfigDictionarySelectInDto - { - [NotDefault] - public Guid TrialId { get; set; } - - public string ParentCode { get; set; } - } - - public class AddTrialConfigDictionaryListInDto - { - [NotDefault] - public Guid TrialId { get; set; } - - public List DictionaryIds { get; set; } - } - public class AddOrEditBasicDic { diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index f8797025..7b5b04d1 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -20,12 +20,10 @@ namespace IRaCIS.Application.Services private readonly IRepository _trialDictionaryRepository; private readonly IRepository _doctorRepository; private readonly IRepository _trialRepository; - private readonly IRepository _trialConfigDictionaryRepository; private readonly IReadingQuestionService _readingQuestionService; public DictionaryService(IRepository sysDicRepository, IRepository doctorDictionaryRepository, IRepository trialDictionaryRepository, IRepository doctorRepository, IRepository trialRepository, - IRepository trialConfigDictionaryRepository, IReadingQuestionService readingQuestionService @@ -36,7 +34,7 @@ namespace IRaCIS.Application.Services _trialDictionaryRepository = trialDictionaryRepository; _doctorRepository = doctorRepository; _trialRepository = trialRepository; - this._trialConfigDictionaryRepository = trialConfigDictionaryRepository; + this._readingQuestionService = readingQuestionService; } @@ -136,96 +134,6 @@ namespace IRaCIS.Application.Services return ResponseOutput.Ok(entity.Id.ToString()); } - - /// - /// 删除项目字典 - /// - /// - /// - [HttpPost("{Id:guid}")] - public async Task DeleteTrialConfigDictionary(Guid Id) - { - await _trialConfigDictionaryRepository.DeleteFromQueryAsync(Id); - await _trialConfigDictionaryRepository.SaveChangesAsync(); - return ResponseOutput.Ok(true); - } - - - /// - /// 获取待添加的项目字典数据 - /// - /// - /// - [HttpPost] - public async Task> GetTrialConfigDictionarySelect(GetTrialConfigDictionarySelectInDto inDto) - { - var parentId = await _dicRepository.Where(x => x.Code == inDto.ParentCode).Select(x => x.Id).FirstNotNullAsync(); - - List result= await _dicRepository.Where(t => t.ParentId == parentId) - .OrderBy(t => t.ShowOrder).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - - - - List addIds = await _trialConfigDictionaryRepository.Where(x => x.Dictionary.ParentId == parentId).Select(x => x.DictionaryId).ToListAsync(); - - result.ForEach(x => { - x.IsAdded = addIds.Contains(x.Id.Value); - }); - - return result; - - } - - - /// - /// 批量添加项目字典 - /// - /// - /// - [HttpPost] - public async Task AddTrialConfigDictionaryList(AddTrialConfigDictionaryListInDto inDto) - { - - await _trialConfigDictionaryRepository.AddRangeAsync(inDto.DictionaryIds.Select(x => new TrialConfigDictionary() { - TrialId = inDto.TrialId, - DictionaryId = x - - })); - - await _trialConfigDictionaryRepository.SaveChangesAsync(); - - return ResponseOutput.Ok(true); - } - - /// - /// 获取项目字典 - /// - /// - /// - [HttpPost] - public async Task> GetTrialConfigDictionaryList(GetTrialConfigDictionaryListInDto inDto) - { - List result = await _trialConfigDictionaryRepository.Where(x => x.TrialId == inDto.TrialId) - .WhereIf(!inDto.ParentCode.IsNullOrEmpty(), x => x.Dictionary.Parent.Code == inDto.ParentCode) - .Select(x => new GetTrialConfigDictionaryListOutDto() - { - Id=x.Id, - DictionaryId=x.DictionaryId, - ChildGroup = x.Dictionary.ChildGroup, - Code = x.Dictionary.Code, - Description = x.Dictionary.Description, - ShowOrder = x.Dictionary.ShowOrder, - ParentCode = x.Dictionary.Parent.Code, - Value = x.Dictionary.Value, - ValueCN = x.Dictionary.ValueCN - }).OrderBy(x => x.ParentCode).ThenBy(x => x.ShowOrder).ToListAsync(); - return result; - } - - - - - /// /// 获取子项数组 /// diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index e9e91dcc..2ce58b99 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -80,6 +80,50 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public bool IsCopyQuestion { get; set; } } + public class SetAssessTypeInDto + { + + [NotDefault] + public Guid CriterionId { get; set; } + + public string ParentCode { get; set; } + + public List DictionaryIds { get; set; } + + public bool IsSystemCriterion { get; set; } = true; + } + + public class GetAssessTypeInDto + { + [NotDefault] + public Guid CriterionId { get; set; } + + public string ParentCode { get; set; } + } + + + public class GetAssessTypeOutDto + { + + public Guid Id { get; set; } + + public Guid DictionaryId { get; set; } + + public int ShowOrder { get; set; } + + public string Description { get; set; } = string.Empty; + + public string Code { get; set; } + + public string ParentCode { get; set; } + + public string ChildGroup { get; set; } + + public string Value { get; set; } = string.Empty; + + public string ValueCN { get; set; } = string.Empty; + } + public class GetSystemCriterionListOutDto { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 109b0b0a..82b58b27 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -24,6 +24,7 @@ namespace IRaCIS.Application.Services private readonly IRepository _clinicalDataTrialSetRepository; private readonly IRepository _clinicalDataSystemSetRepository; private readonly IRepository _dictionaryRepository; + private readonly IRepository _readingCriterionDictionaryRepository; private readonly IRepository _readingTableQuestionTrialRepository; private readonly IRepository _readingCriterionPageRepository; private readonly IRepository _trialRepository; @@ -42,6 +43,7 @@ namespace IRaCIS.Application.Services IRepository ClinicalDataTrialSetRepository, IRepository ClinicalDataSystemSetRepository, IRepository dictionaryRepository, + IRepository readingCriterionDictionaryRepository, IRepository readingTableQuestionTrialRepository, IRepository readingCriterionPageRepository, IRepository trialRepository, @@ -60,6 +62,7 @@ namespace IRaCIS.Application.Services this._clinicalDataTrialSetRepository = ClinicalDataTrialSetRepository; this._clinicalDataSystemSetRepository = ClinicalDataSystemSetRepository; this._dictionaryRepository = dictionaryRepository; + this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository; this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository; this._readingCriterionPageRepository = readingCriterionPageRepository; this._trialRepository = trialRepository; @@ -70,6 +73,61 @@ namespace IRaCIS.Application.Services this._previousPDFRepository = previousPDFRepository; } + #region 全局评估类型 肿瘤学评估类型 + + + /// + /// 获取标准字典 + /// + /// + /// + [HttpPost] + public async Task> GetAssessType(GetAssessTypeInDto inDto) + { + List result = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == inDto.CriterionId + &&x.ParentCode==inDto.ParentCode + ) + .Select(x => new GetAssessTypeOutDto() + { + Id = x.Id, + DictionaryId = x.DictionaryId, + ChildGroup = x.Dictionary.ChildGroup, + Code = x.Dictionary.Code, + Description = x.Dictionary.Description, + ShowOrder = x.Dictionary.ShowOrder, + ParentCode = x.Dictionary.Parent.Code, + Value = x.Dictionary.Value, + ValueCN = x.Dictionary.ValueCN + }).OrderBy(x => x.ParentCode).ThenBy(x => x.ShowOrder).ToListAsync(); + return result; + } + + + /// + /// 设置标准字典 + /// + /// + /// + [HttpPost] + public async Task SetAssessType(SetAssessTypeInDto inDto) + { + await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(x => x.CriterionId == inDto.CriterionId && x.ParentCode == inDto.ParentCode); + + await _readingCriterionDictionaryRepository.AddRangeAsync(inDto.DictionaryIds.Select(x => new ReadingCriterionDictionary() + { + CriterionId = inDto.CriterionId, + DictionaryId = x, + IsSystemCriterion = inDto.IsSystemCriterion, + ParentCode = inDto.ParentCode + })); + + await _readingCriterionDictionaryRepository.SaveChangesAsync(); + + return ResponseOutput.Ok(true); + } + + #endregion + #region 系统标准 /// diff --git a/IRaCIS.Core.Domain/Trial/TrialConfigDictionary.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingCriterionDictionary.cs similarity index 55% rename from IRaCIS.Core.Domain/Trial/TrialConfigDictionary.cs rename to IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingCriterionDictionary.cs index f1946ce7..687432d7 100644 --- a/IRaCIS.Core.Domain/Trial/TrialConfigDictionary.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterionQuestion/ReadingCriterionDictionary.cs @@ -7,16 +7,16 @@ using Newtonsoft.Json; namespace IRaCIS.Core.Domain.Models { - /// - ///TrialConfigDictionary - /// - [Table("TrialConfigDictionary")] - public class TrialConfigDictionary : Entity, IAuditAdd - { + /// + ///ReadingCriterionDictionary + /// + [Table("ReadingCriterionDictionary")] + public class ReadingCriterionDictionary : Entity, IAuditAdd + { /// - /// TrialId - /// - public Guid TrialId { get; set; } + /// CriterionId + /// + public Guid CriterionId { get; set; } /// /// DictionaryId @@ -27,10 +27,20 @@ namespace IRaCIS.Core.Domain.Models /// CreateTime /// public DateTime CreateTime { get; set; } - + /// - /// CreateUserId - /// + /// IsSystemCriterion + /// + public bool IsSystemCriterion { get; set; } = false; + + /// + /// ParentCode + /// + public string ParentCode { get; set; } = string.Empty; + + /// + /// CreateUserId + /// public Guid CreateUserId { get; set; } [JsonIgnore] diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 47c00c53..d1a8d7a7 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -210,6 +210,8 @@ namespace IRaCIS.Core.Infra.EFCore #region Reading public virtual DbSet OrganInfo { get; set; } + + public virtual DbSet ReadingCriterionDictionary { get; set; } public virtual DbSet ReadingTableAnswerRowInfo { get; set; } public virtual DbSet OrganTrialInfo { get; set; } public virtual DbSet ReadingTableQuestionSystem { get; set; } @@ -319,7 +321,7 @@ namespace IRaCIS.Core.Infra.EFCore #region Trial public virtual DbSet Trial { get; set; } - public virtual DbSet TrialConfigDictionary { get; set; } + public virtual DbSet TrialDictionary { get; set; } public virtual DbSet TrialDetail { get; set; } public virtual DbSet UserTrial { get; set; }