Uat_Study
parent
6a7a5cc2dd
commit
f1a70bb6ad
|
@ -6743,6 +6743,20 @@
|
||||||
TrialSiteSurveyService
|
TrialSiteSurveyService
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SendEmialVerifyCode(IRaCIS.Core.Application.Contracts.SendEmialVerifyCodeInDto)">
|
||||||
|
<summary>
|
||||||
|
发送验证码
|
||||||
|
</summary>
|
||||||
|
<param name="userInfo"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.VerifyEmialGetDoctorInfo(IRaCIS.Core.Application.Contracts.VerifyEmialGetDoctorInfoInDto)">
|
||||||
|
<summary>
|
||||||
|
验证邮箱验证码 获取医生信息Id
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SendVerifyCode(IRaCIS.Core.Application.Contracts.SiteSurveySendVerifyCode)">
|
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SendVerifyCode(IRaCIS.Core.Application.Contracts.SiteSurveySendVerifyCode)">
|
||||||
<summary>
|
<summary>
|
||||||
发送验证码
|
发送验证码
|
||||||
|
@ -8326,6 +8340,14 @@
|
||||||
<param name="doctorIds"></param>
|
<param name="doctorIds"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Application.Services.MailVerificationService.SendEmailVerification(System.String,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
发送验证码
|
||||||
|
</summary>
|
||||||
|
<param name="emailAddress"></param>
|
||||||
|
<param name="verificationCode"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:IRaCIS.Application.Services.AttachmentService">
|
<member name="T:IRaCIS.Application.Services.AttachmentService">
|
||||||
<summary>
|
<summary>
|
||||||
医生文档关联关系维护
|
医生文档关联关系维护
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
Task AnolymousSendEmail(string researchProgramNo, string emailAddress, int verificationCode);
|
Task AnolymousSendEmail(string researchProgramNo, string emailAddress, int verificationCode);
|
||||||
|
|
||||||
|
Task SendEmailVerification(string emailAddress, int verificationCode);
|
||||||
|
|
||||||
Task SiteSurveyRejectEmail(MimeMessage messageToSend);
|
Task SiteSurveyRejectEmail(MimeMessage messageToSend);
|
||||||
|
|
||||||
Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode);
|
Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode);
|
||||||
|
@ -208,6 +210,75 @@ namespace IRaCIS.Application.Services
|
||||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送验证码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="emailAddress"></param>
|
||||||
|
/// <param name="verificationCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task SendEmailVerification(string emailAddress, int verificationCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
var messageToSend = new MimeMessage();
|
||||||
|
//发件地址
|
||||||
|
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||||
|
//收件地址
|
||||||
|
messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress));
|
||||||
|
//主题
|
||||||
|
messageToSend.Subject = $"[来自展影IRC]的提醒";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var builder = new BodyBuilder();
|
||||||
|
|
||||||
|
var pathToFile = _hostEnvironment.WebRootPath
|
||||||
|
+ Path.DirectorySeparatorChar.ToString()
|
||||||
|
+ "EmailTemplate"
|
||||||
|
+ Path.DirectorySeparatorChar.ToString()
|
||||||
|
+ "UserOptCommon.html";
|
||||||
|
|
||||||
|
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
||||||
|
{
|
||||||
|
var templateInfo = SourceReader.ReadToEnd();
|
||||||
|
|
||||||
|
|
||||||
|
builder.HtmlBody = string.Format(templateInfo,
|
||||||
|
"",
|
||||||
|
"您正在参与展影医疗IRC项目",
|
||||||
|
verificationCode
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
messageToSend.Body = builder.ToMessageBody();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EventHandler<MessageSentEventArgs> sucessHandle = (sender, args) =>
|
||||||
|
{
|
||||||
|
// args.Response
|
||||||
|
var code = verificationCode.ToString();
|
||||||
|
_ = _verificationCodeRepository.AddAsync(new VerificationCode()
|
||||||
|
{
|
||||||
|
CodeType = VerifyType.Email,
|
||||||
|
HasSend = true,
|
||||||
|
Code = code,
|
||||||
|
UserId = Guid.Empty,//此时不知道用户
|
||||||
|
EmailOrPhone = emailAddress,
|
||||||
|
ExpirationTime = DateTime.Now.AddMinutes(3)
|
||||||
|
}).Result;
|
||||||
|
_ = _verificationCodeRepository.SaveChangesAsync().Result;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//中心调研 登陆
|
//中心调研 登陆
|
||||||
public async Task AnolymousSendEmail(string researchProgramNo, string emailAddress, int verificationCode)
|
public async Task AnolymousSendEmail(string researchProgramNo, string emailAddress, int verificationCode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -685,6 +685,10 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public class AddDoctorCriterionFileDto
|
public class AddDoctorCriterionFileDto
|
||||||
{
|
{
|
||||||
|
public Guid? Id { get; set; }
|
||||||
|
|
||||||
|
public bool IsEnable { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件名称
|
/// 文件名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -710,6 +714,8 @@ namespace IRaCIS.Application.Contracts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件类型
|
/// 文件类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -726,6 +732,8 @@ namespace IRaCIS.Application.Contracts
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
public bool IsEnable { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件路径
|
/// 文件路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -471,7 +471,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加医生标准文件
|
/// 添加修改医生标准文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inDto"></param>
|
/// <param name="inDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -479,6 +479,10 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task<IResponseOutput> AddDoctorCriterionFile(AddDoctorCriterionFileDto inDto)
|
public async Task<IResponseOutput> AddDoctorCriterionFile(AddDoctorCriterionFileDto inDto)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (await _doctorCriterionFileRepository.AnyAsync(x => x.DoctorId == inDto.DoctorId && x.FileType == inDto.FileType && x.IsEnable && x.CriterionType == inDto.CriterionType && x.Id != inDto.Id))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("当前标准已添加过此类型文件");
|
||||||
|
}
|
||||||
var entity = await _doctorCriterionFileRepository.InsertOrUpdateAsync(inDto, true);
|
var entity = await _doctorCriterionFileRepository.InsertOrUpdateAsync(inDto, true);
|
||||||
return ResponseOutput.Ok(entity.Id.ToString());
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,24 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class VerifyEmialGetDoctorInfoInDto
|
||||||
|
{
|
||||||
|
public string VerificationCode { get; set; }
|
||||||
|
|
||||||
|
public string EmailOrPhone { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VerifyEmialGetDoctorInfoOutDto
|
||||||
|
{
|
||||||
|
public Guid? DoctorId { get; set; }
|
||||||
|
|
||||||
|
public string Token { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SendEmialVerifyCodeInDto
|
||||||
|
{
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public class SiteSurveySendVerifyCode
|
public class SiteSurveySendVerifyCode
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,13 +28,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
private readonly IRepository<TrialSiteUserSurvey> _trialSiteUserSurveyRepository;
|
private readonly IRepository<TrialSiteUserSurvey> _trialSiteUserSurveyRepository;
|
||||||
private readonly IRepository<User> _userRepository;
|
private readonly IRepository<User> _userRepository;
|
||||||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
private readonly IRepository<TrialSite> _trialSiteRepository;
|
||||||
|
private readonly IRepository<Doctor> _doctorRepository;
|
||||||
private readonly IRepository<TrialUser> _trialUserRepository;
|
private readonly IRepository<TrialUser> _trialUserRepository;
|
||||||
private readonly ITokenService _tokenService;
|
private readonly ITokenService _tokenService;
|
||||||
private readonly IMailVerificationService _mailVerificationService;
|
private readonly IMailVerificationService _mailVerificationService;
|
||||||
|
|
||||||
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialUser> trialUserRepository, IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,
|
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialUser> trialUserRepository, IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,
|
||||||
IRepository<User> userRepository, IRepository<TrialSite> trialSiteRepository,
|
IRepository<User> userRepository, IRepository<TrialSite> trialSiteRepository,
|
||||||
|
IRepository<Doctor> doctorRepository,
|
||||||
ITokenService tokenService,
|
ITokenService tokenService,
|
||||||
IMailVerificationService mailVerificationService)
|
IMailVerificationService mailVerificationService)
|
||||||
{
|
{
|
||||||
|
@ -43,12 +44,71 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
_userRepository = userRepository;
|
_userRepository = userRepository;
|
||||||
_trialUserRepository = trialUserRepository;
|
_trialUserRepository = trialUserRepository;
|
||||||
_trialSiteRepository = trialSiteRepository;
|
_trialSiteRepository = trialSiteRepository;
|
||||||
|
this._doctorRepository = doctorRepository;
|
||||||
_tokenService = tokenService;
|
_tokenService = tokenService;
|
||||||
_mailVerificationService = mailVerificationService;
|
_mailVerificationService = mailVerificationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
private object lockObj { get; set; } = new object();
|
private object lockObj { get; set; } = new object();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 发送验证码
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<IResponseOutput> SendEmialVerifyCode(SendEmialVerifyCodeInDto userInfo)
|
||||||
|
{
|
||||||
|
//检查手机或者邮箱是否有效
|
||||||
|
if (!Regex.IsMatch(userInfo.Email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("请输入正确的邮箱地址。");
|
||||||
|
}
|
||||||
|
|
||||||
|
//邮箱
|
||||||
|
|
||||||
|
//验证码 6位
|
||||||
|
int verificationCode = new Random().Next(100000, 1000000);
|
||||||
|
await _mailVerificationService.SendEmailVerification(userInfo.Email, verificationCode);
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证邮箱验证码 获取医生信息Id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="inDto"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<VerifyEmialGetDoctorInfoOutDto> VerifyEmialGetDoctorInfo(VerifyEmialGetDoctorInfoInDto inDto)
|
||||||
|
{
|
||||||
|
var verificationRecord = await _repository.GetQueryable<VerificationCode>().OrderByDescending(x=>x.ExpirationTime).Where(t => (t.EmailOrPhone == inDto.EmailOrPhone) && t.Code == inDto.VerificationCode && t.CodeType == VerifyType.Email).FirstOrDefaultAsync();
|
||||||
|
VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto();
|
||||||
|
|
||||||
|
var doctorInfo = await _doctorRepository.Where(x => x.EMail == inDto.EmailOrPhone).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
result.DoctorId = doctorInfo == null ? null : doctorInfo.Id;
|
||||||
|
//检查数据库是否存在该验证码
|
||||||
|
if (verificationRecord == null)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("验证码错误。");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//检查验证码是否失效
|
||||||
|
if (verificationRecord.ExpirationTime < DateTime.Now)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("验证码已经过期。");
|
||||||
|
}
|
||||||
|
else //验证码正确 并且 没有超时
|
||||||
|
{
|
||||||
|
result.Token= _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送验证码
|
/// 发送验证码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -283,7 +283,8 @@ namespace IRaCIS.Application.Contracts
|
||||||
EnrollId = EnrollId,
|
EnrollId = EnrollId,
|
||||||
ToDoQuantity= ReadingTaskStateList.Where(x=>x.ReadingTaskState != ReadingTaskState.HaveSigned&&x.CriterionType== t.CriterionType).Count(),
|
ToDoQuantity= ReadingTaskStateList.Where(x=>x.ReadingTaskState != ReadingTaskState.HaveSigned&&x.CriterionType== t.CriterionType).Count(),
|
||||||
CompletionQuantity = ReadingTaskStateList.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.CriterionType == t.CriterionType).Count(),
|
CompletionQuantity = ReadingTaskStateList.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.CriterionType == t.CriterionType).Count(),
|
||||||
CriterionFileList = CriterionFileList.Where(x=>x.CriterionType==t.CriterionType).ToList(),
|
StatementCriterionFileList = CriterionFileList.Where(x=>x.CriterionType==t.CriterionType&&x.FileType==CriterionFileType.Statement).ToList(),
|
||||||
|
AcknowledgementCriterionFileList = CriterionFileList.Where(x => x.CriterionType == t.CriterionType && x.FileType == CriterionFileType.Acknowledgement).ToList(),
|
||||||
TrialReadingCriterionId = t.TrialReadingCriterionId,
|
TrialReadingCriterionId = t.TrialReadingCriterionId,
|
||||||
ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList()
|
ReadingCategorys = CriterionReadingCategoryList.Where(c => c.TrialReadingCriterionId == t.TrialReadingCriterionId).Select(t => t.ReadingCategory).OrderBy(c => c).ToList()
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
@ -383,7 +384,9 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public int CompletionQuantity { get; set; }
|
public int CompletionQuantity { get; set; }
|
||||||
|
|
||||||
public List<CriterionFile> CriterionFileList { get; set; }
|
public List<CriterionFile> StatementCriterionFileList { get; set; }
|
||||||
|
|
||||||
|
public List<CriterionFile> AcknowledgementCriterionFileList { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public List<ReadingCategory> ReadingCategorys { get; set; } = new List<ReadingCategory>();
|
public List<ReadingCategory> ReadingCategorys { get; set; } = new List<ReadingCategory>();
|
||||||
|
|
|
@ -207,7 +207,7 @@ namespace IRaCIS.Application.Services
|
||||||
IsEnable = allocateRule.IsEnable,
|
IsEnable = allocateRule.IsEnable,
|
||||||
|
|
||||||
TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t=>t.IsConfirm).Select(t=>new TrialReadingCriterionDto() { TrialReadingCriterionId=t.Id,TrialReadingCriterionName=t.CriterionName,CriterionType=t.CriterionType,IsOncologyReading=t.IsOncologyReading,IsArbitrationReading=t.IsArbitrationReading,IsGlobalReading=t.IsGlobalReading,ReadingInfoSignTime=t.ReadingInfoSignTime,ReadingType=t.ReadingType}).ToList(),
|
TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t=>t.IsConfirm).Select(t=>new TrialReadingCriterionDto() { TrialReadingCriterionId=t.Id,TrialReadingCriterionName=t.CriterionName,CriterionType=t.CriterionType,IsOncologyReading=t.IsOncologyReading,IsArbitrationReading=t.IsArbitrationReading,IsGlobalReading=t.IsGlobalReading,ReadingInfoSignTime=t.ReadingInfoSignTime,ReadingType=t.ReadingType}).ToList(),
|
||||||
CriterionFileList= doctor.CriterionFileList.Select(x=> new CriterionFile() {
|
CriterionFileList= doctor.CriterionFileList.Where(x=>x.IsEnable).Select(x=> new CriterionFile() {
|
||||||
CriterionType=x.CriterionType,
|
CriterionType=x.CriterionType,
|
||||||
DoctorId=x.DoctorId,
|
DoctorId=x.DoctorId,
|
||||||
FileName=x.FileName,
|
FileName=x.FileName,
|
||||||
|
|
|
@ -56,6 +56,11 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用
|
||||||
|
/// </summary>
|
||||||
|
public bool IsEnable { get; set; } = true;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[ForeignKey("DoctorId")]
|
[ForeignKey("DoctorId")]
|
||||||
public Doctor Doctor { get; set; }
|
public Doctor Doctor { get; set; }
|
||||||
|
|
Loading…
Reference in New Issue