From 2f77c0ecef0745a4e2790d2cd09179f1b905a9e6 Mon Sep 17 00:00:00 2001
From: he <109787524@qq.com>
Date: Mon, 2 Dec 2024 15:01:17 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Doctor/DTO/DoctorModel.cs | 21 +++++++++++++
.../Service/Doctor/DoctorService.cs | 31 +++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs
index 7ed96e5d2..9f8793b4b 100644
--- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs
+++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs
@@ -415,6 +415,27 @@ namespace IRaCIS.Application.Contracts
/// 项目Id
///
public Guid? TrialId { get; set; }
+
+ public SaveSummarizeInfo SaveSummarizeInfoType { get; set; } = SaveSummarizeInfo.SaveSelf;
+ }
+
+ public enum SaveSummarizeInfo
+ {
+ ///
+ /// 保存自己
+ ///
+ SaveSelf = 0,
+
+ ///
+ /// 保存并覆盖
+ ///
+ SaveAndCover = 1,
+
+ ///
+ /// 保存并新增
+ ///
+ SaveAndAdd = 2,
+
}
public class UpdateGneralSituationDto
diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs
index 7fd5474e4..cdbe0e831 100644
--- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs
+++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs
@@ -262,6 +262,37 @@ namespace IRaCIS.Core.Application.Service
}
}
+ if (inDto.TrialId != null && inDto.SaveSummarizeInfoType!= SaveSummarizeInfo.SaveSelf)
+ {
+ switch (inDto.SaveSummarizeInfoType)
+ {
+ case SaveSummarizeInfo.SaveAndCover:
+ await _doctorSummarizeRepository.BatchUpdateNoTrackingAsync(x =>
+ x.DoctorId == inDto.DoctorId && x.TrialId == null &&
+ x.IndicationEn == inDto.IndicationEn && x.Indication == inDto.Indication, x => new DoctorSummarize()
+ {
+ Summarize = inDto.Summarize,
+ SummarizeEn = inDto.SummarizeEn
+ });
+ break;
+ case SaveSummarizeInfo.SaveAndAdd:
+ 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);
+ }
+ break;
+ }
+ }
+
+
if (inDto.TrialId == null && inDto.IsMain)
{