diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index 093869c77..a0b3e6d1c 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -336,12 +336,12 @@ namespace IRaCIS.Core.Application.Service //后续移除 避免前端看到的不统一 因为采用了新的关联方式,之前数据在Data里面取 现在配置在CommonData 里取 var dataDic = JsonConvert.DeserializeObject>(str); - var commonDic= JsonConvert.DeserializeObject>(str2); + var commonDic = JsonConvert.DeserializeObject>(str2); foreach (var valuePair in dataDic) { if (!commonDic.ContainsKey(valuePair.Key)) { - commonDic.Add(valuePair.Key, valuePair.Value); + commonDic.Add(valuePair.Key, valuePair.Value); } } @@ -1011,8 +1011,8 @@ namespace IRaCIS.Core.Application.Service [HttpGet] public async Task> GetModuleTypeDescriptionList(Guid moduleTypeId) { - var result = await _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.Description != string.Empty).Select(x => x.Description).Distinct().ToListAsync(); - return result; + var result = await _frontAuditConfigRepository.Where(x => x.ModuleTypeId == moduleTypeId && x.ObjectTypeId != null && x.OptTypeId != null && x.Description.Length>0).Select(x => new { x.Description,x.Sort } ).OrderBy(t=>t.Sort).ToListAsync(); + return result.Select(t=>t.Description).Distinct().ToList(); } /// @@ -1133,6 +1133,11 @@ namespace IRaCIS.Core.Application.Service return ResponseOutput.NotOk("名称重复"); } + if (addOrEditFrontAuditConfig.ConfigType == "C") + { + addOrEditFrontAuditConfig.Description = ""; + } + var entity = await _frontAuditConfigRepository.InsertOrUpdateAsync(addOrEditFrontAuditConfig, true); return ResponseOutput.Ok(entity.Id.ToString()); diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 98cf68013..3e1fef586 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -100,6 +100,33 @@ namespace IRaCIS.Core.Infra.EFCore.Common #region 区分 + // 项目 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Trial))) + { + + var entity = item.Entity as Trial; + List trialDics = new List(); + var dictionaryIds = new List(); + if (entity.TrialDicList == null || entity.TrialDicList.Count == 0) + { + dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync(); + } + else + { + dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList(); + } + + trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync(); + + await InsertInspection(item.Entity as Trial, type, x => new InspectionConvertDTO() + { + TrialId = x.Id, + }, new + { + TrialDicList = string.Join(",", trialDics) + }); + } + // 系统文件签署 父层级未记录稽查(系统文档初始数据) foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser))) @@ -418,36 +445,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common } - //系统 Qc 问题 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCQuestion))) - { - var entity = item.Entity as QCQuestion; - - var parentName = await _dbContext.QCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); - - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - IsDistinctionInterface = false - - }, new { ParentName = parentName }); - } - - // 项目QC问题 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestion))) - { - var entity = item.Entity as TrialQCQuestion; - - var parentName = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); - - await InsertInspection(entity, type, x => new InspectionConvertDTO() - { - ObjectRelationParentId = x.TrialId, - IsDistinctionInterface = false - }, new - { - ParentName = parentName - }); - } + //系统文件 @@ -510,15 +508,52 @@ namespace IRaCIS.Core.Infra.EFCore.Common } + //系统 Qc 问题 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCQuestion))) + { + var entity = item.Entity as QCQuestion; + + var parentQuestionName = await _dbContext.QCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + IsDistinctionInterface = false + + }, new { ParentQuestionName = parentQuestionName }); + } + + // 项目QC问题 + foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialQCQuestion))) + { + var entity = item.Entity as TrialQCQuestion; + + var parentQuestionName = await _dbContext.TrialQCQuestionConfigure.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + + await InsertInspection(entity, type, x => new InspectionConvertDTO() + { + ObjectRelationParentId = x.TrialId, + IsDistinctionInterface = false + }, new + { + ParentQuestionName = parentQuestionName + }); + } + //系统 医学审核问题 foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(ReadingMedicineSystemQuestion))) { var entity = item.Entity as ReadingMedicineSystemQuestion; + var parentQuestionName = string.Empty; + if (entity.ParentId != null) + { + parentQuestionName = await _dbContext.ReadingMedicineSystemQuestion.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false, - }); + },new { ParentQuestionName = parentQuestionName }); } //项目医学审核问题 @@ -526,12 +561,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common { var entity = item.Entity as ReadingMedicineTrialQuestion; + var parentQuestionName = string.Empty; + if (entity.ParentId != null) + { + parentQuestionName = await _dbContext.ReadingMedicineTrialQuestion.Where(x => x.Id == entity.ParentId).Select(x => x.QuestionName).FirstOrDefaultAsync(); + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false, ObjectRelationParentId = x.TrialId - }); + }, new { ParentQuestionName = parentQuestionName }); } @@ -544,32 +585,6 @@ namespace IRaCIS.Core.Infra.EFCore.Common }); } - // 项目 - foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(Trial))) - { - - var entity = item.Entity as Trial; - List trialDics = new List(); - var dictionaryIds = new List(); - if (entity.TrialDicList == null || entity.TrialDicList.Count == 0) - { - dictionaryIds = await this._dbContext.TrialDictionary.Where(x => x.TrialId == entity.Id && x.KeyName == "Criterion").Select(x => x.DictionaryId).ToListAsync(); - } - else - { - dictionaryIds = entity.TrialDicList.Select(x => x.DictionaryId).ToList(); - } - - trialDics = await this._dbContext.Dictionary.Where(x => dictionaryIds.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync(); - - await InsertInspection(item.Entity as Trial, type, x => new InspectionConvertDTO() - { - TrialId = x.Id, - }, new - { - TrialDicList = string.Join(",", trialDics) - }); - } // 项目中心 Site未稽查