|
@@ -6,7 +6,6 @@ using LisPacsDataUpload.Models;
|
|
|
using LisPacsDataUpload.services;
|
|
|
using Newtonsoft.Json;
|
|
|
using System;
|
|
|
-using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Drawing;
|
|
@@ -281,14 +280,14 @@ namespace LisPacsDataUpload
|
|
|
th.Name = name;
|
|
|
th.Start(name);
|
|
|
System.Threading.Thread.Sleep(5000);
|
|
|
- string name2 = "LIS2" + Tools.GuidTo16String();
|
|
|
+ string name2 = "LIS1" + Tools.GuidTo16String();
|
|
|
Thread th2 = new Thread(new ParameterizedThreadStart(LisUpload));
|
|
|
th2.IsBackground = true;
|
|
|
th2.Name = name2;
|
|
|
th2.Start(name2);
|
|
|
|
|
|
System.Threading.Thread.Sleep(5000);
|
|
|
- string namecompletUpload = "LIS2" + Tools.GuidTo16String();
|
|
|
+ string namecompletUpload = "LisCompletUpload" + Tools.GuidTo16String();
|
|
|
Thread thredcompletUpload = new Thread(new ParameterizedThreadStart(LisCompletUpload));
|
|
|
thredcompletUpload.IsBackground = true;
|
|
|
thredcompletUpload.Name = namecompletUpload;
|
|
@@ -298,7 +297,7 @@ namespace LisPacsDataUpload
|
|
|
if (1 == open_multiple_upload_flag)
|
|
|
{
|
|
|
System.Threading.Thread.Sleep(5000);
|
|
|
- string name3 = "LIS3" + Tools.GuidTo16String();
|
|
|
+ string name3 = "LIS2" + Tools.GuidTo16String();
|
|
|
Thread th3 = new Thread(new ParameterizedThreadStart(LisUpload2));
|
|
|
th3.IsBackground = true;
|
|
|
th3.Name = name3;
|
|
@@ -425,7 +424,7 @@ namespace LisPacsDataUpload
|
|
|
if (zlhr == zlhrConstant_true)
|
|
|
{
|
|
|
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 100";
|
|
|
+ Order By t.AUDITTIME desc limit 100";
|
|
|
dt = OracleHelper<object>.PgQueryDS(lis_sql);
|
|
|
}
|
|
|
else
|
|
@@ -446,19 +445,21 @@ namespace LisPacsDataUpload
|
|
|
int uploaded = 0;
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
+ string requestId = dt.Rows[i]["requestId"].ToString();
|
|
|
+
|
|
|
//生成pdf
|
|
|
string generatePdfUrl = "未生成pdf成功";
|
|
|
if (zlhr == zlhrConstant_true)
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 临生免报告id
|
|
|
+ // 临生免报告id requestId
|
|
|
string sql_zlhr = @"select dr.id as id from specimen_rec sr, diagnosticreport_rec dr where sr.id = dr.specmids::int
|
|
|
and dr.status in ('3003', '3004') and sr.id = " + requestId;
|
|
|
DataTable dt_lis = OracleHelper<object>.PgQueryDS(sql_zlhr);
|
|
|
- string reportId = dt_lis.Rows[0]["id"].ToString();
|
|
|
- generatePdfUrl = PdfUtils.GeneratePdf(lisSource, reportId, reportId,null);
|
|
|
+ string id = dt_lis.Rows[0]["id"].ToString();
|
|
|
+ generatePdfUrl = PdfUtils.GeneratePdf(lisSource, id, id, null);
|
|
|
}
|
|
|
else if(lisSource==3){
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 申请id
|
|
|
+ // 申请id requestId
|
|
|
generatePdfUrl = PdfUtils.GeneratePdf(lisSource, requestId, requestId,null);
|
|
|
if (!generatePdfUrl.Contains(".pdf"))
|
|
|
{
|
|
@@ -470,9 +471,8 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
else if (lisSource == 10)
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 申请id
|
|
|
+ // 申请id requestId
|
|
|
string pdfUrl = dt.Rows[i]["pdfUrl"].ToString(); // 三方pdf地址 需要下载
|
|
|
-
|
|
|
generatePdfUrl = PdfUtils.GeneratePdf(lisSource, pdfUrl, requestId,null);
|
|
|
if (string.IsNullOrEmpty(generatePdfUrl))
|
|
|
{
|
|
@@ -484,9 +484,10 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 申请id
|
|
|
+ // 申请id requestId
|
|
|
//获取标本号 和报表编号
|
|
|
- string reportNumber = dt.Rows[i]["reportNumber"].ToString(); //报告编号
|
|
|
+ //报告编号 reportNumber
|
|
|
+ string reportNumber = dt.Rows[i]["reportNumber"].ToString();
|
|
|
string bbid = dt.Rows[i]["bbid"].ToString(); // 标本id
|
|
|
generatePdfUrl = PdfUtils.GeneratePdf(lisSource, reportNumber, bbid, requestId);
|
|
|
if (!generatePdfUrl.Contains(".pdf"))
|
|
@@ -514,6 +515,7 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogHelper.Info("generatePdfUrl=" + generatePdfUrl);
|
|
|
attachmentFile = Tools.FileToBase64Str(generatePdfUrl);
|
|
|
}
|
|
|
//LogHelper.Info("上传的文件类容==" + attachmentFile);
|
|
@@ -532,7 +534,6 @@ namespace LisPacsDataUpload
|
|
|
{
|
|
|
|
|
|
//写入后台表机构记录上传错误的数据
|
|
|
-
|
|
|
string errSql = @"Insert Into 互认报告上传异常记录(BUSINESSNUMBER,REPORTID,TYPE,ATTACHMENTID,REQUEST_DATA,IV,UPLOADED,UPLOADE_TIME) Values('{0}','{1}',2,'{2}',{3},{4},0,to_date('{5}','yyyy/mm/dd hh24:mi:ss'))";
|
|
|
errSql = string.Format(errSql, dt.Rows[i]["businessNumber"].ToString(), dt.Rows[i]["reportId"].ToString(), null, file_json, file_vi, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
int err_count = 0;
|
|
@@ -584,7 +585,8 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
pdfcountAll += 1;
|
|
|
|
|
|
-
|
|
|
+ string businessNumber = dt.Rows[i]["businessNumber"].ToString();
|
|
|
+ string reportId = dt.Rows[i]["reportId"].ToString();
|
|
|
//上传lis数据
|
|
|
string item_sql = @"select a.orgCode,
|
|
|
a.orgName,
|
|
@@ -647,7 +649,7 @@ namespace LisPacsDataUpload
|
|
|
a.reportorName,
|
|
|
a.sampleNotes,
|
|
|
a.checkPrice,
|
|
|
- a.attachmentId,
|
|
|
+ b.attachmentId,
|
|
|
a.patientId ,
|
|
|
a.healthNo ,
|
|
|
a.medicareNo ,
|
|
@@ -667,7 +669,7 @@ namespace LisPacsDataUpload
|
|
|
and b.type = 2
|
|
|
and a.BUSINESSNUMBER = '{0}'
|
|
|
and a.REPORTID = '{1}'";
|
|
|
- item_sql = string.Format(item_sql, dt.Rows[i]["businessNumber"].ToString(), dt.Rows[i]["reportId"].ToString());
|
|
|
+ item_sql = string.Format(item_sql, businessNumber, reportId);
|
|
|
List<LIS> list = new List<LIS>();
|
|
|
if (zlhr == zlhrConstant_true)
|
|
|
{
|
|
@@ -730,11 +732,9 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
-
|
|
|
//写入后台表机构记录上传错误的数据
|
|
|
-
|
|
|
string errSql = @"Insert Into 互认报告上传异常记录(BUSINESSNUMBER,REPORTID,TYPE,ATTACHMENTID,REQUEST_DATA,IV,UPLOADED,UPLOADE_TIME) Values('{0}','{1}',2,'{2}',{3},{4},0,to_date('{5}','yyyy/mm/dd hh24:mi:ss'))";
|
|
|
- errSql = string.Format(errSql, dt.Rows[i]["businessNumber"].ToString(), dt.Rows[i]["reportId"].ToString(), resfile.mainBody.attachmentId, json_pacs, vi_pacs, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
+ errSql = string.Format(errSql, businessNumber, reportId, resfile.mainBody.attachmentId, json_pacs, vi_pacs, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
int err_count = 0;
|
|
|
if (zlhr == zlhrConstant_true)
|
|
|
{
|
|
@@ -748,15 +748,13 @@ namespace LisPacsDataUpload
|
|
|
LogHelper.Info("写入后台表机构记录上传错误的数据" + err_count);
|
|
|
LogHelper.Info( e.Message);
|
|
|
continue;
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
string res_aes_pacs = Tools.AESDecrypt(res_pacs, Tools.pwd, vi_pacs);
|
|
|
ResPacs respacs = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs), Encoding.UTF8);
|
|
|
- LogHelper.Info("上传检验报告的接口状态==" + JsonConvert.SerializeObject(respacs));
|
|
|
+ LogHelper.Info(reportId+":lis1上传检验报告的接口状态==" + JsonConvert.SerializeObject(respacs));
|
|
|
if (respacs.statusCode != "1")
|
|
|
{
|
|
|
- ShowLog = respacs.message + ",[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs;
|
|
|
+ ShowLog = respacs.message + ",[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:reportId=" + reportId;
|
|
|
this.SetText(ShowLog);
|
|
|
LogHelper.Info(ShowLog);
|
|
|
LogHelper.Info("[LIS]出错入参:" + json_pacs_log);
|
|
@@ -805,85 +803,7 @@ namespace LisPacsDataUpload
|
|
|
this.SetText(ShowLog);
|
|
|
this.SetText("补传失败lis数据开始");
|
|
|
int count_pc = 0;
|
|
|
- string pc_sql = @"select a.orgCode,
|
|
|
- a.orgName,
|
|
|
- a.orgThrdCode,
|
|
|
- a.reportId,
|
|
|
- a.reportName,
|
|
|
- a.requestId,
|
|
|
- a.barcode,
|
|
|
- a.sampleNo,
|
|
|
- a.businessNumber,
|
|
|
- a.patientType,
|
|
|
- a.patientName,
|
|
|
- a.patientSex,
|
|
|
- a.patientBirthday,
|
|
|
- a.patientAge,
|
|
|
- a.ageUnit,
|
|
|
- a.patientIdCard,
|
|
|
- a.inpatientAreaName,
|
|
|
- a.roomNo,
|
|
|
- a.bedNo,
|
|
|
- a.phoneNo,
|
|
|
- a.address,
|
|
|
- a.reportType,
|
|
|
- a.reportTypeName,
|
|
|
- a.sampCode,
|
|
|
- a.sampName,
|
|
|
- a.diagnosisCode,
|
|
|
- a.diagnosisName,
|
|
|
- a.resultType,
|
|
|
- a.applyTime,
|
|
|
- a.applyerCode,
|
|
|
- a.applyerName,
|
|
|
- a.applyDeptCode,
|
|
|
- a.applyDeptName,
|
|
|
- a.collectTime,
|
|
|
- a.collectCode,
|
|
|
- a.collectName,
|
|
|
- a.transportCode,
|
|
|
- a.transportName,
|
|
|
- a.transportDeptCode,
|
|
|
- a.transportDeptName,
|
|
|
- a.transportOrgCode,
|
|
|
- a.transportOrgName,
|
|
|
- a.acceptTime,
|
|
|
- a.acceptorCode,
|
|
|
- a.acceptorName,
|
|
|
- a.receiveTime,
|
|
|
- a.receiverCode,
|
|
|
- a.receiverName,
|
|
|
- a.checkTime,
|
|
|
- a.checkerCode,
|
|
|
- a.checkerName,
|
|
|
- a.checkDeptCode,
|
|
|
- a.checkDeptName,
|
|
|
- a.auditTime,
|
|
|
- a.auditorCode,
|
|
|
- a.auditorName,
|
|
|
- a.reportTime,
|
|
|
- a.reportorCode,
|
|
|
- a.reportorName,
|
|
|
- a.sampleNotes,
|
|
|
- a.checkPrice,
|
|
|
- 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
|
|
|
- and b.attachmentid is not null
|
|
|
- and b.uploaded = 0
|
|
|
- and b.type = 2 ";
|
|
|
+ string pc_sql = @"select * from lis_complet_upload ";
|
|
|
LogHelper.Info("补传lis数据执行sql:" + pc_sql);
|
|
|
List<LIS> list_pc = new List<LIS>();
|
|
|
if (zlhr == zlhrConstant_true)
|
|
@@ -970,14 +890,12 @@ namespace LisPacsDataUpload
|
|
|
LogHelper.Info("写入后台表机构记录上传错误的数据" + err_count);
|
|
|
LogHelper.Info(e.Message);
|
|
|
continue;
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
string res_aes_pacs_pc = Tools.AESDecrypt(res_pacs_pc, Tools.pwd, vi_pacs_pc);
|
|
|
ResPacs respacs_pc = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs_pc), Encoding.UTF8);
|
|
|
if (respacs_pc.statusCode != "1")
|
|
|
{
|
|
|
- ShowLog = respacs_pc.message + ",补传[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs_pc;
|
|
|
+ ShowLog = respacs_pc.message + ",补传[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:reportId=" + list_pc[i].REPORTID;
|
|
|
this.SetText(ShowLog);
|
|
|
LogHelper.Info(ShowLog);
|
|
|
LogHelper.Info("[LIS]出错入参:" + json_pacs_log_pc);
|
|
@@ -1048,85 +966,7 @@ namespace LisPacsDataUpload
|
|
|
this.SetText(ShowLog);
|
|
|
this.SetText("补传失败lis数据开始");
|
|
|
int count_pc = 0;
|
|
|
- string pc_sql = @"select a.orgCode,
|
|
|
- a.orgName,
|
|
|
- a.orgThrdCode,
|
|
|
- a.reportId,
|
|
|
- a.reportName,
|
|
|
- a.requestId,
|
|
|
- a.barcode,
|
|
|
- a.sampleNo,
|
|
|
- a.businessNumber,
|
|
|
- a.patientType,
|
|
|
- a.patientName,
|
|
|
- a.patientSex,
|
|
|
- a.patientBirthday,
|
|
|
- a.patientAge,
|
|
|
- a.ageUnit,
|
|
|
- a.patientIdCard,
|
|
|
- a.inpatientAreaName,
|
|
|
- a.roomNo,
|
|
|
- a.bedNo,
|
|
|
- a.phoneNo,
|
|
|
- a.address,
|
|
|
- a.reportType,
|
|
|
- a.reportTypeName,
|
|
|
- a.sampCode,
|
|
|
- a.sampName,
|
|
|
- a.diagnosisCode,
|
|
|
- a.diagnosisName,
|
|
|
- a.resultType,
|
|
|
- a.applyTime,
|
|
|
- a.applyerCode,
|
|
|
- a.applyerName,
|
|
|
- a.applyDeptCode,
|
|
|
- a.applyDeptName,
|
|
|
- a.collectTime,
|
|
|
- a.collectCode,
|
|
|
- a.collectName,
|
|
|
- a.transportCode,
|
|
|
- a.transportName,
|
|
|
- a.transportDeptCode,
|
|
|
- a.transportDeptName,
|
|
|
- a.transportOrgCode,
|
|
|
- a.transportOrgName,
|
|
|
- a.acceptTime,
|
|
|
- a.acceptorCode,
|
|
|
- a.acceptorName,
|
|
|
- a.receiveTime,
|
|
|
- a.receiverCode,
|
|
|
- a.receiverName,
|
|
|
- a.checkTime,
|
|
|
- a.checkerCode,
|
|
|
- a.checkerName,
|
|
|
- a.checkDeptCode,
|
|
|
- a.checkDeptName,
|
|
|
- a.auditTime,
|
|
|
- a.auditorCode,
|
|
|
- a.auditorName,
|
|
|
- a.reportTime,
|
|
|
- a.reportorCode,
|
|
|
- a.reportorName,
|
|
|
- a.sampleNotes,
|
|
|
- a.checkPrice,
|
|
|
- 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
|
|
|
- and b.attachmentid is not null
|
|
|
- and b.uploaded = 0
|
|
|
- and b.type = 2 ";
|
|
|
+ string pc_sql = @"select * from lis_complet_upload ";
|
|
|
LogHelper.Info("补传lis数据执行sql:" + pc_sql);
|
|
|
List<LIS> list_pc = new List<LIS>();
|
|
|
if (zlhr == zlhrConstant_true)
|
|
@@ -1215,7 +1055,7 @@ namespace LisPacsDataUpload
|
|
|
ResPacs respacs_pc = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs_pc), Encoding.UTF8);
|
|
|
if (respacs_pc.statusCode != "1")
|
|
|
{
|
|
|
- ShowLog = respacs_pc.message + ",补传[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs_pc;
|
|
|
+ ShowLog = respacs_pc.message + ",补传[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:REPORTID=" + list_pc[i].REPORTID;
|
|
|
this.SetText(ShowLog);
|
|
|
LogHelper.Info(ShowLog);
|
|
|
LogHelper.Info("[LIS]出错入参:" + json_pacs_log_pc);
|
|
@@ -1267,9 +1107,6 @@ namespace LisPacsDataUpload
|
|
|
{
|
|
|
LogHelper.Error(ex);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void HandleLisItemDataForWebLis(List<LISITEMS> items)
|
|
@@ -1368,21 +1205,24 @@ namespace LisPacsDataUpload
|
|
|
int uploaded = 0;
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
{
|
|
|
+ string businessNumber = dt.Rows[i]["businessNumber"].ToString();
|
|
|
+ string reportId = dt.Rows[i]["reportId"].ToString();
|
|
|
|
|
|
+ string requestId = dt.Rows[i]["requestId"].ToString();
|
|
|
//生成pdf
|
|
|
string generatePdfUrl = "未生成pdf成功";
|
|
|
if (zlhr == zlhrConstant_true)
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 临生免报告id
|
|
|
+ // 临生免报告id requestId
|
|
|
string sql_zlhr = @"select dr.id as id from specimen_rec sr, diagnosticreport_rec dr where sr.id = dr.specmids::int
|
|
|
and dr.status in ('3003', '3004') and sr.id = " + requestId;
|
|
|
DataTable dt_lis = OracleHelper<object>.PgQueryDS(sql_zlhr);
|
|
|
- string reportId = dt_lis.Rows[0]["id"].ToString();
|
|
|
- generatePdfUrl = PdfUtils.GeneratePdf(lisSource, reportId, reportId,null);
|
|
|
+ string id = dt_lis.Rows[0]["id"].ToString();
|
|
|
+ generatePdfUrl = PdfUtils.GeneratePdf(lisSource, id, id, null);
|
|
|
}
|
|
|
else if (lisSource == 3)
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 申请id
|
|
|
+ // 申请id requestId
|
|
|
generatePdfUrl = PdfUtils.GeneratePdf(lisSource, requestId, requestId, null);
|
|
|
if (!generatePdfUrl.Contains(".pdf"))
|
|
|
{
|
|
@@ -1394,9 +1234,8 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
else if (lisSource == 10)
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 申请id
|
|
|
+ // 申请id requestId
|
|
|
string pdfUrl = dt.Rows[i]["pdfUrl"].ToString(); // 三方pdf地址 需要下载
|
|
|
-
|
|
|
generatePdfUrl = PdfUtils.GeneratePdf(lisSource, pdfUrl, requestId, null);
|
|
|
if (string.IsNullOrEmpty(generatePdfUrl))
|
|
|
{
|
|
@@ -1408,7 +1247,7 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- string requestId = dt.Rows[i]["requestId"].ToString(); // 申请id
|
|
|
+ // 申请id requestId
|
|
|
//获取标本号 和报表编号
|
|
|
string reportNumber = dt.Rows[i]["reportNumber"].ToString(); //报告编号
|
|
|
string bbid = dt.Rows[i]["bbid"].ToString(); // 标本id
|
|
@@ -1422,7 +1261,6 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
LogHelper.Info("生成pdf成功,地址为 = " + generatePdfUrl);
|
|
|
}
|
|
|
-
|
|
|
//是否授权
|
|
|
if (!isAuthorization())
|
|
|
{
|
|
@@ -1454,7 +1292,7 @@ namespace LisPacsDataUpload
|
|
|
LogHelper.Info("写入后台表机构记录上传错误的数据");
|
|
|
//写入后台表机构记录上传错误的数据
|
|
|
string errSql = @"Insert Into 互认报告上传异常记录(BUSINESSNUMBER,REPORTID,TYPE,ATTACHMENTID,REQUEST_DATA,IV,UPLOADED,UPLOADE_TIME) Values('{0}','{1}',2,'{2}',{3},{4},0,to_date('{5}','yyyy/mm/dd hh24:mi:ss'))";
|
|
|
- errSql = string.Format(errSql, dt.Rows[i]["businessNumber"].ToString(), dt.Rows[i]["reportId"].ToString(), null, file_json, file_vi, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
+ errSql = string.Format(errSql, businessNumber, reportId, null, file_json, file_vi, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
int err_count = 0;
|
|
|
if (zlhr == zlhrConstant_true)
|
|
|
{
|
|
@@ -1474,15 +1312,15 @@ namespace LisPacsDataUpload
|
|
|
ResFile resfile = Tools.JsonToObject<ResFile>(Tools.FormatStr(file_res_aes), Encoding.UTF8);
|
|
|
if (resfile.statusCode != "1")
|
|
|
{
|
|
|
- LogHelper.Info(resfile.message + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。thread2 ");
|
|
|
+ LogHelper.Info(resfile.message + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。thread2 reportId="+ reportId);
|
|
|
LogHelper.Info("入参:" + file_json);
|
|
|
LogHelper.Info("出参:" + file_res_aes);
|
|
|
- ShowLog = "入参:" + file_json + ",出参:" + file_res_aes + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。";
|
|
|
+ ShowLog = "入参:" + file_json + ",出参:" + file_res_aes + ",[LIS]PDF文件上传失败!跳过本条数据上传下一条。" + reportId;
|
|
|
this.SetText(ShowLog);
|
|
|
continue;
|
|
|
}
|
|
|
string sql = @"Insert Into 已上传PDF(BUSINESSNUMBER,REPORTID,TYPE,ATTACHMENTID,UPLOADED,UPLOADE_TIME) Values('{0}','{1}',2,'{2}',0,to_date('{3}','yyyy/mm/dd hh24:mi:ss'))";
|
|
|
- sql = string.Format(sql, dt.Rows[i]["businessNumber"].ToString(), dt.Rows[i]["reportId"].ToString(), resfile.mainBody.attachmentId, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
+ sql = string.Format(sql, businessNumber, reportId, resfile.mainBody.attachmentId, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
|
|
int file_count = 0;
|
|
|
if (zlhr==zlhrConstant_true)
|
|
|
{
|
|
@@ -1502,7 +1340,6 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
pdfcountAll += 1;
|
|
|
|
|
|
-
|
|
|
//上传lis数据
|
|
|
string item_sql = @"select a.orgCode,
|
|
|
a.orgName,
|
|
@@ -1565,7 +1402,7 @@ namespace LisPacsDataUpload
|
|
|
a.reportorName,
|
|
|
a.sampleNotes,
|
|
|
a.checkPrice,
|
|
|
- a.attachmentId,
|
|
|
+ b.attachmentId,
|
|
|
a.patientId ,
|
|
|
a.healthNo ,
|
|
|
a.medicareNo ,
|
|
@@ -1585,7 +1422,7 @@ namespace LisPacsDataUpload
|
|
|
and b.type = 2
|
|
|
and a.BUSINESSNUMBER = '{0}'
|
|
|
and a.REPORTID = '{1}'";
|
|
|
- item_sql = string.Format(item_sql, dt.Rows[i]["businessNumber"].ToString(), dt.Rows[i]["reportId"].ToString());
|
|
|
+ item_sql = string.Format(item_sql, businessNumber, reportId);
|
|
|
List<LIS> list = new List<LIS>();
|
|
|
if (zlhr==zlhrConstant_true)
|
|
|
{
|
|
@@ -1671,9 +1508,10 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
string res_aes_pacs = Tools.AESDecrypt(res_pacs, Tools.pwd, vi_pacs);
|
|
|
ResPacs respacs = Tools.JsonToObject<ResPacs>(Tools.FormatStr(res_aes_pacs), Encoding.UTF8);
|
|
|
+ LogHelper.Info(reportId + ":lis2上传检验报告的接口状态==" + JsonConvert.SerializeObject(respacs));
|
|
|
if (respacs.statusCode != "1")
|
|
|
{
|
|
|
- ShowLog = respacs.message + ",thread2 ,[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:" + vi_pacs;
|
|
|
+ ShowLog = respacs.message + ",thread2 ,[LIS]数据上传异常!跳过本条数据上传下一条,偏移量为:REPORTID=" + list[0].REPORTID;
|
|
|
this.SetText(ShowLog);
|
|
|
LogHelper.Info(ShowLog);
|
|
|
LogHelper.Info("thread2 [LIS]出错入参:" + json_pacs_log);
|
|
@@ -1707,7 +1545,6 @@ namespace LisPacsDataUpload
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
ShowLog = Thread_name + "thread2 本次已生成、上传[LIS]PDF文件总条数为[" + pdfcountAll + "]条,上传[LIS]总条数为[" + uploaded + "]条。";
|
|
@@ -1816,7 +1653,17 @@ namespace LisPacsDataUpload
|
|
|
string file_vi = Tools.GuidTo16String();
|
|
|
file_json = Tools.AESEncrypt(file_json, Tools.pwd, file_vi);
|
|
|
string file_url = "http://40.26.204.3:8084/phimp-napi/attachMent/upload";
|
|
|
- string file_res = Tools.WSCenterData(file_url, file_json, file_vi, Tools.accessToken, 1);
|
|
|
+ //string file_res = Tools.WSCenterData(file_url, file_json, file_vi, Tools.accessToken, 1);
|
|
|
+ string file_res=string.Empty;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ file_res = Tools.WSCenterData(file_url, file_json, file_vi, Tools.accessToken, 1);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ LogHelper.Error(e, "pacs 报告生成上传失败");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
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")
|
|
@@ -1898,7 +1745,7 @@ namespace LisPacsDataUpload
|
|
|
a.machineType ,
|
|
|
a.machineCode ,
|
|
|
a.machineName ,
|
|
|
- a.attachmentId ,
|
|
|
+ b.attachmentId ,
|
|
|
a.studyInstanceUid ,
|
|
|
a.dicomImgFtpUrl ,
|
|
|
a.orgCode ,
|
|
@@ -1948,7 +1795,17 @@ namespace LisPacsDataUpload
|
|
|
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(url_pacs, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ //string res_pacs = Tools.WSCenterData(url_pacs, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ string res_pacs = string.Empty;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ res_pacs = Tools.WSCenterData(url_pacs, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ LogHelper.Error(e, "pacs 报告上传失败");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
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);
|
|
@@ -2047,7 +1904,7 @@ namespace LisPacsDataUpload
|
|
|
a.machineType ,
|
|
|
a.machineCode ,
|
|
|
a.machineName ,
|
|
|
- a.attachmentId ,
|
|
|
+ b.attachmentId ,
|
|
|
a.studyInstanceUid ,
|
|
|
a.dicomImgFtpUrl ,
|
|
|
a.orgCode ,
|
|
@@ -2095,7 +1952,17 @@ namespace LisPacsDataUpload
|
|
|
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(url_pacs, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ //string res_pacs = Tools.WSCenterData(url_pacs, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ string res_pacs = string.Empty;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ res_pacs = Tools.WSCenterData(url_pacs, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ LogHelper.Error(e, "pacs 报告补传失败");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
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);
|
|
@@ -2292,7 +2159,17 @@ namespace LisPacsDataUpload
|
|
|
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_pacs = Tools.WSCenterData(pacs_upload_url, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ string res_pacs = string.Empty;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ res_pacs = Tools.WSCenterData(pacs_upload_url, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ LogHelper.Error(e, "pacs 报告上传失败");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
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);
|
|
@@ -2376,7 +2253,17 @@ namespace LisPacsDataUpload
|
|
|
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_pacs = Tools.WSCenterData(pacs_upload_url, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ string res_pacs = string.Empty;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ res_pacs = Tools.WSCenterData(pacs_upload_url, json_pacs, vi_pacs, Tools.accessToken, 1);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ LogHelper.Error(e, "pacs 报告上传失败");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
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);
|
|
@@ -2538,24 +2425,36 @@ namespace LisPacsDataUpload
|
|
|
private bool isAuthorization()
|
|
|
{
|
|
|
bool result = true;
|
|
|
- if (string.IsNullOrWhiteSpace(Tools.accessToken) || Tools.DateTimes == null || Tools.DateTimes <= DateTime.Now)
|
|
|
+ string res_aes = string.Empty;
|
|
|
+ try
|
|
|
{
|
|
|
- //获取授权
|
|
|
- string vi = Tools.GuidTo16String();
|
|
|
- string url = "http://40.26.204.3:8084/phimp-napi/token";
|
|
|
- string res = Tools.WSCenterData(url, "", vi);
|
|
|
- string res_aes = Tools.AESDecrypt(res, Tools.pwd, vi);
|
|
|
- Authorization ahz = Tools.JsonToObject<Authorization>(Tools.FormatStr(res_aes), Encoding.UTF8);
|
|
|
- if (ahz.statusCode != "1")
|
|
|
+ if (string.IsNullOrWhiteSpace(Tools.accessToken) || Tools.DateTimes == null || Tools.DateTimes <= DateTime.Now)
|
|
|
{
|
|
|
- ShowLog = ahz.message + ",获取Token授权失败!等待下一次轮询。";
|
|
|
- this.SetText(ShowLog);
|
|
|
- LogHelper.Info(ShowLog);
|
|
|
- result = false;
|
|
|
+ //获取授权
|
|
|
+ string vi = Tools.GuidTo16String();
|
|
|
+ string url = "http://40.26.204.3:8084/phimp-napi/token";
|
|
|
+ string res = Tools.WSCenterData(url, "", vi);
|
|
|
+ res_aes = Tools.AESDecrypt(res, Tools.pwd, vi);
|
|
|
+ Authorization ahz = Tools.JsonToObject<Authorization>(Tools.FormatStr(res_aes), Encoding.UTF8);
|
|
|
+ if (ahz.statusCode != "1")
|
|
|
+ {
|
|
|
+ ShowLog = ahz.message + ",获取Token授权失败!等待下一次轮询。";
|
|
|
+ this.SetText(ShowLog);
|
|
|
+ LogHelper.Info(ShowLog);
|
|
|
+ result = false;
|
|
|
+ }
|
|
|
+ Tools.accessToken = ahz.mainBody.accessToken;
|
|
|
+ Tools.DateTimes = DateTime.Now.AddSeconds(int.Parse(ahz.mainBody.expirationTime));
|
|
|
}
|
|
|
- Tools.accessToken = ahz.mainBody.accessToken;
|
|
|
- Tools.DateTimes = DateTime.Now.AddSeconds(int.Parse(ahz.mainBody.expirationTime));
|
|
|
}
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ result = false;
|
|
|
+ LogHelper.Info("isAuthorization Exception=" + result);
|
|
|
+ LogHelper.Info(res_aes+"获取token异常" + e.Message);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ LogHelper.Info("isAuthorization="+ result);
|
|
|
return result;
|
|
|
}
|
|
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|