Uat_Study
he 2022-08-26 11:36:14 +08:00
parent 393abdb0f6
commit 4de2da6ba2
7 changed files with 120 additions and 23 deletions

View File

@ -1690,7 +1690,7 @@
裁判结果的备注 裁判结果的备注
</summary> </summary>
</member> </member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto.TaskId"> <member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SubmitTableQuestionInDto.VisitTaskId">
<summary> <summary>
任务Id 任务Id
</summary> </summary>
@ -6969,7 +6969,7 @@
<param name="inDto"></param> <param name="inDto"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Application.Services.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo})"> <member name="M:IRaCIS.Application.Services.ReadingImageTaskService.FindChildQuestion(IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData,System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TrialReadQuestionData},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionAnswerInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo})">
<summary> <summary>
获取子元素 获取子元素
</summary> </summary>

View File

@ -55,7 +55,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
{ {
public List<ReadingTableQuestionTrial> Questions { get; set; } public List<ReadingTableQuestionTrial> Questions { get; set; }
public List<Dictionary<Guid,string>> Answers { get; set; } public List<Dictionary<string,string>> Answers { get; set; }
} }
public class GetReadingQuestionAndAnswerInDto public class GetReadingQuestionAndAnswerInDto
@ -603,13 +603,15 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// <summary> /// <summary>
/// 任务Id /// 任务Id
/// </summary> /// </summary>
public Guid TaskId { get; set; } public Guid VisitTaskId { get; set; }
/// <summary> /// <summary>
/// 项目Id /// 项目Id
/// </summary> /// </summary>
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
public string MeasureData { get; set; }
public List<SubmitTableQuestionInfo> AnswerList { get; set; } public List<SubmitTableQuestionInfo> AnswerList { get; set; }
@ -742,6 +744,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public class TableQuestionDataInfo public class TableQuestionDataInfo
{ {
/// <summary>
///
/// </summary>
public Guid Id { get; set; }
/// <summary> /// <summary>
/// 问题ID /// 问题ID
/// </summary> /// </summary>
@ -968,7 +975,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public List<TableQuestionDataInfo> TableQuestions { get; set; } //public List<TableQuestionDataInfo> TableQuestions { get; set; }
public List<GetSystemReadingQuestionOutDto> Childrens { get; set; } public List<GetSystemReadingQuestionOutDto> 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<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
private readonly IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository; private readonly IRepository<ReadingTableQuestionSystem> _readingTableQuestionSystemRepository;
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository; private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository; private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
@ -66,6 +67,7 @@ namespace IRaCIS.Application.Services
IRepository<ReadingCriterionPage> readingCriterionPageRepository, IRepository<ReadingCriterionPage> readingCriterionPageRepository,
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository, IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
IRepository<ReadModule> readModuleRepository, IRepository<ReadModule> readModuleRepository,
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
IRepository<ReadingTableQuestionSystem> readingTableQuestionSystemRepository, IRepository<ReadingTableQuestionSystem> readingTableQuestionSystemRepository,
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository, IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository, IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
@ -90,6 +92,7 @@ namespace IRaCIS.Application.Services
this._readingCriterionPageRepository = readingCriterionPageRepository; this._readingCriterionPageRepository = readingCriterionPageRepository;
this._readingJudgeInfoRepository = readingJudgeInfoRepository; this._readingJudgeInfoRepository = readingJudgeInfoRepository;
this._readModuleRepository = readModuleRepository; this._readModuleRepository = readModuleRepository;
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository; this._readingTableQuestionSystemRepository = readingTableQuestionSystemRepository;
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository; this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository; this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
@ -148,8 +151,6 @@ namespace IRaCIS.Application.Services
x.Answer = answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty; x.Answer = answers.Where(y => y.ReadingQuestionTrialId == x.Id).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
}); });
#endregion #endregion
var formType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterion.Id).Select(x => x.FormType).FirstOrDefaultAsync(); var formType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == criterion.Id).Select(x => x.FormType).FirstOrDefaultAsync();
@ -162,8 +163,9 @@ namespace IRaCIS.Application.Services
var tableAnswers = await _readingTableQuestionAnswerRepository var tableAnswers = await _readingTableQuestionAnswerRepository
.ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider) .ProjectTo<ReadingTableQuestionAnswerInfo>(_mapper.ConfigurationProvider)
.Where(x => x.TaskId == inDto.VisitTaskId).ToListAsync(); .Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
if (formType == FormType.MultiplePage) if (formType == FormType.MultiplePage)
{ {
@ -183,7 +185,7 @@ namespace IRaCIS.Application.Services
var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList(); var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
pageGroupList.ForEach(x => pageGroupList.ForEach(x =>
{ {
this.FindChildQuestion(x, newPageQusetionList, tableQuestionList, tableAnswers); 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 == "group" && x.Childrens.Count() == 0)).ToList();
@ -200,7 +202,7 @@ namespace IRaCIS.Application.Services
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, tableQuestionList, tableAnswers); 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 == "group" && x.Childrens.Count() == 0)).ToList();
@ -226,7 +228,7 @@ namespace IRaCIS.Application.Services
/// <param name="item"></param> /// <param name="item"></param>
/// <param name="questionlists"></param> /// <param name="questionlists"></param>
/// <param name="tableQuestionLists"></param> /// <param name="tableQuestionLists"></param>
private void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<ReadingTableQuestionTrial> tableQuestionLists,List<ReadingTableQuestionAnswerInfo> tableAnswers) private void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<ReadingTableQuestionTrial> 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 == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
item.TableQuestions = new TrialReadTableQuestion(); item.TableQuestions = new TrialReadTableQuestion();
@ -234,17 +236,20 @@ namespace IRaCIS.Application.Services
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();
var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList(); var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList();
var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList(); var orders = thisAnswer.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList();
item.TableQuestions.Answers = new List<Dictionary<Guid, string>>(); item.TableQuestions.Answers = new List<Dictionary<string, string>>();
orders.ForEach(x => orders.ForEach(x =>
{ {
Dictionary<Guid, string> answers = new Dictionary<Guid, string>(); Dictionary<string, string> answers = new Dictionary<string, string>();
var rowAnswer = thisAnswer.Where(y => y.RowIndex == x).OrderBy(y => y.ShowOrder).ToList(); var rowAnswer = thisAnswer.Where(y => y.RowIndex == x).OrderBy(y => y.ShowOrder).ToList();
rowAnswer.ForEach(z => rowAnswer.ForEach(z =>
{ {
answers.Add(z.TableQuestionId.ToString(), z.Answer);
answers.Add(z.TableQuestionId, z.Answer);
}); });
var rowInfo = tableAnsweRowInfos.Where(y => y.RowIndex == x && y.QuestionId == item.Id).FirstOrDefault();
answers.Add("MeasureData", rowInfo==null?string.Empty:rowInfo.MeasureData);
item.TableQuestions.Answers.Add(answers); item.TableQuestions.Answers.Add(answers);
}); });
@ -252,7 +257,7 @@ namespace IRaCIS.Application.Services
{ {
item.Childrens.ForEach(x => item.Childrens.ForEach(x =>
{ {
this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers); this.FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos);
}); });
} }
} }
@ -1039,7 +1044,23 @@ namespace IRaCIS.Application.Services
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 == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == item.GroupName)).ToList();
item.TableQuestions = tableQuestions.Where(x => x.ReadingQuestionId == item.Id).ToList();
item.Childrens.AddRange(tableQuestions.Where(x => x.ReadingQuestionId == item.Id).Select(x => new GetSystemReadingQuestionOutDto
{
Childrens = new List<GetSystemReadingQuestionOutDto>(),
ShowOrder = x.ShowOrder,
GroupName = String.Empty,
Id = x.Id,
ImageCount = 0,
ParentId = item.Id,
QuestionName = x.QuestionName,
Remark = x.Remark,
}));
if (item.Childrens != null && item.Childrens.Count != 0) if (item.Childrens != null && item.Childrens.Count != 0)
{ {
item.Childrens.ForEach(x => item.Childrens.ForEach(x =>
@ -1373,7 +1394,8 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task<IResponseOutput> SubmitTableQuestion(SubmitTableQuestionInDto inDto) public async Task<IResponseOutput> SubmitTableQuestion(SubmitTableQuestionInDto inDto)
{ {
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.TaskId == inDto.TaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId); await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId && x.RowIndex == inDto.RowIndex);
await _readingTableAnswerRowInfoRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.TrialId == inDto.TrialId && x.RowIndex == inDto.RowIndex);
List<ReadingTableQuestionAnswer> answerList = inDto.AnswerList.Select(x => new ReadingTableQuestionAnswer() List<ReadingTableQuestionAnswer> answerList = inDto.AnswerList.Select(x => new ReadingTableQuestionAnswer()
{ {
Answer=x.Answer, Answer=x.Answer,
@ -1382,8 +1404,20 @@ namespace IRaCIS.Application.Services
QuestionId=inDto.QuestionId, QuestionId=inDto.QuestionId,
TableQuestionId=x.TableQuestionId, TableQuestionId=x.TableQuestionId,
RowIndex=inDto.RowIndex, RowIndex=inDto.RowIndex,
TaskId=inDto.TaskId VisitTaskId = inDto.VisitTaskId
}).ToList(); }).ToList();
await _readingTableAnswerRowInfoRepository.AddAsync(new ReadingTableAnswerRowInfo()
{
Id = NewId.NextGuid(),
TrialId = inDto.TrialId,
QuestionId = inDto.QuestionId,
MeasureData = inDto.MeasureData,
RowIndex = inDto.RowIndex,
VisitTaskId = inDto.VisitTaskId,
});
await _readingTableQuestionAnswerRepository.AddRangeAsync(answerList); await _readingTableQuestionAnswerRepository.AddRangeAsync(answerList);
await _readingTableQuestionAnswerRepository.SaveChangesAsync(); await _readingTableQuestionAnswerRepository.SaveChangesAsync();
return ResponseOutput.Ok(true); return ResponseOutput.Ok(true);

View File

@ -0,0 +1,56 @@
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2022-08-26 10:38:09
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
using System;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace IRaCIS.Core.Domain.Models
{
///<summary>
/// 表格问题答案行数据
///</summary>
[Table("ReadingTableAnswerRowInfo")]
public class ReadingTableAnswerRowInfo : Entity, IAuditAdd
{
/// <summary>
/// QuestionId
/// </summary>
public Guid QuestionId { get; set; }
/// <summary>
/// VisitTaskId
/// </summary>
public Guid VisitTaskId { get; set; }
/// <summary>
/// TrialId
/// </summary>
public Guid TrialId { get; set; }
/// <summary>
/// RowIndex
/// </summary>
public int RowIndex { get; set; }
/// <summary>
/// MeasureData
/// </summary>
public string MeasureData { get; set; }
/// <summary>
/// CreateTime
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// CreateUserId
/// </summary>
public Guid CreateUserId { get; set; }
}
}

View File

@ -29,7 +29,7 @@ namespace IRaCIS.Core.Domain.Models
/// <summary> /// <summary>
/// 任务Id /// 任务Id
/// </summary> /// </summary>
public Guid TaskId { get; set; } public Guid VisitTaskId { get; set; }
/// <summary> /// <summary>
/// 项目Id /// 项目Id

View File

@ -207,7 +207,7 @@ namespace IRaCIS.Core.Infra.EFCore
#region Reading #region Reading
public virtual DbSet<OrganInfo> OrganInfo { get; set; } public virtual DbSet<OrganInfo> OrganInfo { get; set; }
public virtual DbSet<ReadingTableAnswerRowInfo> ReadingTableAnswerRowInfo { get; set; }
public virtual DbSet<OrganTrialInfo> OrganTrialInfo { get; set; } public virtual DbSet<OrganTrialInfo> OrganTrialInfo { get; set; }
public virtual DbSet<ReadingTableQuestionSystem> ReadingTableQuestionSystem { get; set; } public virtual DbSet<ReadingTableQuestionSystem> ReadingTableQuestionSystem { get; set; }
public virtual DbSet<ReadingPeriodSet> ReadingPeriodSet { get; set; } public virtual DbSet<ReadingPeriodSet> ReadingPeriodSet { get; set; }

View File

@ -4,7 +4,7 @@
public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"; public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true";
public static readonly string DbDatabase = "IRaCIS_New_Tet"; public static readonly string DbDatabase = "IRaCIS_New_Tet";
//表名称用字符串,拼接 //表名称用字符串,拼接
public static readonly string TableName = "TumorAssessment"; public static readonly string TableName = "ReadingTableAnswerRowInfo";
//具体文件里面 例如service 可以配置是否分页 //具体文件里面 例如service 可以配置是否分页
} }
#> #>