diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index d6f98687c..e24c7e99c 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -62,7 +62,8 @@ namespace IRaCIS.Api.Controllers BasicInfoView = await _doctorService.GetBasicInfo(doctorId), EmploymentView = await _doctorService.GetEmploymentInfo(doctorId), AttachmentList = await attachmentService.GetAttachments(doctorId), - + SummarizeInfo = await _doctorService.GetSummarizeInfo(doctorId), + PaymentModeInfo = await _doctorService.GetPaymentMode(doctorId), EducationList = education.EducationList, PostgraduateList = education.PostgraduateList, diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 1d6548d52..e0c12cf8f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1171,6 +1171,20 @@ + + + 修改概述 + + + + + + + 获取概述 + + + + 详情、编辑-获取 医生基本信息 BasicInfo @@ -16821,14 +16835,14 @@ 工作兼职En - + - 工作兼职 + 概述 - + - 工作兼职En + 概述 @@ -17089,6 +17103,13 @@ + + + 获取概述 + + + + 更新医生 工作信息 diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs index e60a54565..02fe85e96 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SubjectVisitQCAndCheckConsumer.cs @@ -1,4 +1,5 @@ -using IRaCIS.Core.Application.MassTransit.Command; +using IRaCIS.Core.Application.Helper; +using IRaCIS.Core.Application.MassTransit.Command; using IRaCIS.Core.Application.Service.Reading.Dto; using IRaCIS.Core.Domain; using IRaCIS.Core.Domain.BaseModel; @@ -33,77 +34,75 @@ public class CRCSubmitedAndQCToAuditEventConsumer( private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue; public async Task Consume(ConsumeContext context) { - //Console.WriteLine("发送(005,006) 【加急项目所有IQC待领取质控任务】邮件!!!"); - //var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US; + Console.WriteLine("发送(005,006) 【加急项目所有IQC待领取质控任务】邮件!!!"); + var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US; - //var subjectVisitId = context.Message.SubjectVisitId; + var subjectVisitId = context.Message.SubjectVisitId; - //var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x=>x.Subject).FirstOrDefaultAsync(); + var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstOrDefaultAsync(); + + var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync(); + + var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).ToList(); + var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId); + + var auditStateCode = "AuditStatePE"; + + if (trialInfo.QCProcessEnum == TrialQCProcess.DoubleAudit) + { + auditStateCode = "AuditStateRC"; + } + + foreach (var userinfo in userinfoList) + { + var messageToSend = new MimeMessage(); + //发件地址 + messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); + messageToSend.To.Add(new MailboxAddress(String.Empty, userinfo.EMail)); + var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; - //var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync(); + var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto() + { - //var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).ToList(); + DictionaryRepository = _dictionaryRepository, + IsEn_US = isEn_US, + DictionaryList = new List() + { + new DictionaryDto (){DictionaryCode= auditStateCode,EnumValue=subjectVisit.AuditState.GetEnumInt(), }, //审核状态 + } + }); - //var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == subjectVisit.TrialId); + Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => + { + var subjectCode = subjectVisit.Subject.Code; + var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, subjectVisit.VisitName); + var htmlBodyStr = string.Format( + CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr), + userinfo.FullName, // 用户名 {0} + trialInfo.ExperimentName, // 项目 {1} + subjectCode, // 受试者 {2} + subjectVisit.VisitName, // 访视 {3} + dictionValue[0], // 审核状态 {4} + _systemEmailConfig.SiteUrl // 链接 {5} + ); - //foreach (var userinfo in userinfoList) - //{ - // var messageToSend = new MimeMessage(); - // //发件地址 - // messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail)); - // messageToSend.To.Add(new MailboxAddress(String.Empty, userinfo.EMail)); + return (topicStr, htmlBodyStr); + }; + await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, - // var companyName = isEn_US ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN; + context.Message.IsPd ? EmailBusinessScenario.PDVerification_PendingImageQCClaim : EmailBusinessScenario.EligibilityVerification_PendingClaim, + messageToSend, emailConfigFunc); - // var dictionValue = await CommonEmailHelper.TranslationDictionary(new TranslationDictionaryDto() - // { - - // DictionaryRepository = _dictionaryRepository, - // IsEn_US = isEn_US, - // DictionaryList = new List() - // { - // new DictionaryDto (){DictionaryCode= "ReadingCategory",EnumValue=subjectVisit.AuditState.GetEnumInt(), }, //审核状态 - - // } - // }); - - // Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input => - // { - // var subjectCode = subjectVisit.Subject.Code; - // var topicStr = string.Format(input.topicStr, trialInfo.ResearchProgramNo, subjectCode, taskInfo.TaskBlindName); - // var htmlBodyStr = string.Format( - // CommonEmailHelper.ReplaceCompanyName(_systemEmailConfig, input.htmlBodyStr), - // userinfo.FullName, // 用户名 {0} - // trialInfo.ExperimentName, // 项目 {1} - // subjectCode, // 受试者 {2} - // subjectVisit.VisitName, // 访视 {3} - // dictionValue[0], // 审核状态 {4} - // _systemEmailConfig.SiteUrl // 链接 {5} - - - - - // ); - - // return (topicStr, htmlBodyStr); - // }; - - // await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, - - // context.Message.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed ? EmailBusinessScenario.ReReadFromPMApproval : EmailBusinessScenario.ReReadFromIRApproval, - - // messageToSend, emailConfigFunc); - - // await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig); - //} + await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig); + } } } diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs index 57c802ef8..cef34031a 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs @@ -247,6 +247,10 @@ namespace IRaCIS.Application.Contracts public ResearchPublicationDTO ResearchPublicationView { get; set; } public TrialExperienceModel TrialExperienceView { get; set; } public ResumeConfirmDTO AuditView { get; set; } + + public UpdateGneralSituationDto SummarizeInfo { get; set; } + + public PaymentModeDto PaymentModeInfo { get; set; } public IEnumerable AttachmentList { get; set; } public List SowList { get; set; } @@ -311,6 +315,53 @@ namespace IRaCIS.Application.Contracts } + public class PaymentModeDto + { + public Guid Id { get; set; } + + + /// + /// 银行卡号 + /// + public string BankNum { get; set; } = string.Empty; + + /// + /// 银行名称 + /// + public string BankName { get; set; } = string.Empty; + + /// + /// 开户行 + /// + public string OpeningBank { get; set; } = string.Empty; + + /// + /// 身份证号 + /// + public string IdCard { get; set; } = string.Empty; + + /// + /// 银行手机号 + /// + public string BankPhoneNum { get; set; } = string.Empty; + + } + + public class UpdateGneralSituationDto + { + public Guid Id { get; set; } + + /// + /// 概述 + /// + public string Summarize { get; set; } = string.Empty; + + /// + /// 概述 + /// + public string SummarizeEn { get; set; } = string.Empty; + } + public class BasicInfoAndEmploymentDto: DoctorBasicInfoCommand { //部门 @@ -331,16 +382,6 @@ namespace IRaCIS.Application.Contracts public Guid? PhysicianId { get; set; } public string Physician { get; set; } = string.Empty; public string PhysicianCN { get; set; } = string.Empty; - - /// - /// 工作兼职 - /// - public string WorkPartTime { get; set; } = string.Empty; - - /// - /// 工作兼职En - /// - public string WorkPartTimeEn { get; set; } = string.Empty; } public class DoctorBasicInfoCommand : DoctorBasicInfo { diff --git a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs index 150823040..853304fc1 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DoctorService.cs @@ -118,12 +118,149 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> AddOrUpdateDoctorBasicInfoAndEmployment(BasicInfoAndEmploymentDto indto) + public async Task> AddOrUpdateDoctorBasicInfoAndEmployment(BasicInfoAndEmploymentDto indto) { - return await AddOrUpdateDoctorBasicInfo(indto); + Expression> verifyExp = t => t.Phone == indto.Phone || t.EMail == indto.EMail; + + //---current phone or email number already existed + var verifyPair = new KeyValuePair>, string>(verifyExp, _localizer["Doctor_DupPhoneOrEmail"]); + + if (indto.Id == Guid.Empty || indto.Id == null) + { + + var doctor = _mapper.Map(indto); + + //验证用户手机号 + if (await _doctorRepository.AnyAsync(t => t.Phone == doctor.Phone)) + { + //---The current phone number already existed! + return ResponseOutput.NotOk(_localizer["Doctor_DupPhone"], new BasicInfoAndEmploymentDto()); + } + + if (await _doctorRepository.AnyAsync(t => t.EMail == doctor.EMail)) + { + //---The current email already existed! + return ResponseOutput.NotOk(_localizer["Doctor_DupEmail"], new BasicInfoAndEmploymentDto()); + } + + doctor.Code = await _doctorRepository.Select(t => t.Code).DefaultIfEmpty().MaxAsync() + 1; + + doctor.ReviewerCode = AppSettings.GetCodeStr(doctor.Code, nameof(Doctor)); + + doctor.Password = MD5Helper.Md5(doctor.Phone); + + //插入中间表 + indto.TitleIds.ForEach(titleId => doctor.DoctorDicRelationList.Add(new DoctorDictionary() { DoctorId = doctor.Id, KeyName = StaticData.Title, DictionaryId = titleId })); - + await _doctorRepository.AddAsync(doctor); + //_doctorRepository.Add(doctor); + + //await _repository.AddAsync(new UserDoctor() { DoctorId = doctor.Id, UserId = _userInfo.Id }); + //_userDoctorRepository.Add(new UserDoctor() { DoctorId = doctor.Id, UserId = _userInfo.Id }); + + var success = await _doctorDictionaryRepository.SaveChangesAsync(); + return ResponseOutput.Result(success, _mapper.Map(doctor)); + + } + else + { + var updateModel = indto; + + var phone = updateModel.Phone.Trim(); + if ((await _doctorRepository.FirstOrDefaultAsync(t => t.Phone == phone && t.Id != updateModel.Id)) != null) + { + //---The current phone number already existed! + return ResponseOutput.NotOk(_localizer["Doctor_DupPhone"], new BasicInfoAndEmploymentDto()); + } + var email = updateModel.EMail.Trim(); + if (await _doctorRepository.AnyAsync(t => t.EMail == email && t.Id != updateModel.Id)) + { + //---The current email already existed! + return ResponseOutput.NotOk(_localizer["Doctor_DupEmail"], new BasicInfoAndEmploymentDto()); + } + + var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == updateModel.Id).IfNullThrowException(); + + //删除中间表 Title对应的记录 + await _doctorDictionaryRepository.BatchDeleteNoTrackingAsync(t => t.DoctorId == updateModel.Id && t.KeyName == StaticData.Title); + + + var adddata = new List(); + //重新插入新的 Title记录 + updateModel.TitleIds.ForEach(titleId => adddata.Add(new DoctorDictionary() { DoctorId = updateModel.Id.Value, KeyName = StaticData.Title, DictionaryId = titleId })); + + await _doctorDictionaryRepository.AddRangeAsync(adddata); + + _mapper.Map(indto, doctor); + + var success = await _doctorDictionaryRepository.SaveChangesAsync(); + + return ResponseOutput.Result(success, indto); + + } + + + + } + + + /// + /// 修改概述 + /// + /// + /// + [HttpPost] + public async Task UpdateGneralSituation(UpdateGneralSituationDto inDto) + { + + await _doctorRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.Id, x => new Doctor() + { + Summarize = inDto.Summarize, + SummarizeEn = inDto.SummarizeEn, + }); + await _doctorRepository.SaveChangesAsync(); + } + + + /// + /// 获取概述 + /// + /// + /// + public async Task GetSummarizeInfo(Guid Id) + { + var doctorBasicInfo = (await _doctorRepository.Where(t => t.Id == Id) + .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); + return doctorBasicInfo; + } + + + /// + /// 修改支付方式 + /// + /// + /// + [HttpPost] + public async Task UpdatePaymentMode(PaymentModeDto inDto) + { + + var doctor = await _doctorRepository.FirstOrDefaultAsync(t => t.Id == inDto.Id).IfNullThrowException(); + _mapper.Map(inDto, doctor); + var success = await _doctorDictionaryRepository.SaveChangesAsync(); + } + + + /// + /// 获取支付方式 + /// + /// + /// + public async Task GetPaymentMode(Guid Id) + { + var doctorBasicInfo = await _doctorRepository.Where(t => t.Id == Id) + .ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + return doctorBasicInfo; } /// diff --git a/IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorService.cs b/IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorService.cs index 6cd2c9d01..0a70ba78e 100644 --- a/IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/Interface/IDoctorService.cs @@ -30,6 +30,22 @@ namespace IRaCIS.Application.Interfaces /// /// Task GetEmploymentInfo(Guid doctorId); + + + /// + ///获取支付信息 + /// + /// + /// + Task GetPaymentMode(Guid Id); + + /// + /// 获取概述 + /// + /// + /// + Task GetSummarizeInfo(Guid Id); + /// /// 更新医生 工作信息 /// diff --git a/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs b/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs index f9d1075ae..0d4951b79 100644 --- a/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/ResearchPublicationService.cs @@ -19,7 +19,6 @@ namespace IRaCIS.Core.Application.Service { var doctorScientificResearchInfo = await _researchPublicationRepository.Where(o => o.DoctorId == doctorId) .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); - return doctorScientificResearchInfo!; } diff --git a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs index da118fc36..aba729ec3 100644 --- a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs @@ -61,6 +61,11 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap(); + CreateMap(); + + CreateMap(); + + CreateMap(); CreateMap(); CreateMap(); diff --git a/IRaCIS.Core.Domain/Dcotor/Doctor.cs b/IRaCIS.Core.Domain/Dcotor/Doctor.cs index 2a6986bb3..87e89ee80 100644 --- a/IRaCIS.Core.Domain/Dcotor/Doctor.cs +++ b/IRaCIS.Core.Domain/Dcotor/Doctor.cs @@ -182,6 +182,43 @@ public class Doctor : BaseFullAuditEntity /// public string WorkPartTimeEn { get; set; } = string.Empty; + /// + /// + /// + public string Summarize { get; set; } = string.Empty; + + /// + /// + /// + public string SummarizeEn { get; set; } = string.Empty; + + + /// + /// п + /// + public string BankNum { get; set; } = string.Empty; + + /// + /// + /// + public string BankName { get; set; } = string.Empty; + + /// + /// + /// + public string OpeningBank { get; set; } = string.Empty; + + /// + /// ֤ + /// + public string IdCard { get; set; } = string.Empty; + + /// + /// ֻ + /// + public string BankPhoneNum { get; set; } = string.Empty; + + [NotMapped] public string FullName => LastName + " / " + FirstName; }