diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index b9a7877bc..7de33aaae 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -419,13 +419,30 @@ namespace IRaCIS.Core.API.Controllers } + /// + /// 重置并同步项目阅片标准 + /// + /// + [HttpPost, Route("Inspection/ReadingCriterion/ResetAndAsyncCriterion")] + [UnitOfWork] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - /// - /// CRC RequestToQC 批量提交 - /// - /// - /// - [HttpPost, Route("Inspection/QCOperation/CRCRequestToQC")] + public async Task ResetAndAsyncCriterion(DataInspectionDto opt) + { + var singid = await _inspectionService.RecordSing(opt.SignInfo); + var result = await _trialConfigService.ResetAndAsyncCriterion(opt.Data); + await _inspectionService.CompletedSign(singid, result); + return result; + } + + + + /// + /// CRC RequestToQC 批量提交 + /// + /// + /// + [HttpPost, Route("Inspection/QCOperation/CRCRequestToQC")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] [UnitOfWork] public async Task CRCRequestToQC(DataInspectionDto opt) diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 9f901627f..3580ca96a 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -208,6 +208,12 @@ + + + 重置并同步项目阅片标准 + + + CRC RequestToQC 批量提交 diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index ea0d004b3..1e08ec5c2 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -11923,6 +11923,13 @@ + + + 重置并同步标准 + + + + 同步项目标准字典信息 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 3b55fe1bf..eca632b44 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -232,6 +232,14 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public List CodeList { get; set; } } + public class ResetAndAsyncCriterionInDto + { + public Guid TrialReadingCriterionId { get; set; } + } + public class ResetAndAsyncCriterionOutDto + { + + } public class SetSystemGlobalInfoInDto { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs index 2f9caca99..2d0ae041e 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingCriterionService.cs @@ -5,6 +5,8 @@ using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Application.Service.Reading.Dto; using Panda.DynamicWebApi.Attributes; +using IRaCIS.Core.Application.Contracts; +using IRaCIS.Application.Interfaces; namespace IRaCIS.Core.Application.Service.RC { @@ -22,7 +24,8 @@ namespace IRaCIS.Core.Application.Service.RC private readonly IRepository _readingCriterionDictionaryRepository; private readonly IRepository _readingTrialCriterionDictionaryRepository; private readonly IRepository _visitTaskRepository; - private readonly IRepository _systemCriterionDictionaryCodeRepository; + private readonly ITrialConfigService _trialConfigService; + private readonly IRepository _systemCriterionDictionaryCodeRepository; private readonly IRepository _readingTableQuestionAnswerRepository; private readonly IRepository _readingTableAnswerRowInfoRepository; @@ -35,7 +38,8 @@ namespace IRaCIS.Core.Application.Service.RC IRepository readingCriterionDictionaryRepository, IRepository readingTrialCriterionDictionaryRepository, IRepository visitTaskRepository, - IRepository systemCriterionDictionaryCodeRepository, + ITrialConfigService trialConfigService, + IRepository systemCriterionDictionaryCodeRepository, IRepository readingTableQuestionTrialRepository, IRepository readingTableQuestionAnswerRepository, IRepository readingTableAnswerRowInfoRepository, @@ -50,7 +54,8 @@ namespace IRaCIS.Core.Application.Service.RC this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository; this._readingTrialCriterionDictionaryRepository = readingTrialCriterionDictionaryRepository; this._visitTaskRepository = visitTaskRepository; - this._systemCriterionDictionaryCodeRepository = systemCriterionDictionaryCodeRepository; + this._trialConfigService = trialConfigService; + this._systemCriterionDictionaryCodeRepository = systemCriterionDictionaryCodeRepository; this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository; this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository; this._readingTaskQuestionAnswer = readingTaskQuestionAnswer; @@ -123,12 +128,13 @@ namespace IRaCIS.Core.Application.Service.RC return ResponseOutput.Ok(); } - /// - /// 设置系统全局阅片阅片信息 - /// - /// - /// - [HttpPost] + + /// + /// 设置系统全局阅片阅片信息 + /// + /// + /// + [HttpPost] [UnitOfWork] public async Task SetSystemGlobalInfo(SetSystemGlobalInfoInDto inDto) { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index b7f47b1d8..3154016bc 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2968,7 +2968,7 @@ namespace IRaCIS.Application.Services typeChangeDic.Add(ModuleTypeEnum.Referee, ReadingCategory.Judge); typeChangeDic.Add(ModuleTypeEnum.Oncology, ReadingCategory.Oncology); #endregion - var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync(); + var taskInfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync(); List needReadList = new List(); if (!taskInfo.IsAnalysisCreate) { @@ -2988,7 +2988,10 @@ namespace IRaCIS.Application.Services ReadModuleId = x.Id, ReadingCategory = typeChangeDic[x.ModuleType], }).ToListAsync(); - if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global)) + + + + if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global)&& taskInfo.TrialReadingCriterion.IsGlobalReading) { needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList(); await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() @@ -3002,7 +3005,7 @@ namespace IRaCIS.Application.Services } else if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Oncology)) { - // 添加肿瘤学 + // 添加肿瘤学 if (await _visitTaskRepository.AnyAsync(x => x.Id == visitTaskId && x.JudgeVisitTaskId == null)) { await AddOncologyTask(needReadList.First().ReadModuleId); diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs index b361b0155..a24eac673 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingOncologyTaskService.cs @@ -376,41 +376,75 @@ namespace IRaCIS.Application.Services if (readModuleInfo != null) { // 先找到对应的全局阅片模块Id - var globalreadModuleId = await _readModuleRepository.Where(x => x.SubjectVisitId == readModuleInfo.SubjectVisitId && + var globalreadModule = await _readModuleRepository.Where(x => x.SubjectVisitId == readModuleInfo.SubjectVisitId && x.TrialReadingCriterionId== readModuleInfo.TrialReadingCriterionId&& - x.ModuleType == ModuleTypeEnum.Global).Include(x=>x.SubjectVisit).Select(x => x.Id).FirstOrDefaultAsync(); - - // 找到一个全局阅片任务是否有裁判任务 - - var judgeVisitTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModuleId && x.TaskState == TaskState.Effect - && x.ReadingCategory == ReadingCategory.Global - && x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.JudgeVisitTaskId).FirstOrDefaultAsync(); - - // 要判断是否为老裁判任务的Id - if (judgeVisitTaskId != null) + x.ModuleType == ModuleTypeEnum.Global).Include(x=>x.SubjectVisit).FirstOrDefaultAsync(); + // 获取系统配置 + var readingType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == readModuleInfo.TrialReadingCriterionId).Select(x => x.ReadingType).FirstOrDefaultAsync(); + if (globalreadModule != null) { - // 如果不存在有效的裁判 - if (!(await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId && x.TaskState == TaskState.Effect))) + // 找到一个全局阅片任务是否有裁判任务 + + var judgeVisitTaskId = await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModule.Id && x.TaskState == TaskState.Effect + && x.ReadingCategory == ReadingCategory.Global + && x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.JudgeVisitTaskId).FirstOrDefaultAsync(); + + // 要判断是否为老裁判任务的Id + if (judgeVisitTaskId != null) { - judgeVisitTaskId = null; + // 如果不存在有效的裁判 + if (!(await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId && x.TaskState == TaskState.Effect))) + { + judgeVisitTaskId = null; + } + } + + + + // 判断阅片是否完成 + if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModule.Id && x.TaskState == TaskState.Effect && x.ReadingCategory == ReadingCategory.Global + && x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate && x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId + ).CountAsync() == (int)readingType)) + { + + finishReading = true; + } + else if (judgeVisitTaskId != null && (await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId.Value && x.JudgeResultTaskId != null && x.ReadingTaskState == ReadingTaskState.HaveSigned))) + { + finishReading = true; } } - // 获取系统配置 - var readingType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == readModuleInfo.TrialReadingCriterionId).Select(x => x.ReadingType).FirstOrDefaultAsync(); + else { - // 判断阅片是否完成 - if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SouceReadModuleId == globalreadModuleId && x.TaskState == TaskState.Effect && x.ReadingCategory == ReadingCategory.Global - && x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate && x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId - ).CountAsync() == (int)readingType)) - { + var judgeVisitTaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == readModuleInfo.SubjectVisitId && x.TaskState == TaskState.Effect + &&x.TrialReadingCriterionId== readModuleInfo.TrialReadingCriterionId + && x.ReadingTaskState == ReadingTaskState.HaveSigned).Select(x => x.JudgeVisitTaskId).FirstOrDefaultAsync(); + // 要判断是否为老裁判任务的Id + if (judgeVisitTaskId != null) + { + // 如果不存在有效的裁判 + if (!(await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId && x.TaskState == TaskState.Effect))) + { + judgeVisitTaskId = null; + } + } - finishReading = true; - } - else if (judgeVisitTaskId != null && (await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId.Value&&x.JudgeResultTaskId!=null && x.ReadingTaskState == ReadingTaskState.HaveSigned))) - { - finishReading = true; - } + // 判断阅片是否完成 + if (judgeVisitTaskId == null && (await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == readModuleInfo.SubjectVisitId && x.TaskState == TaskState.Effect + && x.ReadingTaskState == ReadingTaskState.HaveSigned && !x.IsAnalysisCreate && x.TrialReadingCriterionId == readModuleInfo.TrialReadingCriterionId + ).CountAsync() == (int)readingType)) + { + + finishReading = true; + } + else if (judgeVisitTaskId != null && (await _visitTaskRepository.AnyAsync(x => x.Id == judgeVisitTaskId.Value && x.JudgeResultTaskId != null && x.ReadingTaskState == ReadingTaskState.HaveSigned))) + { + finishReading = true; + } + + } + if (finishReading) { diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs index 1d402a924..6174c5b50 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingPeriod/ReadModuleService.cs @@ -303,7 +303,7 @@ namespace IRaCIS.Application.Services var readModulequery = _readModuleRepository.AsQueryable().Where(x=>x.TrialReadingCriterionId == inDto.TrialReadingCriterionId); var resultlist= await visitQuery.WhereIf(finalVisitNum!=0, x => x.VisitNum <= finalVisitNum) - // .WhereIf(inDto.ReadingSetType== ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id&&y.TrialReadingCriterionId== inDto.TrialReadingCriterionId && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0) + .WhereIf(inDto.ReadingSetType== ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id&&y.TrialReadingCriterionId== inDto.TrialReadingCriterionId && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0) .Where(x=>x.VisitNum> maxReadVisitNum) .Where(x=>!x.IsBaseLine) // 排除基线 .Where(x => readModulequery.Where(y => y.SubjectVisitId == x.Id&& y.TrialReadingCriterionId == inDto.TrialReadingCriterionId && y.ReadingSetType == inDto.ReadingSetType).Count() == 0).OrderBy(x => finalVisitNum) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialConfigService.cs index 75ec6836c..7a06d0fb5 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialConfigService.cs @@ -1,6 +1,7 @@ using IRaCIS.Core.Application.Contracts; using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Infra.EFCore; +using IRaCIS.Core.Application.Service.Reading.Dto; namespace IRaCIS.Application.Interfaces { @@ -20,6 +21,11 @@ namespace IRaCIS.Application.Interfaces Task TrialConfigSignatureConfirm(SignConfirmDTO signConfirmDTO); + Task AsyncTrialCriterionDictionary(AsyncTrialCriterionDictionaryInDto inDto); - } + Task ResetAndAsyncCriterion(ResetAndAsyncCriterionInDto inDto); + + + + } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs index 4d1125b99..da254adad 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs @@ -194,12 +194,33 @@ namespace IRaCIS.Core.Application return trialInfo; } - /// - /// 同步项目标准字典信息 - /// - /// - /// - [HttpPost] + /// + /// 重置并同步标准 + /// + /// + /// + public async Task ResetAndAsyncCriterion(ResetAndAsyncCriterionInDto inDto) + { + await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial + { + SynchronizeOriginalTime = null, + SynchronizeTime = DateTime.Now.AddYears(-20), + IsSigned = false, + ReadingInfoSignTime = null, + + }); + + await AsyncTrialCriterionDictionary(new AsyncTrialCriterionDictionaryInDto() { TrialReadingCriterionId = inDto.TrialReadingCriterionId }); + return ResponseOutput.Ok(true); + } + + + /// + /// 同步项目标准字典信息 + /// + /// + /// + [HttpPost] public async Task AsyncTrialCriterionDictionary(AsyncTrialCriterionDictionaryInDto inDto) {