From c3c433244ee8c353f2390052e20398d0f7ea1fa7 Mon Sep 17 00:00:00 2001
From: he <109787524@qq.com>
Date: Tue, 18 Nov 2025 17:25:07 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 21 ++
.../Reading/Dto/ReadingImageTaskViewModel.cs | 17 ++
.../Service/Reading/_MapConfig.cs | 8 +-
.../General/GeneralCalculateService.cs | 181 ++++++++++++-
.../IRECIST1Point1CalculateService.cs | 234 ++---------------
.../ReadingCalculate/IVUSCalculateService.cs | 234 ++---------------
.../Interface/IGeneralCalculateService.cs | 13 +
.../LuganoCalculateService.cs | 224 ++--------------
.../LuganoWithoutPETCalculateService.cs | 225 ++--------------
.../MRECISTHCCCalculateService.cs | 224 ++--------------
.../MRIPDFFCalculateService.cs | 244 ++----------------
.../ReadingCalculate/OCTCalculateService.cs | 236 ++---------------
.../ReadingCalculate/PCWG3CalculateService.cs | 4 +-
.../RECIST1Point1CalculateService.cs | 228 ++--------------
.../RECIST1Point1_BMCalculateService.cs | 224 ++--------------
.../SelfDefineCalculateService.cs | 244 ++----------------
16 files changed, 424 insertions(+), 2137 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 3cf427dc4..1f684f5bb 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -3585,6 +3585,22 @@
+
+
+ 构造阅片报告问题
+
+
+
+
+
+
+
+
+
+
+
+
+
从上传文件中获取Datatable
@@ -9075,6 +9091,11 @@
单位
+
+
+ 显示图表类型
+
+
高亮问题的答案
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs
index 80dfdc035..3753eb172 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs
@@ -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; }
+ ///
+ /// 显示图表类型
+ ///
+ public ShowChartType ShowChartTypeEnum { get; set; } = ShowChartType.NotShow;
+
///
/// 高亮问题的答案
///
@@ -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
{
diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs
index 7e5cb24db..d7cb5270a 100644
--- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs
@@ -15,9 +15,13 @@ namespace IRaCIS.Core.Application.Service
//是否英文环境
var isEn_Us = false;
- CreateMap();
+ CreateMap()
+ .ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));
+
+ CreateMap()
+ .ForMember(d => d.QuestionId, u => u.MapFrom(s => s.ReadingQuestionId))
+ .ForMember(d => d.TableQuestionId, u => u.MapFrom(s => s.Id));
- CreateMap();
CreateMap();
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs
index 349bde4ae..9502c567f 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs
@@ -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
{
-
+ ///
+ /// 构造阅片报告问题
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> GetReadingReportQuestion(
+ List? questionList,
+ List taskInfoList,
+ List? globalanswerList,
+ List? answers,
+ List? tableAnsweRowInfos,
+ List tableQuestionList,
+ List alltableAnsweRowInfos,
+ List tableAnswers,
+ List organInfos,
+ List needChangeType
+ )
+ {
+ #region 构造问题
+ List questions = _mapper.Map>(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>(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>(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;
+ }
///
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs
index c5db6c847..3636894fa 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IRECIST1Point1CalculateService.cs
@@ -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 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();
-
- var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
- rowoindexs = rowoindexs == null ? new List() : 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
index 430bfdcf8..b320b1ac1 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
@@ -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 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();
-
- var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
- rowoindexs = rowoindexs == null ? new List() : 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs
index 9eaefec17..693033710 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/IGeneralCalculateService.cs
@@ -8,6 +8,19 @@ namespace IRaCIS.Core.Application.Service
public interface IGeneralCalculateService
{
+ Task> GetReadingReportQuestion(
+ List? questionList,
+ List taskInfoList,
+ List? globalanswerList,
+ List? answers,
+ List? tableAnsweRowInfos,
+ List tableQuestionList,
+ List alltableAnsweRowInfos,
+ List tableAnswers,
+ List organInfos,
+ List needChangeType
+ );
+
///
/// 获取ReadingCalculateDto
///
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs
index 5189b878e..1ad89c57f 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs
@@ -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 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs
index 9731a210b..50a04412e 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoWithoutPETCalculateService.cs
@@ -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 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs
index 327a65253..8dddf77d0 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/MRECISTHCCCalculateService.cs
@@ -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 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFCalculateService.cs
index c368029d9..0b564dfd5 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/MRIPDFFCalculateService.cs
@@ -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 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();
-
- var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
- rowoindexs = rowoindexs == null ? new List() : 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
index e58015c3c..946f79244 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
@@ -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 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();
-
- var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
- rowoindexs = rowoindexs == null ? new List() : 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs
index 681871f12..57cb3aa35 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/PCWG3CalculateService.cs
@@ -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,
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs
index c1cdfd829..71c105a3a 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1CalculateService.cs
@@ -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 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 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
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs
index 90ecced86..1f656df30 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/RECIST1Point1_BMCalculateService.cs
@@ -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 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs
index f21281bba..b11cd4f57 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/SelfDefineCalculateService.cs
@@ -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 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();
-
- var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
- rowoindexs = rowoindexs == null ? new List() : 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 questions = await _generalCalculateService.GetReadingReportQuestion
+ (
+ questionList,
+ taskInfoList,
+ globalanswerList,
+ answers,
+ tableAnsweRowInfos,
+ tableQuestionList,
+ alltableAnsweRowInfos,
+ tableAnswers,
+ organInfos,
+ needChangeType
+ );