From f347b0cace8530633127783f1de0c99ce71599f9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 23 Oct 2025 16:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E8=87=B4=E6=80=A7?= =?UTF-8?q?=E6=A0=B8=E6=9F=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.csproj | 4 + .../IRaCIS.Core.Application.xml | 12 +++ .../Consumer/ConsistencyCheckConsumer.cs | 40 +++++--- .../TrialSiteUser/DTO/TrialStatViewModel.cs | 90 ++++++++++++++++++ .../Service/TrialSiteUser/TrialStatService.cs | 93 +++++++++++++++++++ 5 files changed, 224 insertions(+), 15 deletions(-) create mode 100644 IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialStatViewModel.cs create mode 100644 IRaCIS.Core.Application/Service/TrialSiteUser/TrialStatService.cs diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index fba269f0f..913392d43 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -74,4 +74,8 @@ + + + + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 86a8c2e1c..c8452203a 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -18825,6 +18825,18 @@ + + + 访视完成度 + + + + + + 质疑统计列表 --医学审核不区分标准 + + + 访视 质疑状态 触发修改 diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs index 20d6b35f3..97bb2cdae 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/ConsistencyCheckConsumer.cs @@ -33,13 +33,14 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer IRepository _commonDocumentRepository, IStringLocalizer _localizer, IWebHostEnvironment _hostEnvironment, - IRepository _inspectionFileRepository + IRepository _inspectionFileRepository, + IOptionsMonitor _systemEmailSendConfig ) : IConsumer, IConsumer { - private readonly SystemEmailSendConfig _systemEmailConfig; + private readonly SystemEmailSendConfig _systemEmailConfig = _systemEmailSendConfig.CurrentValue; @@ -430,23 +431,32 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer }); } - //导到Excel 上传oss 回更记录状态 - var list = fullCheckResultList; - - var exportInfo = new ExcelExportInfo(); - - exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); - exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); - - var fileStreamResult = (FileStreamResult)await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialConsistentFUllCheckList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(FullCheckResult)); - - var ossRelativePath = await _oSSService.UploadToOSSAsync(fileStreamResult.FileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", "DataReconciliation"); - - await _inspectionFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == inspectionFileId, u => new InspectionFile() { CheckState = EDCCheckState.Success, ResultPath = ossRelativePath }); } } + + //导到Excel 上传oss 回更记录状态 + + var list = fullCheckResultList; + + var exportInfo = new ExcelExportInfo(); + + exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId); + exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId); + + var fileStreamResult = (FileStreamResult)await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialConsistentFUllCheckList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(FullCheckResult)); + + var ossRelativePath = await _oSSService.UploadToOSSAsync(fileStreamResult.FileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", "DataReconciliation"); + + + //var add = await _inspectionFileRepository.FindAsync(inspectionFileId); + //add.CheckState = EDCCheckState.Success; + //add.ResultPath = ossRelativePath; + + //更新 + await _inspectionFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == inspectionFileId, u => new InspectionFile() { CheckState = EDCCheckState.Success, ResultPath = ossRelativePath }); + await _subjectVisitRepository.SaveChangesAsync(); } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialStatViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialStatViewModel.cs new file mode 100644 index 000000000..87eba5c60 --- /dev/null +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialStatViewModel.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Application.ViewModel +{ + public class VisitFinishedStatQuery + { + public Guid TrialId { get; set; } + + public Guid? TrialReadingCriterionId { get; set; } + } + + + public class VisitFinishedStatViewModel + { + public int? UploadedCount { get; set; } + + public int? QCFinishedCount { get; set; } + + public int? CheckFinishedCount { get; set; } + + public List CriterionList { get; set; } + } + + public class VisitReadingCriterionInfo + { + public Guid TrialReadingCriterionId { get; set; } + + public string TrialReadingCriterionName { get; set; } + + public int? ReadingFinishedCount { get; set; } + } + + + public class VisitQuestionStatQuery + { + public Guid TrialId { get; set; } + + } + + public class VisitQuestionViewModel + { + + public int? QCQuestion_IngCount { get; set; } + + public int? QCQuestion_ClosedCount { get; set; } + + public int? CheckQuestion_ClosedCount { get; set; } + + public int? CheckQuestion_IngCount { get; set; } + + public int? MedicalReviewQuestion_ClosedCount { get; set; } + + public int? MedicalReviewQuestion_IngCount { get; set; } + + + //public List CriterionList { get; set; } + + } + + + public class MedicalReviewQuestionInfo + { + public Guid TrialReadingCriterionId { get; set; } + + public string TrialReadingCriterionName { get; set; } + + + public int? MedicalReviewQuestion_ClosedCount { get; set; } + + public int? MedicalReviewQuestion_IngCount { get; set; } + } + + public class EfficacyEvaluationQuery + { + public Guid TrialId { get; set; } + + public Guid TrialReadingCriterionId { get; set; } + } + + public class EfficacyEvaluationStatViewModel + { + public int OverallTumorEvaluation { get; set; } + + public int SubjectCount { get; set; } + } +} diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialStatService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialStatService.cs new file mode 100644 index 000000000..cc79ae16b --- /dev/null +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialStatService.cs @@ -0,0 +1,93 @@ +using IRaCIS.Core.Application.ViewModel; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IRaCIS.Core.Application; + +[ApiExplorerSettings(GroupName = "Trial")] +public class TrialStatService( + IRepository _trialRepository, + IRepository _subjectVisitRepository, + IRepository _trialDocumentRepository, + IRepository _systemDocumentRepository, + IRepository _systemNoticeRepository, + IRepository _subjectVisitImageBackRecordReposiotry, + IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService +{ + + /// + /// 访视完成度 + /// + /// + public async Task> GetTrialVisitFinishedStatList(VisitFinishedStatQuery inQuery) + { + + + var list = await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new VisitFinishedStatViewModel() + { + UploadedCount = t.SubjectVisitList.Where(t => t.SubmitState == SubmitStateEnum.Submitted).Count(), + QCFinishedCount = t.SubjectVisitList.Where(t => t.AuditState == AuditStateEnum.QCPassed || t.AuditState == AuditStateEnum.QCFailed).Count(), + CheckFinishedCount = t.SubjectVisitList.Where(t => t.CheckState == CheckStateEnum.CVPassed).Count(), + + CriterionList = t.TrialReadingCriterionList.Select(t => new VisitReadingCriterionInfo() + { + TrialReadingCriterionId = t.Id, + TrialReadingCriterionName = t.CriterionName, + ReadingFinishedCount = t.VisitTaskList.Where(t => t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false + && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit) + .GroupBy(t => t.SourceSubjectVisitId) + .Where(g => t.ReadingType == ReadingMethod.Double ? g.Count() == 2 : true) + .Count() + + }).ToList() + + + }).ToListAsync(); + + + return list; + } + + + /// + /// 质疑统计列表 --医学审核不区分标准 + /// + /// + public async Task> GetTrialQuestionStatList(VisitQuestionStatQuery inQuery) + { + + + var list = await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new VisitQuestionViewModel() + { + + + QCQuestion_ClosedCount = t.SubjectVisitList.SelectMany(t => t.QCChallengeList).Where(c => c.IsClosed).Count(), + + QCQuestion_IngCount = t.SubjectVisitList.SelectMany(t => t.QCChallengeList).Where(c => c.IsClosed == false).Count(), + + CheckQuestion_ClosedCount = t.SubjectVisitList.Where(t => t.CheckChallengeState == CheckChanllengeTypeEnum.Closed).Count(), + CheckQuestion_IngCount = t.SubjectVisitList.Where(t => t.CheckChallengeState != CheckChanllengeTypeEnum.Closed).Count(), + + + MedicalReviewQuestion_ClosedCount = t.TaskMedicalReviewList.Where(t => t.VisitTask.IsAnalysisCreate == false && t.IsClosedDialog).Count(), + + MedicalReviewQuestion_IngCount = t.TaskMedicalReviewList.Where(t => t.VisitTask.IsAnalysisCreate == false && t.IsClosedDialog == false).Count(), + + + }).ToListAsync(); + + + return list; + } + + /////疗效统计表,只针对肿瘤标准 排除基线 + ///// + //public async Task> GetTrialEfficacyEvaluationStatList(EfficacyEvaluationQuery inQuery) + //{ + + //} +} \ No newline at end of file