Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
fb76c5af6c
|
@ -33,9 +33,9 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
/// <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>
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ using IRaCIS.Core.Application.Service;
|
|||
using DocumentFormat.OpenXml.Office.CustomUI;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using SixLabors.ImageSharp.Formats.Tiff.Compression.Decompressors;
|
||||
|
||||
namespace IRaCIS.Core.Application
|
||||
{
|
||||
|
@ -946,10 +947,13 @@ namespace IRaCIS.Core.Application
|
|||
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
|
||||
|
||||
trialConfig.Modalitys = $"|{String.Join('|', trialConfig.ModalityList)}|";
|
||||
trialConfig.Modalitys = $"{String.Join('|', trialConfig.ModalityList)}";
|
||||
_mapper.Map(trialConfig, trialInfo);
|
||||
trialInfo.UpdateTime = DateTime.Now;
|
||||
|
||||
|
||||
await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialConfig.TrialId && t.IsSigned == false, u => new ReadingQuestionCriterionTrial() { CriterionModalitys = trialConfig.Modalitys });
|
||||
|
||||
return ResponseOutput.Ok(await _repository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
|
@ -1034,6 +1038,7 @@ namespace IRaCIS.Core.Application
|
|||
if (trialConfig.TrialCriterionIds.Contains(item.Id))
|
||||
{
|
||||
item.IsConfirm = true;
|
||||
item.CriterionModalitys = trialInfo.Modalitys;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1310,7 +1315,7 @@ namespace IRaCIS.Core.Application
|
|||
|
||||
public async Task<IResponseOutput<List<TrialBodyPartView>>> GetTrialBodyPartList(Guid trialId)
|
||||
{
|
||||
var list = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialBodyPartList).Select(t=>new TrialBodyPartView() { Code=t.Code,Name=_userInfo.IsEn_Us?t.Name:t.NameCN}).ToListAsync();
|
||||
var list = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialBodyPartList).Select(t => new TrialBodyPartView() { Code = t.Code, Name = _userInfo.IsEn_Us ? t.Name : t.NameCN }).ToListAsync();
|
||||
|
||||
return ResponseOutput.Ok(list);
|
||||
}
|
||||
|
@ -1318,10 +1323,24 @@ namespace IRaCIS.Core.Application
|
|||
public async Task<IResponseOutput> AddOrUpdateTrialBodyPart(AddOrUpdateTrialBodyPartCommand incommand)
|
||||
{
|
||||
|
||||
var codeList = await _repository.Where<TrialBodyPart>(t => t.TrialId == incommand.TrialId).Select(t => t.Code).ToListAsync();
|
||||
|
||||
|
||||
var newString = incommand.Code;
|
||||
// 检查字符串是否在集合中存在,如果存在,则在后面加上一个数字
|
||||
int count = 1;
|
||||
while (codeList.Contains(newString))
|
||||
{
|
||||
newString = $"{newString}{count}";
|
||||
count++;
|
||||
}
|
||||
|
||||
incommand.Code = newString;
|
||||
|
||||
var exp = new EntityVerifyExp<TrialBodyPart>()
|
||||
{
|
||||
VerifyExp = t => (t.Name.Equals(incommand.Name) || t.NameCN.Equals(incommand.NameCN)),
|
||||
|
||||
VerifyExp = t => (_userInfo.IsEn_Us ? t.Name.Equals(incommand.Name) : t.NameCN.Equals(incommand.NameCN)) && t.TrialId == incommand.TrialId,
|
||||
|
||||
VerifyMsg = _localizer["TrialBodyPart_DupName"]
|
||||
};
|
||||
|
||||
|
@ -1329,7 +1348,7 @@ namespace IRaCIS.Core.Application
|
|||
|
||||
|
||||
|
||||
return ResponseOutput.Ok(cro.Id.ToString());
|
||||
return ResponseOutput.Ok(cro.Id.ToString(), ApiResponseCodeEnum.NeedTips);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ using static IRaCIS.Core.Domain.Share.StaticData;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using System.Linq.Expressions;
|
||||
using System.Linq;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -221,6 +222,19 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
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));
|
||||
|
||||
return ResponseOutput.Ok(trial);
|
||||
|
@ -268,12 +282,35 @@ namespace IRaCIS.Application.Services
|
|||
trial.AttendedReviewerTypes = $"|{string.Join('|', updateModel.AttendedReviewerTypeEnumList.Select(x => ((int)x).ToString()).ToList())}|";
|
||||
|
||||
var success = await _repository.SaveChangesAsync();
|
||||
|
||||
//维护CRO Sponsor
|
||||
await DealSponsorAndCROAsync(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 ?
|
||||
[NonDynamicMethod]
|
||||
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 UpdateUserId { 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 DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
public Guid UpdateUserId { get; set; } = Guid.Empty;
|
||||
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue