|
|
|
|
@ -0,0 +1,289 @@ |
|
|
|
|
using LIS_Platform_Linker.Dtos.LIS; |
|
|
|
|
using LIS_Platform_Linker.Dtos.Platform; |
|
|
|
|
using LIS_Platform_Linker.Services.Interfaces; |
|
|
|
|
using LIS_Platform_Linker.Tools; |
|
|
|
|
using LIS_Platform_Linker.Tools.Extensions; |
|
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Data; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
|
|
namespace LIS_Platform_Linker.Services |
|
|
|
|
{ |
|
|
|
|
public class ReceiverService : IReceiverService |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
public ActionResult QueryApply(QueryApplyLISRequest queryApplyLISRequest) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
LoggerHelper.Log.Info("【查询申请单】接收入参:" + JsonConvert.SerializeObject(queryApplyLISRequest)); |
|
|
|
|
|
|
|
|
|
var request = new BasePlatformRequest("QUERYAPPLY"); |
|
|
|
|
var data = new QueryApplyData(); |
|
|
|
|
request.data = data; |
|
|
|
|
var queryApply = new QueryApply(); |
|
|
|
|
data.queryapply = queryApply; |
|
|
|
|
queryApply.srclabcode = queryApplyLISRequest.srclabcode; |
|
|
|
|
queryApply.srclabname = queryApplyLISRequest.srclabname; |
|
|
|
|
queryApply.targetlabcode = ConfigHelper.HospitalCode; |
|
|
|
|
queryApply.targetlabname = ConfigHelper.HospitalName; |
|
|
|
|
queryApply.barcode = queryApplyLISRequest.barcode; |
|
|
|
|
queryApply.operatetime = DateTime.Now.ToStandardString(); |
|
|
|
|
queryApply.operatorcode = queryApplyLISRequest.operatorcode; |
|
|
|
|
queryApply.operatorname = queryApplyLISRequest.operatorname; |
|
|
|
|
|
|
|
|
|
var response = HttpClientHelper.Post(request); |
|
|
|
|
LoggerHelper.Log.Info("【查询申请单】返回结果:" + JsonConvert.SerializeObject(response)); |
|
|
|
|
return Result.Success(response); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
LoggerHelper.Log.Error(ex); |
|
|
|
|
return Result.Fail(ex.Message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ActionResult CancelRegApply(string jsonString) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ActionResult RejectApply(string jsonString) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ActionResult SubmitReport(SubmitReportLISRequest submitReportRequest) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
LoggerHelper.Log.Info("【发送报告单】接收入参:" + JsonConvert.SerializeObject(submitReportRequest)); |
|
|
|
|
|
|
|
|
|
var request = new BasePlatformRequest("SUBMITREPORT"); |
|
|
|
|
var datas = new List<SubmitReportData>(); |
|
|
|
|
request.data = datas; |
|
|
|
|
|
|
|
|
|
var now = DateTime.Now.ToStandardString(); |
|
|
|
|
foreach (string barcode in submitReportRequest.barcodes) |
|
|
|
|
{ |
|
|
|
|
var data = new SubmitReportData(); |
|
|
|
|
datas.Add(data); |
|
|
|
|
var report = new SubmitReport(); |
|
|
|
|
data.report = report; |
|
|
|
|
data.order = new List<SubmitOrder>(); |
|
|
|
|
data.file = new SubmitFile(); |
|
|
|
|
data.item = new List<SubmitItem>(); |
|
|
|
|
//data.bacterias = new List<SubmitBacteria>(); |
|
|
|
|
|
|
|
|
|
#region report |
|
|
|
|
|
|
|
|
|
string sql_report = $@"select ID, PatientName, PatientID, HisId, BirthDay, IDCardNo, Age, AgeClass, Sex, PatientClass, SpecimenCode, SpecimenName, SampleCode, ReportDate, Reporter, CheckDate, Checker, Description, TestDate from Rpt_Patient (NOLOCK) where barcode = '{barcode}'; "; |
|
|
|
|
var dt_report = DBHelper.ExecuteDataTable(sql_report); |
|
|
|
|
report.srclabcode = submitReportRequest.srclabcode; |
|
|
|
|
report.srclabname = submitReportRequest.srclabname; |
|
|
|
|
report.targetlabcode = ConfigHelper.HospitalCode; |
|
|
|
|
report.targetlabname = ConfigHelper.HospitalName; |
|
|
|
|
report.operatetime = now; |
|
|
|
|
report.operatorcode = submitReportRequest.operatorcode; |
|
|
|
|
report.operatorname = submitReportRequest.operatorname; |
|
|
|
|
report.barcode = barcode; |
|
|
|
|
report.reportno = dt_report.Rows[0]["ID"].ToString(); |
|
|
|
|
report.patname = dt_report.Rows[0]["PatientName"].ToString(); |
|
|
|
|
report.patientid = dt_report.Rows[0]["PatientID"].ToString(); |
|
|
|
|
report.cureno = dt_report.Rows[0]["HisId"].ToString(); |
|
|
|
|
report.hospno = dt_report.Rows[0]["HisId"].ToString(); |
|
|
|
|
report.cardno = dt_report.Rows[0]["HisId"].ToString(); |
|
|
|
|
report.cardtype = string.Empty; |
|
|
|
|
report.birthday = DateTime.Parse(dt_report.Rows[0]["BirthDay"].ToString()).ToStandardString(); |
|
|
|
|
report.idnum = dt_report.Rows[0]["IDCardNo"].ToString(); |
|
|
|
|
report.age = dt_report.Rows[0]["Age"].ToString(); |
|
|
|
|
report.ageunit = dt_report.Rows[0]["AgeClass"].ToString(); |
|
|
|
|
report.sex = dt_report.Rows[0]["Sex"].ToString(); |
|
|
|
|
report.wardorreg = string.Empty; |
|
|
|
|
report.wardorregname = dt_report.Rows[0]["PatientClass"].ToString(); |
|
|
|
|
report.samplecode = dt_report.Rows[0]["SpecimenCode"].ToString(); |
|
|
|
|
report.samplename = dt_report.Rows[0]["SpecimenName"].ToString(); |
|
|
|
|
report.sampledescode = string.Empty; |
|
|
|
|
report.sampledescname = string.Empty; |
|
|
|
|
report.sampleshapecode = string.Empty; |
|
|
|
|
report.sampleshapename = string.Empty; |
|
|
|
|
report.testinstid = string.Empty; |
|
|
|
|
report.testinstcode = string.Empty; |
|
|
|
|
report.testinstname = string.Empty; |
|
|
|
|
report.testtechno = dt_report.Rows[0]["SampleCode"].ToString(); |
|
|
|
|
report.exectime = dt_report.Rows[0]["ReportDate"].ToString(); |
|
|
|
|
report.execdoccode = string.Empty; |
|
|
|
|
report.execdocname = dt_report.Rows[0]["Reporter"].ToString(); |
|
|
|
|
report.verifytime = dt_report.Rows[0]["CheckDate"].ToString(); |
|
|
|
|
report.verifiercode = string.Empty; |
|
|
|
|
report.verifiername = dt_report.Rows[0]["Checker"].ToString(); |
|
|
|
|
report.reporttime = dt_report.Rows[0]["CheckDate"].ToString(); |
|
|
|
|
report.pubtime = dt_report.Rows[0]["CheckDate"].ToString(); |
|
|
|
|
report.pubdoccode = string.Empty; |
|
|
|
|
report.pubdocname = dt_report.Rows[0]["Checker"].ToString(); |
|
|
|
|
report.remark = dt_report.Rows[0]["Description"].ToString(); |
|
|
|
|
report.examresult = string.Empty; |
|
|
|
|
report.labdiagnosis = string.Empty; |
|
|
|
|
report.redoflag = "0"; |
|
|
|
|
report.redosample = string.Empty; |
|
|
|
|
report.redoreason = string.Empty; |
|
|
|
|
report.redosampledesc = string.Empty; |
|
|
|
|
report.panicflag = "0"; |
|
|
|
|
report.biohazardflag = "0"; |
|
|
|
|
report.micflag = "0"; |
|
|
|
|
report.finishflag = "1"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//测试用 |
|
|
|
|
//report.barcode = "260305000001"; |
|
|
|
|
//report.patname = "铁扎啊"; |
|
|
|
|
//report.birthday = "2002-12-10 00:00:00"; |
|
|
|
|
//report.idnum = "5327295272544448"; |
|
|
|
|
//report.age = "23"; |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region order |
|
|
|
|
string sql_order = $@"select ReqItemCode, ReqItemName, Cost, SerialNum, CostDate from Rpt_CheckCost where barcode = '{barcode}'; "; |
|
|
|
|
var dt_order = DBHelper.ExecuteDataTable(sql_order); |
|
|
|
|
foreach (DataRow dr in dt_order.Rows) |
|
|
|
|
{ |
|
|
|
|
var order = new SubmitOrder(); |
|
|
|
|
data.order.Add(order); |
|
|
|
|
|
|
|
|
|
order.itemcode = dr["ReqItemCode"].ToString(); |
|
|
|
|
order.itemname = dr["ReqItemName"].ToString(); |
|
|
|
|
order.itemtype = string.Empty; |
|
|
|
|
order.itemqty = string.Empty; |
|
|
|
|
order.itemunit = string.Empty; |
|
|
|
|
order.price = dr["Cost"].ToString(); |
|
|
|
|
order.hisapplyno = dr["SerialNum"].ToString(); |
|
|
|
|
order.groupno = string.Empty; |
|
|
|
|
order.logno = string.Empty; |
|
|
|
|
order.specimencode = data.report.samplecode; |
|
|
|
|
order.specimenname = data.report.samplename; |
|
|
|
|
order.status = "1"; |
|
|
|
|
order.chargeflag = dr["SerialNum"] == DBNull.Value ? "0" : "1"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region file |
|
|
|
|
|
|
|
|
|
var reportfiles = new List<ReportFile>(); |
|
|
|
|
data.file.reportfile = reportfiles; |
|
|
|
|
string sql_file = $@"select Report from Rpt_ReportFile where Barcode = '{barcode}'; "; |
|
|
|
|
var dt_file = DBHelper.ExecuteDataTable(sql_file); |
|
|
|
|
foreach (DataRow dr in dt_file.Rows) |
|
|
|
|
{ |
|
|
|
|
var reportfile = new ReportFile(); |
|
|
|
|
reportfiles.Add(reportfile); |
|
|
|
|
|
|
|
|
|
reportfile.filename = "报告文件"; |
|
|
|
|
reportfile.reportflag = "1"; |
|
|
|
|
reportfile.filetype = "9"; |
|
|
|
|
reportfile.filedata = dr["Report"].ToString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var itemimgs = new List<ItemImage>(); |
|
|
|
|
data.file.itemimg = itemimgs; |
|
|
|
|
string sql_img = $@"select RptItemCode, Img from Rpt_ImageResult where SampleCode='{dt_report.Rows[0]["SampleCode"]}' and TestDate = '{dt_report.Rows[0]["TestDate"]}'; "; |
|
|
|
|
var dt_img = DBHelper.ExecuteDataTable(sql_img); |
|
|
|
|
foreach (DataRow dr in dt_img.Rows) |
|
|
|
|
{ |
|
|
|
|
var itemimg = new ItemImage(); |
|
|
|
|
itemimgs.Add(itemimg); |
|
|
|
|
|
|
|
|
|
string[] imgcode = dr["RptItemCode"].ToString().Split(' ', StringSplitOptions.RemoveEmptyEntries); |
|
|
|
|
itemimg.itemcode = imgcode[0]; |
|
|
|
|
itemimg.filename = imgcode[1]; |
|
|
|
|
itemimg.filetype = "1"; |
|
|
|
|
itemimg.filedata = dr["Img"].ToString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
#region item |
|
|
|
|
|
|
|
|
|
string sql_item = $@"select C.RptItemCode, C.RptItemName, A.InTime, A.Result, A.ResultStr, A.Range, A.Unit, A.IsReview from Rpt_CheckResult A
|
|
|
|
|
join Rpt_Patient B on A.SampleCode=B.SampleCode and A.TestDate=B.TestDate |
|
|
|
|
join Dict_ReportItem C on A.RptItemCode=C.RptItemCode |
|
|
|
|
where B.Barcode = '{barcode}'; ";
|
|
|
|
|
var dt_item = DBHelper.ExecuteDataTable(sql_item); |
|
|
|
|
foreach (DataRow dr in dt_item.Rows) |
|
|
|
|
{ |
|
|
|
|
var item = new SubmitItem(); |
|
|
|
|
data.item.Add(item); |
|
|
|
|
|
|
|
|
|
item.itemnum = dr["RptItemCode"].ToString(); |
|
|
|
|
item.itemcode = dr["RptItemCode"].ToString(); |
|
|
|
|
item.itemname = dr["RptItemName"].ToString(); |
|
|
|
|
item.resulttime = DateTime.Parse(dr["InTime"].ToString()).ToStandardString(); |
|
|
|
|
item.instid = string.Empty; |
|
|
|
|
item.instcode = string.Empty; |
|
|
|
|
item.instname = string.Empty; |
|
|
|
|
item.resultvalue = dr["Result"].ToString(); |
|
|
|
|
item.resultchar = dr["ResultStr"].ToString(); |
|
|
|
|
item.result = dr["ResultStr"].ToString(); |
|
|
|
|
item.hintinfo = string.Empty; |
|
|
|
|
item.displayflag = "0"; |
|
|
|
|
item.hideflag = "0"; |
|
|
|
|
item.scientificflag = string.Empty; |
|
|
|
|
item.odresult = string.Empty; |
|
|
|
|
item.odresultchar = string.Empty; |
|
|
|
|
item.cutoffvalue = string.Empty; |
|
|
|
|
item.cutoffvaluechar = string.Empty; |
|
|
|
|
item.scovalue = string.Empty; |
|
|
|
|
item.scovaluechar = string.Empty; |
|
|
|
|
item.testmethod = string.Empty; |
|
|
|
|
item.printorder = string.Empty; |
|
|
|
|
item.highlowflag = string.Empty; |
|
|
|
|
item.referencerange = dr["Range"].ToString(); |
|
|
|
|
item.unit = dr["Unit"].ToString(); |
|
|
|
|
item.resulttype = string.Empty; |
|
|
|
|
item.redo = dr["IsReview"].ToString() == "1" ? "1" : "0"; |
|
|
|
|
item.panicflag = string.Empty; |
|
|
|
|
item.panicreferencerange = string.Empty; |
|
|
|
|
item.biohazardflag = string.Empty; |
|
|
|
|
item.scopicflag = string.Empty; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
} |
|
|
|
|
LoggerHelper.Log.Info("【发送报告单】发送对象:" + JsonConvert.SerializeObject(request)); |
|
|
|
|
var response = HttpClientHelper.Post(request); |
|
|
|
|
LoggerHelper.Log.Info("【发送报告单】返回结果:" + JsonConvert.SerializeObject(response)); |
|
|
|
|
return Result.Success(response); |
|
|
|
|
//LoggerHelper.Log.Info("【发送报告单】发送对象:" + JsonConvert.SerializeObject(request)); |
|
|
|
|
//return Result.Success(request); |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
LoggerHelper.Log.Error(ex); |
|
|
|
|
return Result.Fail(ex.Message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ActionResult CallbackReport(string jsonString) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ActionResult ImportPDF(string jsonString) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ActionResult QueryApplyByTime(string jsonString) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |