Uat_Study
parent
0017b9c98e
commit
040f721394
|
@ -205,6 +205,10 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public List<ReadingCategory> ReadingCategoryList { get; set; }
|
||||
}
|
||||
|
||||
public class ConvertedRowInfo : ReadingTableAnswerRowInfo
|
||||
{
|
||||
public Guid OriginalId { get; set; }
|
||||
}
|
||||
public class GenerateTaskCommand
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
|
|
@ -36,7 +36,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
|
||||
private readonly IRepository<SubjectUser> _subjectUserRepository;
|
||||
private readonly IRepository<ReadModule> _readModuleRepository;
|
||||
|
||||
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
|
||||
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
|
||||
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IUserInfo _userInfo;
|
||||
private readonly IRepository<VisitTaskReReading> _visitTaskReReadingRepository;
|
||||
|
@ -52,6 +54,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
public VisitTaskHelpeService(IRepository<VisitTask> visitTaskRepository, IRepository<SubjectUser> subjectUserRepository, IRepository<Trial> trialRepository, IEasyCachingProvider provider,
|
||||
IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IRepository<ReadModule> readModuleRepository,
|
||||
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
|
||||
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
|
||||
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
|
||||
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
|
||||
IRepository<TaskAllocationRule> taskAllocationRuleRepository, IMapper mapper, IUserInfo userInfo, IRepository<VisitTaskReReading> visitTaskReReadingRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> trialReadingCriterionRepository, IRepository<ClinicalDataTrialSet> trialClinicalDataSetRepository, IRepository<ReadingClinicalData> readingClinicalDataRepository,
|
||||
|
@ -63,6 +68,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
_visitTaskRepository = visitTaskRepository;
|
||||
_trialRepository = trialRepository;
|
||||
this._readModuleRepository = readModuleRepository;
|
||||
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
|
||||
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
|
||||
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
|
||||
_provider = provider;
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
|
||||
|
@ -100,7 +108,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task AddConvertedTask(Guid taskId)
|
||||
{
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == taskId).IgnoreAutoIncludes().AsNoTracking().FirstNotNullAsync();
|
||||
taskInfo.ReadingTaskState = ReadingTaskState.WaitReading;
|
||||
taskInfo.ReadingTaskState = ReadingTaskState.Reading;
|
||||
taskInfo.IsConvertedTask = true;
|
||||
taskInfo.BeforeConvertedTaskId = taskId;
|
||||
taskInfo.Id = NewId.NextGuid();
|
||||
|
@ -125,6 +133,43 @@ namespace IRaCIS.Core.Application.Service
|
|||
TaskState = TaskState.Freeze
|
||||
});
|
||||
|
||||
|
||||
var taskAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId && x.ReadingQuestionTrial.Type != "calculation").IgnoreAutoIncludes().ToListAsync();
|
||||
|
||||
taskAnswer.ForEach(x => {
|
||||
|
||||
x.VisitTaskId = taskInfo.Id;
|
||||
x.Id= NewId.NextGuid();
|
||||
});
|
||||
|
||||
|
||||
var tableRowAnswers = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().ProjectTo<ConvertedRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
{
|
||||
x.VisitTaskId = taskInfo.Id;
|
||||
x.IsCurrentTaskAdd = false;
|
||||
x.Id = NewId.NextGuid();
|
||||
});
|
||||
|
||||
tableRowAnswers.ForEach(x =>
|
||||
{
|
||||
x.SplitRowId = tableRowAnswers.Where(y => y.OriginalId == x.SplitRowId).Select(y => y.Id).FirstOrDefault();
|
||||
x.MergeRowId = tableRowAnswers.Where(y => y.OriginalId == x.MergeRowId).Select(y => y.Id).FirstOrDefault();
|
||||
|
||||
});
|
||||
|
||||
var tableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == taskId).IgnoreAutoIncludes().ToListAsync();
|
||||
|
||||
tableAnswer.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
x.RowId = tableRowAnswers.Where(y => y.OriginalId == x.RowId).Select(x => x.Id).FirstOrDefault();
|
||||
});
|
||||
var addrowInfo = _mapper.Map<List<ReadingTableAnswerRowInfo>>(tableRowAnswers);
|
||||
await _readingTaskQuestionAnswerRepository.AddRangeAsync(taskAnswer);
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(addrowInfo);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswer);
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
public AllocationConfig()
|
||||
{
|
||||
|
||||
CreateMap<ReadingTableAnswerRowInfo, ConvertedRowInfo>()
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ConvertedRowInfo, ReadingTableAnswerRowInfo>();
|
||||
|
||||
|
||||
CreateMap<TaskAllocationRule, TaskAllocationRuleView>()
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
|
|
|
@ -543,7 +543,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid? DeleteUserId { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 来自于哪个标记
|
||||
/// </summary>
|
||||
public string FromMark { get; set; } = string.Empty;
|
||||
|
||||
public string RowMark { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue