修改 CRO Sponsor 部位
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
facd9e0e5f
commit
c95ea8c547
|
@ -33,9 +33,9 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> 根据CRO 名称查询所有CRO 列表 </summary>
|
/// <summary> 根据CRO 名称查询所有CRO 列表 </summary>
|
||||||
public async Task<IEnumerable<CroSelectDTO>> GetAllCROList(Guid? croId)
|
public async Task<IEnumerable<CroSelectDTO>> GetAllCROList(Guid? trialId)
|
||||||
{
|
{
|
||||||
return await _croRepository/*.Where(t => t.IsTrialLevel == false || t.Id == croId)*/.ProjectTo<CroSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
|
return await _croRepository.Where(t => t.IsTrialLevel == false || t.TrialId == trialId).ProjectTo<CroSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> 分页获取申办方列表 </summary>
|
/// <summary> 分页获取申办方列表 </summary>
|
||||||
public async Task<IEnumerable<SponsorSelectDTO>> GetAllSponsorList(Guid? sponsorId)
|
public async Task<IEnumerable<SponsorSelectDTO>> GetAllSponsorList(Guid? trialId)
|
||||||
{
|
{
|
||||||
|
|
||||||
var sponsorQueryable = _sponsorRepository/*.Where(t => t.IsTrialLevel == false || t.Id == sponsorId)*/.ProjectTo<SponsorSelectDTO>(_mapper.ConfigurationProvider,new { isEn_Us= _userInfo.IsEn_Us});
|
var sponsorQueryable = _sponsorRepository.Where(t => t.IsTrialLevel == false || t.TrialId == trialId).ProjectTo<SponsorSelectDTO>(_mapper.ConfigurationProvider,new { isEn_Us= _userInfo.IsEn_Us});
|
||||||
return await sponsorQueryable.ToListAsync();
|
return await sponsorQueryable.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ using static IRaCIS.Core.Domain.Share.StaticData;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -221,6 +222,19 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var success = await _repository.SaveChangesAsync();
|
var success = await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
//维护CRO Sponsor
|
||||||
|
await DealSponsorAndCROAsync(trial);
|
||||||
|
|
||||||
|
//维护部位到项目表
|
||||||
|
var searchList = await _repository.Where<Dictionary>(t => t.Parent.Code == "BodyPart" && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
|
var needAddBodyPartList = searchList.Select(t => new TrialBodyPart() { Code = t.Code, Name = t.Value, NameCN = t.ValueCN });
|
||||||
|
|
||||||
|
needAddBodyPartList.ForEach(t => t.TrialId = trial.Id);
|
||||||
|
|
||||||
|
await _repository.AddRangeAsync(needAddBodyPartList);
|
||||||
|
|
||||||
|
|
||||||
_provider.Set(trial.Id.ToString(), StaticData.TrialState.TrialInitializing, TimeSpan.FromDays(7));
|
_provider.Set(trial.Id.ToString(), StaticData.TrialState.TrialInitializing, TimeSpan.FromDays(7));
|
||||||
|
|
||||||
return ResponseOutput.Ok(trial);
|
return ResponseOutput.Ok(trial);
|
||||||
|
@ -268,12 +282,35 @@ namespace IRaCIS.Application.Services
|
||||||
trial.AttendedReviewerTypes = $"|{string.Join('|', updateModel.AttendedReviewerTypeEnumList.Select(x => ((int)x).ToString()).ToList())}|";
|
trial.AttendedReviewerTypes = $"|{string.Join('|', updateModel.AttendedReviewerTypeEnumList.Select(x => ((int)x).ToString()).ToList())}|";
|
||||||
|
|
||||||
var success = await _repository.SaveChangesAsync();
|
var success = await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
|
//维护CRO Sponsor
|
||||||
|
await DealSponsorAndCROAsync(trial);
|
||||||
|
|
||||||
return ResponseOutput.Ok(trial);
|
return ResponseOutput.Ok(trial);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task DealSponsorAndCROAsync(Trial trial)
|
||||||
|
{
|
||||||
|
if (trial.SponsorId != null)
|
||||||
|
{
|
||||||
|
if (await _repository.AnyAsync<Sponsor>(t => t.Id == trial.SponsorId && t.IsTrialLevel))
|
||||||
|
{
|
||||||
|
await _repository.BatchUpdateAsync<Sponsor>(t => t.Id == trial.SponsorId, u => new Sponsor() { TrialId = trial.Id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trial.CROId != null)
|
||||||
|
{
|
||||||
|
if (await _repository.AnyAsync<Sponsor>(t => t.Id == trial.SponsorId && t.IsTrialLevel))
|
||||||
|
{
|
||||||
|
await _repository.BatchUpdateAsync<Sponsor>(t => t.Id == trial.SponsorId, u => new Sponsor() { TrialId = trial.Id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: 需要优化,嵌套两层 switch case ?
|
// TODO: 需要优化,嵌套两层 switch case ?
|
||||||
[NonDynamicMethod]
|
[NonDynamicMethod]
|
||||||
private async Task TrialExpeditedStatusChange(Guid trialId, int oldState, int newState)
|
private async Task TrialExpeditedStatusChange(Guid trialId, int oldState, int newState)
|
||||||
|
|
|
@ -17,5 +17,7 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public Guid CreateUserId { get; set; }
|
public Guid CreateUserId { get; set; }
|
||||||
public Guid UpdateUserId { get; set; }
|
public Guid UpdateUserId { get; set; }
|
||||||
public DateTime UpdateTime { get; set; }
|
public DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
|
public Guid? TrialId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public Guid CreateUserId { get; set; } = Guid.Empty;
|
public Guid CreateUserId { get; set; } = Guid.Empty;
|
||||||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||||
public Guid UpdateUserId { get; set; } = Guid.Empty;
|
public Guid UpdateUserId { get; set; } = Guid.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
public Guid? TrialId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue