修改一版

Uat_Study
he 2022-08-25 13:54:31 +08:00
parent 4cdd3c5206
commit 5a046da4d0
3 changed files with 298 additions and 55 deletions

View File

@ -663,6 +663,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
} }
public class GetSystemReadingQuestionPageDto
{
public List<GetSystemReadingQuestionOutDto> SinglePage { get; set; }
public List<GetSystemReadingQuestionOutDto> MultiPage { get; set; }
public List<GetSystemReadingQuestionOutDto> PublicPage { get; set; }
}
public class GetTrialReadingQuestionPageDto public class GetTrialReadingQuestionPageDto
{ {
public List<GetTrialReadingQuestionOutDto> SinglePage { get; set; } public List<GetTrialReadingQuestionOutDto> SinglePage { get; set; }
@ -672,7 +681,238 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public List<GetTrialReadingQuestionOutDto> PublicPage{ get; set; } public List<GetTrialReadingQuestionOutDto> PublicPage{ get; set; }
} }
public class TableQuestionDataInfo
{
/// <summary>
/// 问题ID
/// </summary>
public Guid ReadingQuestionId { get; set; }
/// <summary>
/// Type
/// </summary>
public string Type { get; set; }
/// <summary>
/// ParentId
/// </summary>
public Guid? ParentId { get; set; }
/// <summary>
///父问题触发值
/// </summary>
public string ParentTriggerValue { get; set; }
/// <summary>
/// 问题名称
/// </summary>
public string QuestionName { get; set; }
/// <summary>
/// IsRequired
/// </summary>
public int IsRequired { get; set; }
/// <summary>
/// 排序号
/// </summary>
public int ShowOrder { get; set; }
/// <summary>
/// 值
/// </summary>
public string TypeValue { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建用户
/// </summary>
public Guid CreateUserId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 显示父问题
/// </summary>
public Guid? RelevanceId { get; set; }
/// <summary>
/// 显示父问题的值
/// </summary>
public string RelevanceValue { get; set; }
/// <summary>
/// 是否显示
/// </summary>
public int ShowQuestion { get; set; }
/// <summary>
/// 最大问题数
/// </summary>
public int? MaxRowCount { get; set; }
/// <summary>
/// 数据表名称
/// </summary>
public string DataTableName { get; set; }
/// <summary>
/// 数据列
/// </summary>
public string DataTableColumn { get; set; }
/// <summary>
/// 关联父问题
/// </summary>
public Guid? DependParentId { get; set; }
/// <summary>
/// 是否关联
/// </summary>
public IsDepend IsDepend { get; set; }
/// <summary>
/// 表格问题类型
/// </summary>
public TableQuestionType? TableQuestionType { get; set; }
/// <summary>
/// 问题标识
/// </summary>
public QuestionMark? QuestionMark { get; set; }
}
public class GetSystemReadingQuestionOutDto
{
public Guid Id { get; set; }
/// <summary>
/// 系统标准Id
/// </summary>
public Guid ReadingQuestionCriterionSystemId { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 父问题触发
/// </summary>
public string ParentTriggerValue { get; set; }
/// <summary>
/// 问题名称
/// </summary>
public string QuestionName { get; set; }
/// <summary>
/// 是否是必须
/// </summary>
public IsRequired IsRequired { get; set; }
/// <summary>
/// 排序
/// </summary>
public int ShowOrder { get; set; }
/// <summary>
/// 父问题ID
/// </summary>
public Guid? ParentId { get; set; }
/// <summary>
/// 类型值
/// </summary>
public string TypeValue { get; set; }
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 是否是裁判问题
/// </summary>
public bool IsJudgeQuestion { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 关联ID
/// </summary>
public Guid? RelevanceId { get; set; }
/// <summary>
/// 关联Value
/// </summary>
public string RelevanceValue { get; set; } = string.Empty;
/// <summary>
/// 分组
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 图片数量
/// </summary>
public int ImageCount { get; set; } = 1;
/// <summary>
/// 是否显示
/// </summary>
public ShowQuestion ShowQuestion { get; set; } = ShowQuestion.Show;
/// <summary>
/// 最大问题数
/// </summary>
public int? MaxQuestionCount { get; set; }
/// <summary>
/// 病灶类型
/// </summary>
public LesionType? LesionType { get; set; }
/// <summary>
/// 问题类型
/// </summary>
public QuestionType? QuestionType { get; set; }
/// <summary>
/// 是否显示在Dicom阅片中
/// </summary>
public bool IsShowInDicom { get; set; }
public List<TableQuestionDataInfo> TableQuestions { get; set; }
public List<GetSystemReadingQuestionOutDto> Childrens { get; set; }
}
public class GetTrialReadingQuestionOutDto public class GetTrialReadingQuestionOutDto
{ {
@ -770,6 +1010,31 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary> /// </summary>
public ShowQuestion ShowQuestion { get; set; } public ShowQuestion ShowQuestion { get; set; }
/// <summary>
/// 最大问题数
/// </summary>
public int? MaxQuestionCount { get; set; }
/// <summary>
/// 病灶类型
/// </summary>
public LesionType? LesionType { get; set; }
/// <summary>
/// 问题类型
/// </summary>
public QuestionType? QuestionType { get; set; }
/// <summary>
/// 是否显示在Dicom阅片中
/// </summary>
public bool IsShowInDicom { get; set; } = false;
public List<TableQuestionDataInfo> TableQuestions { get; set; }
public List<GetTrialReadingQuestionOutDto> Childrens { get; set; } public List<GetTrialReadingQuestionOutDto> Childrens { get; set; }
} }

View File

@ -41,6 +41,7 @@ namespace IRaCIS.Application.Services
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository; private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository; private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository;
private readonly IRepository<ReadModule> _readModuleRepository; private readonly IRepository<ReadModule> _readModuleRepository;
private readonly IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository;
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository; private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository; private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository;
private readonly IRepository<ReadingQuestionCriterionSystem> _readingQuestionCriterionSystemRepository; private readonly IRepository<ReadingQuestionCriterionSystem> _readingQuestionCriterionSystemRepository;
@ -64,6 +65,7 @@ namespace IRaCIS.Application.Services
IRepository<ReadingCriterionPage> readingCriterionPageRepository, IRepository<ReadingCriterionPage> readingCriterionPageRepository,
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository, IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
IRepository<ReadModule> readModuleRepository, IRepository<ReadModule> readModuleRepository,
IRepository<ReadingTableQuestionSystem> readingTableQuestionSystemRepository,
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository, IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository, IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrialRepository,
IRepository<ReadingQuestionCriterionSystem> readingQuestionCriterionSystemRepository, IRepository<ReadingQuestionCriterionSystem> readingQuestionCriterionSystemRepository,
@ -86,6 +88,7 @@ namespace IRaCIS.Application.Services
this._readingCriterionPageRepository = readingCriterionPageRepository; this._readingCriterionPageRepository = readingCriterionPageRepository;
this._readingJudgeInfoRepository = readingJudgeInfoRepository; this._readingJudgeInfoRepository = readingJudgeInfoRepository;
this._readModuleRepository = readModuleRepository; this._readModuleRepository = readModuleRepository;
this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository;
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository; this._readingQuestionCriterionTrialRepository = readingQuestionCriterionTrialRepository;
this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository; this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository;
@ -864,36 +867,24 @@ namespace IRaCIS.Application.Services
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task<GetTrialReadingQuestionPageDto> GetSystemReadingQuestion(GetSystemReadingQuestionInDto inDto) public async Task<GetSystemReadingQuestionPageDto> GetSystemReadingQuestion(GetSystemReadingQuestionInDto inDto)
{ {
var result = new GetTrialReadingQuestionPageDto(); var result = new GetSystemReadingQuestionPageDto();
var query = from data in _readingQuestionSystem.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id) var qusetionList =await _readingQuestionSystem.Where(x => x.ReadingQuestionCriterionSystemId == inDto.Id)
select new GetTrialReadingQuestionOutDto() .ProjectTo<GetSystemReadingQuestionOutDto>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
{
ReadingQuestionTrialId = data.Id,
ParentTriggerValue = data.ParentTriggerValue,
GroupName = data.GroupName,
QuestionName = data.QuestionName,
IsRequired = data.IsRequired,
ShowOrder = data.ShowOrder,
ParentId = data.ParentId,
TypeValue = data.TypeValue,
Answer = string.Empty,
ShowQuestion=data.ShowQuestion,
PageShowOrder = data.ShowOrder,
Type=data.Type,
};
var qusetionList = await query.OrderBy(x => x.ShowOrder).ToListAsync();
var groupList = new List<GetTrialReadingQuestionOutDto>(); var tableQuestionList =await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.Id)
.ProjectTo<TableQuestionDataInfo>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList(); var groupList = new List<GetSystemReadingQuestionOutDto>();
qusetionList = qusetionList.Where(x => x.ParentId == null).ToList();
groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
groupList.ForEach(x => groupList.ForEach(x =>
{ {
this.FindChildQuestion(x, qusetionList); this.FindSystemChildQuestion(x, qusetionList, tableQuestionList);
}); });
groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList();
@ -901,47 +892,30 @@ namespace IRaCIS.Application.Services
result.SinglePage = groupList; result.SinglePage = groupList;
return (result); return result;
} }
#endregion
#region 获取阅片任务和答案
/// <summary> /// <summary>
/// 获取阅片任务和答案 /// 获取系统
/// </summary> /// </summary>
/// <returns></returns> /// <param name="item"></param>
private async Task<List<GetTrialReadingQuestionOutDto>> GetTaskAndAnswer(Guid visitTaskId) /// <param name="questionlists"></param>
/// <param name="tableQuestions"></param>
public void FindSystemChildQuestion(GetSystemReadingQuestionOutDto item, List<GetSystemReadingQuestionOutDto> questionlists,List<TableQuestionDataInfo> tableQuestions)
{ {
var taskQuery = from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId) item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
join trialQuestion in _readingQuestionTrialRepository.AsQueryable() on questionAnswer.ReadingQuestionTrialId equals trialQuestion.Id item.TableQuestions = tableQuestions.Where(x => x.ReadingQuestionId == item.Id).ToList();
select new GetTrialReadingQuestionOutDto() if (item.Childrens != null && item.Childrens.Count != 0)
{
ReadingQuestionTrialId = trialQuestion.Id,
ReadingQuestionCriterionTrialId = trialQuestion.ReadingQuestionCriterionTrialId,
TrialId = trialQuestion.TrialId,
Type = trialQuestion.Type,
ParentTriggerValue = trialQuestion.ParentTriggerValue,
GroupName = trialQuestion.GroupName,
QuestionName = trialQuestion.QuestionName,
IsRequired = trialQuestion.IsRequired,
ShowOrder = trialQuestion.ShowOrder,
ParentId = trialQuestion.ParentId,
TypeValue = trialQuestion.TypeValue,
Answer = questionAnswer.Answer
};
var qusetionList = await taskQuery.OrderBy(x => x.ShowOrder).ToListAsync();
List<GetTrialReadingQuestionOutDto> groupList = qusetionList.Where(x => x.ParentId == null).ToList();
groupList.ForEach(x =>
{ {
this.FindChildQuestion(x, qusetionList); item.Childrens.ForEach(x =>
}); {
this.FindSystemChildQuestion(x, questionlists, tableQuestions);
return groupList; });
}
} }
#endregion #endregion
/// <summary> /// <summary>
/// 获取阅片的受试者信息 /// 获取阅片的受试者信息
/// </summary> /// </summary>
@ -1214,7 +1188,7 @@ namespace IRaCIS.Application.Services
} }
} }
#endregion #endregion
#region 保存任务问题 #region 保存任务问题

View File

@ -51,6 +51,10 @@ namespace IRaCIS.Core.Application.Service
#region 阅片问题 #region 阅片问题
CreateMap<ReadingQuestionSystem, GetSystemReadingQuestionOutDto>();
CreateMap<ReadingTableQuestionSystem, TableQuestionDataInfo>();
CreateMap<ReadingTableQuestionSystem, ReadingTableQuestionSystemView>() CreateMap<ReadingTableQuestionSystem, ReadingTableQuestionSystemView>()
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder)); .ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder));