diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 7d3d1cd21..17f465189 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1364,6 +1364,13 @@
+
+
+ 保存脾尖或者脾底进行计算
+
+
+
+
获取阅片的计算数据
@@ -2060,6 +2067,13 @@
+
+
+ 保存脾尖或者脾底进行计算
+
+
+
+
获取脾脏状态
@@ -13752,7 +13766,7 @@
-
+
保存任务问题 带动态稽查参数
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
index 7bd7cbdb7..1f5bc9ce0 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs
@@ -20,6 +20,7 @@ using DocumentFormat.OpenXml.Drawing.Charts;
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
using AutoMapper.QueryableExtensions;
using IRaCIS.Application.Contracts;
+using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Application.Services
{
@@ -1741,18 +1742,26 @@ namespace IRaCIS.Application.Services
return await ChangeDicomReadingQuestionAnswer(inDto);
}
- ///
- /// 保存任务问题 带动态稽查参数
- ///
- ///
- ///
+ ///
+ /// 保存任务问题 带动态稽查参数
+ ///
+ ///
+ ///
[Route("/SaveTaskQuestion/{param}")]
[HttpPost]
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
- public async Task SaveTaskQuestion(ChangeDicomReadingQuestionAnswerInDto inDto)
- {
- return await this.SaveImageQuality(inDto);
- }
+ public async Task SaveTaskQuestion(ChangeDicomReadingQuestionAnswerInDto inDto, string param)
+ {
+ var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
+ var result = await this.SaveImageQuality(inDto);
+ // 保存脾尖或者脾底进行计算
+ if (taskinfo.TrialReadingCriterion.CriterionType == CriterionType.Lugano2014 && (param == "4" || param == "5"))
+ {
+ await _luganoCalculateService.SaveSplenicCalculate(inDto.VisitTaskId);
+ }
+
+ return result;
+
+ }
/////
///// 保存ECRF
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ILuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ILuganoCalculateService.cs
index 81624907a..a5b030976 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ILuganoCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/Interface/ILuganoCalculateService.cs
@@ -22,5 +22,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate.Interface
///
///
Task CalculateMergeTargetLesionStatus(CalculateTargetLesionStatusInDto inDto);
+
+ ///
+ /// 保存脾尖或者脾底进行计算
+ ///
+ ///
+ ///
+ Task SaveSplenicCalculate(Guid visitTaskId);
}
}
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs
index bce37b092..865bcaabf 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/LuganoCalculateService.cs
@@ -2144,15 +2144,96 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
#endregion
- #region 获取脾脏状态
-
///
- /// 获取脾脏状态
+ /// 保存脾尖或者脾底进行计算
///
///
- ///
///
- [HttpPost]
+ public async Task SaveSplenicCalculate(Guid visitTaskId)
+ {
+ var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
+
+ List questionTypes = new List
+ {
+ QuestionType.SplenicTopPosition,
+ QuestionType.SplenicBottomPosition,
+ QuestionType.SpleenLength,
+ QuestionType.SplenicStatus,
+
+ };
+ var questionlist = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId &&
+ questionTypes.Contains(x.QuestionType)).ToListAsync();
+
+ var splenicTopQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SplenicTopPosition).Select(x => x.Id).FirstOrDefault();
+ var splenicBottomQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SplenicBottomPosition).Select(x => x.Id).FirstOrDefault();
+
+ decimal? spleenLength = null;
+ string? splenicState = null;
+
+ // 脾尖答案
+ var splenicTopAnswer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId && x.ReadingQuestionTrialId == splenicTopQuestionId).FirstOrDefaultAsync();
+ // 脾底答案
+ var splenicBottomAnswer= await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId && x.ReadingQuestionTrialId == splenicBottomQuestionId).FirstOrDefaultAsync();
+
+ if (splenicTopAnswer != null && splenicBottomAnswer != null)
+ {
+ spleenLength = splenicTopAnswer.Answer.IsNullOrEmptyReturn0() - splenicBottomAnswer.Answer.IsNullOrEmptyReturn0();
+ if(spleenLength<0)
+ {
+ spleenLength = 0 - spleenLength;
+ }
+ splenicState =await GetSplenicState(visitTaskId, spleenLength.Value);
+ }
+
+ //脾脏垂直径Id
+ var spleenVerticalDiameterQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SpleenLength).Select(x => x.Id).FirstOrDefault();
+ // 脾脏状态Id
+ var splenicStatusQuestionId = questionlist.Where(x => x.QuestionType == QuestionType.SplenicStatus).Select(x => x.Id).FirstOrDefault();
+
+ List readingTaskQuestionAnswers = new List();
+ if (spleenLength != null)
+ {
+ readingTaskQuestionAnswers.Add(new ReadingTaskQuestionAnswer()
+ {
+ Answer = spleenLength.Value.ToString(),
+ ReadingQuestionTrialId = spleenVerticalDiameterQuestionId,
+ VisitTaskId = visitTaskId,
+ SubjectId = taskinfo.SubjectId,
+ TrialId = taskinfo.TrialId,
+ ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
+
+ });
+ }
+ if (splenicState != null)
+ {
+ readingTaskQuestionAnswers.Add(new ReadingTaskQuestionAnswer()
+ {
+ Answer = splenicState.ToString(),
+ ReadingQuestionTrialId = splenicStatusQuestionId,
+ VisitTaskId = visitTaskId,
+ SubjectId = taskinfo.SubjectId,
+ TrialId = taskinfo.TrialId,
+ ReadingQuestionCriterionTrialId = taskinfo.TrialReadingCriterionId,
+
+ });
+ }
+
+ await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == visitTaskId && (x.ReadingQuestionTrialId == spleenVerticalDiameterQuestionId || x.ReadingQuestionTrialId == splenicStatusQuestionId));
+ await _readingTaskQuestionAnswerRepository.AddRangeAsync(readingTaskQuestionAnswers);
+ await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
+
+
+ }
+
+ #region 获取脾脏状态
+
+ ///
+ /// 获取脾脏状态
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
public async Task GetSplenicState(Guid visitTaskId,decimal spleenLength)
{
diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
index 93e01519e..396877ef7 100644
--- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
+++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
@@ -2285,10 +2285,10 @@ public enum SUVChangeVSBaseline
///
LiverState = 47,
- ///
- /// 脾脏长度
- ///
- SpleenLength = 48,
+ ///
+ /// 脾脏垂直径
+ ///
+ SpleenLength = 48,
///
/// 脾脏状态
diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
index 186af7474..0ad3d6c38 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
@@ -2707,7 +2707,13 @@ namespace IRaCIS.Core.Infra.EFCore.Common
{
var type = AuditOpt.Add;
- var extraIdentification = string.Empty;
+ List unitDataList = (await _dbContext.Dictionary.Where(x => x.Parent.Code == "ValueUnit").Where(x => x.Code != "0").ToListAsync()).Select(x => new UnitData()
+ {
+
+ Unit = (ValueUnit)int.Parse(x.Code),
+ UnitName = x.Value.ToString(),
+ }).ToList();
+ var extraIdentification = string.Empty;
//具体的答案
var taskQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTaskQuestionAnswer)).Select(t => t.Entity as ReadingTaskQuestionAnswer).ToList();
@@ -2796,7 +2802,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
t => t.ReadingQuestionTrialId,
u => u.QuestionId,
(t, u) =>
- new { Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer, u.DictionaryCode, u.QuestionName, u.QuestionEnName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList()
+ new { Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer + unitDataList.Where(y => y.Unit == u.Unit).Select(x => x.UnitName).FirstIsNullReturnEmpty()
+ , u.DictionaryCode, u.QuestionName, u.QuestionEnName, u.ShowOrder }).OrderBy(t => t.ShowOrder).ToList()
,
TableQuestionAndAnswerList = tableQuesionAndAnswerList
}
@@ -2820,8 +2827,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
var tableQuestionAnswerList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTableQuestionAnswer)).Select(t => t.Entity as ReadingTableQuestionAnswer).Where(t => t.RowId == entity.Id).ToList();
- //获取表格问题名称 组合成数组
- var tableQuesionList = await _dbContext.ReadingTableQuestionTrial.Where(t => tableQuestionAnswerList.Select(k => k.TableQuestionId).Contains(t.Id)).Select(t =>
+ List unitDataList = (await _dbContext.Dictionary.Where(x => x.Parent.Code == "ValueUnit").Where(x => x.Code != "0").ToListAsync()).Select(x => new UnitData()
+ {
+
+ Unit = (ValueUnit)int.Parse(x.Code),
+ UnitName = x.Value.ToString(),
+ }).ToList();
+
+ //获取表格问题名称 组合成数组
+ var tableQuesionList = await _dbContext.ReadingTableQuestionTrial.Where(t => tableQuestionAnswerList.Select(k => k.TableQuestionId).Contains(t.Id)).Select(t =>
new
{
TrialReadingCriterionId = t.ReadingQuestionTrial.ReadingQuestionCriterionTrialId, //标准Id
@@ -2886,7 +2900,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
new
{
//如果问题类型是附件 特殊处理 方便前端解析
- Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer,
+ Answer = u.AnswerType == "upload" ? "❄❅❆❇❈❉❊" + t.Answer : t.Answer+ unitDataList.Where(y=>y.Unit==u.Unit).Select(x=>x.UnitName).FirstIsNullReturnEmpty(),
//t.Answer /*u.Unit==ValueUnit.Custom? t.Answer+u.CustomUnit:(u.Unit != ValueUnit.None|| u.Unit != null)*/,
u.QuestionName,
u.QuestionEnName,
diff --git a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs
index 2534fb6f9..501f81324 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/Dto/SetDictionaryValueDto.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using IRaCIS.Core.Domain.Models;
+using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Infra.EFCore.Common.Dto
{
@@ -97,6 +98,17 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
public Guid ChildId { get; set; }
}
+
+ public class UnitData
+ {
+ ///
+ /// 单位
+ ///
+ public ValueUnit? Unit { get; set; }
+
+ public string UnitName { get; set; }
+ }
+
///
/// 稽查数据
///