From ec53815bb05cdcb407da16a1c209f53bded9d013 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 19 Jul 2023 13:40:53 +0800 Subject: [PATCH] S-84 --- .../Controllers/InspectionController.cs | 18 ++++++++++ .../ClinicalData/ClinicalAnswerService.cs | 36 ++++++++++++++----- .../Service/Reading/Dto/ClinicalAnswerDto.cs | 4 ++- .../Interface/IClinicalAnswerService.cs | 2 ++ .../Reading/ReadingPeriod/ReadModule.cs | 10 +++--- 5 files changed, 56 insertions(+), 14 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 8ef86050d..b9a7877bc 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -254,6 +254,24 @@ namespace IRaCIS.Core.API.Controllers return result; } + + /// + /// CRC确认临床数据 + /// + /// + /// + [HttpPost, Route("Inspection/ClinicalAnswer/CRCConfirmClinical")] + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + + [UnitOfWork] + public async Task CRCConfirmClinical(DataInspectionDto opt) + { + var singid = await _inspectionService.RecordSing(opt.SignInfo); + var result = await _clinicalAnswerService.CRCConfirmClinical(opt.Data); + await _inspectionService.CompletedSign(singid, result); + return result; + } + /// /// CRC撤销临床数据 /// diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs index 6ec0c5aa2..d16354bd0 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs @@ -530,6 +530,7 @@ namespace IRaCIS.Core.Application.Service { SubjectId = x.SubjectId, + IsNotNeedPMConfirm=x.IsNotNeedPMConfirm, IsCRCConfirm = x.IsCRCConfirm, IsCRCApplicationRevoke=x.IsCRCApplicationRevoke, VisitBlindName=x.SubjectVisit.BlindName, @@ -792,11 +793,16 @@ namespace IRaCIS.Core.Application.Service }); }); - var readModuleIds = confirmlist.Select(x => x.ReadModuleId).ToList(); + foreach (var item in confirmlist) + { + await _readModuleRepository.UpdatePartialFromQueryAsync(x =>x.Id==item.ReadModuleId , x => new ReadModule() + { + IsCRCConfirm = true, + IsPMConfirm=item.ClinicalFormList.Count()==0?true:false, + IsNotNeedPMConfirm= item.ClinicalFormList.Count() == 0 ? true : false, + }); + } - await _readModuleRepository.UpdatePartialFromQueryAsync(x => readModuleIds.Contains(x.Id),x=>new ReadModule() { - IsCRCConfirm=true - }); await _readModuleCriterionFromRepository.AddRangeAsync(needAddList); await _readModuleCriterionFromRepository.SaveChangesAsync(); @@ -835,11 +841,23 @@ namespace IRaCIS.Core.Application.Service throw new BusinessValidationFailedException("PM已确认,无法取消!"); } - - await _readModuleRepository.UpdatePartialFromQueryAsync(x => presentData.ReadModuleId==x.Id, x => new ReadModule() - { - IsCRCApplicationRevoke = true - }); + if (presentData.IsNotNeedPMConfirm) + { + await _readModuleRepository.UpdatePartialFromQueryAsync(x => presentData.ReadModuleId == x.Id, x => new ReadModule() + { + IsPMConfirm = false, + IsCRCConfirm = false, + IsNotNeedPMConfirm = false, + }); + } + else + { + await _readModuleRepository.UpdatePartialFromQueryAsync(x => presentData.ReadModuleId == x.Id, x => new ReadModule() + { + IsCRCApplicationRevoke = true, + }); + } + //await _readModuleCriterionFromRepository.BatchDeleteNoTrackingAsync(x=>x.ReadModuleId== presentData.ReadModuleId); diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalAnswerDto.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalAnswerDto.cs index 1cb030cc3..eb05dd111 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalAnswerDto.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ClinicalAnswerDto.cs @@ -270,7 +270,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// 受试者ID /// public Guid SubjectId { get; set; } - public Guid ReadModuleId { get; set; } + + public bool IsNotNeedPMConfirm { get; set; } = false; + public Guid ReadModuleId { get; set; } /// /// 模块名称 diff --git a/IRaCIS.Core.Application/Service/Reading/Interface/IClinicalAnswerService.cs b/IRaCIS.Core.Application/Service/Reading/Interface/IClinicalAnswerService.cs index 802c97fa7..a7b15aee6 100644 --- a/IRaCIS.Core.Application/Service/Reading/Interface/IClinicalAnswerService.cs +++ b/IRaCIS.Core.Application/Service/Reading/Interface/IClinicalAnswerService.cs @@ -17,6 +17,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Interface Task SubmitClinicalForm(SubmitClinicalFormInDto inDto); + Task CRCConfirmClinical(CRCConfirmClinicalInDto inDto); + Task CRCCancelConfirmClinical(CRCCancelConfirmClinicalInDto inDto); } diff --git a/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs b/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs index bd4d29278..e45d82b4b 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingPeriod/ReadModule.cs @@ -80,10 +80,12 @@ namespace IRaCIS.Core.Domain.Models public bool IsPMConfirm { get; set; } = false; - /// - /// CRC是否正在申请撤回 - /// - public bool IsCRCApplicationRevoke { get; set; } = false; + public bool IsNotNeedPMConfirm { get; set; } = false; + + /// + /// CRC是否正在申请撤回 + /// + public bool IsCRCApplicationRevoke { get; set; } = false; public bool IsDeleted { get; set; } public DateTime? DeletedTime { get; set; }