Ver Fonte

体检中心兼容

付宇 há 1 ano atrás
pai
commit
c6ae479239

+ 13 - 0
Desktop/Worklist/.idea/.idea.Worklist/.idea/.gitignore

@@ -0,0 +1,13 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# Rider 忽略的文件
+/modules.xml
+/projectSettingsUpdater.xml
+/contentModel.xml
+/.idea.Worklist.iml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 4 - 0
Desktop/Worklist/.idea/.idea.Worklist/.idea/encodings.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
+</project>

+ 8 - 0
Desktop/Worklist/.idea/.idea.Worklist/.idea/indexLayout.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="UserContentModel">
+    <attachedFolders />
+    <explicitIncludes />
+    <explicitExcludes />
+  </component>
+</project>

+ 6 - 0
Desktop/Worklist/.idea/.idea.Worklist/.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
+  </component>
+</project>

+ 38 - 6
Desktop/Worklist/App.config

@@ -1,16 +1,48 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <appSettings>
-        <add key="AETitle"   value="ZSKKCT" />
-        <add key="CallingAE" value="ZSKKCT" />
-        
-        <add key="Modality"  value="CT" />
-        <add key="Port"      value="108" />
+        <add key="AETitle"   value="XIAFH" />
+        <add key="CallingAE" value="XIAFH" />
+        <add key="Modality"  value="DX" />
+        <add key="Port"      value="9900" />
         <add key="IpAddress" value="0.0.0.0"/>
         
         <add key="Type"      value="API"/>
-        <add key="API"       value="http://192.168.10.240:12321/web/worklist/worklist"/>
+        <add key="API"       value="http://kunlun.pacsonline.cn/public/phytemp/phytemp/getworklist"/>
         <add key="JSON"      value="exam.json"/>
+
+
+
+        <add key="CallingAE_9900" value="XIAFH" />
+        <add key="Modality_9900"  value="DX" />
+
+        <add key="CallingAE_9901" value="DEXA" />
+        <add key="Modality_9901"  value="OT" />
+
+        <add key="CallingAE_9903" value="DIRECT_DIGXRAY" />
+        <add key="Modality_9903"  value="MG" />
+
+        <add key="CallingAE_9904" value="CT106286" />
+        <add key="Modality_9904"  value="CT" />
+
+        <add key="CallingAE_9905" value="HRI_ct121051" />
+        <add key="Modality_9905"  value="CT" />
+
+        <add key="CallingAE_9906" value="AWP139840" />
+        <add key="Modality_9906"  value="MR" />
+
+        <add key="CallingAE_9907" value="ANKON" />
+        <add key="Modality_9907"  value="ES" />
+
+
+        <add key="CallingAE_9911" value="SERVER" />
+        <add key="Modality_9911"  value="US" />
+
+        <add key="CallingAE_9912" value="SERVER" />
+        <add key="Modality_9912"  value="US" />
+
+        <add key="CallingAE_9913" value="SERVER" />
+        <add key="Modality_9913"  value="US" />
     </appSettings>
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>

+ 29 - 0
Desktop/Worklist/Model/PeisWorklistItem.cs

@@ -0,0 +1,29 @@
+// Copyright (c) 2012-2020 fo-dicom contributors.
+// Licensed under the Microsoft Public License (MS-PL).
+
+using System;
+
+namespace Worklist_SCP.Model
+{
+
+    /// <summary>
+    /// This class contains the most important values that are transmitted per worklist
+    /// </summary>
+    [Serializable]
+    public class PeisWorklistItem
+    {
+        public DateTime SCHEDULED_DATE_TIME {get; set;}
+        public string DATE_OF_BIRTH {get; set;}
+
+        public string EXAM_NO {get; set;}
+        public string PATIENT_ID {get; set;}
+        public string PATIENT_LOCAL_ID {get; set;}
+        public string STUDY_INSTANCE_UID {get; set;}
+        public string NAME_PHONETIC {get; set;}
+        public string PATIENT_NAME {get; set;}
+        public string PATIENT_AGE {get; set;}
+        public string PATIENT_SEX {get; set;}
+        public string Patient_Weight {get; set;}
+
+    }
+}

+ 170 - 57
Desktop/Worklist/Model/WorklistApiHandler.cs

@@ -52,32 +52,60 @@ namespace Worklist_SCP.Model
 
         public static IEnumerable<DicomDataset> FilterWorklistItems(DicomDataset request)
         {
-            var patientName = request.GetSingleValueOrDefault(DicomTag.PatientName, string.Empty);
-            var PatientID = request.GetSingleValueOrDefault(DicomTag.PatientID, string.Empty);
+            var NAME_PHONETIC = request.GetSingleValueOrDefault(DicomTag.PatientName, string.Empty);
+            var PATIENT_ID = request.GetSingleValueOrDefault(DicomTag.PatientID, string.Empty);
+            var PATIENT_SEX   = request.GetSingleValueOrDefault(DicomTag.PatientSex, string.Empty);
+            var MODALITY = request.GetSingleValueOrDefault(DicomTag.Modality, WorklistServer.modality);
+            var PATIENT_LOCAL_ID = request.GetSingleValueOrDefault(DicomTag.AccessionNumber, string.Empty);
+            
+            var ScheduledProcedureStepStartDate = request.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepStartDate, string.Empty);
+            var ScheduledProcedureStepEndDate = request.GetSingleValueOrDefault(DicomTag.PerformedProcedureStepEndDate, string.Empty);
+            
             var api = ConfigurationManager.AppSettings["API"];
-            var AETitleConfig = ConfigurationManager.AppSettings["AETitle"];
-            var CallingAEConfig = ConfigurationManager.AppSettings["CallingAE"];
-            var ModalityConfig = ConfigurationManager.AppSettings["Modality"];
-            var paramStr = $"patientName={patientName}&PatientID={PatientID}";
+            var AE_TITLE = WorklistServer.AETitle;
+            
+            var sps = request.Get<DicomSequence>(DicomTag.ScheduledProcedureStepSequence);
+            foreach (var item in sps) {
+                MODALITY = item.GetSingleValueOrDefault<string>(DicomTag.Modality, MODALITY);
+                ScheduledProcedureStepStartDate = item.GetSingleValueOrDefault<string>(DicomTag.ScheduledProcedureStepStartDate, ScheduledProcedureStepStartDate);
+                ScheduledProcedureStepEndDate = item.GetSingleValueOrDefault<string>(DicomTag.ScheduledProcedureStepEndDate, ScheduledProcedureStepEndDate);
+            }
+            
+            string[] StepDateArray          = FormatStepDate(AE_TITLE, ScheduledProcedureStepStartDate,ScheduledProcedureStepEndDate);
+            ScheduledProcedureStepStartDate = StepDateArray[0];
+            ScheduledProcedureStepEndDate   = StepDateArray[1];
+            
+            // var CallingAEConfig = ConfigurationManager.AppSettings["CallingAE"];
+
+
+            var paramStr = $"AE_TITLE={AE_TITLE}" +
+                           $"&PATIENT_LOCAL_ID={PATIENT_LOCAL_ID}" +
+                           $"&PATIENT_ID={PATIENT_ID}" +
+                           $"&NAME_PHONETIC={NAME_PHONETIC}" +
+                           $"&PATIENT_SEX={PATIENT_SEX}" +
+                           $"&MODALITY={MODALITY}" +
+                           $"&ScheduledProcedureStepStartDate={ScheduledProcedureStepStartDate}" +
+                           $"&ScheduledProcedureStepEndDate={ScheduledProcedureStepEndDate}";
             DicomDataset procedureStep = null;
 
-            if (request.Contains(DicomTag.ScheduledProcedureStepSequence))
-            {
-                procedureStep = request.GetSequence(DicomTag.ScheduledProcedureStepSequence).First();
-                var scheduledStationAET = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledStationAETitle, string.Empty);
-                var performingPhysician = procedureStep.GetSingleValueOrDefault(DicomTag.PerformingPhysicianName, string.Empty);
-                var modality = procedureStep.GetSingleValueOrDefault(DicomTag.Modality, string.Empty);
-                var scheduledProcedureStepStartDateTime = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepStartDateTime, string.Empty);
-                var procedureStepLocation = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepLocation, string.Empty);
-                var procedureDescription = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepDescription, string.Empty);
-                paramStr = $"AETitleConfig={AETitleConfig}&CallingAEConfig={CallingAEConfig}&ModalityConfig={ModalityConfig}&patientName={patientName}&PatientID={PatientID}&scheduledStationAET={scheduledStationAET}&performingPhysician={performingPhysician}&modality={modality}&scheduledProcedureStepStartDateTime={scheduledProcedureStepStartDateTime}&procedureStepLocation={procedureStepLocation}&procedureDescription={procedureDescription}";
-            }
+            // if (request.Contains(DicomTag.ScheduledProcedureStepSequence))
+            // {
+            //     procedureStep = request.GetSequence(DicomTag.ScheduledProcedureStepSequence).First();
+            //     var scheduledStationAET = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledStationAETitle, string.Empty);
+            //     var performingPhysician = procedureStep.GetSingleValueOrDefault(DicomTag.PerformingPhysicianName, string.Empty);
+            //     var modality = procedureStep.GetSingleValueOrDefault(DicomTag.Modality, string.Empty);
+            //     var scheduledProcedureStepStartDateTime = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepStartDateTime, string.Empty);
+            //     var procedureStepLocation = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepLocation, string.Empty);
+            //     var procedureDescription = procedureStep.GetSingleValueOrDefault(DicomTag.ScheduledProcedureStepDescription, string.Empty);
+            //     paramStr = $"AETitleConfig={AETitleConfig}&CallingAEConfig={CallingAEConfig}&ModalityConfig={ModalityConfig}&patientName={patientName}&PatientID={PatientID}&scheduledStationAET={scheduledStationAET}&performingPhysician={performingPhysician}&modality={modality}&scheduledProcedureStepStartDateTime={scheduledProcedureStepStartDateTime}&procedureStepLocation={procedureStepLocation}&procedureDescription={procedureDescription}";
+            // }
+            //
             Console.Write($"Http request url: {api} paramStr: {paramStr}");
             string str = HttpPost(api, paramStr);
             Console.Write($"HttpPost results: {str}");
 
-            List<WorklistItem> exams = new List<WorklistItem>();
-            exams = JsonConvert.DeserializeObject<List<WorklistItem>>(str);
+            List<PeisWorklistItem> exams = new List<PeisWorklistItem>();
+            exams = JsonConvert.DeserializeObject<List<PeisWorklistItem>>(str);
             //List<WorklistItem> thislist = new List<WorklistItem>();
             //thislist = JavaScriptConvert.DeserializeObject<List<WorklistItem>>(str);
             //string connstr = "data source=127.0.0.1;database=wq_db;user id=wq;password=Wq@2020~!@#;pooling=false;charset=utf8";//pooling代表是否使用连接池
@@ -158,46 +186,60 @@ namespace Worklist_SCP.Model
                 var resultingSPS = new DicomDataset();
                 var resultDataset = new DicomDataset();
                 var resultingSPSSequence = new DicomSequence(DicomTag.ScheduledProcedureStepSequence, resultingSPS);
-
-                if (procedureStep != null)
-                {
-                    resultDataset.Add(resultingSPSSequence);
+                
+     //                DicomDataset dds = new DicomDataset();
+				string EXAM_NO      = result.EXAM_NO.ToString();
+				string PatientID    = result.PATIENT_ID.ToString();
+                string AccessionNb  = result.PATIENT_LOCAL_ID.ToString();
+                string StudyUid     = result.STUDY_INSTANCE_UID.ToString();
+                string PinyinName   = result.NAME_PHONETIC.ToString();
+                string HanziName    = result.PATIENT_NAME.ToString();
+                string PatientAge   = result.PATIENT_AGE.ToString();
+                string PatientSex   = result.PATIENT_SEX.ToString();
+                string Patient_Weight =  result.Patient_Weight.ToString();
+				DateTime birthDate = DateTime.ParseExact(result.DATE_OF_BIRTH.ToString(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);//生日需要date格式时间 dds.Add(DicomTag.PatientBirthDate, row["DATE_OF_BIRTH"].ToString());
+ //
+				PatientSex          = FormatSex(PatientSex);
+                PatientAge          = FormatAge(PatientAge);
+ //
+				// if (string.IsNullOrEmpty(PinyinName)) {
+				// 	PinyinName = HanziToPinyin(HanziName);
+				// }
+				if (string.IsNullOrEmpty(AccessionNb)) {
+					AccessionNb = EXAM_NO;
+				}
+				if (string.IsNullOrEmpty(StudyUid)) {
+					StudyUid = "1.3.6.1.4.1.30071.8." + PatientID + "." + EXAM_NO;
+				}
+                AddIfExistsInRequest(resultDataset, request, DicomTag.ScheduledStationAETitle, "CFINDSCP");  // 西门子需要设置aetitle
+                AddIfExistsInRequest(resultDataset, request, DicomTag.AccessionNumber, AccessionNb); 
+                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientID, PatientID);
+                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientSex, PatientSex);
+                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientAge, PatientAge);
+                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientName, PinyinName);
+                AddIfExistsInRequest(resultDataset, request, DicomTag.StudyInstanceUID, StudyUid);
+                AddIfExistsInRequest(resultDataset, request, DicomTag.StudyInstanceUID, StudyUid);
+                if (!string.IsNullOrEmpty(Patient_Weight)) {
+                    AddIfExistsInRequest(resultDataset, request, DicomTag.PatientWeight, Patient_Weight);
                 }
-
-                // add results to "main" dataset
-                AddIfExistsInRequest(resultDataset, request, DicomTag.AccessionNumber, result.AccessionNumber);    // T2
-                AddIfExistsInRequest(resultDataset, request, DicomTag.InstitutionName, result.HospitalName);
-                AddIfExistsInRequest(resultDataset, request, DicomTag.ReferringPhysicianName, result.ReferringPhysician); // T2
-
-                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientName, result.Surname + "^" + result.Forename + "^^" + result.Title); //T1
-                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientID, result.PatientID); // T1
-                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientBirthDate, result.DateOfBirth); // T2
-                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientSex, result.Sex); //T2
-
-                AddIfExistsInRequest(resultDataset, request, DicomTag.StudyInstanceUID, result.StudyUID); // T1
-
-                AddIfExistsInRequest(resultDataset, request, DicomTag.RequestingPhysician, result.ReferringPhysician); //T2
-                AddIfExistsInRequest(resultDataset, request, DicomTag.RequestedProcedureDescription, result.ExamDescription); //T1C
-
-                AddIfExistsInRequest(resultDataset, request, DicomTag.RequestedProcedureID, result.ProcedureID); // T1
-
-                // Scheduled Procedure Step sequence T1
-                // add results to procedure step dataset
-                // Return if requested
-                if (procedureStep != null)
+                else
                 {
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledStationAETitle, result.ScheduledAET); // T1
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledProcedureStepStartDate, result.ExamDateAndTime); //T1
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledProcedureStepStartTime, result.ExamDateAndTime); //T1
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.Modality, result.Modality); // T1
-
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledPerformingPhysicianName, result.PerformingPhysician); //T2
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledProcedureStepDescription, result.ExamDescription); // T1C
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledProcedureStepID, result.ProcedureStepID); // T1
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledStationName, result.ExamRoom); //T2
-                    AddIfExistsInRequest(resultingSPS, procedureStep, DicomTag.ScheduledProcedureStepLocation, result.ExamRoom); //T2
+                    AddIfExistsInRequest(resultDataset, request, DicomTag.PatientWeight, ""); 
                 }
-
+				DicomDataset backSR = new DicomDataset();
+				backSR.Add(DicomTag.AccessionNumber, AccessionNb);
+                backSR.Add(DicomTag.ScheduledStationAETitle, "CFINDSCP");
+				resultDataset.Add(DicomTag.ReferencedStudySequence, backSR);
+				DicomDataset backsps = new DicomDataset();
+				// backsps.Add(DicomTag.RequestedProcedureDescription, result.REQ_MEMO.ToString());
+				DateTime spsStartDate = result.SCHEDULED_DATE_TIME;
+				backsps.Add(DicomTag.ScheduledProcedureStepStartDate, spsStartDate);
+				//backsps.Add(DicomTag.ScheduledProcedureStepStartTime, "010203"); //胶囊胃镜需要传
+				backsps.Add(DicomTag.ScheduledProcedureStepEndTime, spsStartDate);
+				backsps.Add(DicomTag.Modality, MODALITY);
+				backsps.Add(DicomTag.ScheduledProcedureStepID, "8008" + result.EXAM_NO.ToString());
+                resultDataset.Add(DicomTag.ScheduledProcedureStepSequence, backsps);
+                
                 // Put blanks in for unsupported fields which are type 2 (i.e. must have a value even if NULL)
                 // In a real server, you may wish to support some or all of these, but they are not commonly supported
                 AddIfExistsInRequest(resultDataset, request, DicomTag.ReferencedStudySequence, new DicomDataset());         // Ref//d Study Sequence
@@ -206,14 +248,85 @@ namespace Worklist_SCP.Model
                 AddIfExistsInRequest(resultDataset, request, DicomTag.AdmissionID, "");                               // Admission ID
                 AddIfExistsInRequest(resultDataset, request, DicomTag.CurrentPatientLocation, "");                    // Patient Location
                 AddIfExistsInRequest(resultDataset, request, DicomTag.ReferencedPatientSequence, new DicomDataset());       // Ref//d Patient Sequence
-                AddIfExistsInRequest(resultDataset, request, DicomTag.PatientWeight, "");                             // Weight
                 AddIfExistsInRequest(resultDataset, request, DicomTag.ConfidentialityConstraintOnPatientDataDescription, ""); // Confidentiality Constraint
+                // AddIfExistsInRequest(resultDataset, request, DicomTag.ScheduledProcedureStepID , "8008" + result.EXAM_NO.ToString()); // Confidentiality Constraint
+                // AddIfExistsInRequest(resultDataset, request, DicomTag.PerformedProcedureStepID , "8008" + result.EXAM_NO.ToString()); // Confidentiality Constraint
 
                 // Send Reponse Back
                 yield return resultDataset;
             }
         }
 
+        public static string FormatSex(string sex)
+        {
+            // Console.WriteLine(sex);
+            string backsex = "O";
+            if (sex == "男")
+                backsex = "F";
+            if (sex == "女")
+                backsex = "M";
+            if (sex == "1")
+                backsex = "F";
+            if (sex == "2")
+                backsex = "M";
+            if (sex == "F")
+                backsex = "F";
+            if (sex == "M")
+                backsex = "M";
+            // Console.WriteLine(backsex);
+            return backsex;
+        }
+        /**
+         *格式年龄000Y
+         *
+        */
+        public static string FormatAge(string age) {
+            int ageInt = int.Parse(age);
+            string prefix = "", suffix = "Y";
+            if(ageInt < 10) {
+                prefix = "00";
+            } else if(ageInt < 100) {
+                prefix = "0";
+            }
+            return prefix + ageInt.ToString() + suffix;
+        }
+        public static string[] FormatStepDate(string CallingAE,string start,string end) {
+            string[] stepDate = new string[2];
+            switch (CallingAE) {
+                case "CT106286":// 西门子16排设备
+                case "XIAFH":// 万登DR
+                case "DEXA":// 豪洛捷骨密度
+                    if (string.IsNullOrEmpty(start)) {
+                        stepDate[0] = "";
+                        stepDate[1] = "";
+                    } else {
+                        string[] temp = start.Split('-');
+                        if(temp == null || temp.Length < 1 || string.IsNullOrEmpty(temp[0])) {
+                            stepDate[0] = "";
+                        } else {
+                            stepDate[0] = temp[0];
+                        }
+                        if(temp == null || temp.Length < 2 || string.IsNullOrEmpty(temp[1])) {
+                            stepDate[1] = "";
+                        } else {
+                            stepDate[1] = temp[1];
+                        }
+                    }
+                    break;
+                default:
+                    if (string.IsNullOrEmpty(start)) {
+                        start = "";
+                    }
+                    if (string.IsNullOrEmpty(end)) {
+                        end = "";
+                    }
+                    stepDate[0] = start;
+                    stepDate[1] = end;
+                    break;
+
+            }
+            return stepDate;
+        }
 
         //Splits patient name into 2 separte strings surname and forename and send then to the addstringcondition subroutine.
         internal static IQueryable<WorklistItem> AddNameCondition(IQueryable<WorklistItem> exams, string dicomName)

+ 2 - 0
Desktop/Worklist/Model/WorklistItem.cs

@@ -24,6 +24,8 @@ namespace Worklist_SCP.Model
         public string Title { get; set; }
 
         public string Sex { get; set; }
+        
+        public string Age { get; set; }
 
         public DateTime DateOfBirth { get; set; }
 

+ 20 - 1
Desktop/Worklist/Program.cs

@@ -26,10 +26,29 @@ namespace Worklist_SCP
         var configIpAddress = ConfigurationManager.AppSettings["IpAddress"];
         var configPort = ConfigurationManager.AppSettings["Port"];
         var configAETitle = ConfigurationManager.AppSettings["AETitle"];
+        var configModality = ConfigurationManager.AppSettings["Modality"];
 
+        // AETitle,CallingAE,Modality,Port,IpAddress
+        
+        if(args.Length == 0) {
+            Console.WriteLine("启动服务器 没有传入任何参数默认启动");
+        } else if(args.Length == 1){
+            ConsoleLogger.Instance.Debug("启动服务器 监听端口:{0}", args);
+            configPort = args[0];
+            //Console.WriteLine("启动服务器 监听端口:" + args[0]);
+        } else if(args.Length == 3) {
+            ConsoleLogger.Instance.Debug("启动服务器 监听端口:{0} 检查类型:{1} 设备AEtitle:{2}", args);
+            configPort = args[0];
+            configModality = args[1];
+            configAETitle = args[2];
+            //Console.WriteLine("启动服务器 监听端口:" + args[0] + "\t 检查类型:" + args[1] + "\t AEtitle" + args[2]);
+        } else {
+            ConsoleLogger.Instance.Debug("参数个数有误 传入了{0}个参数 请检查参数列表",args.Length);
+        }
+        
         Console.WriteLine($"Starting QR SCP server with AET: {configAETitle} on ipAdress {configIpAddress} port {configPort}");
 
-        WorklistServer.Start(configIpAddress,  int.Parse(configPort), configAETitle);
+        WorklistServer.Start(configIpAddress,  int.Parse(configPort), configAETitle, configModality);
 
         Console.WriteLine("Press any key to stop the service");
 

+ 1 - 0
Desktop/Worklist/Worklist.csproj

@@ -84,6 +84,7 @@
     <Compile Include="Model\IMppsSource.cs" />
     <Compile Include="Model\IWorklistItemsSource.cs" />
     <Compile Include="Model\MppsHandler.cs" />
+    <Compile Include="Model\PeisWorklistItem.cs" />
     <Compile Include="Model\WorklistJsonHandler.cs" />
     <Compile Include="Model\WorklistItem.cs" />
     <Compile Include="Model\WorklistItemsProvider.cs" />

+ 16 - 1
Desktop/Worklist/WorklistServer.cs

@@ -21,7 +21,7 @@ namespace Worklist_SCP
       }
 
       public static string AETitle { get; set; }
-
+      public static string modality { get; set; }
 
       //public static IWorklistItemsSource CreateItemsSourceService => new WorklistItemsProvider();
 
@@ -56,6 +56,21 @@ namespace Worklist_SCP
             //    CurrentWorklistItems = newWorklistItems;
             //}, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
         }
+        public static void Start(string ipAdress ,int port, string aet, string _modality)
+        {
+           AETitle = aet;
+           modality = _modality;
+           
+           NetworkManager.SetImplementation(new DesktopNetworkManager());
+           Dicom.IO.IOManager.SetImplementation(new Dicom.IO.DesktopIOManager());
+           _server = DicomServer.Create<WorklistService>(ipAdress, port);
+           // every 30 seconds the worklist source is queried and the current list of items is cached in _currentWorklistItems
+           //_itemsLoaderTimer = new Timer((state) =>
+           //{
+           //    var newWorklistItems = CreateItemsSourceService.GetAllCurrentWorklistItems();
+           //    CurrentWorklistItems = newWorklistItems;
+           //}, null, TimeSpan.Zero, TimeSpan.FromSeconds(30));
+        }
 
 
         public static void Stop()

+ 12 - 6
Desktop/Worklist/WorklistService.cs

@@ -122,10 +122,14 @@ namespace Worklist_SCP
             foreach (var pc in association.PresentationContexts)
             {
                 if (pc.AbstractSyntax == DicomUID.Verification
-                    || pc.AbstractSyntax == DicomUID.ModalityWorklistInformationModelFIND
-                    || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepSOPClass
-                    || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepNotificationSOPClass
-                    || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepNotificationSOPClass)
+                    || pc.AbstractSyntax == DicomUID.ModalityWorklistInformationModelFind
+                    || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStep
+                    || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepNotification
+                    || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepNotification)
+                    // || pc.AbstractSyntax == DicomUID.ModalityWorklistInformationModelFIND
+                    // || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepSOPClass
+                    // || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepNotificationSOPClass
+                    // || pc.AbstractSyntax == DicomUID.ModalityPerformedProcedureStepNotificationSOPClass)
                 {
                     pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
                 }
@@ -149,7 +153,8 @@ namespace Worklist_SCP
 
         public DicomNCreateResponse OnNCreateRequest(DicomNCreateRequest request)
         {
-            if (request.SOPClassUID != DicomUID.ModalityPerformedProcedureStepSOPClass)
+            // if (request.SOPClassUID != DicomUID.ModalityPerformedProcedureStepSOPClass)
+                if (request.SOPClassUID != DicomUID.ModalityPerformedProcedureStep)
             {
                 return new DicomNCreateResponse(request, DicomStatus.SOPClassNotSupported);
             }
@@ -169,7 +174,8 @@ namespace Worklist_SCP
 
         public DicomNSetResponse OnNSetRequest(DicomNSetRequest request)
         {
-            if (request.SOPClassUID != DicomUID.ModalityPerformedProcedureStepSOPClass)
+            // if (request.SOPClassUID != DicomUID.ModalityPerformedProcedureStepSOPClass)
+            if (request.SOPClassUID != DicomUID.ModalityPerformedProcedureStep)
             {
                 return new DicomNSetResponse(request, DicomStatus.SOPClassNotSupported);
             }