自动计算患者年龄
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-07-17 14:52:53 +08:00
parent 425bd7bf9a
commit 0b3542e9c3
1 changed files with 15 additions and 0 deletions

View File

@ -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
{