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); } ///