From 7c5f3323de95b5bee769fdfbc6cf97a13e016792 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 1 Aug 2024 16:57:25 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageAndDoc/DTO/UnionStudyViewDodel.cs | 14 ++ .../ImageAndDoc/DownloadAndUploadService.cs | 142 +++++++++++++++--- 2 files changed, 135 insertions(+), 21 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 6be7f1de5..24982f635 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -214,6 +214,20 @@ namespace IRaCIS.Core.Application.Contracts public int FileCount { get; set; } } + + public class SubejctZipInfoQuery + { + public Guid? SubejctId { get; set; } + + public string? SubjectCode { get; set; } + + + public Guid? SubejectVisitId { get; set; } + + public Guid? TrialReadingCriterionId { get; set; } + + } + public class TaskArchiveStudyCommand { [NotDefault] diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 9f71bad89..acf4c3dd5 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -4,6 +4,7 @@ using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Service.ImageAndDoc.DTO; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure.Extention; @@ -11,6 +12,7 @@ using MassTransit; using MathNet.Numerics; using Medallion.Threading; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -536,36 +538,134 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc - public async Task GetSubejectVisitPathInfo(Guid subjectVisitId) + /// + /// 受试者级别所有的影像 + /// 访视级别的影响 传递subjectVisitId + /// 标准Id是可选的 不同标准有些检查可能有过滤 + /// + /// + /// + /// + public async Task GetSubejectOrVisitZipInfo([FromServices] IRepository _subjectRepository, SubejctZipInfoQuery inQuery) { - var query = from sv in _subjectVisitRepository.Where(t => t.Id == subjectVisitId) + var isImageFilter = false; - select new - { - SubjectCode = sv.Subject.Code, - VisitName = sv.VisitName, - StudyList = sv.StudyList.Select(u => new + var criterionModalitys = string.Empty; + + if (inQuery.TrialReadingCriterionId != null) + { + var criterionInfo = await _repository.Where(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.IsImageFilter, t.CriterionModalitys }).FirstOrDefaultAsync(); + + if (criterionInfo != null) + { + isImageFilter = criterionInfo.IsImageFilter; + criterionModalitys = criterionInfo.CriterionModalitys; + } + + } + + if (inQuery.SubejectVisitId != null) + { + var query = from sv in _subjectVisitRepository.Where(t => t.Id == inQuery.SubejectVisitId) + + + select new { - u.PatientId, - u.StudyTime, - u.StudyCode, - - SeriesList = u.SeriesList.Select(z => new + SubjectCode = sv.Subject.Code, + VisitName = sv.VisitName, + StudyList = sv.StudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|")) + .Select(u => new { - z.Modality, + u.PatientId, + u.StudyTime, + u.StudyCode, - InstancePathList = z.DicomInstanceList.Select(k => new + SeriesList = u.SeriesList.Select(z => new { - k.Path + z.Modality, + + InstancePathList = z.DicomInstanceList.Select(k => new + { + k.Path + }) + }) + + }), + + NoneDicomStudyList = sv.NoneDicomStudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.Modality + "|")) + .Select(nd => new + { + nd.Modality, + nd.StudyCode, + nd.ImageDate, + + FileList = nd.NoneDicomFileList.Select(file => new + { + file.FileName, + file.Path, + file.FileType }) }) + }; - }) - }; + var result = query.ToList(); + + return ResponseOutput.Ok(result); + } + else if (inQuery.SubejctId != null) + { + var query = from sv in _subjectRepository.Where(t => t.Id == inQuery.SubejctId).SelectMany(t=>t.SubjectVisitList) + + + select new + { + SubjectCode = sv.Subject.Code, + VisitName = sv.VisitName, + StudyList = sv.StudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|")) + .Select(u => new + { + u.PatientId, + u.StudyTime, + u.StudyCode, + + SeriesList = u.SeriesList.Select(z => new + { + z.Modality, + + InstancePathList = z.DicomInstanceList.Select(k => new + { + k.Path + }) + }) + + }), + + NoneDicomStudyList = sv.NoneDicomStudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.Modality + "|")) + .Select(nd => new + { + nd.Modality, + nd.StudyCode, + nd.ImageDate, + + FileList = nd.NoneDicomFileList.Select(file => new + { + file.FileName, + file.Path, + file.FileType + }) + }) + }; + + var result = query.ToList(); + + return ResponseOutput.Ok(result); + } + else + { + return ResponseOutput.NotOk("不允许 subjectId subjectId 都不传递"); + } - var info = query.FirstOrDefault(); - return ResponseOutput.Ok(info); } /// @@ -765,9 +865,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc foreach (var file in noneDicomStudy.FileList) { string destinationPath = Path.Combine(studyNoneDicomFolderPath, Path.GetFileName(file.FileName)); - + //下载到当前目录 - await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path) , destinationPath); + await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath); } } From 62f37a4bb4f79b743e57b8634a473f9ad19cb5a0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 1 Aug 2024 17:05:28 +0800 Subject: [PATCH 02/16] =?UTF-8?q?crc=20=E9=87=8D=E4=BC=A0=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=BF=AE=E6=94=B9=E9=83=A8=E4=BD=8D=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/QC/QCOperationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index d67743443..dd8f0f34c 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -707,7 +707,7 @@ namespace IRaCIS.Core.Application.Image.QA } else { - if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted)) + if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted && !t.QCChallengeList.Any(c=>c.ReuploadEnum==QCChanllengeReuploadEnum.CRCRequestReupload)) ) { //---提交之后,不允许修改! throw new BusinessValidationFailedException(_localizer["QCOperation_NoModifyAfterSubmit"]); From 63c6c2f67b0f639831d360b964a575ee15f29900 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 1 Aug 2024 17:22:10 +0800 Subject: [PATCH 03/16] =?UTF-8?q?QCAgreeUpload=20=20=E6=89=8D=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/QC/QCOperationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index dd8f0f34c..3bccf5c80 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -707,7 +707,7 @@ namespace IRaCIS.Core.Application.Image.QA } else { - if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted && !t.QCChallengeList.Any(c=>c.ReuploadEnum==QCChanllengeReuploadEnum.CRCRequestReupload)) ) + if (await _subjectVisitRepository.AnyAsync(t => t.Id == updateModalityCommand.SubjectVisitId && t.SubmitState == SubmitStateEnum.Submitted && !t.QCChallengeList.Any(c=>c.ReuploadEnum==QCChanllengeReuploadEnum.QCAgreeUpload)) ) { //---提交之后,不允许修改! throw new BusinessValidationFailedException(_localizer["QCOperation_NoModifyAfterSubmit"]); From eb1dcc9f0a33184e166f2a6784aab36e675df149 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 09:54:31 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs | 2 +- .../Service/Allocation/DTO/VisitTaskViewModel.cs | 2 ++ IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs | 2 +- IRaCIS.Core.Domain/Allocation/VisitTask.cs | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index 1f4ca4079..7c54848c6 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -18,7 +18,7 @@ namespace IRaCIS.Core.API //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddDbContext(options => + services.AddDbContextPool(options => { options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()); diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 27bcb5d88..302351e3d 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -201,6 +201,8 @@ namespace IRaCIS.Core.Application.ViewModel public Guid? SourceSubjectVisitId { get; set; } public Guid? SouceReadModuleId { get; set; } + + public bool IsHaveFeedBack { get; set; } //public bool IsAfterConvertedTask { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 510ee9b8b..649ca5ba6 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -145,7 +145,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.HistoryReadingDoctorUserList, t => t.MapFrom(u => u.JudgeVisitList)); CreateMap().IncludeBase() - + .ForMember(o => o.IsHaveFeedBack, t => t.MapFrom(u => u.UserFeedBackList.Any())) ; CreateMap().IncludeBase() diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 77516f056..5a45dd3c4 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -436,5 +436,8 @@ namespace IRaCIS.Core.Domain.Models public int ImageStudyState { get; set; } + [JsonIgnore] + public List UserFeedBackList { get; set; } + } } From c98db93ecbe009918adb268ef97d4afd5728c1fa Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 10:30:33 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E4=B8=80=E8=87=B4=E6=80=A7=E5=88=86?= =?UTF-8?q?=E6=9E=90=20=E5=85=A8=E5=B1=80=E4=BB=BB=E5=8A=A1=20SouceReadMod?= =?UTF-8?q?uleId=20=20=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Allocation/TaskConsistentRuleService.cs | 53 +++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs index 0941f9d25..579c1e766 100644 --- a/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/TaskConsistentRuleService.cs @@ -88,7 +88,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask ) + public async Task>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask) { var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId) .Where(t => t.IsAnalysisCreate) @@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => /*(t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) ||*/ (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) /*&& t.IsAnalysisCreate == false*/)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) - .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => ((t.Subject.Code.Contains(queryVisitTask.SubjectCode)||t.Subject.MedicalNo.Contains(queryVisitTask.SubjectCode)) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => ((t.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.Subject.MedicalNo.Contains(queryVisitTask.SubjectCode)) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime >= queryVisitTask.BeginAllocateDate) .WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime <= queryVisitTask.EndAllocateDate) .WhereIf(queryVisitTask.BeginSignTime != null, t => t.SignTime >= queryVisitTask.BeginSignTime) @@ -118,7 +118,7 @@ namespace IRaCIS.Core.Application.Service var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); - var trialTaskConfig = _repository.Where(t => t.Id == queryVisitTask.TrialId).Select(t => new { IsHaveDoubleReadCriterion=t.TrialReadingCriterionList.Any(t=>t.IsSigned && t.IsConfirm && t.ReadingType==ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault(); + var trialTaskConfig = _repository.Where(t => t.Id == queryVisitTask.TrialId).Select(t => new { IsHaveDoubleReadCriterion = t.TrialReadingCriterionList.Any(t => t.IsSigned && t.IsConfirm && t.ReadingType == ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault(); return ResponseOutput.Ok(pageList, trialTaskConfig); } @@ -154,7 +154,7 @@ namespace IRaCIS.Core.Application.Service { - var filterObj = await _taskConsistentRuleRepository.Where(t => t.Id == inCommand.TaskConsistentRuleId).Include(t=>t.TrialReadingCriterion).FirstOrDefaultAsync(); + var filterObj = await _taskConsistentRuleRepository.Where(t => t.Id == inCommand.TaskConsistentRuleId).Include(t => t.TrialReadingCriterion).FirstOrDefaultAsync(); var doctorUserId = inCommand.DoctorUserId; var trialReadingCriterionId = filterObj.TrialReadingCriterionId; @@ -169,7 +169,7 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException(_localizer["TaskConsistent_NotAllowedGenerate"]); } - if (subjectList.Count<2 * filterObj.PlanSubjectCount) + if (subjectList.Count < 2 * filterObj.PlanSubjectCount) { throw new BusinessValidationFailedException(_localizer["TaskConsistent_NotAllowedGenerate1"]); } @@ -254,6 +254,17 @@ namespace IRaCIS.Core.Application.Service TaskBlindName = lastTask.TaskBlindName + "_Global", TrialReadingCriterionId = trialReadingCriterionId, }; + + var afterGlobal = _visitTaskRepository.Where(t => t.SubjectId == lastTask.SubjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum > lastTask.VisitTaskNum).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); + + if (afterGlobal == null) + { + throw new BusinessValidationFailedException("联系后台排查数据,没找到后续全局"); + } + else + { + existGlobal.SouceReadModuleId = afterGlobal.SouceReadModuleId; + } } @@ -294,7 +305,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> > GetGroupConsistentRuleSubjectList(GroupConsistentQuery inQuery) + public async Task>> GetGroupConsistentRuleSubjectList(GroupConsistentQuery inQuery) { var trialId = inQuery.TrialId; @@ -304,7 +315,7 @@ namespace IRaCIS.Core.Application.Service if (filterObj == null) { object tt = null; - return ResponseOutput.Ok(new PageOutput(), new { Rule = tt, IsAllowAutoAllocate = false }) ; + return ResponseOutput.Ok(new PageOutput(), new { Rule = tt, IsAllowAutoAllocate = false }); } var query = await GetGroupConsistentQueryAsync(filterObj); @@ -316,9 +327,9 @@ namespace IRaCIS.Core.Application.Service var list = await GetGroupConsistentRuleMatchSubjectIdListAsync(new GroupConsistentSimpleQuery() { TrialId = inQuery.TrialId, TrialReadingCriterionId = inQuery.TrialReadingCriterionId }); - var isAllowAutoAllocate = !list.Any(t => t.IsHaveGeneratedTask) && list.Count() > 2*(rule?.PlanSubjectCount??0); + var isAllowAutoAllocate = !list.Any(t => t.IsHaveGeneratedTask) && list.Count() > 2 * (rule?.PlanSubjectCount ?? 0); - return ResponseOutput.Ok(pagedList, new {Rule=rule, IsAllowAutoAllocate = isAllowAutoAllocate }); + return ResponseOutput.Ok(pagedList, new { Rule = rule, IsAllowAutoAllocate = isAllowAutoAllocate }); } @@ -336,11 +347,11 @@ namespace IRaCIS.Core.Application.Service { var trialId = inCommand.TrialId; - var filterObj = await _taskConsistentRuleRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == inCommand.TrialReadingCriterionId && t.IsSelfAnalysis == false).Include(t=>t.TrialReadingCriterion).FirstNotNullAsync(); + var filterObj = await _taskConsistentRuleRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == inCommand.TrialReadingCriterionId && t.IsSelfAnalysis == false).Include(t => t.TrialReadingCriterion).FirstNotNullAsync(); var trialReadingCriterionId = filterObj.TrialReadingCriterionId; - + //随机分配 if (inCommand.IsAutoAllocateGenerateTask) @@ -353,12 +364,12 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException(_localizer["TaskConsistent_NotAllowedGenerate"]); } - if (subjectSelectList.Count< 2 * filterObj.PlanSubjectCount) + if (subjectSelectList.Count < 2 * filterObj.PlanSubjectCount) { throw new BusinessValidationFailedException(_localizer["TaskConsistent_NotAllowedGenerate1"]); } - inCommand.SubejctIdList = subjectSelectList.Select(t => t.SubjectId).ToList().GetRandomCountList(filterObj.PlanSubjectCount) ; + inCommand.SubejctIdList = subjectSelectList.Select(t => t.SubjectId).ToList().GetRandomCountList(filterObj.PlanSubjectCount); } @@ -573,7 +584,7 @@ namespace IRaCIS.Core.Application.Service var subjectQuery = _subjectRepository.Where(t => t.TrialId == trialId && t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).Count() >= filterObj.PlanVisitCount) .WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter) - .Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Any(t => t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum>filterObj.PlanVisitCount-1)) + .Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Any(t => t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum > filterObj.PlanVisitCount - 1)) ; @@ -684,7 +695,7 @@ namespace IRaCIS.Core.Application.Service t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Count() >= filterObj.PlanVisitCount ) //.WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).OrderBy(t => t.VisitTaskNum).Take(filterObj.PlanVisitCount * 2 + 2).Any(t => t.ReadingCategory == ReadingCategory.Global)) - .WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum> filterObj.PlanVisitCount - 1).Select(t => t.DoctorUserId).Distinct().Count() == 2) + .WhereIf(filterObj.IsHaveReadingPeriod == true, u => u.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter).Where(t => t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum > filterObj.PlanVisitCount - 1).Select(t => t.DoctorUserId).Distinct().Count() == 2) ; @@ -804,14 +815,14 @@ namespace IRaCIS.Core.Application.Service //全局要>计划访视数量后面 t.SubjectVisitTaskList.AsQueryable().Where(comonTaskFilter) .Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SignTime!.Value.AddDays(taskConsistentRule.IntervalWeeks * 7) < appDateTimeNow && t.DoctorUserId == user.Id) - .Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Any(t => t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum>taskConsistentRule.PlanVisitCount-1) + .Where(t => t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global).Any(t => t.ReadingCategory == ReadingCategory.Global && t.VisitTaskNum > taskConsistentRule.PlanVisitCount - 1) && t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter) .Where(t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SignTime!.Value.AddDays(taskConsistentRule.IntervalWeeks * 7) < appDateTimeNow && t.DoctorUserId == user.Id) - .Count()>= taskConsistentRule.PlanVisitCount + .Count() >= taskConsistentRule.PlanVisitCount ) - + .Count(), @@ -841,9 +852,9 @@ namespace IRaCIS.Core.Application.Service //var taskConsistentRuleQueryable = _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId) // .ProjectTo(_mapper.ConfigurationProvider); - var list= await taskConsistentRuleQueryable.ToListAsync(); + var list = await taskConsistentRuleQueryable.ToListAsync(); - var rule= await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == true && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + var rule = await _taskConsistentRuleRepository.Where(t => t.TrialId == inQuery.TrialId && t.IsSelfAnalysis == true && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); return ResponseOutput.Ok(list, rule); } @@ -880,7 +891,7 @@ namespace IRaCIS.Core.Application.Service public async Task> GetUpdateVirtualSiteCodeList(Guid trialId) { - var list = await _trialVirtualSiteCodeUpdateRepository.Where(t => t.TrialId == trialId).Select(t => new UpdateTrialSiteCodeCommandView() { TrialId = trialId, VirtualSiteCode = t.VirturalSiteCode, Creatime = t.CreateTime }).OrderByDescending(t=>t.Creatime).ToListAsync(); + var list = await _trialVirtualSiteCodeUpdateRepository.Where(t => t.TrialId == trialId).Select(t => new UpdateTrialSiteCodeCommandView() { TrialId = trialId, VirtualSiteCode = t.VirturalSiteCode, Creatime = t.CreateTime }).OrderByDescending(t => t.Creatime).ToListAsync(); return list; } From fa9c9de12cc6197dc28595ce56ce392113cbea6c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 11:27:51 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E8=B4=A8=E6=8E=A7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 34 +++++++++++++++++++ .../Service/QC/DTO/QCListViewModel.cs | 16 +++++++-- .../Service/QC/QCListService.cs | 12 +++++-- 3 files changed, 57 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index a79b6199f..970833ba3 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -885,6 +885,16 @@ + + + 受试者级别所有的影像 + 访视级别的影响 传递subjectVisitId + 标准Id是可选的 不同标准有些检查可能有过滤 + + + + + 后台任务调用,前端忽略该接口 @@ -5178,6 +5188,16 @@ 是否是正在转化 + + + 是否盲化 + + + + + 是否完整 + + 项目ID @@ -14148,6 +14168,20 @@ + + + 一致性分析临床数据签名 + + + + + + + 一致性分析临床数据签名完设置任务为有效 + + + + 获取单个阅片临床数据的所有文件 diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 2db5966a6..588085be1 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -62,6 +62,10 @@ namespace IRaCIS.Core.Application.Contracts //public string VisitPlanInfo { get; set; } = String.Empty; public Guid? HandleUserId { get; set; } + + public DateTime? BeginAuditTime { get; set; } + + public DateTime? EndAuditTime { get; set; } } public class GetNextIQCQualityInDto @@ -1110,6 +1114,9 @@ namespace IRaCIS.Core.Application.Contracts public bool IsHaveUploadFailed { get; set; } + + + } public class GetNextCRCChallengeInDto @@ -1415,8 +1422,7 @@ namespace IRaCIS.Core.Application.Contracts public string ReviewAuditUserName { get; set; } = String.Empty; - public DateTime? ReviewAuditTime { get; set; } - public DateTime? PreliminaryAuditTime { get; set; } + public bool IsEnrollmentConfirm { get; set; } = false; public DateTime? SubjectFirstGiveMedicineTime { get; set; } @@ -1491,6 +1497,12 @@ namespace IRaCIS.Core.Application.Contracts public PackState PackState { get; set; } //public Guid? ClinicalDataSignUserId { get; set; } + + public DateTime? ReviewAuditTime { get; set; } + public DateTime? PreliminaryAuditTime { get; set; } + + + public DateTime? AuditTime => QCProcessEnum == TrialQCProcess.SingleAudit ? PreliminaryAuditTime : (QCProcessEnum == TrialQCProcess.DoubleAudit ? ReviewAuditTime : null); } diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index 4ec4e93bf..cf6324aa6 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -235,7 +235,7 @@ namespace IRaCIS.Core.Application.Image.QA PageSize = 1, }); - return result.Item1.CurrentPageData.Count > 0 ? result.Item1.CurrentPageData[0] : null; + return result.Data.CurrentPageData.Count > 0 ? result.Data.CurrentPageData[0] : null; } /// @@ -244,7 +244,7 @@ namespace IRaCIS.Core.Application.Image.QA /// /// [HttpPost] - public async Task<(PageOutput, TrialSubjectAndSVConfig)> GetQCVisitList(QCVisitSearchDTO visitSearchDTO) + public async Task>> GetQCVisitList(QCVisitSearchDTO visitSearchDTO) { var svExpression = QCCommon.GetSubjectVisitFilter(visitSearchDTO.VisitPlanArray); @@ -266,6 +266,12 @@ namespace IRaCIS.Core.Application.Image.QA || t.QCChallengeDialogList.Any(t => t.CreateUserId == visitSearchDTO.HandleUserId)) .WhereIf(visitSearchDTO.IsUrgent != null, t => t.IsUrgent == visitSearchDTO.IsUrgent) .Where(t => t.SubmitState != SubmitStateEnum.None) + .WhereIf(visitSearchDTO.BeginAuditTime != null, t => t.Trial.QCProcessEnum==TrialQCProcess.SingleAudit? t.PreliminaryAuditTime>= visitSearchDTO.BeginAuditTime: + (t.Trial.QCProcessEnum == TrialQCProcess.DoubleAudit?t.ReviewAuditTime>= visitSearchDTO.BeginAuditTime:true)) + + .WhereIf(visitSearchDTO.EndAuditTime != null, t => t.Trial.QCProcessEnum == TrialQCProcess.SingleAudit ? t.ReviewAuditTime <= visitSearchDTO.EndAuditTime : + (t.Trial.QCProcessEnum == TrialQCProcess.DoubleAudit ? t.ReviewAuditTime <= visitSearchDTO.EndAuditTime : true)) + //.WhereIf(visitSearchDTO.SubmitState != null, t => t.SubmitState == visitSearchDTO.SubmitState) //.WhereIf(visitSearchDTO.ChallengeState != null, t => t.ChallengeState == visitSearchDTO.ChallengeState) .ProjectTo(_mapper.ConfigurationProvider); @@ -279,7 +285,7 @@ namespace IRaCIS.Core.Application.Image.QA var config = await _repository.Where(t => t.Id == visitSearchDTO.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); - return (pageList, config); + return ResponseOutput.Ok (pageList, config); } From 9b4e29a812828e279626df39bd24330b34f7433d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 11:28:58 +0800 Subject: [PATCH 07/16] x --- IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index 7c54848c6..1f4ca4079 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -18,7 +18,7 @@ namespace IRaCIS.Core.API //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddDbContextPool(options => + services.AddDbContext(options => { options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()); From cb53dbefcf15c72fd2b21fb271e282d2ee46fb4b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 11:48:09 +0800 Subject: [PATCH 08/16] =?UTF-8?q?CRC=20=E4=B8=8A=E4=BC=A0=E5=AF=BC?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs | 7 +++++++ IRaCIS.Core.Application/Service/QC/_MapConfig.cs | 1 + 2 files changed, 8 insertions(+) diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index 588085be1..3a4ba042c 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -191,6 +191,13 @@ namespace IRaCIS.Core.Application.Contracts public string SubmitUserName { get; set; } + + public TrialQCProcess QCProcessEnum { get; set; } + + public DateTime? ReviewAuditTime { get; set; } + public DateTime? PreliminaryAuditTime { get; set; } + + public DateTime? AuditTime => QCProcessEnum == TrialQCProcess.SingleAudit ? PreliminaryAuditTime : (QCProcessEnum == TrialQCProcess.DoubleAudit ? ReviewAuditTime : null); } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 2110ce0bd..b5c088c66 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -22,6 +22,7 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap() .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) + .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) .ForMember(d => d.SubmitUserName, u => u.MapFrom(s => s.SubmitUser.FullName)) From 826f8a670db483dab6fd01f93b78a57dea5d3d06 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 13:25:44 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/MailService.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index e34361d6f..fab8dd58f 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -177,9 +177,7 @@ namespace IRaCIS.Application.Services var topicStr = string.Format(input.topicStr, companyName); var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr), - userName, - _localizer[mfaType == UserMFAType.Login ? "Mail_EmailMFALoginEmail" : "Mail_EmailMFAUnlockEmail"], verificationCode ); @@ -218,7 +216,6 @@ namespace IRaCIS.Application.Services userName, //---您正在进行邮箱重置操作 - _localizer["Mail_ResettingEmail"], verificationCode ); @@ -258,7 +255,6 @@ namespace IRaCIS.Application.Services "Sir/Madam", //---您正在进行邮箱重置密码操作 - _localizer["Mail_ResettingPassword"], verificationCode ); @@ -302,7 +298,7 @@ namespace IRaCIS.Application.Services "Sir/Madam", //---您正在参与展影医疗IRC项目 - _localizer["Mail_IRCProject", companyName], + companyName, verificationCode ); @@ -344,7 +340,7 @@ namespace IRaCIS.Application.Services "Sir/Madam", //---您正在参与展影医疗IRC项目中心调研工作 - _localizer["Mail_CenterResearchReminder", companyName], + companyName, verificationCode ); From 99eef312022a4d341c93d285970ffb422d82ddf4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 13:31:57 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/TrialSiteUser/DTO/TrialViewModel.cs | 1 + IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs | 3 +++ IRaCIS.Core.Domain/Trial/Trial.cs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs index a25cf7e19..93469cbcf 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialViewModel.cs @@ -159,6 +159,7 @@ namespace IRaCIS.Application.Contracts //public int? StudyCount { get; set; } = 0; //public int? SiteCount { get; set; } = 0; + public int? UserFeedBackUnDealedCount { get; set; } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 461523bfa..9a3326db6 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -77,6 +77,9 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.ReviewMode, u => u.MapFrom(s => isEn_Us ? s.ReviewMode.Value : s.ReviewMode.ValueCN)) //.ForMember(d => d.ReviewType, u => u.MapFrom(s => s.ReviewType.Value)) .ForMember(d => d.IsLocked, u => u.MapFrom(s => s.WorkloadList.Any(u => u.DataFrom == (int)WorkLoadFromStatus.FinalConfirm))) + .ForMember(d => d.UserFeedBackUnDealedCount, u => u.MapFrom(s => s.UserFeedBackList.Count(t=>t.State==0))) + + //.ForMember(d => d.SiteCount, u => u.MapFrom(s => userTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator ? s.TrialSiteUserList.Count(k => k.UserId == userId) : s.TrialSiteList.Count())) //.ForMember(d => d.StudyCount, u => u.MapFrom(s => userTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator ? s.StudyList.Count(t => t.TrialSite.CRCUserList.Any(t => t.UserId == userId)) : s.StudyList.Count())) //.ForMember(d => d.SubjectCount, u => u.MapFrom(s => userTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator ? s.SubjectList.Count(t => t.TrialSite.CRCUserList.Any(t => t.UserId == userId)) : s.SubjectList.Count())) diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index 2160203ab..f2dc183c9 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -59,8 +59,8 @@ namespace IRaCIS.Core.Domain.Models public List TrialSiteUserList { get; set; } = new List(); [JsonIgnore] public List ReadModuleList { get; set; } = new List(); - - + [JsonIgnore] + public List UserFeedBackList { get; set; } = new List(); public Guid IndicationTypeId { get; set; } = Guid.Empty; public Guid? PhaseId { get; set; } = Guid.Empty; From 1875b56b3729ea5ea2b496cf3f90db8c8ed03e3a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 13:50:16 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index 649ca5ba6..8ae10c42c 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -145,7 +145,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(o => o.HistoryReadingDoctorUserList, t => t.MapFrom(u => u.JudgeVisitList)); CreateMap().IncludeBase() - .ForMember(o => o.IsHaveFeedBack, t => t.MapFrom(u => u.UserFeedBackList.Any())) + .ForMember(o => o.IsHaveFeedBack, t => t.MapFrom(u => u.UserFeedBackList.Any(t=>t.State==0))) ; CreateMap().IncludeBase() From 994a770fef4f4ced97f0f25fa60d192b73ffc3ac Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 13:58:54 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Management/DTO/UserFeedBackViewModel.cs | 2 ++ .../Service/Management/UserFeedBackService.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserFeedBackViewModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserFeedBackViewModel.cs index 14a6fcd70..51bc992bb 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserFeedBackViewModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserFeedBackViewModel.cs @@ -67,6 +67,8 @@ namespace IRaCIS.Core.Application.ViewModel public DateTime? EndCreatime { get; set; } + public Guid? TrialId { get; set; } + } diff --git a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs index a9217b6a5..5a950602d 100644 --- a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs @@ -36,6 +36,7 @@ namespace IRaCIS.Core.Application.Service var userFeedBackQueryable = _userFeedBackRepository .WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.Id) .WhereIf(inQuery.State != null, t => t.State == inQuery.State) + .WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId) .WhereIf(inQuery.QuestionType != null, t => t.QuestionType == inQuery.QuestionType) .WhereIf(inQuery.BeginCreatime != null, t => t.CreateTime >= inQuery.BeginCreatime) From e1038c27f6e19706df3886b3efebe615f7b3230f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 15:41:29 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/QC/QCListService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/QC/QCListService.cs b/IRaCIS.Core.Application/Service/QC/QCListService.cs index cf6324aa6..dd1e1d662 100644 --- a/IRaCIS.Core.Application/Service/QC/QCListService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCListService.cs @@ -269,7 +269,7 @@ namespace IRaCIS.Core.Application.Image.QA .WhereIf(visitSearchDTO.BeginAuditTime != null, t => t.Trial.QCProcessEnum==TrialQCProcess.SingleAudit? t.PreliminaryAuditTime>= visitSearchDTO.BeginAuditTime: (t.Trial.QCProcessEnum == TrialQCProcess.DoubleAudit?t.ReviewAuditTime>= visitSearchDTO.BeginAuditTime:true)) - .WhereIf(visitSearchDTO.EndAuditTime != null, t => t.Trial.QCProcessEnum == TrialQCProcess.SingleAudit ? t.ReviewAuditTime <= visitSearchDTO.EndAuditTime : + .WhereIf(visitSearchDTO.EndAuditTime != null, t => t.Trial.QCProcessEnum == TrialQCProcess.SingleAudit ? t.PreliminaryAuditTime <= visitSearchDTO.EndAuditTime : (t.Trial.QCProcessEnum == TrialQCProcess.DoubleAudit ? t.ReviewAuditTime <= visitSearchDTO.EndAuditTime : true)) //.WhereIf(visitSearchDTO.SubmitState != null, t => t.SubmitState == visitSearchDTO.SubmitState) From c353ae645b800cec432c285373daff543fa5af54 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 17:03:23 +0800 Subject: [PATCH 14/16] =?UTF-8?q?dbcontext=20=E4=B8=8A=E4=B8=8B=E6=96=87?= =?UTF-8?q?=E6=B1=A0=EF=BC=8C=E6=8F=90=E9=AB=98=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/HostConfig/AutofacModuleSetup.cs | 4 +- IRC.Core.SCP/HostConfig/EFSetup.cs | 27 +++++++++--- .../_ServiceExtensions/AutofacModuleSetup.cs | 4 +- IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs | 29 +++++++++++-- .../Context/IRaCISDBContext.cs | 41 +++++++++++-------- 5 files changed, 75 insertions(+), 30 deletions(-) diff --git a/IRC.Core.SCP/HostConfig/AutofacModuleSetup.cs b/IRC.Core.SCP/HostConfig/AutofacModuleSetup.cs index 6567c9735..629cf9636 100644 --- a/IRC.Core.SCP/HostConfig/AutofacModuleSetup.cs +++ b/IRC.Core.SCP/HostConfig/AutofacModuleSetup.cs @@ -45,8 +45,8 @@ namespace IRaCIS.Core.SCP .PropertiesAutowired().AsImplementedInterfaces(); - containerBuilder.RegisterType().As().SingleInstance(); - containerBuilder.RegisterType().As().InstancePerLifetimeScope(); + //containerBuilder.RegisterType().As().SingleInstance(); + //containerBuilder.RegisterType().As().InstancePerLifetimeScope(); diff --git a/IRC.Core.SCP/HostConfig/EFSetup.cs b/IRC.Core.SCP/HostConfig/EFSetup.cs index b53095cbd..77d9465c8 100644 --- a/IRC.Core.SCP/HostConfig/EFSetup.cs +++ b/IRC.Core.SCP/HostConfig/EFSetup.cs @@ -1,4 +1,6 @@ -using IRaCIS.Core.Infra.EFCore; +using EntityFramework.Exceptions.SqlServer; +using IRaCIS.Core.Domain.Share; +using IRaCIS.Core.Infra.EFCore; using Medallion.Threading; using Medallion.Threading.SqlServer; using Microsoft.EntityFrameworkCore; @@ -11,15 +13,25 @@ namespace IRaCIS.Core.SCP { public static void AddEFSetup( this IServiceCollection services, IConfiguration configuration) { - //services.AddScoped(); + services.AddHttpContextAccessor(); + services.AddScoped(); + //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddDbContext(options => + services.AddPooledDbContextFactory(options => { - options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, + // 在控制台 + //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); + var logFactory = LoggerFactory.Create(builder => { builder.AddDebug(); }); + + options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()); + options.UseLoggerFactory(logFactory); + + options.UseExceptionProcessor(); + options.EnableSensitiveDataLogging(); options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor()); @@ -30,6 +42,12 @@ namespace IRaCIS.Core.SCP }); + // Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above, + services.AddScoped(); + + // Finally, arrange for a context to get injected from our Scoped factory: + services.AddScoped(sp => sp.GetRequiredService().CreateDbContext()); + //注意区分 easy caching 也有 IDistributedLockProvider services.AddSingleton(sp => { @@ -38,7 +56,6 @@ namespace IRaCIS.Core.SCP return new SqlDistributedSynchronizationProvider(configuration.GetSection("ConnectionStrings:RemoteNew").Value); }); - //services.AddAssemblyTriggers(typeof(SubjectVisitImageDateTrigger).Assembly); } } } diff --git a/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs index 015405bf1..3806353b2 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/AutofacModuleSetup.cs @@ -55,8 +55,8 @@ namespace IRaCIS.Core.API - containerBuilder.RegisterType().As().SingleInstance(); - containerBuilder.RegisterType().As().InstancePerLifetimeScope(); + //containerBuilder.RegisterType().As().SingleInstance(); + //containerBuilder.RegisterType().As().InstancePerLifetimeScope(); //注册hangfire任务 依赖注入 diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index 1f4ca4079..17aa20a19 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -1,11 +1,15 @@ -using Hangfire.SqlServer; +using Castle.Core.Logging; +using EntityFramework.Exceptions.SqlServer; +using Hangfire.SqlServer; using IRaCIS.Core.Application.Triggers; +using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore; using Medallion.Threading; using Medallion.Threading.SqlServer; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using StackExchange.Redis; namespace IRaCIS.Core.API @@ -14,15 +18,28 @@ namespace IRaCIS.Core.API { public static void AddEFSetup( this IServiceCollection services, IConfiguration configuration) { - //services.AddScoped(); + + services.AddHttpContextAccessor(); + services.AddScoped(); + + // First, register a pooling context factory as a Singleton service, as usual: //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddDbContext(options => + services.AddPooledDbContextFactory(options => { + + // 在控制台 + //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); + var logFactory = LoggerFactory.Create(builder => { builder.AddDebug(); }); + options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()); + options.UseLoggerFactory(logFactory); + + options.UseExceptionProcessor(); + options.EnableSensitiveDataLogging(); options.AddInterceptors(new QueryWithNoLockDbCommandInterceptor()); @@ -62,6 +79,12 @@ namespace IRaCIS.Core.API }); + // Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above, + services.AddScoped(); + + // Finally, arrange for a context to get injected from our Scoped factory: + services.AddScoped(sp => sp.GetRequiredService().CreateDbContext()); + //注意区分 easy caching 也有 IDistributedLockProvider services.AddSingleton(sp => { diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index f81edd5f5..0644e35c3 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -24,33 +24,38 @@ using IRaCIS.Core.Infrastructure; namespace IRaCIS.Core.Infra.EFCore { + + public class IRaCISDBScopedFactory : IDbContextFactory + { + + private readonly IDbContextFactory _pooledFactory; + private readonly IUserInfo _userInfo; + + public IRaCISDBScopedFactory(IDbContextFactory pooledFactory,IUserInfo userInfo) + { + _pooledFactory = pooledFactory; + _userInfo = userInfo; + } + + public IRaCISDBContext CreateDbContext() + { + var context = _pooledFactory.CreateDbContext(); + context._userInfo = _userInfo; + return context; + } + } + public class IRaCISDBContext : DbContext { - public readonly IUserInfo _userInfo; + public IUserInfo _userInfo; public readonly ILogger _logger; - // 在控制台 - //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); - // 调试窗口 - public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddDebug(); }); - public IRaCISDBContext(DbContextOptions options, IUserInfo userInfo, ILogger logger + public IRaCISDBContext(DbContextOptions options, ILogger logger ) : base(options) { _logger= logger; - _userInfo = userInfo; - - } - - - //比数据库上下文构造函数先执行 不能构造函数注入的方式使用配置文件 - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder.UseLoggerFactory(MyLoggerFactory); - - optionsBuilder.UseExceptionProcessor(); - } From 4eaf070243ee8f26492a0f81989776c2cd262268 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 2 Aug 2024 17:44:45 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E6=92=A4=E5=9B=9E=20dbcontext=20?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/HostConfig/EFSetup.cs | 10 +++++----- IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs | 8 ++++---- IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs | 5 +++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/IRC.Core.SCP/HostConfig/EFSetup.cs b/IRC.Core.SCP/HostConfig/EFSetup.cs index 77d9465c8..921f293b9 100644 --- a/IRC.Core.SCP/HostConfig/EFSetup.cs +++ b/IRC.Core.SCP/HostConfig/EFSetup.cs @@ -19,7 +19,7 @@ namespace IRaCIS.Core.SCP //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddPooledDbContextFactory(options => + services.AddDbContext(options => { // 在控制台 //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); @@ -42,11 +42,11 @@ namespace IRaCIS.Core.SCP }); - // Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above, - services.AddScoped(); + //// Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above, + //services.AddScoped(); - // Finally, arrange for a context to get injected from our Scoped factory: - services.AddScoped(sp => sp.GetRequiredService().CreateDbContext()); + //// Finally, arrange for a context to get injected from our Scoped factory: + //services.AddScoped(sp => sp.GetRequiredService().CreateDbContext()); //注意区分 easy caching 也有 IDistributedLockProvider services.AddSingleton(sp => diff --git a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs index 17aa20a19..820a2a67e 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/EFSetup.cs @@ -26,7 +26,7 @@ namespace IRaCIS.Core.API //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddPooledDbContextFactory(options => + services.AddDbContext(options => { // 在控制台 @@ -80,10 +80,10 @@ namespace IRaCIS.Core.API }); // Register an additional context factory as a Scoped service, which gets a pooled context from the Singleton factory we registered above, - services.AddScoped(); + //services.AddScoped(); - // Finally, arrange for a context to get injected from our Scoped factory: - services.AddScoped(sp => sp.GetRequiredService().CreateDbContext()); + //// Finally, arrange for a context to get injected from our Scoped factory: + //services.AddScoped(sp => sp.GetRequiredService().CreateDbContext()); //注意区分 easy caching 也有 IDistributedLockProvider services.AddSingleton(sp => diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 0644e35c3..210224194 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -51,11 +51,12 @@ namespace IRaCIS.Core.Infra.EFCore public readonly ILogger _logger; - public IRaCISDBContext(DbContextOptions options, ILogger logger + public IRaCISDBContext(DbContextOptions options, IUserInfo userInfo, ILogger logger ) : base(options) { - _logger= logger; + _userInfo= userInfo; + _logger = logger; } From 9f5b8e985807732112304bc968f2523f7e54b701 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 5 Aug 2024 10:41:42 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=8E=8B=E7=BC=A9?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8E=8B=E7=BC=A9=E7=BA=A7=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/HostConfig/EFSetup.cs | 2 +- .../ResponseCompressionSetup.cs | 14 ++++++- .../Context/IRaCISDBContext.cs | 40 ++++++++++--------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/IRC.Core.SCP/HostConfig/EFSetup.cs b/IRC.Core.SCP/HostConfig/EFSetup.cs index 921f293b9..00ee49222 100644 --- a/IRC.Core.SCP/HostConfig/EFSetup.cs +++ b/IRC.Core.SCP/HostConfig/EFSetup.cs @@ -19,7 +19,7 @@ namespace IRaCIS.Core.SCP //这个注入没有成功--注入是没问题的,构造函数也只是支持参数就好,错在注入的地方不能写DbContext //Web程序中通过重用池中DbContext实例可提高高并发场景下的吞吐量, 这在概念上类似于ADO.NET Provider原生的连接池操作方式,具有节省DbContext实例化成本的优点 - services.AddDbContext(options => + services.AddDbContextPool(options => { // 在控制台 //public static readonly ILoggerFactory MyLoggerFactory = LoggerFactory.Create(builder => { builder.AddConsole(); }); diff --git a/IRaCIS.Core.API/_ServiceExtensions/ResponseCompressionSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/ResponseCompressionSetup.cs index 6037273da..5bc11b6cb 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/ResponseCompressionSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/ResponseCompressionSetup.cs @@ -1,18 +1,30 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.ResponseCompression; using Microsoft.Extensions.DependencyInjection; +using System.IO.Compression; namespace IRaCIS.Core.API { - public static class ResponseCompressionSetup + public static class ResponseCompressionSetup { public static void AddResponseCompressionSetup(this IServiceCollection services) { services.AddResponseCompression(options => { + options.EnableForHttps = true; options.Providers.Add(); options.Providers.Add(); }); + + services.Configure(options => + { + options.Level = CompressionLevel.Optimal; + }); + + services.Configure(options => + { + options.Level = CompressionLevel.Optimal; + }); } } } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 210224194..44a2ad291 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -24,32 +24,34 @@ using IRaCIS.Core.Infrastructure; namespace IRaCIS.Core.Infra.EFCore { + /// + /// 报错,添加subject 报错,重复添加访视 + /// + //public class IRaCISDBScopedFactory : IDbContextFactory + //{ - public class IRaCISDBScopedFactory : IDbContextFactory - { + // private readonly IDbContextFactory _pooledFactory; + // private readonly IUserInfo _userInfo; - private readonly IDbContextFactory _pooledFactory; - private readonly IUserInfo _userInfo; + // public IRaCISDBScopedFactory(IDbContextFactory pooledFactory,IUserInfo userInfo) + // { + // _pooledFactory = pooledFactory; + // _userInfo = userInfo; + // } - public IRaCISDBScopedFactory(IDbContextFactory pooledFactory,IUserInfo userInfo) - { - _pooledFactory = pooledFactory; - _userInfo = userInfo; - } - - public IRaCISDBContext CreateDbContext() - { - var context = _pooledFactory.CreateDbContext(); - context._userInfo = _userInfo; - return context; - } - } + // public IRaCISDBContext CreateDbContext() + // { + // var context = _pooledFactory.CreateDbContext(); + // context._userInfo = _userInfo; + // return context; + // } + //} public class IRaCISDBContext : DbContext { - public IUserInfo _userInfo; + private IUserInfo _userInfo; - public readonly ILogger _logger; + private readonly ILogger _logger; public IRaCISDBContext(DbContextOptions options, IUserInfo userInfo, ILogger logger