Uat_Study
he 2022-09-01 17:03:23 +08:00
parent 38509ba814
commit 1a637881f7
3 changed files with 34 additions and 25 deletions

View File

@ -152,12 +152,12 @@ namespace IRaCIS.Application.Services
{ {
var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.IsConfirm && x.TrialId == inDto.TrialId).Select(x => x.Id).FirstOrDefaultAsync(); var criterionId = await _readingQuestionCriterionTrialRepository.Where(x => x.IsConfirm && x.TrialId == inDto.TrialId).Select(x => x.Id).FirstOrDefaultAsync();
var questions = await _readingQuestionTrialRepository.Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == criterionId&&x.Type!="table") var questions = await _readingQuestionTrialRepository.Where(x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == criterionId&&x.Type!=ReadingQestionType.Table)
.ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync(); .ProjectTo<DicomReadingQuestionAnswer>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync(); var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
var result = questions.Where(x => x.Type == "group").ToList(); var result = questions.Where(x => x.Type == ReadingQestionType.Group).ToList();
foreach (var item in result) foreach (var item in result)
{ {
@ -170,7 +170,7 @@ namespace IRaCIS.Application.Services
private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item,List<DicomReadingQuestionAnswer> questions,List<ReadingTaskQuestionAnswer> answers) private void GetDicomReadingAnswer(DicomReadingQuestionAnswer item,List<DicomReadingQuestionAnswer> questions,List<ReadingTaskQuestionAnswer> answers)
{ {
item.Answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty(); item.Answer = answers.Where(x => x.ReadingQuestionTrialId == item.Id).Select(x => x.Answer).FirstIsNullReturnEmpty();
item.Childrens = questions.Where(x => x.ParentId == item.Id||((item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)) ).ToList(); item.Childrens = questions.Where(x => x.ParentId == item.Id||((item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)) ).ToList();
if (item.Childrens != null && item.Childrens.Count > 0) if (item.Childrens != null && item.Childrens.Count > 0)
{ {
foreach (var question in item.Childrens) foreach (var question in item.Childrens)
@ -221,7 +221,7 @@ namespace IRaCIS.Application.Services
// 第一级 // 第一级
#region 构造问题 #region 构造问题
List<ReadingReportDto> questions = questionList.Where(x => x.Type == "group").OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
{ {
QuestionId = x.Id, QuestionId = x.Id,
GroupName = x.GroupName, GroupName = x.GroupName,
@ -234,7 +234,7 @@ namespace IRaCIS.Application.Services
// 分组 // 分组
foreach (var item in questions) foreach (var item in questions)
{ {
item.Childrens = questionList.Where(x => x.GroupName == item.GroupName&&x.Type!= "group").OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto() item.Childrens = questionList.Where(x => x.GroupName == item.GroupName&&x.Type!= ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
{ {
GroupName = x.GroupName, GroupName = x.GroupName,
QuestionId = x.Id, QuestionId = x.Id,
@ -352,9 +352,9 @@ namespace IRaCIS.Application.Services
#region 获取问题及答案 #region 获取问题及答案
var qusetionList = await _readingQuestionTrialRepository.Where(x=>x.ReadingQuestionCriterionTrialId== criterion.Id) var qusetionList = await _readingQuestionTrialRepository.Where(x=>x.ReadingQuestionCriterionTrialId== criterion.Id)
.ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider).Where(x=>x.IsShowInDicom && (x.Type == "table"||x.Type== "group")).OrderBy(x => x.ShowOrder).ToListAsync(); .ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider).Where(x=>x.IsShowInDicom && (x.Type == ReadingQestionType.Table||x.Type== ReadingQestionType.Group)).OrderBy(x => x.ShowOrder).ToListAsync();
var usedGurops = qusetionList.Where(x => x.Type == "table").Select(x => x.GroupName).ToList(); var usedGurops = qusetionList.Where(x => x.Type == ReadingQestionType.Table).Select(x => x.GroupName).ToList();
qusetionList = qusetionList.Where(x =>usedGurops.Contains(x.GroupName)).ToList(); qusetionList = qusetionList.Where(x =>usedGurops.Contains(x.GroupName)).ToList();
var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync(); var answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
@ -395,13 +395,13 @@ namespace IRaCIS.Application.Services
IsPublicPage = firstData.IsPublicPage, IsPublicPage = firstData.IsPublicPage,
}; };
var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
pageGroupList.ForEach(x => pageGroupList.ForEach(x =>
{ {
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos); this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos);
}); });
page.Childrens = pageGroupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
groupList.Add(page); groupList.Add(page);
} }
@ -412,13 +412,13 @@ namespace IRaCIS.Application.Services
{ {
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList(); qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList();
groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
groupList.ForEach(x => groupList.ForEach(x =>
{ {
this.FindChildQuestion(x, qusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos); this.FindChildQuestion(x, qusetionList, tableQuestionList, tableAnswers, tableAnsweRowInfos);
}); });
groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
result.SinglePage = groupList; result.SinglePage = groupList;
@ -443,7 +443,7 @@ namespace IRaCIS.Application.Services
/// <param name="tableQuestionLists"></param> /// <param name="tableQuestionLists"></param>
private void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists,List<ReadingTableQuestionAnswerInfo> tableAnswers,List<ReadingTableAnswerRowInfo> tableAnsweRowInfos) private void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists,List<ReadingTableQuestionAnswerInfo> tableAnswers,List<ReadingTableAnswerRowInfo> tableAnsweRowInfos)
{ {
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
item.TableQuestions = new TrialReadTableQuestion(); item.TableQuestions = new TrialReadTableQuestion();
item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x=>x.ShowOrder).ToList(); item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x=>x.ShowOrder).ToList();
@ -1157,13 +1157,13 @@ namespace IRaCIS.Application.Services
IsPublicPage = firstData.IsPublicPage, IsPublicPage = firstData.IsPublicPage,
}; };
var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
pageGroupList.ForEach(x => pageGroupList.ForEach(x =>
{ {
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList); this.FindChildQuestion(x, newPageQusetionList, tableQuestionList);
}); });
page.Childrens = pageGroupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
groupList.Add(page); groupList.Add(page);
} }
@ -1174,13 +1174,13 @@ namespace IRaCIS.Application.Services
{ {
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList(); qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList();
groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
groupList.ForEach(x => groupList.ForEach(x =>
{ {
this.FindChildQuestion(x, qusetionList, tableQuestionList); this.FindChildQuestion(x, qusetionList, tableQuestionList);
}); });
groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
result.SinglePage = groupList; result.SinglePage = groupList;
@ -1269,13 +1269,13 @@ namespace IRaCIS.Application.Services
//qusetionList = qusetionList.Where(x => x.ParentId == null).ToList(); //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 == ReadingQestionType.Group || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
groupList.ForEach(x => groupList.ForEach(x =>
{ {
this.FindSystemChildQuestion(x, qusetionList, tableQuestionList); this.FindSystemChildQuestion(x, qusetionList, tableQuestionList);
}); });
groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList(); groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count() == 0)).ToList();
result.SinglePage = groupList; result.SinglePage = groupList;
@ -1292,7 +1292,7 @@ namespace IRaCIS.Application.Services
/// <param name="tableQuestions"></param> /// <param name="tableQuestions"></param>
public void FindSystemChildQuestion(GetSystemReadingQuestionOutDto item, List<GetSystemReadingQuestionOutDto> questionlists,List<TableQuestionDataInfo> tableQuestions) public void FindSystemChildQuestion(GetSystemReadingQuestionOutDto item, List<GetSystemReadingQuestionOutDto> questionlists,List<TableQuestionDataInfo> tableQuestions)
{ {
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetSystemReadingQuestionOutDto item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetSystemReadingQuestionOutDto
{ {
@ -1614,7 +1614,7 @@ namespace IRaCIS.Application.Services
[NonDynamicMethod] [NonDynamicMethod]
public void FindChildQuestion(GetTrialReadingQuestionOutDto item, List<GetTrialReadingQuestionOutDto> questionlists,List<TableQuestionDataInfo> tableQuestions) public void FindChildQuestion(GetTrialReadingQuestionOutDto item, List<GetTrialReadingQuestionOutDto> questionlists,List<TableQuestionDataInfo> tableQuestions)
{ {
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList(); item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (item.Type == ReadingQestionType.Group && x.Type != ReadingQestionType.Group && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetTrialReadingQuestionOutDto item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetTrialReadingQuestionOutDto

View File

@ -1308,7 +1308,7 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task<List<string>> GetTrialGroupNameList(GetTrialGroupNameListInDto inDto) public async Task<List<string>> GetTrialGroupNameList(GetTrialGroupNameListInDto inDto)
{ {
var result = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.CriterionId && x.Type == "group") var result = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.CriterionId && x.Type == ReadingQestionType.Group)
.Where(x=>x.ReadingCriterionPageId==inDto.ReadingCriterionPageId) .Where(x=>x.ReadingCriterionPageId==inDto.ReadingCriterionPageId)
.Select(x => x.GroupName).ToListAsync(); .Select(x => x.GroupName).ToListAsync();
@ -1325,7 +1325,7 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task<List<string>> GetSystemGroupNameList(GetTrialGroupNameListInDto inDto) public async Task<List<string>> GetSystemGroupNameList(GetTrialGroupNameListInDto inDto)
{ {
var result = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.CriterionId && x.Type == "group") var result = await _readingQuestionSystemRepository.Where(x => x.ReadingQuestionCriterionSystemId == inDto.CriterionId && x.Type == ReadingQestionType.Group)
.Select(x => x.GroupName).ToListAsync(); .Select(x => x.GroupName).ToListAsync();
return result; return result;

View File

@ -7,6 +7,15 @@ using System.Threading.Tasks;
namespace IRaCIS.Core.Domain.Share namespace IRaCIS.Core.Domain.Share
{ {
public static class ReadingQestionType
{
public static readonly string Table = "table";
public static readonly string Group = "group";
}
/// <summary> /// <summary>
/// 模块枚举 /// 模块枚举
/// </summary> /// </summary>