From 0b3542e9c3e69f2d452ca38ffb8e12232f5754b8 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 17 Jul 2024 14:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E6=82=A3?= =?UTF-8?q?=E8=80=85=E5=B9=B4=E9=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRC.Core.SCP/Service/DicomArchiveService.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/IRC.Core.SCP/Service/DicomArchiveService.cs b/IRC.Core.SCP/Service/DicomArchiveService.cs index 8e66feceb..8632cd4e8 100644 --- a/IRC.Core.SCP/Service/DicomArchiveService.cs +++ b/IRC.Core.SCP/Service/DicomArchiveService.cs @@ -11,6 +11,7 @@ using FellowOakDicom.Network; using IRaCIS.Core.SCP.Service; using IRaCIS.Core.Infra.EFCore; using MassTransit; +using System.Runtime.Intrinsics.X86; namespace IRaCIS.Core.SCP.Service { @@ -115,6 +116,20 @@ namespace IRaCIS.Core.SCP.Service { findPatient.PatientBirthDate = birthDateStr; + DateTime birthDate; + + if (findPatient.PatientAge == string.Empty && studyTime.HasValue && DateTime.TryParse(findPatient.PatientBirthDate,out birthDate)) + { + var patientAge = studyTime.Value.Year - birthDate.Year; + // 如果生日还未到,年龄减去一岁 + if (studyTime.Value < birthDate.AddYears(patientAge)) + { + patientAge--; + } + + findPatient.PatientAge = patientAge.ToString(); + } + } else {