From 86e330c586bcaf86cf2f7d7493c499f8d6ce56c9 Mon Sep 17 00:00:00 2001 From: "{872297557@qq.com}" <872297557@qq.com> Date: Tue, 31 Jan 2023 15:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=BD=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteUserSurveyService.cs | 2 +- .../Handlers/TrialStateCacheHandler.cs | 6 ++-- .../Common/AuditingData.cs | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index d8877f22..77c475c2 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -65,7 +65,7 @@ namespace IRaCIS.Core.Application.Contracts if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) { - var trialId= _trialSiteUserSurveyRepository.Where(t=>t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.TrialSiteSurvey.TrialId).FirstOrDefault(); + var trialId= _trialSiteUserSurveyRepository.Where(t=>t.TrialSiteSurveyId == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.TrialSiteSurvey.TrialId).FirstOrDefault(); var trialType = _repository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); diff --git a/IRaCIS.Core.Application/_MediatR/Handlers/TrialStateCacheHandler.cs b/IRaCIS.Core.Application/_MediatR/Handlers/TrialStateCacheHandler.cs index 151f78e8..0f011158 100644 --- a/IRaCIS.Core.Application/_MediatR/Handlers/TrialStateCacheHandler.cs +++ b/IRaCIS.Core.Application/_MediatR/Handlers/TrialStateCacheHandler.cs @@ -28,16 +28,16 @@ namespace IRaCIS.Core.Application.MediatR.Handlers } - public Task Handle(TrialStateCacheRequest request, CancellationToken cancellationToken) + public async Task Handle(TrialStateCacheRequest request, CancellationToken cancellationToken) { //项目启动,将项目状态缓存,因为hangfire 加入后台任务,还是向队列添加任务,执行都有延迟,效果不好 - var list = _trialRepository.Select(t => new { TrialId = t.Id, TrialStatusStr = t.TrialStatusStr }).ToList(); + var list = await _trialRepository.Select(t => new { TrialId = t.Id, TrialStatusStr = t.TrialStatusStr }).ToListAsync(); // 每天都会有任务刷新状态,项目编辑 添加时 都会处理到缓存中 list.ForEach(t => _provider.Set(t.TrialId.ToString(), t.TrialStatusStr, TimeSpan.FromDays(7))); - return Task.FromResult(true); + return true; } } diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs index 23c7ade6..66dcc5a8 100644 --- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs +++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs @@ -1557,11 +1557,42 @@ namespace IRaCIS.Core.Infra.EFCore.Common extraIdentification = "/ConfirmSelect"; } + //获取配置的标准名称 + + //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(); + + var trialReadingCritiralIdList= new List(); + + var criterionNameList = new List(); + + if (entity.TrialClinicalDataSetCriteriaList==null || entity.TrialClinicalDataSetCriteriaList.Count() == 0) + { + criterionNameList = await _dbContext.TrialClinicalDataSetCriterion.Where(t => t.TrialClinicalDataSetId == entity.Id).Select(t => t.TrialReadingCriterion.CriterionName).ToListAsync(); + } + else + { + var ids = entity.TrialClinicalDataSetCriteriaList.Select(t => t.TrialReadingCriterionId).ToList(); + criterionNameList = await _dbContext.ReadingQuestionCriterionTrial.Where(t => ids.Contains(t.Id)).Select(t => t.CriterionName).ToListAsync(); + } + await InsertInspection(entity, type, x => new InspectionConvertDTO() { IsDistinctionInterface = false, ObjectRelationParentId = entity.TrialId, ExtraIndentification = extraIdentification, + },new + { + CriterionNames= criterionNameList?.Count()>0? string.Join(",", criterionNameList):string.Empty }); }