コード例 #1
0
        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());
        }