修改一版
parent
bf630825e0
commit
275baf16db
|
@ -831,52 +831,45 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
if (trialCriterion.ReadingQuestionCriterionSystemId != null)
|
||||
{
|
||||
|
||||
// 先找到项目系统问题Id和项目问题Id的对应关系
|
||||
var questionRelation = _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id).ToDictionary(
|
||||
x => x.ReadingQuestionSystemId??default(Guid),
|
||||
x => x.Id
|
||||
);
|
||||
|
||||
// 将系统里面的问题转为项目问题
|
||||
var newTrialQuestionList = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == trialCriterion.ReadingQuestionCriterionSystemId)
|
||||
.ProjectTo<ReadingQuestionTrial>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
newTrialQuestionList.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
if (questionRelation.ContainsKey(x.Id))
|
||||
{
|
||||
x.Id = questionRelation[x.Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
var newid= NewId.NextGuid();
|
||||
questionRelation.Add(x.Id, newid);
|
||||
x.Id = newid;
|
||||
}
|
||||
|
||||
x.ReadingQuestionCriterionTrialId = trialCriterion.Id;
|
||||
x.TrialId = trialCriterion.TrialId;
|
||||
});
|
||||
var copyNewQuestionList = newTrialQuestionList.Clone();
|
||||
var trialQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialCriterion.Id).ToListAsync();
|
||||
|
||||
var needAddDatas = new List<ReadingQuestionTrial>();
|
||||
|
||||
foreach (var x in newTrialQuestionList)
|
||||
{
|
||||
var question = x.Clone();
|
||||
|
||||
var firstQuestion = trialQuestionList.Where(y => y.ReadingQuestionSystemId == x.ReadingQuestionSystemId).FirstOrDefault();
|
||||
if (firstQuestion != null)
|
||||
{
|
||||
var systemData = _mapper.Map<ReadingQuestionSystem>(x);
|
||||
if (firstQuestion.IsJudgeQuestion)
|
||||
{
|
||||
if (firstQuestion.TypeValue != x.TypeValue)
|
||||
{
|
||||
firstQuestion.AnswerCombination = string.Empty;
|
||||
firstQuestion.AnswerGroup = string.Empty;
|
||||
firstQuestion.JudgeType = JudgeTypeEnum.None;
|
||||
}
|
||||
}
|
||||
var newData = _mapper.Map(systemData, firstQuestion);
|
||||
newData.Id = x.Id;
|
||||
newData.ReadingQuestionSystemId = x.ReadingQuestionSystemId;
|
||||
question = newData.Clone();
|
||||
}
|
||||
// 最大问题数
|
||||
question.MaxQuestionCount = x.MaxQuestionCount;
|
||||
if (question.ParentId != null)
|
||||
{
|
||||
question.ParentId = copyNewQuestionList.Where(y => x.ParentId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
|
||||
question.ParentId = questionRelation[question.ParentId??default(Guid)];
|
||||
}
|
||||
if (question.RelevanceId != null)
|
||||
{
|
||||
question.RelevanceId = copyNewQuestionList.Where(y => x.RelevanceId == y.ReadingQuestionSystemId).Select(y => y.Id).FirstOrDefault();
|
||||
question.RelevanceId = questionRelation[question.RelevanceId ?? default(Guid)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -898,19 +891,35 @@ namespace IRaCIS.Application.Services
|
|||
}) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 表格问题
|
||||
|
||||
// 先找到项目系统问题Id和项目问题Id的对应关系
|
||||
|
||||
var questionIds = needAddDatas.Select(x => x.Id).ToList();
|
||||
|
||||
|
||||
var tableQuestionRelation = _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId== trialCriterion.Id).ToDictionary(
|
||||
x => x.SystemTableQuestionId ?? default(Guid),
|
||||
x => x.Id
|
||||
);
|
||||
|
||||
|
||||
var newTrialTableQuestionList = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == trialCriterion.ReadingQuestionCriterionSystemId)
|
||||
.ProjectTo<ReadingTrialTableQuestionData>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
newTrialTableQuestionList.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
if (tableQuestionRelation.ContainsKey(x.Id))
|
||||
{
|
||||
x.Id = tableQuestionRelation[x.Id];
|
||||
}
|
||||
else
|
||||
{
|
||||
var newid = NewId.NextGuid();
|
||||
tableQuestionRelation.Add(x.Id, newid);
|
||||
x.Id = newid;
|
||||
}
|
||||
});
|
||||
|
||||
var copyNewTrialTableQuestionList = newTrialTableQuestionList.Clone();
|
||||
|
@ -945,24 +954,6 @@ namespace IRaCIS.Application.Services
|
|||
await _readingTableQuestionTrialRepository.AddRangeAsync(needAddTableDatas);
|
||||
#endregion
|
||||
|
||||
|
||||
//#region 标准字典 移到别处去了
|
||||
//await _readingCriterionDictionaryRepository.BatchDeleteNoTrackingAsync(x => x.CriterionId == trialCriterion.Id);
|
||||
//var criterionDictionaryList = await _readingCriterionDictionaryRepository.Where(x => x.CriterionId == trialCriterion.ReadingQuestionCriterionSystemId.Value).
|
||||
// Select(x => new ReadingCriterionDictionary() {
|
||||
// CriterionId = trialCriterion.Id,
|
||||
// DictionaryId = x.DictionaryId,
|
||||
// IsSystemCriterion = false,
|
||||
// ParentCode = x.ParentCode,
|
||||
|
||||
// }).ToListAsync();
|
||||
|
||||
//await _readingCriterionDictionaryRepository.AddRangeAsync(criterionDictionaryList);
|
||||
//await _readingCriterionDictionaryRepository.SaveChangesAsync();
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
await _readingQuestionTrialRepository.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -617,10 +617,10 @@ namespace IRaCIS.Application.Services
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(GetReadingTableQuestionOutDto, bool)> GetCustomTableQuestionAnswer(GetCustomTableQuestionAnswerInDto inDto)
|
||||
public async Task<(GetReadingTableQuestionOutDto, object)> GetCustomTableQuestionAnswer(GetCustomTableQuestionAnswerInDto inDto)
|
||||
{
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.SourceSubjectVisit).FirstNotNullAsync();
|
||||
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository
|
||||
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
|
||||
|
@ -644,7 +644,9 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
|
||||
), true);
|
||||
),new {
|
||||
IsBaseline= taskInfo.SourceSubjectVisit!=null&&taskInfo.SourceSubjectVisit.IsBaseLine
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<ReadingTableQuestionSystem, ReadingTrialTableQuestionData>()
|
||||
.ForMember(dest => dest.DependParentQuestion, opt => opt.Ignore())
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.SystemTableQuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingTrialTableQuestionData>()
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
|
|
@ -198,6 +198,11 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public bool IsCopy { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 系统表格问题Id
|
||||
/// </summary>
|
||||
public Guid? SystemTableQuestionId { get; set; }
|
||||
|
||||
|
||||
[NotMapped]
|
||||
public List<string> ParentTriggerValueList
|
||||
|
|
Loading…
Reference in New Issue