Uat_Study
he 2022-08-18 13:47:08 +08:00
parent 81d5de19e6
commit fe3316f7a8
4 changed files with 97 additions and 12 deletions

View File

@ -8,6 +8,14 @@ using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public class CopySystemCriterionDataInDto
{
public Guid SourceSystemCriterionId { get; set; }
public Guid NewSystemCriterionId { get; set; }
}
public class GetSystemCriterionListOutDto
{
public Guid CriterionId { get; set; }
@ -163,6 +171,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
}
public class ReadingQuestionSystemData : ReadingQuestionSystem
{
public Guid OriginalId { get; set; }
}
public class ReadingTableQuestionSystemData : ReadingTableQuestionSystem
{
public Guid OriginalId { get; set; }
}
public class ReadingTrialTableQuestionData : ReadingTableQuestionTrial
{
public Guid OriginalId { get; set; }

View File

@ -173,10 +173,6 @@ namespace IRaCIS.Core.Application.Service
join trialData in _organTrialInfoRepository.WhereIf(inDto.IsEnable != null, x => x.IsEnable == inDto.IsEnable)
.Where(x => x.TrialId == inDto.TrialId)
on data.Id equals trialData.OrganInfoId
select new GetTrialOrganListOutDto()
{
Id = trialData.Id,

View File

@ -71,6 +71,71 @@ namespace IRaCIS.Application.Services
this._previousPDFRepository = previousPDFRepository;
}
/// <summary>
/// 赋值一个系统标准到另一系统标准
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> CopySystemCriterionData(CopySystemCriterionDataInDto inDto)
{
var newSystemQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.SourceSystemCriterionId)
.ProjectTo<ReadingQuestionSystemData>(_mapper.ConfigurationProvider).ToListAsync();
newSystemQuestionList.ForEach(x =>
{
x.Id = NewId.NextGuid();
x.ReadingQuestionCriterionSystemId = inDto.NewSystemCriterionId;
});
var copyNewQuestionList = newSystemQuestionList.Clone();
var needAddDatas = new List<ReadingQuestionSystemData>();
foreach (var x in newSystemQuestionList)
{
var question = x.Clone();
if (question.ParentId != null)
{
question.ParentId = copyNewQuestionList.Where(y => x.ParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (question.RelevanceId != null)
{
question.RelevanceId = copyNewQuestionList.Where(y => x.RelevanceId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
needAddDatas.Add(question);
};
await _readingQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.NewSystemCriterionId);
await _readingQuestionSystemRepository.AddRangeAsync(needAddDatas);
#region 表格问题
var newSystemTableQuestionList = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.SourceSystemCriterionId)
.ProjectTo<ReadingTableQuestionSystemData>(_mapper.ConfigurationProvider).ToListAsync();
var copeNewSystemTableQuestionList = newSystemTableQuestionList.Clone();
var needAddTableDatas = new List<ReadingTableQuestionSystemData>();
foreach (var x in newSystemTableQuestionList)
{
var tableQuestion = x.Clone();
tableQuestion.SystemCriterionId =inDto.NewSystemCriterionId;
tableQuestion.Id = NewId.NextGuid();
if (tableQuestion.ParentId != null)
{
tableQuestion.ParentId = copeNewSystemTableQuestionList.Where(y => x.ParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (tableQuestion.RelevanceId != null)
{
tableQuestion.RelevanceId = copeNewSystemTableQuestionList.Where(y => x.RelevanceId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (tableQuestion.DependParentId != null)
{
tableQuestion.DependParentId = copeNewSystemTableQuestionList.Where(y => x.DependParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
needAddTableDatas.Add(tableQuestion);
}
await _readingTableQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.SystemCriterionId == inDto.NewSystemCriterionId);
await _readingTableQuestionSystemRepository.AddRangeAsync(needAddTableDatas);
#endregion
await _readingTableQuestionSystemRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
/// <summary>
/// 获取获取系统阅片标准下拉
/// </summary>
@ -279,7 +344,7 @@ namespace IRaCIS.Application.Services
x.ReadingQuestionCriterionTrialId = trialCriterion.Id;
x.TrialId = trialCriterion.TrialId;
});
var copeNewQuestionList = newTrialQuestionList.Clone();
var copyNewQuestionList = newTrialQuestionList.Clone();
var trialQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id).ToListAsync();
var needAddDatas = new List<ReadingQuestionTrial>();
@ -309,11 +374,11 @@ namespace IRaCIS.Application.Services
if (question.ParentId != null)
{
question.ParentId = copeNewQuestionList.Where(y => x.ParentId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
question.ParentId = copyNewQuestionList.Where(y => x.ParentId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
}
if (question.RelevanceId != null)
{
question.RelevanceId = copeNewQuestionList.Where(y => x.RelevanceId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
question.RelevanceId = copyNewQuestionList.Where(y => x.RelevanceId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
}
@ -336,7 +401,7 @@ namespace IRaCIS.Application.Services
var newTrialTableQuestionList = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == trialCriterion.ReadingQuestionCriterionSystemId)
.ProjectTo<ReadingTrialTableQuestionData>(_mapper.ConfigurationProvider).ToListAsync();
var copenewTrialTableQuestionList = newTrialTableQuestionList.Clone();
var copyNewTrialTableQuestionList = newTrialTableQuestionList.Clone();
var needAddTableDatas = new List<ReadingTrialTableQuestionData>();
foreach (var x in newTrialTableQuestionList)
@ -349,16 +414,16 @@ namespace IRaCIS.Application.Services
if (tableQuestion.ParentId != null)
{
tableQuestion.ParentId = copenewTrialTableQuestionList.Where(y => x.ParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
tableQuestion.ParentId = copyNewTrialTableQuestionList.Where(y => x.ParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (tableQuestion.RelevanceId != null)
{
tableQuestion.RelevanceId = copenewTrialTableQuestionList.Where(y => x.RelevanceId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
tableQuestion.RelevanceId = copyNewTrialTableQuestionList.Where(y => x.RelevanceId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
if (tableQuestion.DependParentId != null)
{
tableQuestion.DependParentId = copenewTrialTableQuestionList.Where(y => x.DependParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
tableQuestion.DependParentId = copyNewTrialTableQuestionList.Where(y => x.DependParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault();
}
needAddTableDatas.Add(tableQuestion);

View File

@ -59,6 +59,12 @@ namespace IRaCIS.Core.Application.Service
CreateMap<ReadingQuestionTrial, ReadingQuestionSystem>();
CreateMap<ReadingQuestionSystem, ReadingQuestionSystemData>()
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
CreateMap<ReadingTableQuestionSystem, ReadingTableQuestionSystemData>()
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
CreateMap<ReadingQuestionSystem, ReadingQuestionTrial>()
.ForMember(d => d.ReadingQuestionSystemId, u => u.MapFrom(s => s.Id));