public KRResponse PostExamResult(ExamResultMetadata <T> result) { try { switch (this._type) { case ProductType.BMD: var bmdTcpService = _proxy as IBMDTcpService; var jsonStr = CommunicationHelper.SerializeObjToJsonStr(result); if (bmdTcpService != null) { return(bmdTcpService.PostExamResult(jsonStr)); } break; case ProductType.KRTCD: break; default: throw new ArgumentOutOfRangeException(); } } catch (Exception ex) { ClientHelper.TraceException("TCPClientManager.PostExamResult", "上传检查结果", ex.Message); } return(new KRResponse() { Status = "FAIL", Msg = "" }); }
public void SaveReportMetadata <T>(ExamResultMetadata <T> reportMetadata) where T : BaseCheckResult { var outPath = getOutPath(); var xml = CommunicationHelper.SerializerToXml(reportMetadata); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); doc.Save(outPath + "Report_" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff") + ".xml"); }
public override KRResponse PostExamResult(ExamResultMetadata <T> result) { var response = new KRResponse(); var nh = new KRNetworkingHelper <T>(result); bool isSuccSaveReport = false; bool isSuccDataSave = false; try { switch (Config.ReportSaveModel.ReportSaveType) { case "无": isSuccSaveReport = isSuccDataSave = nh.SaveCallBackData(); break; case "FTP": isSuccSaveReport = nh.SaveReportByFtp(result.Bitmap, ref _finalDir); isSuccDataSave = nh.SaveCallBackData(); break; case "文件夹": isSuccSaveReport = nh.SaveReportByDir(result.Bitmap, ref _finalDir); isSuccDataSave = nh.SaveCallBackData(); break; case "表": isSuccSaveReport = isSuccDataSave = nh.SaveCallBackData(result.Bitmap); break; default: break; } } catch (Exception ex) { throw new Exception("上传检查结果失败"); } StringBuilder resultSb = new StringBuilder(); resultSb.Append(isSuccSaveReport ? string.Empty : "报告单图片保存失败!"); resultSb.Append(resultSb.ToString().Length == 0 ? string.Empty : "\n"); resultSb.Append(isSuccDataSave ? string.Empty : "数据回写失败"); var msg = resultSb.ToString(); if (string.IsNullOrEmpty(msg)) { response.Msg = msg = "联网数据保存成功!"; response.Status = "SUCCESS"; } else { response.Msg = msg; response.Status = "FAIL"; } return(response); }
public override KRResponse PostExamResult(ExamResultMetadata <T> result) { try { return(mgr.PostExamResult(result)); } catch (System.Exception ex) { throw new System.Exception("上传检查结果失败"); } }
public KRResponse PostExamResult(ExamResultMetadata <BMDCheckResult> result) { if (result != null) { return(new KRResponse() { Status = "SUCCESS", Msg = "撒旦发射点发" }); } return(null); }
public KRResponse SendExamResult(ExamResultMetadata <T> result) { try { return(_client.PostExamResult(result)); } catch (Exception ex) { throw ex; } }
private void BuildHttpItem(ExamResultMetadata <T> checkResult, HttpItem pitem, string postResultUrl, string parameterName) { pitem.URL = postResultUrl; if (string.IsNullOrEmpty(parameterName)) { pitem.Postdata = CommunicationHelper.SerializeObjToJsonStr(checkResult); pitem.ContentType = "application/json"; } else { pitem.Postdata = AddToken(string.Format("{0}={1}", parameterName, CommunicationHelper.SerializeObjToJsonStr(checkResult))); pitem.ContentType = "application/x-www-form-urlencoded"; pitem.PostEncoding = Encoding.UTF8; } }
public override KRResponse PostExamResult(ExamResultMetadata <T> result) { try { var resultStr = CommunicationHelper.SerializeObjToJsonStr(result); string[] param = { ClientConstants.KR_POST_RESULT, resultStr }; var proxy = new WebServiceProxy(Config.HttpConfigModel.PostCheckResultUrl, Config.HttpConfigModel.WebServiceName); Trace.WriteLine(string.Format("开始发送检查结果,地址为{0}", Config.HttpConfigModel.PostCheckResultUrl)); var response = (string)proxy.ExecuteQuery(Config.HttpConfigModel.WebServiceName, param); Trace.WriteLine(string.Format("开始发送检查结果结束,返回结果{0}", resultStr)); return(CommunicationHelper.DeserializeJsonToObj <KRResponse>(response)); } catch (KRException ex) { throw new Exception("上传检查结果失败 " + ex.Msg); } }
public override KRResponse PostExamResult(ExamResultMetadata <T> checkResult) { try { var postResultUrl = Config.HttpConfigModel.PostCheckResultUrl; var parameterName = Config.HttpConfigModel.ResultParameterName; Trace.WriteLine(string.Format("开始发送检查结果,地址为{0}", postResultUrl)); if (!string.IsNullOrEmpty(parameterName)) { checkResult.ParamterName = parameterName; } var pitem = new HttpItem(); BuildHttpItem(checkResult, pitem, postResultUrl, parameterName); var result = PostData(pitem); KRResponse response = new KRResponse(); if (result.StatusCode == System.Net.HttpStatusCode.OK) { response.Msg = "联网数据上传成功"; response.Status = "SUCCESS"; } else { response.Msg = "联网数据上传失败"; response.Status = "FAIL"; } Trace.WriteLine(string.Format("开始发送检查结果结束,返回结果{0}", response.Status)); return(response); } catch (Exception ex) { throw new Exception("上传检查结果失败"); } }
public KRResponse PostExamResult(ExamResultMetadata <BMDCheckResult> result) { return(Provider.PostExamResult(result)); }
static void Main(string[] args) { //ClientProxy<BMDCheckResult> proxy = new ClientProxy<BMDCheckResult>(); //proxy.ConfigClient(ProductType.BMD, Protocol.WebService); ////Use CallUnknowWebService //var webSvcClient = proxy.ClientObj as WebServiceClient<BMDCheckResult>; //string[] param = { "20160101" }; //var result = webSvcClient.CallUnknowWebService("http://localhost:51374/WebService1.asmx", "GetPatient", param); //var patient = CommunicationHelper.DeserializeJsonToObj<Patient_DTO>(result); //Use config //[NET_CONFIG] //BassAddress=localhost //Port = 51374 //[BUSINESS] //GetPatientUrl=WebService1.asmx //PostCheckResultUrl = WebService1.asmx //var patient1 = proxy.GetPatient("20160101"); //ExamResultMetadata<BMDCheckResult> bmdCheckResult = new ExamResultMetadata<BMDCheckResult>() //{ // Diagnosis = "everything is good", // BrithDay = "19870808", // Age = 30, // CardID = "131002198702274615", // CardType = CardType.IDCard, // Name = "zhangshiwei", // Result = new BMDCheckResult() // { // Position = "zuo", // EOA = 22, // Fracturerisk = 55, // HP = 90, // LimbSide = "123", // PAB = 33, // TValue = 33, // ZValue = 89, // RRF = 98, // Percentage = 76, // Physical = "444", // SOS = 4233, // STI = 34 // } //}; ClientProxy <APIPWVCheckResult> proxy = new ClientProxy <APIPWVCheckResult>(); //proxy.ConfigClient(Protocol.Http); ExamResultMetadata <APIPWVCheckResult> ABIPWV = new ExamResultMetadata <APIPWVCheckResult>() { Diagnosis = "everything is good", BrithDay = "19870808", Age = 30, CardID = "131002198702274615", CardType = CardType.IDCard, Name = "zhangshiwei", Result = new APIPWVCheckResult() { ABIL = "3212", ABIR = "343", BAIL = "454", BAIR = "53", DBPLA = 123, DBPLB = 5656, DBPRA = 44, DBPRB = 454, MBPLA = 123, MBPLB = 123, MBPRA = 645, MBPRB = 654, PPLA = 64, PPLB = 345, PPRA = 435, PPRB = 456, PWVL = 123, PWVR = 234, SBPLA = 345, SBPLB = 345, SBPRA = 567, SBPRB = 77 } }; string json = CommunicationHelper.SerializeObjToJsonStr(ABIPWV); var response = proxy.SendExamResult(ABIPWV); //string result1 = PostWebRequest("http://121.42.41.188:8080/PostCheckExam", "checkresult=" + json, Encoding.UTF8); var response1 = CreateGetHttpResponse(string.Format("{0}{1}", "http://121.42.41.188:8080/AAS/PostCheckExam?checkresult=", json)); Console.Read(); //ExamResultMetadata<KRSGCheckResult> krsgCheckresult = new ExamResultMetadata<KRSGCheckResult>() //{ // Diagnosis = "everything is good", // BrithDay = "19870808", // Age = 30, // CardID = "131002198702274615", // CardType = CardType.IDCard, // Name = "zhangshiwei", // Result = new KRSGCheckResult() // { // BMI = 24.1f, // Brithday = "1987/01/01", // CurrentCount = 3, // DeviceID = "2015354878512", // Gender = 1, // Height = 198, // MeasureDateTime = "2016/05/09", // Order = 4, // PatientID = "201650548", // PatientName = "小明", // ScanCode = "65584", // Status = 2, // Temperature = 39.5f, // TotalCount = 44, // TransferIndex = 234, // TransferTotalCount = 2, // Weight = 59.5f // } //}; //string json = CommunicationHelper.SerializeObjToJsonStr(krsgCheckresult); //ExamResultMetadata<TCDDopplerCheckResult> dopplerCheckresult = new ExamResultMetadata<TCDDopplerCheckResult>() //{ // Diagnosis = "everything is good", // BrithDay = "19870808", // Age = 30, // CardID = "131002198702274615", // CardType = CardType.IDCard, // Name = "zhangshiwei", // Result = new TCDDopplerCheckResult() // { // Age = 20, // BaseLine = 33, // Depth = 4, // Filter = 6, // Gain = 6, // Gender = 1, // GraphUse = false, // HR = 4, // ImageFilePath = "", // ListUse = false, // Number = 5, // PI = 55, // PRF = 55, // ProbeHz = 33, // ProberDirection = 3, // ProbeType = 3, // RI = 5, // SBI = 55, // Scale = 5, // SD = 3, // StudyUID = "", // UID = "", // UseIndex = 3, // Vs = 43, // Vd = 34, // Vm = 1 // } //}; //string json = CommunicationHelper.SerializeObjToJsonStr(dopplerCheckresult); //var response = proxy.SendExamResult(bmdCheckResult); Console.Read(); }
public virtual KRResponse PostExamResult(ExamResultMetadata <T> result) { return(null); }
public KRNetworkingHelper(ExamResultMetadata <T> result) { _result = result; _nowDateTime = DateTime.Now; }