From fdcb81306dd7d03515c2a97535f380283729525c Mon Sep 17 00:00:00 2001
From: he <109787524@qq.com>
Date: Tue, 4 Aug 2026 13:32:51 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Reading/Dto/ReadingCalculateViewModel.cs | 31 ++++++++++
.../ReadingCalculate/IVUSCalculateService.cs | 61 ++++++++++++++++++-
.../ReadingCalculate/OCTCalculateService.cs | 59 ++++++++++++++++++
IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs | 5 ++
4 files changed, 155 insertions(+), 1 deletion(-)
diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs
index ff52940a3..9b98c98cb 100644
--- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs
+++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingCalculateViewModel.cs
@@ -250,6 +250,37 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public string TaskBlindName { get; set; }
public string SubjectID { get; set; }
+
+ ///
+ /// 靶段
+ ///
+ public string TargetSegment { get; set; }
+
+ ///
+ /// 靶段备注
+ ///
+ public string TargetSegmentRemarks { get; set; }
+
+ ///
+ /// ROI段落总长度
+ ///
+ public string ROIAllLength { get; set; }
+
+ ///
+ /// 回撤中的图像帧数
+ ///
+ public string PullbackFrameCount { get; set; }
+
+ ///
+ /// 斑块类型
+ ///
+ public string PlaqueType { get; set; }
+
+ ///
+ /// 访视点备注(如有)
+ ///
+ public string AdjustReason { get; set; }
+
}
public class OCTFCTUploadData
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
index ed0469fe2..11c01d139 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/IVUSCalculateService.cs
@@ -1,4 +1,6 @@
-using IRaCIS.Core.Application.Service.Reading.Dto;
+using DocumentFormat.OpenXml.Spreadsheet;
+using IRaCIS.Core.Application.Interfaces;
+using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
@@ -6,6 +8,7 @@ using MassTransit;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
@@ -18,6 +21,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository _readingTableAnswerRowInfoRepository,
IRepository _readingQuestionTrialRepository,
IRepository _organInfoRepository,
+ ISubjectVisitService iSubjectVisitService,
+ IRepository _dictionaryRepository,
IRepository _readingGlobalTaskInfoRepository,
IRepository _subjectVisitRepository,
IRepository _tumorAssessmentRepository,
@@ -414,10 +419,64 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x=>x.Subject).FirstNotNullAsync();
+ //靶段
+ var targetSegmentdic = await _dictionaryRepository.Where(x => x.Parent.Code == "TargetSegment").ToListAsync();
+
+ //斑块类型
+ var plaqueTypedic = await _dictionaryRepository.Where(x => x.Parent.Code == "PlaqueType").ToListAsync();
+
+
+
+
+ var awswerList=await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Include(x=>x.ReadingQuestionTrial).ToListAsync();
+
+
+
+ var targetSegmentAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegment).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
+ if (targetSegmentAnswer.IsNotNullOrEmpty())
+ {
+ var data= JsonConvert.DeserializeObject>(targetSegmentAnswer);
+ targetSegmentAnswer = string.Join(",", targetSegmentdic
+ .Where(x => data.Contains(x.Code))
+ .Select(x => x.Value));
+ }
+ else
+ {
+ var targetSegmentData = await iSubjectVisitService.GetReadingVisitStudyList(new Contracts.GetReadingVisitStudyListIndto()
+ {
+ SujectVisitId = taskinfo.SourceSubjectVisitId ?? default(Guid),
+ TrialId = taskinfo.TrialId,
+ VisitTaskId = inDto.VisitTaskId
+ });
+ targetSegmentAnswer = string.Join(",", targetSegmentData
+ .Where(x =>x.BodyPartForEdit.IsNotNullOrEmpty())
+ .Select(x => x.BodyPartForEdit));
+ }
+
+
+ var plaqueTypeAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PlaqueType).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
+ if (plaqueTypeAnswer.IsNotNullOrEmpty())
+ {
+ var data = JsonConvert.DeserializeObject>(plaqueTypeAnswer);
+ plaqueTypeAnswer = string.Join(",", plaqueTypedic
+ .Where(x => data.Contains(x.Code))
+ .Select(x => x.Value));
+ }
+
+
var values = new TemplateData()
{
SubjectID = (taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode),
TaskBlindName = taskinfo.TaskBlindName,
+ TargetSegment= targetSegmentAnswer,
+ TargetSegmentRemarks = awswerList.Where(x=>x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegmentRemarks).Select(x=>x.Answer).FirstOrDefault()??string.Empty,
+ ROIAllLength = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.ROIAllLength).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ PullbackFrameCount = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PullbackFrameCount).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ AdjustReason = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ PlaqueType = plaqueTypeAnswer,
+
+
+
};
return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
{
diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
index 862855b7d..8f2bcc7ab 100644
--- a/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
+++ b/IRaCIS.Core.Application/Service/ReadingCalculate/OCTCalculateService.cs
@@ -2,6 +2,7 @@
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using DocumentFormat.OpenXml.Office.SpreadSheetML.Y2023.MsForms;
using DocumentFormat.OpenXml.Office2010.Excel;
+using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
@@ -12,6 +13,7 @@ using MassTransit;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
@@ -24,6 +26,8 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
IRepository _readingTableAnswerRowInfoRepository,
IRepository _readingQuestionTrialRepository,
IRepository _organInfoRepository,
+ ISubjectVisitService iSubjectVisitService,
+ IRepository _dictionaryRepository,
IHttpContextAccessor httpContext,
IRepository _readingGlobalTaskInfoRepository,
IRepository _subjectVisitRepository,
@@ -271,10 +275,65 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task GetOCTFCTTemplate(GetExportTemplateInDto inDto)
{
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).FirstNotNullAsync();
+
+ //靶段
+ var targetSegmentdic = await _dictionaryRepository.Where(x => x.Parent.Code == "TargetSegment").ToListAsync();
+
+ //斑块类型
+ var plaqueTypedic = await _dictionaryRepository.Where(x => x.Parent.Code == "PlaqueType").ToListAsync();
+
+
+
+
+ var awswerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Include(x => x.ReadingQuestionTrial).ToListAsync();
+
+
+
+ var targetSegmentAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegment).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
+ if (targetSegmentAnswer.IsNotNullOrEmpty())
+ {
+ var data = JsonConvert.DeserializeObject>(targetSegmentAnswer);
+ targetSegmentAnswer = string.Join(",", targetSegmentdic
+ .Where(x => data.Contains(x.Code))
+ .Select(x => x.Value));
+ }
+ else
+ {
+ var targetSegmentData = await iSubjectVisitService.GetReadingVisitStudyList(new Contracts.GetReadingVisitStudyListIndto()
+ {
+ SujectVisitId = taskinfo.SourceSubjectVisitId ?? default(Guid),
+ TrialId = taskinfo.TrialId,
+ VisitTaskId = inDto.VisitTaskId
+ });
+ targetSegmentAnswer = string.Join(",", targetSegmentData
+ .Where(x => x.BodyPartForEdit.IsNotNullOrEmpty())
+ .Select(x => x.BodyPartForEdit));
+ }
+
+
+ var plaqueTypeAnswer = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PlaqueType).Select(x => x.Answer).FirstOrDefault() ?? string.Empty;
+ if (plaqueTypeAnswer.IsNotNullOrEmpty())
+ {
+ var data = JsonConvert.DeserializeObject>(plaqueTypeAnswer);
+ plaqueTypeAnswer = string.Join(",", plaqueTypedic
+ .Where(x => data.Contains(x.Code))
+ .Select(x => x.Value));
+ }
+
+
var values = new TemplateData()
{
SubjectID = (taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode),
TaskBlindName = taskinfo.TaskBlindName,
+ TargetSegment = targetSegmentAnswer,
+ TargetSegmentRemarks = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.TargetSegmentRemarks).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ ROIAllLength = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.ROIAllLength).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ //PullbackFrameCount = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.PullbackFrameCount).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ AdjustReason = awswerList.Where(x => x.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
+ PlaqueType = plaqueTypeAnswer,
+
+
+
};
return await _visitTaskHelpeService.ExportTemplateAsync(new IRaCIS.Application.Contracts.ExportTemplateAsyncDto()
{
diff --git a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
index 2b7eea0f7..8240f31c5 100644
--- a/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
+++ b/IRaCIS.Core.Domain.Share/Reading/ReadEnum.cs
@@ -3060,6 +3060,11 @@ namespace IRaCIS.Core.Domain.Share
///
ROIAllLength = 1015,
+ ///
+ /// 斑块类型
+ ///
+ PlaqueType=1018,
+
///
/// PAV(冠状动脉粥样硬化体积百分比)
///