Uat_Study
parent
4328f7d2ca
commit
89edf082af
|
@ -202,6 +202,34 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid TrialId { get; set; }
|
||||
}
|
||||
|
||||
public class CopyTableAnswerDto
|
||||
{
|
||||
public int RowIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 问题标识
|
||||
/// </summary>
|
||||
public QuestionMark? QuestionMark { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 问题Id
|
||||
/// </summary>
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 表格问题Id
|
||||
/// </summary>
|
||||
public Guid TableQuestionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目Id
|
||||
/// </summary>
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public string Answer { get; set; }
|
||||
}
|
||||
public class GetReadingReportEvaluationInDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
@ -211,6 +239,9 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public class GetReadingQuestionAndAnswerOutDto
|
||||
{
|
||||
|
||||
public bool IsBaseLineTask { get; set; }
|
||||
|
||||
public List<TrialReadQuestionData> SinglePage { get; set; }
|
||||
|
||||
public List<TrialReadQuestionData> MultiPage { get; set; }
|
||||
|
|
|
@ -212,6 +212,73 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加基线表格数据到其他任务
|
||||
/// </summary>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
private async Task<bool> AddBaseLineAnswerToOtherTask(Guid visitTaskId)
|
||||
{
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SourceSubjectVisitId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
// 判断当前任务是否是基线
|
||||
if (taskinfo.SourceSubjectVisitId != baseLineVisitId)
|
||||
{
|
||||
// 判断当前任务是是否有表格问题答案
|
||||
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||
{
|
||||
// 找到基线的任务Id
|
||||
var baseLineTaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == baseLineVisitId && x.TaskState == TaskState.Effect).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
var copyTableAnswers =await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == baseLineVisitId).Select(x=> new CopyTableAnswerDto() {
|
||||
Answer=x.Answer,
|
||||
QuestionId=x.QuestionId,
|
||||
QuestionMark=x.ReadingTableQuestionTrial.QuestionMark,
|
||||
TableQuestionId=x.TableQuestionId,
|
||||
RowIndex=x.RowIndex,
|
||||
TrialId=x.TrialId
|
||||
}).ToListAsync();
|
||||
|
||||
var tableRowAnswers=await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == baseLineVisitId).Select(x=> new ReadingTableAnswerRowInfo() {
|
||||
Id = NewId.NextGuid(),
|
||||
IsCurrentTaskAdd=false,
|
||||
QuestionId=x.QuestionId,
|
||||
RowIndex=x.RowIndex,
|
||||
TrialId=x.TrialId,
|
||||
VisitTaskId=visitTaskId
|
||||
}).ToListAsync();
|
||||
|
||||
List<QuestionMark?> notNeedCopyMarks = new List<QuestionMark?>()
|
||||
{
|
||||
QuestionMark.MajorAxis,
|
||||
QuestionMark.ShortAxis,
|
||||
};
|
||||
|
||||
var tableAnswers = copyTableAnswers.Select(x => new ReadingTableQuestionAnswer
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
Answer = notNeedCopyMarks.Contains(x.QuestionMark) ? string.Empty : x.Answer,
|
||||
QuestionId = x.QuestionId,
|
||||
RowIndex = x.RowIndex,
|
||||
TableQuestionId = x.TableQuestionId,
|
||||
TrialId = x.TrialId,
|
||||
VisitTaskId = visitTaskId,
|
||||
});
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableRowAnswers);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return taskinfo.SourceSubjectVisitId == baseLineVisitId;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片报告
|
||||
/// </summary>
|
||||
|
@ -381,11 +448,14 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<(GetReadingQuestionAndAnswerOutDto,object)> GetReadingQuestionAndAnswer(GetReadingQuestionAndAnswerInDto inDto)
|
||||
{
|
||||
|
||||
var result = new GetReadingQuestionAndAnswerOutDto();
|
||||
result.IsBaseLineTask= await this.AddBaseLineAnswerToOtherTask(inDto.VisitTaskId);
|
||||
|
||||
var readingTaskState = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.ReadingTaskState).FirstOrDefaultAsync();
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm).FirstNotNullAsync();
|
||||
|
||||
|
||||
var result = new GetReadingQuestionAndAnswerOutDto();
|
||||
|
||||
|
||||
#region 获取问题及答案
|
||||
|
||||
|
@ -473,6 +543,8 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取子元素
|
||||
/// </summary>
|
||||
|
@ -516,7 +588,7 @@ namespace IRaCIS.Application.Services
|
|||
var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList();
|
||||
var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList();
|
||||
item.TableQuestions.Answers = new List<Dictionary<string, string>>();
|
||||
orders.ForEach(x =>
|
||||
orders.ForEach(async x =>
|
||||
{
|
||||
Dictionary<string, string> answers = new Dictionary<string, string>();
|
||||
var rowAnswer = thisAnswer.Where(y => y.RowIndex == x).OrderBy(y => y.ShowOrder).ToList();
|
||||
|
@ -531,6 +603,8 @@ namespace IRaCIS.Application.Services
|
|||
answers.Add("RowIndex", x.ToString());
|
||||
answers.Add("InstanceId", rowInfo == null ? string.Empty : rowInfo.InstanceId.ToString());
|
||||
answers.Add("SeriesId", rowInfo == null ? string.Empty : rowInfo.SeriesId.ToString());
|
||||
answers.Add("IsCurrentTaskAdd", rowInfo == null ? false.ToString() : rowInfo.IsCurrentTaskAdd.ToString());
|
||||
|
||||
|
||||
item.TableQuestions.Answers.Add(answers);
|
||||
});
|
||||
|
@ -1794,6 +1868,7 @@ namespace IRaCIS.Application.Services
|
|||
TrialId = inDto.TrialId,
|
||||
QuestionId = inDto.QuestionId,
|
||||
MeasureData = inDto.MeasureData,
|
||||
IsCurrentTaskAdd=true,
|
||||
RowIndex = inDto.RowIndex,
|
||||
InstanceId=inDto.InstanceId,
|
||||
SeriesId=inDto.SeriesId,
|
||||
|
|
|
@ -55,10 +55,15 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// CreateTime
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// CreateUserId
|
||||
/// </summary>
|
||||
/// 是否是当前任务添加
|
||||
/// </summary>
|
||||
public bool IsCurrentTaskAdd { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// CreateUserId
|
||||
/// </summary>
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
[ForeignKey("QuestionId")]
|
||||
|
|
Loading…
Reference in New Issue