using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.IO.Ports; using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; namespace FlyDockTool { internal class apiOptions { /// /// 让此类创建一个API操作的单例类 /// public static apiOptions Instance; //申明一个EcgDrawing对象,复制Null private static readonly object LockHelper = new object(); public static string MacAddress;//计算机名称 设备唯一代码,这个代码是LIS系统里添加设备时,给设备生成的唯一设备码 public static string MachineCode;//设备型号 public static string MachineID;//设备编码 public static string CurrentDevice;//当前设备 public static apiOptions CreateInstance() { if (Instance == null) lock (LockHelper) { if (Instance == null) Instance = new apiOptions(); } return Instance; } /// /// 1.根据MacAddress获取设备信息,请求方式:get /// /// 计算机名称 /// 设备型号 /// public baseMsgModel getMacAddressInfo() { string apiUrl = ConfigurationManager.AppSettings["getMacAddressInfo"];//获取设备信息URL if (MacAddress.Trim().Length > 0) apiUrl += "?MacAddress="+ apiOptions.MacAddress; if (MachineCode.Trim().Length > 0) apiUrl += "&MachineCode=" + apiOptions.MachineCode; //string returnDeviceInfoJson=commonOptions.HttpGet(apiUrl); string returnDeviceInfoJson = commonOptions.HttpGet(apiUrl); baseMsgModel bmm=JsonConvert.DeserializeObject(returnDeviceInfoJson); return bmm; } /// /// 上传检查结果到LIS系统 /// /// /// public baseMsgModel upLoadExamResult(List ermList) { string apiUrl = ConfigurationManager.AppSettings["upLoadExamResult"]; string examListJson = JsonConvert.SerializeObject(ermList); string returnJson = commonOptions.PostMoths(apiUrl, examListJson); baseMsgModel bmm = JsonConvert.DeserializeObject(returnJson); return bmm; } /// /// 上传图片结果到LIS系统 /// /// /// public baseMsgModel uploadExamImage(List EIPM) { string apiUrl = ConfigurationManager.AppSettings["upLoadExamImage"]; string examImageListJson = JsonConvert.SerializeObject(EIPM); string returnJson = commonOptions.PostMoths(apiUrl, examImageListJson); baseMsgModel bmm = JsonConvert.DeserializeObject(returnJson); return bmm; } } }