From e1f19e9eaeafaae5e171305cd7f21c699006f18a Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Wed, 25 Dec 2024 10:38:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=85=E7=89=87=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingImageTaskViewModel.cs | 2 -- .../ReadingImageTaskService.cs | 23 ++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 511dad39d..ac099b561 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1061,8 +1061,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public string? OrderMark { get; set; } - public List TableQuestionMarkList = new List(); - public string? OrderMarkName { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 2a1630836..13d49f0ee 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Serialization; using NPOI.POIFS.Properties; using NPOI.SS.Formula.Functions; using Panda.DynamicWebApi.Attributes; @@ -973,12 +974,12 @@ namespace IRaCIS.Core.Application.Service .ToListAsync(); - var tableQuestionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync(); + //var tableQuestionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync(); - result.ForEach(x => - { - x.TableQuestionMarkList = tableQuestionMarkList.Where(y => y.RowId == x.RowId).ToList(); - }); + //result.ForEach(x => + //{ + // x.TableQuestionMarkList = tableQuestionMarkList.Where(y => y.RowId == x.RowId).ToList(); + //}); var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); @@ -1473,7 +1474,17 @@ namespace IRaCIS.Core.Application.Service answers.Add("OtherNumberOfFrames", rowInfo == null || rowInfo.OtherNumberOfFrames == null ? string.Empty : rowInfo.OtherNumberOfFrames.ToString()); answers.Add("OtherMarkTool", rowInfo == null || rowInfo.OtherMarkTool == null ? string.Empty : rowInfo.OtherMarkTool.ToString()); answers.Add("RowIndex", x.ToString()); - answers.Add("TableQuestionMarkList", rowInfo == null ? "[]" : JsonConvert.SerializeObject(TableQuestionMarkList.Where(x=>x.RowId== rowInfo.Id).ToList())); + + JsonSerializerSettings settings = new JsonSerializerSettings + { + Formatting = Formatting.None, + FloatParseHandling = FloatParseHandling.Double, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new SnakeCaseNamingStrategy() // 如果需要下划线风格的JSON键 + } + }; + answers.Add("TableQuestionMarkList", rowInfo == null ? "[]" : JsonConvert.SerializeObject(TableQuestionMarkList.Where(x=>x.RowId== rowInfo.Id).ToList(), settings)); answers.Add("RowId", rowInfo == null ? string.Empty : rowInfo.Id.ToString()); answers.Add("MarkTool", rowInfo.MarkTool); answers.Add("StudyId", rowInfo.StudyId.ToString());