From 3e9221b39caf4b2ae2c1b509e9ea0ab20cb6e800 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Fri, 20 Dec 2024 14:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BB=E9=99=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Doctor/DTO/DoctorModel.cs | 3 +++ .../Service/Doctor/DTO/EducationModel.cs | 1 + .../Service/Doctor/DoctorService.cs | 18 +++++++++++++++ .../Service/Doctor/EducationService.cs | 23 ++++++++++++++++--- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs index 2fe29dbe4..1f9675972 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs @@ -445,6 +445,9 @@ namespace IRaCIS.Application.Contracts public class BasicInfoAndEmploymentDto: DoctorBasicInfoCommand { + + public string HospitalName { get; set; } = string.Empty; + //部门 public Guid? DepartmentId { get; set; } public string DepartmentOther { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/EducationModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/EducationModel.cs index 734c4cbb4..0c2ded656 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/EducationModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/EducationModel.cs @@ -37,6 +37,7 @@ } public class PostgraduateCommand { + public Guid? Id { get; set; } public Guid DoctorId { get; set; } diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index a3629fab3..f7d582319 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -144,6 +144,24 @@ namespace IRaCIS.Core.Application.Service //---current phone or email number already existed var verifyPair = new KeyValuePair>, string>(verifyExp, _localizer["Doctor_DupPhoneOrEmail"]); + if (indto.HospitalName != string.Empty) + { + var hospital = await _hospitalRepository.Where(x => x.HospitalName == indto.HospitalName && x.SiteId == null).FirstOrDefaultAsync(); + if (hospital != null) + { + indto.HospitalId = hospital.Id; + } + else + { + var newHospital = await _hospitalRepository.AddAsync(new Hospital() + { + HospitalName = indto.HospitalName, + IsConfirm = false, + }, true); + indto.HospitalId = newHospital.Id; + } + } + if (indto.Id == Guid.Empty || indto.Id == null) { diff --git a/IRaCIS.Core.Application/Service/Doctor/EducationService.cs b/IRaCIS.Core.Application/Service/Doctor/EducationService.cs index ad8d8a751..c10251657 100644 --- a/IRaCIS.Core.Application/Service/Doctor/EducationService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/EducationService.cs @@ -8,6 +8,7 @@ namespace IRaCIS.Core.Application.Service { [ApiExplorerSettings(GroupName = "Reviewer")] public class EducationService(IRepository _postgraduateRepository, + IRepository _hospitalRepository, IRepository _educationRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEducationService { @@ -88,7 +89,7 @@ namespace IRaCIS.Core.Application.Service /// 添加/更新医生继续学习经历 [HttpPost] - public async Task AddOrUpdatePostgraduateInfo(PostgraduateCommand postgraduateViewModel) + public async Task AddOrUpdatePostgraduateInfo(PostgraduateCommand inDto) { #region 封装前 @@ -109,8 +110,24 @@ namespace IRaCIS.Core.Application.Service //} #endregion - - var entity = await _postgraduateRepository.InsertOrUpdateAsync(postgraduateViewModel, true); + if (inDto.Hospital != string.Empty) + { + var hospital = await _hospitalRepository.Where(x => x.HospitalName == inDto.Hospital && x.SiteId == null).FirstOrDefaultAsync(); + if (hospital != null) + { + inDto.HospitalId = hospital.Id; + } + else + { + var newHospital = await _hospitalRepository.AddAsync(new Hospital() + { + HospitalName = inDto.Hospital, + IsConfirm = false, + }, true); + inDto.HospitalId = newHospital.Id; + } + } + var entity = await _postgraduateRepository.InsertOrUpdateAsync(inDto, true); return ResponseOutput.Ok(entity.Id); } ///