You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.9 KiB
44 lines
1.9 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DicomTool.Utils
|
|
{
|
|
public static class PacsSqlHelper
|
|
{
|
|
public static List<ReportPacs> GetPacsReportList()
|
|
{
|
|
var dayBetween = $@"> '{DateTime.Today.AddDays(-7):yyyy-MM-dd}'";
|
|
// var dayBetween = $@"BETWEEN '{DateTime.Today:yyyy-MM-dd}' AND '{DateTime.Today.AddDays(1):yyyy-MM-dd}'";
|
|
var reportList = DAOHelp.GetDataBySQL<ReportPacs>($@"
|
|
SELECT top 2 A.PatientCode, A.ExamFeeitem_Code,A.AccessionNumber
|
|
FROM PACS.DICOMSERVER.DBO.PEIS_PacsResult A
|
|
where A.ExamDatetime IS NOT NULL and a.ExamDatetime {dayBetween}
|
|
AND EXISTS ( SELECT 1 FROM PACS.DICOMSERVER.DBO.ImgForReport WHERE AccessionNumber = A.AccessionNumber )
|
|
AND NOT EXISTS ( SELECT 1 FROM Exam_PacsImage WHERE EID = A.PatientCode AND ReportNo=A.ExamFeeitem_Code)
|
|
");
|
|
|
|
Console.WriteLine($"【待同步的PACS报告】{dayBetween}至今,{reportList.Count}");
|
|
return reportList;
|
|
}
|
|
|
|
public static List<string> GetReportUidList(string reportAccessionNumber)
|
|
{
|
|
|
|
// 已选图片UID
|
|
var selectedList = DAOHelp.GetDataBySQL<ReportPacs>
|
|
($@"SELECT SopInstanceUID FROM PACS.DICOMSERVER.DBO.ImgForReport WHERE AccessionNumber='{reportAccessionNumber}'")
|
|
.Select(s => s.SopInstanceUID).ToList();
|
|
return selectedList;
|
|
}
|
|
|
|
public static string GetPacsImageFile(string reportPatientCode,string reportExamFeeitemCode)
|
|
{
|
|
return DAOHelp.GetDataBySQL<ReportPacs>
|
|
($@"SELECT ImageFile FROM PACS.DICOMSERVER.DBO.PEIS_PacsResult WHERE PatientCode='{reportPatientCode}' and ExamFeeitem_Code='{reportExamFeeitemCode}'")
|
|
?.FirstOrDefault()?.ImageFile;
|
|
}
|
|
}
|
|
}
|
|
|