diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs index 4d97196fc..dd19de189 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs @@ -324,7 +324,7 @@ namespace IRaCIS.Application.Contracts public class SendEmailInDto { - public string Email { get; set; } + public List Email { get; set; } public string Url { get; set; } } @@ -400,12 +400,12 @@ namespace IRaCIS.Application.Contracts /// /// 适应症 /// - public string Indication { get; set; } + public string Indication { get; set; } = string.Empty; /// /// 适应症 /// - public string IndicationEn { get; set; } + public string IndicationEn { get; set; } = string.Empty; /// /// 项目Id diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index d74e514a7..6a1c02cfc 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -301,7 +301,12 @@ namespace IRaCIS.Core.Application.Service var messageToSend = new MimeMessage(); //发件地址 messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - messageToSend.To.Add(new MailboxAddress(String.Empty, inDto.Email)); + foreach (var item in inDto.Email) + { + messageToSend.To.Add(new MailboxAddress(String.Empty, item)); + + } + Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index dcec4d69e..09856aa93 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -223,6 +223,16 @@ namespace IRaCIS.Core.Application.Contracts } + public class UseEmialGetDoctorInfoOutDto + { + public Guid DoctorId { get; set; } + } + + public class UseEmialGetDoctorInfoInDto + { + public string EmailOrPhone { get; set; } + } + public class VerifyEmialGetDoctorInfoInDto { public string VerificationCode { get; set; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 71a851038..9b1b58ddc 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -20,6 +20,7 @@ using Newtonsoft.Json; using System.Text.RegularExpressions; using static MassTransit.ValidationResultExtensions; using DocumentFormat.OpenXml.Vml.Spreadsheet; +using IdentityModel.OidcClient; namespace IRaCIS.Core.Application.Contracts { @@ -114,6 +115,45 @@ namespace IRaCIS.Core.Application.Contracts } + /// + /// 根据邮箱获取DoctorId 没有的话创建一个 + /// + /// + /// + [HttpPost] + public async Task UseEmialGetDoctorInfo(UseEmialGetDoctorInfoInDto inDto) + { + var dockerInfo = await _doctorRepository.Where(t => t.EMail == inDto.EmailOrPhone || t.Phone == inDto.EmailOrPhone).FirstOrDefaultAsync(); + + if (dockerInfo != null) + { + return new UseEmialGetDoctorInfoOutDto() + { + DoctorId = dockerInfo.Id + }; + } + else + { + Doctor doctor = new Doctor() + { + EMail = inDto.EmailOrPhone, + IsVirtual = true, + AcceptingNewTrial = false, + ActivelyReading = false, + CooperateStatus = ContractorStatusEnum.Noncooperation, + + ReviewStatus = ReviewerInformationConfirmStatus.ConfirmRefuse + }; + + var info = await _doctorRepository.AddAsync(doctor, true); + + return new UseEmialGetDoctorInfoOutDto() + { + DoctorId = info.Id + }; + } + } + /// /// 验证邮箱验证码 获取医生信息Id ///