private static IDicomPatient MapToDicomPatient(PatientQueryIod patientQueryIod) { return(new DicomPatient { PatientId = patientQueryIod.PatientId, PatientFullName = patientQueryIod.PatientsName, PatientBirthDate = patientQueryIod.PatientsBirthDate.Date.ToString("yyyyMMdd") }); }
public IDicomPatient GetPatientIdFromPatientDetails( string patientFullname, string patientBirthDate) { var query = new PatientQueryIod(); query.SetCommonTags(); query.PatientsName = new PersonName(patientFullname); query.PatientsBirthDate = DateTime.ParseExact(patientBirthDate, "yyyyMMdd", CultureInfo.CurrentCulture); var findScu = new PatientRootFindScu(); var patient = findScu.Find(LocalNode.AeTitle, RemoteNode.AeTitle, RemoteNode.IpAddress, RemoteNode.Port, query).ToList(); if (!patient.Any()) { throw new Exception($"No patient found with name [{patientFullname}] " + $"and birth date [{patientBirthDate}]"); } if (patient.Count > 1) { throw new Exception($"{patient.Count} patients were found for name [{patientFullname}] " + $"and birth date [{patientBirthDate}]"); } return(patient.Select(MapToDicomPatient).FirstOrDefault()); }