Browse Source

开启多个上传 模式参数 控制 和德江医嘱内容多个引号格式化 报错问题解决

zackhua 7 months ago
parent
commit
29ef8d6898

+ 54 - 31
LisPacsDataUpload/Form1.cs

@@ -35,6 +35,7 @@ namespace LisPacsDataUpload
         private string DicLis = AppDomain.CurrentDomain.BaseDirectory + "Lis\\";
 
         private int zlhr = 0;// 是否为临生免
+        private int open_multiple_upload_flag = 0;// 开启多个线程上传
         private delegate void SetTextCallback(string text);
         //在给textBox1.text赋值的地方调用以下方法即可
         public Form1()
@@ -65,7 +66,7 @@ namespace LisPacsDataUpload
         }
         private void ShowCheckBox1()
         {
-            string sql_lis = @"select 互认,zlhr from 互认配置表";
+            string sql_lis = @"select 互认,zlhr,open_multiple_upload from 互认配置表";
             DataTable dt_lis = OracleHelper<object>.RunQueryDS(sql_lis);
             int total = int.Parse(dt_lis.Rows[0]["互认"].ToString());
             if (total == 1)
@@ -81,6 +82,8 @@ namespace LisPacsDataUpload
             {
                 zlhr= zlhrValue;
             }
+            open_multiple_upload_flag = int.Parse(dt_lis.Rows[0]["open_multiple_upload"].ToString());
+
         }
         private void ShowCheckBox2()
         {
@@ -258,12 +261,16 @@ namespace LisPacsDataUpload
             th2.Name = name2;
             th2.Start(name2);
 
-           /* 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 (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)//没传影像云的需要上传检查
             {
@@ -951,27 +958,29 @@ namespace LisPacsDataUpload
                                                        t.attachmentId Is Null
                                                        Order By to_date(t.AUDITTIME,'yyyy-mm-dd hh24:mi:ss')
                                                        ) b 
-                                           ) where rn <30";
+                                           ) where rn <300 and rn >150  ";
+
                     DataTable dt = new DataTable();
                     if (zlhr == zlhrConstant_true)
                     {
                         /*limit 100  offset 100*/
                         lis_sql = @"Select t.* from lis_upload t  Where t.attachmentId Is Null
-                                                       Order By to_date(t.AUDITTIME,'yyyy-mm-dd hh24:mi:ss') limit 30 offset 30";
+                                                       Order By to_date(t.AUDITTIME,'yyyy-mm-dd hh24:mi:ss') limit 100 offset 100";
                         dt = OracleHelper<object>.PgQueryDS(lis_sql);
                     }
                     else
                     {
                         dt = OracleHelper<object>.RunQueryDS(lis_sql);
                     }
+                    LogHelper.Info("thread2  " + lis_sql);
                     if (dt.Rows.Count < 1)
                     {
-                        LogHelper.Info(Thread_name + "本次[LIS]无数据,等待下一次轮询。");
-                        LogHelper.Info("执行sql:" + lis_sql);
+                        LogHelper.Info(Thread_name + " thread2 本次[LIS]无数据,等待下一次轮询。");
+                        LogHelper.Info("thread2  执行sql:" + lis_sql);
                     }
                     else
                     {
-                        ShowLog = Thread_name + "本次需上传[LIS]数据总条数为[" + dt.Rows.Count + "]条,逐条上传中,请耐心等待。";
+                        ShowLog = Thread_name + "thread2  本次需上传[LIS]数据总条数为[" + dt.Rows.Count + "]条,逐条上传中,请耐心等待。";
                         this.SetText(ShowLog);
                         LogHelper.Info(ShowLog);
                         int pdfcountAll = 0;
@@ -1015,7 +1024,7 @@ namespace LisPacsDataUpload
                             baseInfo = string.Format(baseInfo, name, sex, age, type, ch, zyh, mzh, dep);
                             string reportId = dt.Rows[i]["reportId"].ToString();
                             string dt_sql = @"Select * From lis_upload_items t Where t.groupItemCode = '" + reportId + "'";
-                            LogHelper.Info("LIS 2 项目指标执行sql:" + dt_sql);
+                            LogHelper.Info("thread2  项目指标执行sql:" + dt_sql);
                             DataTable items = new DataTable();
                             if (zlhr==zlhrConstant_true)
                             {
@@ -1025,7 +1034,7 @@ namespace LisPacsDataUpload
                             {
                                 items = OracleHelper<object>.RunQueryDS(dt_sql);
                             }
-                            LogHelper.Info("LIS 2 项目指标执行sql 条数:" + items.Rows.Count);
+                            LogHelper.Info("thread2  项目指标执行sql 条数:" + items.Rows.Count);
                             if (items.Rows.Count < 1)
                             {
                                 LogHelper.Info("查询LIS项目指标数据为空,生成PDF失败,跳过本条数据生成下一条PDF。");
@@ -1055,7 +1064,7 @@ namespace LisPacsDataUpload
                             ResFile resfile = Tools.JsonToObject<ResFile>(Tools.FormatStr(file_res_aes), Encoding.UTF8);
                             if (resfile.statusCode != "1")
                             {
-                                LogHelper.Info(resfile.message + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。");
+                                LogHelper.Info(resfile.message + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。thread2 ");
                                 LogHelper.Info("入参:" + file_json);
                                 LogHelper.Info("出参:" + file_res_aes);
                                 ShowLog = "入参:" + file_json + ",出参:" + file_res_aes + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。";
@@ -1075,9 +1084,9 @@ namespace LisPacsDataUpload
                             }
                             if (file_count < 1)
                             {
-                                LogHelper.Info("[LIS]新增表【已上传PDF】失败,跳过本条数据上传下一条!");
-                                LogHelper.Info("执行sql:" + sql);
-                                ShowLog = "[LIS]新增表【已上传PDF】失败,跳过本条数据上传下一条!执行sql:" + sql;
+                                LogHelper.Info("thread2  [LIS]新增表【已上传PDF】失败,跳过本条数据上传下一条!");
+                                LogHelper.Info("thread2  执行sql:" + sql);
+                                ShowLog = "thread2  [LIS]新增表【已上传PDF】失败,跳过本条数据上传下一条!执行sql:" + sql;
                                 this.SetText(ShowLog);
                                 continue;
                             }
@@ -1146,7 +1155,18 @@ namespace LisPacsDataUpload
                                                         a.reportorName,
                                                         a.sampleNotes,
                                                         a.checkPrice,
-                                                        a.attachmentId
+                                                        a.attachmentId,
+                                                        a.patientId ,
+                                                        a.healthNo ,
+                                                        a.medicareNo ,
+                                                        a.socialNo ,
+                                                        a.inpatientAreaCode ,
+                                                        a.sampleName ,
+                                                        a.execHospitalCode ,
+                                                        a.execHospitalName,
+                                                        a.sameHospital,
+                                                        a.projectCode,
+                                                        a.projectName
                                                         from lis_upload a ,已上传PDF b 
                                                            where b.businessnumber = a.BUSINESSNUMBER 
                                                            and b.reportid = a.REPORTID 
@@ -1167,8 +1187,8 @@ namespace LisPacsDataUpload
                             }
                             if (list.Count < 1)
                             {
-                                LogHelper.Info("查询LIS数据为空,跳过本条数据上传下一条。");
-                                LogHelper.Info("执行sql:" + item_sql);
+                                LogHelper.Info("thread2  查询LIS数据为空,跳过本条数据上传下一条。");
+                                LogHelper.Info("thread2  执行sql:" + item_sql);
                                 continue;
                             }
                             List<Dictionary<string, object>> plist = new List<Dictionary<string, object>>();
@@ -1194,8 +1214,12 @@ namespace LisPacsDataUpload
                                 LogHelper.Info("执行sql:" + lisitems_sql);
                                 continue;
                             }
-                            //处理 互认编码的数据 
-                            HandleLisItemData(lisitems);
+                            if(zlhr == zlhrConstant_true)
+                            {
+                                //处理 互认编码的数据 
+                                HandleLisItemData(lisitems);
+                            }
+                            
                             dic.Add("DETAILLIST", lisitems);
                             plist.Add(dic);
                             //是否授权
@@ -1213,11 +1237,11 @@ namespace LisPacsDataUpload
                             ResPacs respacs = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs), Encoding.UTF8);
                             if (respacs.statusCode != "1")
                             {
-                                ShowLog = respacs.message + ",[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs;
+                                ShowLog = respacs.message + ",thread2 ,[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs;
                                 this.SetText(ShowLog);
                                 LogHelper.Info(ShowLog);
-                                LogHelper.Info("[LIS]出错入参:" + json_pacs_log);
-                                LogHelper.Info("[LIS]出错出参:" + res_aes_pacs);
+                                LogHelper.Info("thread2  [LIS]出错入参:" + json_pacs_log);
+                                LogHelper.Info("thread2  [LIS]出错出参:" + res_aes_pacs);
                                 continue;
                             }
                             else
@@ -1239,9 +1263,9 @@ namespace LisPacsDataUpload
                                 }
                                 if (upload_count < 1)
                                 {
-                                    LogHelper.Info("[LIS]更新表【已上传PDF】失败,跳过本条数据上传下一条!");
-                                    LogHelper.Info("执行sql:" + sql_upload);
-                                    ShowLog = "[LIS]新增表【已上传PDF】失败,跳过本条数据上传下一条!执行sql:" + sql_upload;
+                                    LogHelper.Info("thread2  [LIS]更新表【已上传PDF】失败,跳过本条数据上传下一条!");
+                                    LogHelper.Info("thread2  执行sql:" + sql_upload);
+                                    ShowLog = "thread2  [LIS]新增表【已上传PDF】失败,跳过本条数据上传下一条!执行sql:" + sql_upload;
                                     this.SetText(ShowLog);
                                     continue;
                                 }
@@ -1250,13 +1274,12 @@ namespace LisPacsDataUpload
 
                         }
 
-                        ShowLog = Thread_name + "本次已生成、上传[LIS]PDF文件总条数为[" + pdfcountAll + "]条,上传[LIS]总条数为[" + uploaded + "]条。";
+                        ShowLog = Thread_name + "thread2  本次已生成、上传[LIS]PDF文件总条数为[" + pdfcountAll + "]条,上传[LIS]总条数为[" + uploaded + "]条。";
                         this.SetText(ShowLog);
                         LogHelper.Info(ShowLog);
                         GetLisDefault();
                     }
 
-
                     #endregion
 
                    

+ 4 - 4
LisPacsDataUpload/Models/Count.cs

@@ -26,10 +26,10 @@ namespace LisPacsDataUpload.Models
         public string ITEMNAMES { get; set; }//开单项目名称(多个项目使用英文逗号拼接,如:肝功能,肾功能,血脂六项)
 
         public string APPLYTIME { get; set; }  //开单时间
-        public string hisApplyCode { get; set; }  //机构开单编号(HIS 开申请单传递给平台的唯一主键)
-        public string patientType { get; set; } //患者类型(1:门诊 2:住院3:体检4:公卫5:其他)
-        public string doctorCode { get; set; } // 是 医生编号
-        public string doctorName { get; set; } //医生名称
+        public string HISAPPLYCODE { get; set; }  //机构开单编号(HIS 开申请单传递给平台的唯一主键)
+        public string PATIENTTYPE { get; set; } //患者类型(1:门诊 2:住院3:体检4:公卫5:其他)
+        public string DOCTORCODE { get; set; } // 是 医生编号
+        public string DOCTORNAME { get; set; } //医生名称
 
 
     }

+ 2 - 2
ZLPlugin_LisPacs_MR/LisPacs_MR_Bll.cs

@@ -261,7 +261,7 @@ namespace ZLPlugin_LisPacs_MR
 
         public static string GetTotalPriceForLisByZLXM(string zlxmid)
         {
-            string sql = @"Select sum(现价) 金额 from 收费价目 where  终止日期 > sysdate  and 收费细目id in (select 收费项目id from 诊疗收费关系 where 诊疗项目id = {0} )";
+            string sql = @"Select nvl(sum(现价),'0') 金额 from 收费价目 where  终止日期 > sysdate  and 收费细目id in (select 收费项目id from 诊疗收费关系 where 诊疗项目id = {0} )";
             sql = string.Format(sql, zlxmid);
             Log.Info("GetTotalPriceForLisByZLXM==" + sql);
             Recordset rd = new Recordset();
@@ -271,7 +271,7 @@ namespace ZLPlugin_LisPacs_MR
                 rd.MoveFirst();
                 return rd.Fields["金额"].Value.ToString();
             }
-            return "";
+            return "0";
         }
 
         /// <summary>

+ 2 - 2
ZLPlugin_LisPacs_MR/Properties/AssemblyInfo.cs

@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
 // General Information about an assembly is controlled through the following 
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("互认新加金额字段和其他三个字段")]
+[assembly: AssemblyTitle("互认金额版本和金额默认设置为0,以及医嘱内容引号解决")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("zlsoft")]
@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.4.35.140")]
-[assembly: AssemblyFileVersion("1.0.1.1")]
+[assembly: AssemblyFileVersion("1.0.1.3")]

+ 5 - 1
ZLPlugin_LisPacs_MR/Tools.cs

@@ -171,7 +171,11 @@ namespace ZLPlugin_LisPacs_MR
                         }
                         else
                         {
-                            if (rd.Fields[j].Name== "附项")
+                            if (rd.Fields[j].Name == "医嘱内容")
+                            {
+                                value += "\"" + rd.Fields[j].Name + "\":\"" + val.Replace("\"", " ") + "\",";
+                            }
+                            else if (rd.Fields[j].Name== "附项")
                             {
                                 value += "\"" + rd.Fields[j].Name + "\":null,";