From b610143e33f6d9171114877cfb0fe4d9338a101a Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 2 Dec 2024 17:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Doctor/DoctorService.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index d21fd09e9..7c3424066 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -262,14 +262,7 @@ namespace IRaCIS.Core.Application.Service } } - var exists = await _doctorSummarizeRepository - .WhereIf(_userInfo.IsEn_Us, x=>x.IndicationEn == inDto.IndicationEn) - .WhereIf(!_userInfo.IsEn_Us, x=>x.Indication == inDto.Indication) - .AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null); - if (exists) - { - throw new BusinessValidationFailedException(_localizer["DoctorSummarize_repeat"]); - } + if (inDto.TrialId != null && inDto.SaveSummarizeInfoType!= SaveSummarizeInfo.SaveSelf) { @@ -286,6 +279,15 @@ namespace IRaCIS.Core.Application.Service break; case SaveSummarizeInfo.SaveAndAdd: + + var exists = await _doctorSummarizeRepository + .WhereIf(_userInfo.IsEn_Us, x => x.IndicationEn == inDto.IndicationEn) + .WhereIf(!_userInfo.IsEn_Us, x => x.Indication == inDto.Indication) + .AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null); + if (exists) + { + throw new BusinessValidationFailedException(_localizer["DoctorSummarize_repeat"]); + } await _doctorSummarizeRepository.BatchDeleteNoTrackingAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == inDto.TrialId);