验证是否有重复的概况
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-12-02 16:51:05 +08:00
parent 004f73b24d
commit 393bce5f5c
1 changed files with 12 additions and 13 deletions

View File

@ -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) if (inDto.TrialId != null && inDto.SaveSummarizeInfoType!= SaveSummarizeInfo.SaveSelf)
{ {
switch (inDto.SaveSummarizeInfoType) switch (inDto.SaveSummarizeInfoType)
@ -279,18 +286,10 @@ namespace IRaCIS.Core.Application.Service
await _doctorSummarizeRepository.BatchDeleteNoTrackingAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == inDto.TrialId); 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(); var needData = inDto.Clone();
needData.TrialId = null; needData.TrialId = null;
await _doctorSummarizeRepository.InsertOrUpdateAsync(needData, true); await _doctorSummarizeRepository.InsertOrUpdateAsync(needData, true);
}
break; break;
} }
} }