using DicomTool.Utils; using System.Net; namespace DcmToPng.Helper { public static class DataHelper { public static Dictionary GetReports() { var data = new Dictionary(); int i = 1; try { var reportList = PacsSqlHelper.GetPacsReportList(); foreach (var report in reportList) { // 已选图片UID var selectedList = PacsSqlHelper.GetReportUidList(report.AccessionNumber); if (selectedList.Count <= 0) continue; // DCM图片路径 var imageFiles = PacsSqlHelper.GetPacsImageFile(report.PatientCode, report.ExamFeeitem_Code); if (string.IsNullOrEmpty(imageFiles)) continue; // 得到DCM共享文件地址 var dcmPaths = imageFiles.Split(';'); // 路径为空 if (!(dcmPaths?.Length > 0)) continue; selectedList.ForEach(selected => { var file = selected + ".DCM"; string downPath = dcmPaths[0].Substring(0, dcmPaths[0].Length - file.Length) + file; if (Path.HasExtension(downPath)) { var name = $"{report.PatientCode?.Trim()}-{report.ExamFeeitem_Code?.Trim()}-" + i; if (data.ContainsKey(name)) name += "x"; data.Add($"{name}.DCM", downPath); i++; }; }); } } catch (Exception e) { Console.WriteLine($"[GetReports][Error]" + e.Message); Console.ReadKey(); } return data; } } }