Parcourir la source

b超代码上传调整 和回传提示解决

zackhua il y a 5 mois
Parent
commit
9a730aab1d

+ 2 - 0
LisPacsDataUpload/App.config

@@ -11,6 +11,8 @@
     <add key="start_time" value="7"/>
     <!--是否上传检查数据,1:上传,0不上传-->
     <add key="pacs" value="0"/>
+	  <!--是否上传lis数据,1:上传,0不上传-->
+	  <add key="lis" value="0"/>
     <!--清除多久以前已上传的数据(单位:月),整数,小于1不删除-->
     <add key="upload_time" value="1"/>
 

+ 314 - 21
LisPacsDataUpload/Form1.cs

@@ -3,8 +3,10 @@ using iTextSharp.text;
 using iTextSharp.text.pdf;
 using LisPacsDataUpload.business;
 using LisPacsDataUpload.Models;
+using LisPacsDataUpload.services;
 using Newtonsoft.Json;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
@@ -29,6 +31,7 @@ namespace LisPacsDataUpload
         //        int PageStart = (PageIndex - 1) * PageSize + 1;
         //int PageEnd = PageSize * PageIndex;
         private int UploadPacs;//是否上传pacs
+        private int UploadLis;//是否上传 Lis
         private string ShowLog = "";
         private int Lis_total = 0;//今日lis上传总数
         private int pacs_total = 0;//今日pacs上传总数
@@ -40,6 +43,8 @@ namespace LisPacsDataUpload
         private int open_multiple_upload_flag = 0;// 开启多个线程上传
 
         string lis_upload_url = "http://40.26.204.3:8084/phimp-napi/qyhrlischeckreportinfo/save"; //lis 上传接口地址
+        string pacs_upload_url = "http://40.26.204.3:8084/phimp-napi/qyhrpacscheckreportinfo/save"; //pacs 上传地址
+
         string file_url = "http://40.26.204.3:8084/phimp-napi/attachMent/upload";  // 文件上传地址
         private delegate void SetTextCallback(string text);
         //在给textBox1.text赋值的地方调用以下方法即可
@@ -60,7 +65,11 @@ namespace LisPacsDataUpload
             ShowCheckBox1();
             ShowCheckBox2();
             UploadPacs = OracleHelper<object>.UploadPacs();
-            GetLisDefault();
+            UploadLis = OracleHelper<object>.UploadLis();
+            if (UploadLis == 1)
+            {
+                GetLisDefault();
+            }
             if (UploadPacs == 1)
             {
                 GetPacsDefault();
@@ -264,33 +273,36 @@ namespace LisPacsDataUpload
                 return;
             }
             LogHelper.Info("zlhr=="+zlhr);
-            string name = "LIS1" + Tools.GuidTo16String();
-            Thread th = new Thread(new ParameterizedThreadStart(CountUpload));
-            th.IsBackground = true;
-            th.Name = name;
-            th.Start(name);
-            System.Threading.Thread.Sleep(5000);
-            string name2 = "LIS2" + Tools.GuidTo16String();
-            Thread th2 = new Thread(new ParameterizedThreadStart(LisUpload));
-            th2.IsBackground = true;
-            th2.Name = name2;
-            th2.Start(name2);
-
-            // 开启第二个上传
-            if (1== open_multiple_upload_flag)
+            if (UploadLis == 1)
             {
+                string name = "LIS1" + Tools.GuidTo16String();
+                Thread th = new Thread(new ParameterizedThreadStart(CountUpload));
+                th.IsBackground = true;
+                th.Name = name;
+                th.Start(name);
                 System.Threading.Thread.Sleep(5000);
-                string name3 = "LIS3" + Tools.GuidTo16String();
-                Thread th3 = new Thread(new ParameterizedThreadStart(LisUpload2));
-                th3.IsBackground = true;
-                th3.Name = name3;
-                th3.Start(name3);
+                string name2 = "LIS2" + Tools.GuidTo16String();
+                Thread th2 = new Thread(new ParameterizedThreadStart(LisUpload));
+                th2.IsBackground = true;
+                th2.Name = name2;
+                th2.Start(name2);
+
+                // 开启第二个上传
+                if (1 == open_multiple_upload_flag)
+                {
+                    System.Threading.Thread.Sleep(5000);
+                    string name3 = "LIS3" + Tools.GuidTo16String();
+                    Thread th3 = new Thread(new ParameterizedThreadStart(LisUpload2));
+                    th3.IsBackground = true;
+                    th3.Name = name3;
+                    th3.Start(name3);
+                }
             }
 
             if (UploadPacs == 1)//没传影像云的需要上传检查
             {
                 LogHelper.Info("没传影像云的需要上传检查");
-                Thread thp = new Thread(new ThreadStart(PacsUpload));
+                Thread thp = new Thread(new ThreadStart(PacsUploadNew));
                 thp.IsBackground = true;
                 thp.Name = "PACS" + Tools.GuidTo16String();
                 thp.Start();
@@ -1885,6 +1897,287 @@ namespace LisPacsDataUpload
             }
 
 
+        }
+
+        private void PacsUploadNew()
+        {
+            try
+            {
+                lock (PacsLock)
+                {
+                    int uploaded = 0;
+                   // string url_pacs = "http://40.26.204.3:8084/phimp-napi/qyhrpacscheckreportinfo/save";
+                    #region 1、生成、上传单条PACS文件及数据
+                    LogHelper.Info("[PACS]开始");
+                    
+                    DataTable dt = PacsUploadServiceImpl.getPacsDataTable();
+                    if (dt.Rows.Count > 0)
+                    {
+                        ShowLog = "本次需上传[PACS]数据总条数为[" + dt.Rows.Count + "]条,逐条上传中,请耐心等待。";
+                        this.SetText(ShowLog);
+                        int countAll = 0;
+                        for (int i = 0; i < dt.Rows.Count; i++)
+                        {
+                           string reportId =  dt.Rows[i]["reportId"].ToString();
+                            string businessNumber = dt.Rows[i]["businessNumber"].ToString();
+                            #region 获取报告数据并生成报告 开始
+
+                            string orgName = dt.Rows[i]["orgName"].ToString();
+                            string name = dt.Rows[i]["patientName"].ToString();
+                            string sex = dt.Rows[i]["sex"].ToString();
+                            string ch = dt.Rows[i]["bedNo"].ToString();
+                            string zyh = dt.Rows[i]["zyh"].ToString();
+                            string mzh = dt.Rows[i]["mzh"].ToString();//patientType
+                            string age = dt.Rows[i]["age"].ToString();
+                            string type;
+                            string patientType = dt.Rows[i]["patientType"].ToString();
+                            string dep = dt.Rows[i]["dep"].ToString();
+                            if (patientType == "1")
+                            {
+                                type = "门诊";
+                            }
+                            else if (patientType == "2")
+                            {
+                                type = "住院";
+                            }
+                            else if (patientType == "3")
+                            {
+                                type = "体检";
+                            }
+                            else
+                            {
+                                type = "其他";
+                            }
+                            string baseInfo = "姓名:{0}  性别:{1}  年龄:{2}  病人来源:{3}  床号:{4}  住院号:{5}   门诊号:{6}  申请科室:{7}";
+                            string findings = dt.Rows[i]["findings"].ToString();
+                            string diagnosResult = dt.Rows[i]["diagnosResult"].ToString();
+                            string signature = "签名:{0}  日期:{1}";
+                            string qname = dt.Rows[i]["auditorName"].ToString();
+                            string qdate = dt.Rows[i]["auditTime"].ToString();
+                            signature = string.Format(signature, qname, qdate);
+                            baseInfo = string.Format(baseInfo, name, sex, age, type, ch, zyh, mzh, dep);
+                            string res = CreatePDF(orgName, baseInfo, findings, diagnosResult, signature);
+                            if (res == "")
+                            {
+                                ShowLog = "生成PACS的PDF文件失败。[PACS]上传失败!跳过本条数据上传下一条。";
+                                LogHelper.Info(ShowLog);
+                                this.SetText(ShowLog);
+                                continue;
+                            }
+                            //获取报告数据并生成报告 结束
+                            #endregion
+
+
+                            // 这里需要获取原始报告
+
+
+                            //是否授权
+                            if (!isAuthorization())
+                            {
+                                continue;
+                            }
+
+                            string base64FileContent = Tools.FileToBase64Str(res);
+
+                            ResFile resfile = PdfUtils.uploadFileToPlatform(file_url, base64FileContent);
+                            if (resfile.statusCode != "1")
+                            {
+                                LogHelper.Info(resfile.message + ",[PACS]文件上传失败,跳过本条数据上传下一条。报告id = "+ reportId);
+                                ShowLog = reportId+" 报告上传失败,[PACS]文件上传失败,跳过本条数据上传下一条。";
+                                this.SetText(ShowLog);
+                                continue;
+                            }
+                            int file_count = PacsUploadServiceImpl.insertPdfForPacs(businessNumber, reportId,resfile.mainBody.attachmentId);
+                            if (file_count < 1)
+                            {
+                                ShowLog = "[PACS]新增表【已上传PDF】失败,跳过本条数据上传下一条。!";
+                                LogHelper.Info(ShowLog);
+                                this.SetText(ShowLog);
+                                continue;
+                            }
+                            countAll += 1;
+
+                            //上传数据
+
+                            List<PACS> list = PacsUploadServiceImpl.beginUploadPacsData(businessNumber,reportId);
+                            if (list.Count < 1)
+                            {
+                                continue;
+                            }
+
+                            List<Dictionary<string, object>> plist = new List<Dictionary<string, object>>();
+                            Dictionary<string, object> dic = new Dictionary<string, object>();
+                            foreach (var property in list[0].GetType().GetProperties())
+                            {
+                                dic.Add(property.Name, property.GetValue(list[0], null));
+                            }
+                            string lisitems_sql = @"Select * From pacs_upload_items t Where t.yzxgid = " + list[0].YZID + "";
+                            List<PacsItems> pacsItems = new List<PacsItems>();
+                            if (zlhr == zlhrConstant_true)
+                            {
+                                pacsItems = OracleHelper<PacsItems>.PgRunQueryList(lisitems_sql);
+                            }
+                            else
+                            {
+                                pacsItems = OracleHelper<PacsItems>.RunQueryList(lisitems_sql);
+                            }
+                            if (pacsItems.Count < 1)
+                            {
+                                LogHelper.Info("查询pacs检查项目明细数据为空,跳过本条数据上传下一条。");
+                                LogHelper.Info("执行sql:" + lisitems_sql);
+                                continue;
+                            }
+                            /*if (zlhr == zlhrConstant_true)
+                            {
+                                //处理 互认编码的数据 
+                                HandleLisItemDataForWebLis(lisitems);
+                            }*/
+
+                            dic.Add("ITEMLIST", pacsItems);
+                            plist.Add(dic);
+                            if (!isAuthorization())
+                            {
+                                continue;
+                            }
+
+                            string json_pacs = JsonConvert.SerializeObject(plist);
+                            //string json_pacs = Tools.ObjectToJson<List<PACS>>(list, Encoding.UTF8);
+                            json_pacs = "{\"mainBody\":" + json_pacs + "}";
+                            string json_pacs_log = json_pacs;
+                            string vi_pacs = Tools.GuidTo16String();
+                            json_pacs = Tools.AESEncrypt(json_pacs, Tools.pwd, vi_pacs);
+                            string res_pacs = Tools.WSCenterData(pacs_upload_url, json_pacs, vi_pacs, Tools.accessToken, 1);
+                            string res_aes_pacs = Tools.AESDecrypt(res_pacs, Tools.pwd, vi_pacs);
+                            //LogHelper.Info("[PACS]上传出参:" + res_aes_pacs);
+                            ResPacs respacs = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs), Encoding.UTF8);
+                            if (respacs.statusCode != "1")
+                            {
+                                ShowLog = respacs.message + ",[PACS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs;
+                                this.SetText(ShowLog);
+                                LogHelper.Info("[PACS]出错入参:" + json_pacs_log);
+                                LogHelper.Info("[PACS]出错出参:" + res_aes_pacs);
+                                continue;
+                            }
+                            else
+                            {
+                                pacs_total += 1;
+                                uploaded += 1;
+                                int upload_count = PacsUploadServiceImpl.updatePdfForPacs(businessNumber,reportId);
+                                if (upload_count < 1)
+                                {
+                                    LogHelper.Info("[PACS]更新表【已上传PDF】失败,跳过本条数据上传下一条!"+ reportId);
+                                    ShowLog = "[PACS]新增表【已上传PDF】失败,跳过本条数据上传下一条!执行sql:" + reportId;
+                                    this.SetText(ShowLog);
+                                    continue;
+                                }
+                            }
+                        }
+                        ShowLog = "本次已生成、上传[PACS]PDF文件总条数为[" + countAll + "]条,上传[PACS]总条数为[" + uploaded + "]条。";
+                        this.SetText(ShowLog);
+                        LogHelper.Info(ShowLog);
+                        GetPacsDefault();
+
+                    }
+                    #endregion
+                    #region 2、补传失败数据
+                    //上传数据
+                    LogHelper.Info("PACS补传失败数据");
+
+                    ShowLog = "PACS补传失败数据开始";
+                    this.SetText(ShowLog);
+
+                    List<PACS> list_pc = PacsUploadServiceImpl.completUploadPacsData();
+                    if (list_pc.Count < 1)
+                    {
+                        return;
+                    }
+                    int count_pc = 0;
+                    for (int i = 0; i < list_pc.Count; i++)
+                    {
+
+                        List<Dictionary<string, object>> plist_pc = new List<Dictionary<string, object>>();
+                        Dictionary<string, object> dic_pc = new Dictionary<string, object>();
+                        foreach (var property in list_pc[i].GetType().GetProperties())
+                        {
+                            dic_pc.Add(property.Name, property.GetValue(list_pc[i], null));
+                        }
+                        string pacsitems_sql = @"Select * From pacs_upload_items t Where t.yzxgid = " + list_pc[i].YZID + "";
+                        List<PacsItems> pacsItems = new List<PacsItems>();
+                        if (zlhr == zlhrConstant_true)
+                        {
+                            pacsItems = OracleHelper<PacsItems>.PgRunQueryList(pacsitems_sql);
+                        }
+                        else
+                        {
+                            pacsItems = OracleHelper<PacsItems>.RunQueryList(pacsitems_sql);
+                        }
+                        if (pacsItems.Count < 1)
+                        {
+                            LogHelper.Info("查询pacs检查项目明细数据为空,跳过本条数据上传下一条。");
+                            LogHelper.Info("执行sql:" + pacsitems_sql);
+                            continue;
+                        }
+
+                        dic_pc.Add("ITEMLIST", pacsItems);
+                        plist_pc.Add(dic_pc);
+                        if (!isAuthorization())
+                        {
+                            continue;
+                        }
+                        string json_pacs = JsonConvert.SerializeObject(plist_pc);
+                        //string json_pacs = Tools.ObjectToJson<List<PACS>>(list_pc[i], Encoding.UTF8);
+                        json_pacs = "{\"mainBody\":[" + json_pacs + "]}";
+                        string json_pacs_log = json_pacs;
+                        string vi_pacs = Tools.GuidTo16String();
+                        json_pacs = Tools.AESEncrypt(json_pacs, Tools.pwd, vi_pacs);
+                        string res_pacs = Tools.WSCenterData(pacs_upload_url, json_pacs, vi_pacs, Tools.accessToken, 1);
+                        string res_aes_pacs = Tools.AESDecrypt(res_pacs, Tools.pwd, vi_pacs);
+                        //LogHelper.Info("[PACS]上传出参:" + res_aes_pacs);
+                        ResPacs respacs = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs), Encoding.UTF8);
+                        if (respacs.statusCode != "1")
+                        {
+                            ShowLog = respacs.message + ",[PACS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs;
+                            this.SetText(ShowLog);
+                            LogHelper.Info("[PACS]出错入参:" + json_pacs_log);
+                            LogHelper.Info("[PACS]出错出参:" + res_aes_pacs);
+                            continue;
+                        }
+                        else
+                        {
+                            pacs_total += 1;
+                            count_pc += 1;
+                            string sql_upload = @"update 已上传PDF set UPLOADED = 1,UPLOADE_TIME = to_date('{2}','yyyy/mm/dd hh24:mi:ss') where type = 1
+                                                           and BUSINESSNUMBER = '{0}'
+                                                           and REPORTID = '{1}'";
+                            sql_upload = string.Format(sql_upload, list_pc[i].BUSINESSNUMBER, list_pc[i].REPORTID, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
+                            int upload_count = OracleHelper<object>.ExecuteNonQuery(sql_upload);
+                            if (upload_count < 1)
+                            {
+                                LogHelper.Info("[PACS]更新表【已上传PDF】失败,跳过本条数据上传下一条!");
+                                LogHelper.Info("执行sql:" + sql_upload);
+                                ShowLog = "[PACS]新增表【已上传PDF】失败,跳过本条数据上传下一条!执行sql:" + sql_upload;
+                                this.SetText(ShowLog);
+                                continue;
+                            }
+                        }
+                    }
+                    if (count_pc > 0)
+                    {
+                        ShowLog = "本次补传[PACS]数据为[" + count_pc + "]条,等待下一次轮询。";
+                        this.SetText(ShowLog);
+                        LogHelper.Info(ShowLog);
+                        GetPacsDefault();
+                    }
+                    #endregion
+                }
+
+            }
+            catch (Exception ex)
+            {
+                LogHelper.Error(ex);
+            }
+
+
         }
         /// <summary>
         /// 生成pdf

+ 3 - 0
LisPacsDataUpload/Models/PACS.cs

@@ -87,5 +87,8 @@ namespace LisPacsDataUpload.Models
         public string STUDYUID { get; set; }  //  检查 UID,DICOM 中协议中影像检查唯一标识
 
 
+        public string YZID { get; set; }   //医嘱id   对应多检查的医嘱  相关部位的相关id
+
+
     }
 }

+ 6 - 0
LisPacsDataUpload/OracleHelper.cs

@@ -55,6 +55,12 @@ namespace LisPacsDataUpload
 
         }
 
+        public static int UploadLis()
+        {
+            return Convert.ToInt32(ConfigurationManager.AppSettings["lis"]);
+
+        }
+
         public static int UploadTime()
         {
             return Convert.ToInt32(ConfigurationManager.AppSettings["upload_time"]);

+ 21 - 0
LisPacsDataUpload/business/PdfUtils.cs

@@ -1,6 +1,7 @@
 using Common;
 using iTextSharp.text;
 using iTextSharp.text.pdf;
+using LisPacsDataUpload.Models;
 using LisPacsDataUpload.Models.Report;
 using Newtonsoft.Json;
 using System;
@@ -13,6 +14,7 @@ using System.Linq;
 using System.Net;
 using System.Reflection;
 using System.Security.Cryptography.X509Certificates;
+using System.Text;
 
 
 namespace LisPacsDataUpload.business
@@ -340,5 +342,24 @@ namespace LisPacsDataUpload.business
             public string Server { get; set; }
         }
 
+
+        public static ResFile uploadFileToPlatform(string file_url,string base64FileContent)
+        {
+            //上传文件
+            string file_json = "{\"attachmentType\":\".pdf\",\"attachmentName\":\"检查报告\",\"businessType\":\"A001\",\"attachmentFile\":\"" + base64FileContent + "\"}";
+            string file_vi = Tools.GuidTo16String();
+            file_json = Tools.AESEncrypt(file_json, Tools.pwd, file_vi);
+            string file_res = Tools.WSCenterData(file_url, file_json, file_vi, Tools.accessToken, 1);
+            string file_res_aes = Tools.AESDecrypt(file_res, Tools.pwd, file_vi);
+            ResFile resfile = Tools.JsonToObject<ResFile>(Tools.FormatStr(file_res_aes), Encoding.UTF8);
+            if (resfile.statusCode != "1")
+            {
+                LogHelper.Info("上传失败入参:" + file_json);
+                LogHelper.Info("出参:" + file_res_aes);
+            }
+            return resfile;
+
+        }
+
     }
 }

+ 265 - 0
LisPacsDataUpload/services/PacsUploadServiceImpl.cs

@@ -0,0 +1,265 @@
+using Common;
+using LisPacsDataUpload.Models;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LisPacsDataUpload.services
+{
+
+    //pacs 上传实现类
+    public class PacsUploadServiceImpl
+    {
+
+        public static DataTable getPacsDataTable()
+        {
+            string sql_pdf = @"select * from (Select rownum as rn,b.* From (select t.* from PACS_UPLOAD t 
+                                                       Where  t.attachmentId Is Null
+                                                       Order By to_date(t.AUDITTIME,'yyyy-mm-dd hh24:mi:ss')
+                                                       ) b 
+                                           )  Where rn <= 150";
+            DataTable dt = OracleHelper<object>.RunQueryDS(sql_pdf);
+            if (dt.Rows.Count < 1)
+            {
+                LogHelper.Info("本次无数据,或[PACS]PDF已生成并上传。");
+                LogHelper.Info("执行sql:" + sql_pdf);
+            }
+            return dt;
+
+        }
+
+        //更新  已上传pdf 表状态
+        public static int insertPdfForPacs(string businessNumber, string reportId, string attachmentId)
+        {
+            string sql = @"Insert Into 已上传PDF(BUSINESSNUMBER,REPORTID,TYPE,ATTACHMENTID,UPLOADED,UPLOADE_TIME) Values('{0}','{1}',1,'{2}',0, to_date('{3}','yyyy/mm/dd hh24:mi:ss'))";
+            sql = string.Format(sql, businessNumber, reportId, attachmentId, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
+            int file_count = OracleHelper<object>.ExecuteNonQuery(sql);
+            if (file_count < 1)
+            {
+                LogHelper.Info("updatePdfForPacs="+ file_count);
+            }
+            return file_count;
+
+        }
+
+        public static int updatePdfForPacs(string businessNumber, string reportId)
+        {
+            string sql_upload = @"update 已上传PDF set UPLOADED = 1,UPLOADE_TIME = to_date('{2}','yyyy/mm/dd hh24:mi:ss') where type = 1
+                                                           and BUSINESSNUMBER = '{0}'
+                                                           and REPORTID = '{1}'";
+            sql_upload = string.Format(sql_upload, businessNumber, reportId, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
+            int upload_count = OracleHelper<object>.ExecuteNonQuery(sql_upload);
+            if (upload_count < 1)
+            {
+                LogHelper.Info("updatePdfForPacs=" + upload_count);
+                LogHelper.Info("updatePdfForPacs执行sql:" + sql_upload);
+            }
+            return upload_count;
+
+        }
+
+        public static List<PACS> beginUploadPacsData(string businessNumber, string reportId)
+        {
+            string item_sql = @"select a.patientAge  ,
+                                        a.ageUnit ,
+                                        a.patientIdCard ,
+                                        a.inTime  ,
+                                        a.inpatientAreaName ,
+                                        a.roomNo  ,
+                                        a.bedNo ,
+                                        a.phoneNo ,
+                                        a.address ,
+                                        a.reportTypeName  ,
+                                        a.reportTypeCode  ,
+                                        a.diagnosisCode ,
+                                        a.diagnosisName ,
+                                        a.applyTime ,
+                                        a.applyerCode ,
+                                        a.applyerName ,
+                                        a.applyDeptCode ,
+                                        a.applyDeptName ,
+                                        a.applyOrgCode  ,
+                                        a.applyOrgName  ,
+                                        a.receiverTime  ,
+                                        a.receiverCode  ,
+                                        a.receiverName  ,
+                                        a.checkTime ,
+                                        a.checkerCode ,
+                                        a.checkerName ,
+                                        a.checkDeptCode ,
+                                        a.checkDeptName ,
+                                        a.reportTime  ,
+                                        a.reportorCode  ,
+                                        a.reportorName  ,
+                                        a.auditTime ,
+                                        a.auditorCode ,
+                                        a.auditorName ,
+                                        a.localItemId ,
+                                        a.standardItemId  ,
+                                        a.itemName  ,
+                                        a.purpose ,
+                                        a.testPrice ,
+                                        a.checkTypeCode ,
+                                        a.checkTypeName ,
+                                        a.positionCode  ,
+                                        a.positionName  ,
+                                        a.methodCode  ,
+                                        a.methodName  ,
+                                        a.isEnganced  ,
+                                        a.isMakeShadow  ,
+                                        a.process ,
+                                        a.findings  ,
+                                        a.diagnosResult ,
+                                        a.resultType  ,
+                                        a.unit  ,
+                                        a.machineType ,
+                                        a.machineCode ,
+                                        a.machineName ,
+                                        a.attachmentId  ,
+                                        a.studyInstanceUid  ,
+                                        a.dicomImgFtpUrl  ,
+                                        a.orgCode ,
+                                        a.orgName ,
+                                        a.pacsYunOrgCode  ,
+                                        a.reportId  ,
+                                        a.reportName  ,
+                                        a.reportType  ,
+                                        a.requestId ,
+                                        a.businessNumber  ,
+                                        a.patientType ,
+                                        a.patientName ,
+                                        a.patientSex  ,
+                                        a.patientBirthday ,
+                                        a.regionHr,
+                                        a.HEALTHNO,  
+                                        a.MEDICARENO ,  
+                                        a.ACCESSNUMBER,  
+                                        a.CONCLUSION,  
+                                        a.BRIEFHISTORY, 
+                                        a.ISIMAGESERVICE,  
+                                        a.STUDYUID  ,
+                                        a.YZID
+                                        from pacs_upload a ,已上传PDF b 
+                                        where b.businessnumber = a.BUSINESSNUMBER 
+                                        and b.reportid = a.REPORTID 
+                                        and b.attachmentid is not null
+                                        and b.uploaded = 0
+                                        and b.type = 1
+                                        and a.BUSINESSNUMBER = '{0}'
+                                        and a.REPORTID = '{1}'";
+            item_sql = string.Format(item_sql, businessNumber, reportId);
+            List<PACS> list = OracleHelper<PACS>.RunQueryList(item_sql);
+            if (list.Count < 1)
+            {
+                LogHelper.Info("查询PACS数据为空,跳过本条数据上传下一条。");
+                LogHelper.Info("执行sql:" + item_sql);
+            }
+
+            return list;
+        }
+
+
+        //补传数据  pacs
+        public static List<PACS> completUploadPacsData()
+        {
+            string pc_sql = @"select
+                                              a.patientAge  ,
+                                              a.ageUnit ,
+                                              a.patientIdCard ,
+                                              a.inTime  ,
+                                              a.inpatientAreaName ,
+                                              a.roomNo  ,
+                                              a.bedNo ,
+                                              a.phoneNo ,
+                                              a.address ,
+                                              a.reportTypeName  ,
+                                              a.reportTypeCode  ,
+                                              a.diagnosisCode ,
+                                              a.diagnosisName ,
+                                              a.applyTime ,
+                                              a.applyerCode ,
+                                              a.applyerName ,
+                                              a.applyDeptCode ,
+                                              a.applyDeptName ,
+                                              a.applyOrgCode  ,
+                                              a.applyOrgName  ,
+                                              a.receiverTime  ,
+                                              a.receiverCode  ,
+                                              a.receiverName  ,
+                                              a.checkTime ,
+                                              a.checkerCode ,
+                                              a.checkerName ,
+                                              a.checkDeptCode ,
+                                              a.checkDeptName ,
+                                              a.reportTime  ,
+                                              a.reportorCode  ,
+                                              a.reportorName  ,
+                                              a.auditTime ,
+                                              a.auditorCode ,
+                                              a.auditorName ,
+                                              a.localItemId ,
+                                              a.standardItemId  ,
+                                              a.itemName  ,
+                                              a.purpose ,
+                                              a.testPrice ,
+                                              a.checkTypeCode ,
+                                              a.checkTypeName ,
+                                              a.positionCode  ,
+                                              a.positionName  ,
+                                              a.methodCode  ,
+                                              a.methodName  ,
+                                              a.isEnganced  ,
+                                              a.isMakeShadow  ,
+                                              a.process ,
+                                              a.findings  ,
+                                              a.diagnosResult ,
+                                              a.resultType  ,
+                                              a.unit  ,
+                                              a.machineType ,
+                                              a.machineCode ,
+                                              a.machineName ,
+                                              a.attachmentId  ,
+                                              a.studyInstanceUid  ,
+                                              a.dicomImgFtpUrl  ,
+                                              a.orgCode ,
+                                              a.orgName ,
+                                              a.pacsYunOrgCode  ,
+                                              a.reportId  ,
+                                              a.reportName  ,
+                                              a.reportType  ,
+                                              a.requestId ,
+                                              a.businessNumber  ,
+                                              a.patientType ,
+                                              a.patientName ,
+                                              a.patientSex  ,
+                                              a.patientBirthday ,
+                                              a.regionHr,
+                                                a.HEALTHNO,  
+                                                a.MEDICARENO ,  
+                                                a.ACCESSNUMBER,  
+                                                a.CONCLUSION,  
+                                                a.BRIEFHISTORY, 
+                                                a.ISIMAGESERVICE,  
+                                                a.STUDYUID  ,
+                                                a.YZID
+                                              from pacs_upload a ,已上传PDF b 
+                                                where b.businessnumber = a.BUSINESSNUMBER 
+                                                and b.reportid = a.REPORTID 
+                                                and b.attachmentid is not null
+                                                and b.uploaded = 0
+                                                and b.type = 1";
+            List<PACS> list_pc = OracleHelper<PACS>.RunQueryList(pc_sql);
+            if (list_pc.Count < 1)
+            {
+                LogHelper.Info("查询补传PACS数据为空,等待下一次轮询。");
+                LogHelper.Info("执行sql:" + pc_sql);
+            }
+
+            return list_pc;
+        }
+
+    }
+}

+ 1 - 1
ZLPlugin_LisPacs_MR/SocketClient.cs

@@ -97,7 +97,7 @@ namespace ZLPlugin_LisPacs_MR
             //string message = "";
             try
             {
-                byte[] TempData = new byte[1024 * 10];
+                byte[] TempData = new byte[1024 * 1000];
                 while (IsRun)
                 {
                     //传递一个byte数组,用于接收数据。length表示接收了多少字节的数据

+ 2 - 1
ZLPlugin_LisPacs_MR/clsPlugin.cs

@@ -347,11 +347,12 @@ namespace ZLPlugin_LisPacs_MR
                     return false;
                 }
                     
-                Log.Info("退出循环!");
+                
                 Log.Info("listlis count!" + listlis.Count);
                 Log.Info("listpacs count!" + listpacs.Count);
                 if (!string.IsNullOrWhiteSpace(SocketClient.Message))
                 {
+                    Log.Info( SocketClient.Message);
                     ResultsEx rex = new ResultsEx();
                     rex = JSON.JsonToObject<ResultsEx>(Tools.FormatStr(SocketClient.Message), Encoding.UTF8);
                     if (rex.ResultCode == 2)//有互认