From 393bce5f5cf836ca99f6ff32ddb3763171aa1477 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 2 Dec 2024 16:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=98=AF=E5=90=A6=E6=9C=89?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E7=9A=84=E6=A6=82=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Doctor/DoctorService.cs | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index d295986b0..b541b8e8c 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -262,6 +262,13 @@ namespace IRaCIS.Core.Application.Service } } + var exists = await _doctorSummarizeRepository.AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null && + (x.IndicationEn == inDto.IndicationEn && x.Indication == inDto.Indication)); + if (exists) + { + throw new BusinessValidationFailedException(_localizer["DoctorSummarize_repeat"]); + } + if (inDto.TrialId != null && inDto.SaveSummarizeInfoType!= SaveSummarizeInfo.SaveSelf) { switch (inDto.SaveSummarizeInfoType) @@ -278,19 +285,11 @@ namespace IRaCIS.Core.Application.Service case SaveSummarizeInfo.SaveAndAdd: await _doctorSummarizeRepository.BatchDeleteNoTrackingAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == inDto.TrialId); - - var exists = await _doctorSummarizeRepository.AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null && - (x.IndicationEn == inDto.IndicationEn && x.Indication == inDto.Indication)); - if (exists) - { - throw new BusinessValidationFailedException(_localizer["DoctorSummarize_repeat"]); - } - else - { - var needData = inDto.Clone(); - needData.TrialId = null; - await _doctorSummarizeRepository.InsertOrUpdateAsync(needData, true); - } + + + var needData = inDto.Clone(); + needData.TrialId = null; + await _doctorSummarizeRepository.InsertOrUpdateAsync(needData, true); break; } }