123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using Common;
- using LisPacsDataUpload;
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Text;
- namespace ZLPlugin_LisPacs_MR_YJMZ
- {
- public class MyHttpServer : HttpServer
- {
- public MyHttpServer(int port)
- : base(port)
- {
- }
- public override void handleGETRequest(HttpProcessor p)
- {
- Object obj = new { result = 0, errmsg = "拒绝Get请求,请用Post方式提交。" };
- //Console.WriteLine("request: {0}", p.http_url);
- //Console.WriteLine("666");
- p.writeSuccess();
- p.outputStream.Write(JsonConvert.SerializeObject(obj));
- //p.outputStream.WriteLine("<html><body><h1>test server</h1>");
- //p.outputStream.WriteLine("Current Time: " + DateTime.Now.ToString());
- //p.outputStream.WriteLine("url : {0}", p.http_url);
- //p.outputStream.WriteLine("<form method=post action=/form>");
- //p.outputStream.WriteLine("<input type=text name=foo value=foovalue>");
- //p.outputStream.WriteLine("<input type=submit name=bar value=barvalue>");
- //p.outputStream.WriteLine("</form>");
- }
- public override void handlePOSTRequest(HttpProcessor p, StreamReader inputData)
- {
- Object obj = new { result = 1, errmsg = "hello啊打发撒旦" };
- //SocketClient client = new SocketClient("127.0.0.1", 6061);
- try
- {
- string input = inputData.ReadToEnd();
- LogHelper.Info("input:" + input);
- Data data = JsonConvert.DeserializeObject<Data>(input);
- ////obj = new { result = 1, errmsg = "" };
- ////int res = 1;
- ////int waittingdate = 0;
- //string sql = @"Select 互认 As AGREE,WAITINGDATE From zllpmr.互认配置表";
- //DataTable dt = OracleHelper<object>.RunQueryDS(sql);
- //int res = Convert.ToInt32(dt.Rows[0]["AGREE"]);
- //int waittingdate = Convert.ToInt32(dt.Rows[0]["WAITINGDATE"]);
- ////LisPacs_MR_Bll.IsAgree(out res, out waittingdate);
- //if (res == 0)//互认关闭
- //{
- // obj = new { result = 0, errmsg = "互认已关闭。" };
- // return;
- //}
- //List<YZData> ss_list = LisPacs_MR_Bll.GetYZList(lngSendID);
- //string code = "";
- //List<Codes> listlis;
- //List<Codes> listpacs;
- //LisPacs_MR_Bll.GetTreatmentId(ss_list, out code, out listlis, out listpacs);
- //Recordset rd = LisPacs_MR_Bll.GetMZPostJson(lngClinicID, code, hrType);
- //int hrType = 0;
- //if (listlis.Count == 0 && listpacs.Count == 0)
- //{
- // obj = new { result = 1, errmsg = "新开项目不存在检查或检验。" };
- // return;
- //}
- //else if (listlis.Count > 0 && listpacs.Count == 0)//只有检验
- //{
- // hrType = 1;
- //}
- //else if (listpacs.Count > 0 && listlis.Count == 0)//只有检查
- //{
- // hrType = 2;
- //}
- //if (lngModual == 1253)//住院
- //{
- // rd = LisPacs_MR_Bll.GetZYPostJson(lngPatientID, lngClinicID, code, hrType);
- //}
- //else
- //{
- // rd = LisPacs_MR_Bll.GetMZPostJson(lngClinicID, code, hrType);
- //}
- //string json = ZLPlugin_LisPacs_MR.Tools.RecordsetToJson(rd);
- //client.Send(json);
- //ZLPlugin_LisPacs_MR.Tools.Delay(10000, 0);
- //if (!string.IsNullOrWhiteSpace(SocketClient.Message))
- //{
- // //Log.Info(SocketClient.Message);
- // ResultsEx rex = new ResultsEx();
- // rex = JSON.JsonToObject<ResultsEx>(ZLPlugin_LisPacs_MR.Tools.FormatStr(SocketClient.Message), Encoding.UTF8);
- // if (rex.ResultCode == 2)//有互认
- // {
- // SocketClient.Message = null;
- // return SaveData(waittingdate, lngPatientID, lngClinicID, listlis, listpacs);
- // }
- // else if (rex.ResultCode == -1)//互认引用失败
- // {
- // //MessageBox.Show(rex.ResultText.ToString(), "中联软件", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
- // //return true;
- // }
- // else
- // {
- // //return true;//此病人不存在互认信息
- // }
- //}
- }
- catch(Exception ex)
- {
- LogHelper.Error(ex);
- //obj = new { result = 0, errmsg = ex.Message };
- }
- //if (client != null )
- //{
- // client.Close();
- //}
- p.writeSuccess();
- p.outputStream.Write(JsonConvert.SerializeObject(obj));
- //p.outputStream.WriteLine("<html><body><h1>test server</h1>");
- //p.outputStream.WriteLine("<a href=/test>return</a><p>");
- //p.outputStream.WriteLine("postbody: <pre>{0}</pre>", data);
- }
- }
- }
|