修改
This commit is contained in:
@@ -247,6 +247,8 @@ 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 IEnumerable<AttachmentDTO> AttachmentList { get; set; }
|
||||
|
||||
public List<SowDTO> SowList { get; set; }
|
||||
@@ -311,6 +313,22 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class UpdateGneralSituationDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 概述
|
||||
/// </summary>
|
||||
public string Summarize { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 概述
|
||||
/// </summary>
|
||||
public string SummarizeEn { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class BasicInfoAndEmploymentDto: DoctorBasicInfoCommand
|
||||
{
|
||||
//部门
|
||||
@@ -331,16 +349,6 @@ namespace IRaCIS.Application.Contracts
|
||||
public Guid? PhysicianId { get; set; }
|
||||
public string Physician { get; set; } = string.Empty;
|
||||
public string PhysicianCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 工作兼职
|
||||
/// </summary>
|
||||
public string WorkPartTime { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 工作兼职En
|
||||
/// </summary>
|
||||
public string WorkPartTimeEn { get; set; } = string.Empty;
|
||||
}
|
||||
public class DoctorBasicInfoCommand : DoctorBasicInfo
|
||||
{
|
||||
|
||||
@@ -118,12 +118,121 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="indto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<DoctorBasicInfoCommand>> AddOrUpdateDoctorBasicInfoAndEmployment(BasicInfoAndEmploymentDto indto)
|
||||
public async Task<IResponseOutput<BasicInfoAndEmploymentDto>> AddOrUpdateDoctorBasicInfoAndEmployment(BasicInfoAndEmploymentDto indto)
|
||||
{
|
||||
return await AddOrUpdateDoctorBasicInfo(indto);
|
||||
Expression<Func<Doctor, bool>> verifyExp = t => t.Phone == indto.Phone || t.EMail == indto.EMail;
|
||||
|
||||
//---current phone or email number already existed
|
||||
var verifyPair = new KeyValuePair<Expression<Func<Doctor, bool>>, string>(verifyExp, _localizer["Doctor_DupPhoneOrEmail"]);
|
||||
|
||||
if (indto.Id == Guid.Empty || indto.Id == null)
|
||||
{
|
||||
|
||||
var doctor = _mapper.Map<Doctor>(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<BasicInfoAndEmploymentDto>(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<DoctorDictionary>();
|
||||
//重新插入新的 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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改概述
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取概述
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<UpdateGneralSituationDto?> GetSummarizeInfo(Guid Id)
|
||||
{
|
||||
var doctorBasicInfo = (await _doctorRepository.Where(t => t.Id == Id)
|
||||
.ProjectTo<UpdateGneralSituationDto>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
return doctorBasicInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,6 +30,14 @@ namespace IRaCIS.Application.Interfaces
|
||||
/// <param name="doctorId"></param>
|
||||
/// <returns></returns>
|
||||
Task<EmploymentDTO> GetEmploymentInfo(Guid doctorId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取概述
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
Task<UpdateGneralSituationDto?> GetSummarizeInfo(Guid Id);
|
||||
|
||||
/// <summary>
|
||||
/// 更新医生 工作信息
|
||||
/// </summary>
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
var doctorScientificResearchInfo = await _researchPublicationRepository.Where(o => o.DoctorId == doctorId)
|
||||
.ProjectTo<ResearchPublicationDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
return doctorScientificResearchInfo!;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<Doctor, ResumeConfirmDTO>();
|
||||
|
||||
CreateMap<Doctor, DoctorSelectDTO>();
|
||||
CreateMap<Doctor, UpdateGneralSituationDto>();
|
||||
|
||||
CreateMap<Doctor, TrialExperienceModel>();
|
||||
CreateMap<TrialExperience, TrialExperienceCommand>();
|
||||
|
||||
Reference in New Issue
Block a user