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 {