From 281b5d2177baff147c7ebbb17120570c0462f7f5 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 26 Nov 2024 16:46:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Helper/FileDocProcess/ExcelExportHelper.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs index 879db8897..b97c0e8b4 100644 --- a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs @@ -77,7 +77,8 @@ public static class ExcelExportHelper //处理集合里面时间类型,根据当前语言将时间转变为字符串 foreach (var itemValuePair in itemDic) { - if (DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) + // 临床数据 1,1 会变成2024-01-01 + if (itemValuePair.Value?.ToString().Length > 4 && DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) { itemDic[itemValuePair.Key] = ExportExcelConverterDate.DateTimeInternationalToString(result); } @@ -337,7 +338,7 @@ public static class ExcelExportHelper //处理集合里面时间类型,根据当前语言将时间转变为字符串 foreach (var itemValuePair in itemDic) { - if (DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) + if (itemValuePair.Value?.ToString().Length > 4 && DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) { itemDic[itemValuePair.Key] = ExportExcelConverterDate.DateTimeInternationalToString(result); }