报告修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
df65d592ad
commit
c3c433244e
|
|
@ -3585,6 +3585,22 @@
|
|||
<returns></returns>
|
||||
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetReadingReportQuestion(System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.VisitTaskInfo},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.Globalanswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Application.Service.Reading.Dto.TableAnsweRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},System.Collections.Generic.List{IRaCIS.Core.Domain.Models.OrganInfo},System.Collections.Generic.List{System.Nullable{IRaCIS.Core.Domain.Share.QuestionMark}})">
|
||||
<summary>
|
||||
构造阅片报告问题
|
||||
</summary>
|
||||
<param name="questionList"></param>
|
||||
<param name="taskInfoList"></param>
|
||||
<param name="globalanswerList"></param>
|
||||
<param name="answers"></param>
|
||||
<param name="tableAnsweRowInfos"></param>
|
||||
<param name="tableQuestionList"></param>
|
||||
<param name="alltableAnsweRowInfos"></param>
|
||||
<param name="tableAnswers"></param>
|
||||
<param name="organInfos"></param>
|
||||
<param name="needChangeType"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.GeneralCalculateService.GetDataTableFromUpload(Microsoft.AspNetCore.Http.IFormFile,System.String,System.Guid)">
|
||||
<summary>
|
||||
从上传文件中获取Datatable
|
||||
|
|
@ -9075,6 +9091,11 @@
|
|||
单位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingReportDto.ShowChartTypeEnum">
|
||||
<summary>
|
||||
显示图表类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingReportDto.HighlightAnswer">
|
||||
<summary>
|
||||
高亮问题的答案
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public string QuestionEnName { get; set; }
|
||||
|
||||
public bool IsCanEditPosition { get; set; } = false;
|
||||
|
||||
public string BlindName { get; set; }
|
||||
|
|
@ -136,6 +138,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public string? ReportMark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示图表类型
|
||||
/// </summary>
|
||||
public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
|
||||
|
||||
/// <summary>
|
||||
/// 高亮问题的答案
|
||||
/// </summary>
|
||||
|
|
@ -192,6 +199,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
public class Globalanswer
|
||||
{
|
||||
public Guid TaskId { get; set; }
|
||||
|
||||
public string Answer { get; set; }
|
||||
|
||||
public decimal VisitTaskNum { get; set; }
|
||||
|
||||
public Guid? QuestionId { get; set; }
|
||||
}
|
||||
|
||||
public class LesionDto
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,9 +15,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
//是否英文环境
|
||||
var isEn_Us = false;
|
||||
|
||||
CreateMap<ReadingQuestionTrial, ReadingReportDto>();
|
||||
CreateMap<ReadingQuestionTrial, ReadingReportDto>()
|
||||
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingReportDto>()
|
||||
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.ReadingQuestionId))
|
||||
.ForMember(d => d.TableQuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingReportDto>();
|
||||
|
||||
|
||||
CreateMap<SystemCriterionKeyFile, SystemCriterionKeyFileView>();
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using IRaCIS.Core.Domain.Models;
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
using MassTransit.Saga;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MiniExcelLibs;
|
||||
|
|
@ -27,7 +28,185 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
IOSSService oSSService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IGeneralCalculateService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 构造阅片报告问题
|
||||
/// </summary>
|
||||
/// <param name="questionList"></param>
|
||||
/// <param name="taskInfoList"></param>
|
||||
/// <param name="globalanswerList"></param>
|
||||
/// <param name="answers"></param>
|
||||
/// <param name="tableAnsweRowInfos"></param>
|
||||
/// <param name="tableQuestionList"></param>
|
||||
/// <param name="alltableAnsweRowInfos"></param>
|
||||
/// <param name="tableAnswers"></param>
|
||||
/// <param name="organInfos"></param>
|
||||
/// <param name="needChangeType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ReadingReportDto>> GetReadingReportQuestion(
|
||||
List<ReadingQuestionTrial>? questionList,
|
||||
List<VisitTaskInfo> taskInfoList,
|
||||
List<Globalanswer>? globalanswerList,
|
||||
List<ReadingTaskQuestionAnswer>? answers,
|
||||
List<TableAnsweRowInfo>? tableAnsweRowInfos,
|
||||
List<ReadingTableQuestionTrial> tableQuestionList,
|
||||
List<ReadingTableAnswerRowInfo> alltableAnsweRowInfos,
|
||||
List<ReadingTableQuestionAnswer> tableAnswers,
|
||||
List<OrganInfo> organInfos,
|
||||
List<QuestionMark?> needChangeType
|
||||
)
|
||||
{
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = _mapper.Map<List<ReadingReportDto>>(questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder));
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.QuestionName = item.QuestionName.LanguageName(item.QuestionEnName, _userInfo.IsEn_Us);
|
||||
item.ReportLayType = ReportLayType.Group;
|
||||
|
||||
item.Childrens = _mapper.Map<List<ReadingReportDto>>(questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder));
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
question.QuestionName = question.QuestionName.LanguageName(question.QuestionEnName, _userInfo.IsEn_Us);
|
||||
question.ReportLayType = ReportLayType.Question;
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = _mapper.Map<List<ReadingReportDto>>(tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId));
|
||||
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
tableQuestion.QuestionName = tableQuestion.QuestionName.LanguageName(tableQuestion.QuestionEnName, _userInfo.IsEn_Us);
|
||||
tableQuestion.LesionType = question.LesionType;
|
||||
tableQuestion.RowId = row.RowId;
|
||||
tableQuestion.IsShowInDicom = question.IsShowInDicom;
|
||||
tableQuestion.RowIndex = row.RowIndex;
|
||||
tableQuestion.ReportLayType = ReportLayType.TableQuestion;
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
;
|
||||
}
|
||||
#endregion
|
||||
|
||||
return questions;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -146,12 +146,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId= x.TaskId,
|
||||
VisitTaskNum= x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId= x.QuestionId,
|
||||
Answer= x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -165,217 +165,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -166,12 +166,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -185,217 +185,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
public interface IGeneralCalculateService
|
||||
{
|
||||
|
||||
Task<List<ReadingReportDto>> GetReadingReportQuestion(
|
||||
List<ReadingQuestionTrial>? questionList,
|
||||
List<VisitTaskInfo> taskInfoList,
|
||||
List<Globalanswer>? globalanswerList,
|
||||
List<ReadingTaskQuestionAnswer>? answers,
|
||||
List<TableAnsweRowInfo>? tableAnsweRowInfos,
|
||||
List<ReadingTableQuestionTrial> tableQuestionList,
|
||||
List<ReadingTableAnswerRowInfo> alltableAnsweRowInfos,
|
||||
List<ReadingTableQuestionAnswer> tableAnswers,
|
||||
List<OrganInfo> organInfos,
|
||||
List<QuestionMark?> needChangeType
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// 获取ReadingCalculateDto
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -133,12 +133,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
|
@ -153,207 +153,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -133,12 +133,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
|
|
@ -153,208 +153,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
;
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -106,12 +106,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}).ToList();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -125,207 +125,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -108,12 +108,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -127,227 +127,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionType = x.QuestionType,
|
||||
DataSource = x.DataSource,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
DataSource = x.DataSource,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
GroupEnName = x.GroupEnName,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
RowId = row.RowId,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -160,12 +160,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -177,219 +177,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
QuestionMark.Part,
|
||||
};
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
ReportMark = rowinfo != null ? rowinfo.ReportMark : string.Empty,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
ShowChartTypeEnum=x.ShowChartTypeEnum,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
|
|
@ -171,6 +172,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionId = x.Id,
|
||||
ShowChartTypeEnum = x.ShowChartTypeEnum,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
|
|
@ -238,7 +240,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
|
||||
ShowChartTypeEnum = x.ShowChartTypeEnum,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
|
|
@ -104,12 +107,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
}).ToList();
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -123,207 +126,20 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -100,12 +100,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -119,207 +119,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName,
|
||||
GroupEnName = x.GroupEnName,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
QuestionType = x.QuestionType,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName,
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
|
||||
question.Childrens = rowlist.Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + x.RowIndex.GetLesionMark(),
|
||||
SplitOrMergeLesionName = x.MergeName.IsNullOrEmpty() ? x.SplitName : x.MergeName,
|
||||
SplitOrMergeType = x.SplitOrMergeType,
|
||||
LesionType = question.LesionType,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
IsCanEditPosition = x.IsCanEditPosition,
|
||||
RowIndex = x.RowIndex,
|
||||
BlindName = x.BlindName,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
RowId = row.RowId,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -103,12 +103,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new Globalanswer()
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
TaskId = x.TaskId,
|
||||
VisitTaskNum = x.GlobalVisitTask.VisitTaskNum,
|
||||
QuestionId = x.QuestionId,
|
||||
Answer = x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
|
|
@ -122,227 +122,19 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionType = x.QuestionType,
|
||||
DataSource = x.DataSource,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
DataSource = x.DataSource,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
GroupEnName = x.GroupEnName,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
RowId = row.RowId,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
List<ReadingReportDto> questions = await _generalCalculateService.GetReadingReportQuestion
|
||||
(
|
||||
questionList,
|
||||
taskInfoList,
|
||||
globalanswerList,
|
||||
answers,
|
||||
tableAnsweRowInfos,
|
||||
tableQuestionList,
|
||||
alltableAnsweRowInfos,
|
||||
tableAnswers,
|
||||
organInfos,
|
||||
needChangeType
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue