private void TransReportDs(DataSet ds) { ds.Tables[0].Columns.Add("No"); ds.Tables[0].Columns.Add("isFloatPop"); ds.Tables[0].Columns.Add("isHousePop"); DeviceInfoBLL ARCHIVE_DEVICEINFO = new DeviceInfoBLL(); int i = 1; foreach (DataRow row in ds.Tables[0].Rows) { row["No"] = i.ToString(); if (!string.IsNullOrEmpty(row["LiveType"].ToString())) { if (row["LiveType"].ToString() == "1") { row["isHousePop"] = "√"; } else { row["isFloatPop"] = "√"; } } i++; } }
private void notify_save() { DeviceInfoModel devInfo = new DeviceInfoModel { IDCardNo = idNo }; devInfo.UpdateData = DateTime.Now.ToString(); bool flag = TranslateClsResult.TranslateToModel(devInfo, this.baseInfo); DeviceInfoBLL deviceinfo2 = new DeviceInfoBLL(); if (!flag) { try { if (deviceinfo2.Add(devInfo) != 0) { TranslateClsResult.set_tj_content(devInfo); } } catch (Exception ex) { LogHelper.WriteLog(ex.ToString()); } } }
private void TransDs(DataSet ds) { DeviceInfoBLL ARCHIVE_DEVICEINFO = new DeviceInfoBLL(); foreach (DataRow row in ds.Tables[0].Rows) { row["Sex"] = !(row["Sex"].ToString() == "1") ? "女" : "男"; row["Nation"] = !(row["Nation"].ToString() == "1") ? row["MINORITY"] : "汉族"; } }
private void FrmBT_Data_Load(object sender, EventArgs e) { List <DeviceInfoModel> modelList = new DeviceInfoBLL().GetModelList(string.Format("IDCardNo = '{0}' order by UpdateData desc", this.IDCardNo)); List <DevRecord> list2 = new List <DevRecord>(); foreach (DeviceInfoModel deviceinfo in modelList) { DevRecord rcd = this.GetRcd(deviceinfo); list2.Add(rcd); } this.dataGridView1.DataSource = list2; }
public static stru_result GetDevData(string IDCardNo, string DeviceType, string DeviceName) { stru_result _result = new stru_result(); string strWhere = ""; strWhere = string.Format(" IDCardNo = '{0}' and DeviceType = '{1}' ", IDCardNo, DeviceType); if (!string.IsNullOrEmpty(DeviceName)) { strWhere = strWhere + string.Format("and DeviceName = '{0}' ", DeviceName); } strWhere = strWhere + " order by id desc "; List <DeviceInfoModel> modelList = new DeviceInfoBLL().GetModelList(strWhere); if ((modelList != null) && (modelList.Count > 0)) { _result.type = DeviceType; _result.HasValue = true; _result.datetime = modelList[0].UpdateData; _result.value1 = modelList[0].Value1; if (DeviceType == "20") { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; } if (DeviceType == "33") { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; _result.value4 = modelList[0].Value4; _result.value5 = modelList[0].Value5; _result.value6 = modelList[0].Value6; _result.value7 = modelList[0].Value7; _result.value8 = modelList[0].Value8; _result.value9 = modelList[0].Value9; _result.value10 = modelList[0].Value10; _result.value11 = modelList[0].Value11; } if (DeviceType == "32") { _result.value2 = modelList[0].Value2; } if (DeviceType == "35") { } return(_result); } _result.HasValue = false; return(_result); }
private void TransDs(DataSet ds) { ds.Tables[0].Columns.Add("BlueToothRecord"); DeviceInfoBLL ARCHIVE_DEVICEINFO = new DeviceInfoBLL(); foreach (DataRow row in ds.Tables[0].Rows) { row["Sex"] = !(row["Sex"].ToString() == "1") ? "女" : "男"; row["Nation"] = !(row["Nation"].ToString() == "1") ? row["MINORITY"] : "汉"; if (ARCHIVE_DEVICEINFO.GetRecordCount(string.Format(" IDCardNo = '{0}'", row["IDCardNo"])) > 0) { row["BlueToothRecord"] = "检测数据"; } } }
private void TransDs(DataSet ds) { ds.Tables[0].Columns.Add("UpdateData"); DeviceInfoBLL ARCHIVE_DEVICEINFO = new DeviceInfoBLL(); foreach (DataRow row in ds.Tables[0].Rows) { row["Sex"] = !(row["Sex"].ToString() == "1") ? "女" : "男"; row["UpdateData"] = "修改"; //if (ARCHIVE_DEVICEINFO.GetRecordCount(string.Format(" IDCardNo = '{0}'", row["IDCardNo"])) > 0) //{ // row["BlueToothRecord"] = this.RecordsName; //} } }
public static stru_result GetDevData(string IDCardNo, string DeviceType) { stru_result _result = new stru_result(); List <DeviceInfoModel> modelList = new DeviceInfoBLL().GetModelList((!(DeviceType == "24") ? string.Format(" IDCardNo = '{0}' and DeviceType = '{1}' ", IDCardNo, DeviceType) : string.Format(" IDCardNo = '{0}' and (DeviceType = 24 or (DeviceType = 35 and DeviceName = '血糖' )) ", IDCardNo, DeviceType)) + " order by id desc "); if ((modelList != null) && (modelList.Count > 0)) { _result.type = DeviceType; _result.HasValue = true; _result.datetime = modelList[0].UpdateData; _result.value1 = modelList[0].Value1; if (DeviceType == "20") { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; } if (DeviceType == "39") { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; } if (DeviceType == "33") { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; _result.value4 = modelList[0].Value4; _result.value5 = modelList[0].Value5; _result.value6 = modelList[0].Value6; _result.value7 = modelList[0].Value7; _result.value8 = modelList[0].Value8; _result.value9 = modelList[0].Value9; _result.value10 = modelList[0].Value10; _result.value11 = modelList[0].Value11; } if (DeviceType == "32") { _result.value2 = modelList[0].Value2; } return(_result); } _result.HasValue = false; return(_result); }
/// <summary> /// 事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void comm_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { Thread.Sleep(2000); int n = comm.BytesToRead; byte[] buf = new byte[n]; while (buf.Length < 325) { n = comm.BytesToRead; buf = new byte[n]; } comm.Read(buf, 0, n); string str = System.Text.Encoding.ASCII.GetString(buf); byte[] STX = new byte[] { 0x02 }; // 开始符 byte[] EXT = new byte[] { 0x03 }; // 结束符 string start = System.Text.Encoding.ASCII.GetString(STX); string end = System.Text.Encoding.ASCII.GetString(EXT); string[] value = str.Split(new String[] { end }, StringSplitOptions.RemoveEmptyEntries); DeviceInfoModel saveDeviceModel = new DeviceInfoModel { IDCardNo = baseInfo.IDCardNo, UpdateData = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }; saveDeviceModel.DeviceName = "尿液信息"; saveDeviceModel.DeviceType = "33"; saveDeviceModel.FirstName = "EMPUI"; for (int i = 0; i < value.Length; i++) { string value2 = value[i].Replace(start, ""); string[] empValue = value2.Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); if (empValue.Length > 13) { saveDeviceModel.Value9 = empValue[4].Substring(5, 2).Replace(" ", ""); // 尿白细胞 LEU saveDeviceModel.Value4 = empValue[5].Substring(5, 2).Replace(" ", ""); // 尿酮体 KET saveDeviceModel.Value8 = empValue[6].Substring(5, 2).Replace(" ", ""); // 亚硝酸盐 NIT saveDeviceModel.Value1 = empValue[7].Substring(5, 2).Replace(" ", ""); // 尿胆原 URO saveDeviceModel.Value6 = empValue[8].Substring(5, 2).Replace(" ", ""); // 尿蛋白 PRO saveDeviceModel.Value3 = empValue[9].Substring(5, 2).Replace(" ", ""); // 胆红素 BIL saveDeviceModel.Value5 = empValue[10].Substring(5, 2).Replace(" ", ""); // 尿糖 GLU saveDeviceModel.Value10 = empValue[11].Substring(5).Replace(" ", ""); // 比重 SG saveDeviceModel.Value2 = empValue[12].Substring(5, 2).Replace(" ", ""); // 尿潜血 BLD saveDeviceModel.Value7 = empValue[13].Substring(5).Replace(" ", ""); // 酸碱度 PH saveDeviceModel.Value11 = empValue[14].Substring(5, 2).Replace(" ", ""); // 抗坏血酸 VC } } if (saveDeviceModel.Value6 == "" || saveDeviceModel.Value5 == "") { MessageBox.Show("测量错误,请重新测量!"); return; } string appInfo = string.Format("LEU:白细胞 {0} BLD:尿潜血 {1}\nNIT:亚硝酸盐 {2} KET:酮体 {3}\nUBG:尿胆原 {4} BIL:胆红素 {5}\nPRO:蛋白质 {6} GLU:葡萄糖 {7}\np H {8} V C:维生素C {9}\nS G:尿比重 {10}\n {11}" , saveDeviceModel.Value9.PadLeft(2, ' ') , saveDeviceModel.Value2.PadLeft(2, ' ') , saveDeviceModel.Value8.PadLeft(2, ' ') , saveDeviceModel.Value4.PadLeft(2, ' ') , saveDeviceModel.Value1.PadLeft(2, ' ') , saveDeviceModel.Value3.PadLeft(2, ' ') , saveDeviceModel.Value6.PadLeft(2, ' ') , saveDeviceModel.Value5.PadLeft(2, ' ') , saveDeviceModel.Value7.PadLeft(2, ' ') , saveDeviceModel.Value11.PadLeft(2, ' ') , saveDeviceModel.Value10, "尚未保存" ); ClsMsgWindow.SendDeviceInfo("EMPUI" + ";BT"); base.Invoke(new Action <string, string>(this.run_notify_window), new object[] { TranslateClsResult.GetDeviceCName("EMPUI"), appInfo }); DeviceInfoBLL deviceInfo = new DeviceInfoBLL(); if (deviceInfo.Add(saveDeviceModel) != 0) { TranslateClsResult.set_tj_content(saveDeviceModel); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } StopRead(); }
public static stru_result GetDevData(string IDCardNo, string DeviceType, string DeviceName) { stru_result _result = new stru_result(); string str = string.Format(" IDCardNo = '{0}' and DeviceType = '{1}' ", IDCardNo, DeviceType); if (DeviceType == "20") { if (DeviceName == "心率") { str = str + string.Format(" and Value3 != '' ", new object[0]); } if (DeviceName == "血压") { str = str + string.Format(" and Value1 != '' ", new object[0]); } } List <DeviceInfoModel> modelList = new DeviceInfoBLL().GetModelList(str + " order by id desc "); if ((modelList != null) && (modelList.Count > 0)) { _result.type = DeviceType; _result.HasValue = true; _result.datetime = modelList[0].UpdateData; _result.value1 = modelList[0].Value1; if (DeviceType == "20") { if (DeviceName == "血压") { DeviceInfoModel deviceinfo = modelList.First <DeviceInfoModel>(mc => !string.IsNullOrEmpty(mc.Value1 + mc.Value2)); if (deviceinfo != null) { _result.value1 = deviceinfo.Value1; _result.value2 = deviceinfo.Value2; _result.value3 = deviceinfo.Value3; } } else if (DeviceName == "心率") { DeviceInfoModel deviceinfo2 = modelList.First <DeviceInfoModel>(mc => !string.IsNullOrEmpty(mc.Value3)); if (deviceinfo2 != null) { _result.value3 = deviceinfo2.Value3; } } else { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; } } if (DeviceType == "33") { _result.value2 = modelList[0].Value2; _result.value3 = modelList[0].Value3; _result.value4 = modelList[0].Value4; _result.value5 = modelList[0].Value5; _result.value6 = modelList[0].Value6; _result.value7 = modelList[0].Value7; _result.value8 = modelList[0].Value8; _result.value9 = modelList[0].Value9; _result.value10 = modelList[0].Value10; _result.value11 = modelList[0].Value11; } if (DeviceType == "32") { _result.value2 = modelList[0].Value2; } if (!(DeviceType == "35")) { } return(_result); } _result.HasValue = false; return(_result); }
public IHttpActionResult GetEquipmentReportListDataByHandl2(DeviceDataListModel2 model) { DeviceDataBLL data = new DeviceDataBLL(); RetDeviceTableData tabledata = new RetDeviceTableData(); ReturnItem <List <RetDeviceTableData> > retdata = new ReturnItem <List <RetDeviceTableData> >(); DeviceDataModel datamodel = new DeviceDataModel() { EndTime = model.EndTime, StartTime = model.StartTime, GetTogetherType = model.GetTogetherType, IntervalUnit = model.IntervalUnit, StatisticalInterval = model.StatisticalInterval }; Dictionary <string, string> itemIdToDeviceId = new Dictionary <string, string>(); //key为itemID,value为deviceId if (model.DeviceIDs != null || model.DeviceIDs.Count != 0) //获取参数中的所有设备对应的propertyLable属性 { UserApi api = new UserApi(); var userApi = api.GetUserInfoByToken(); model.DeviceItemIDs = new List <string>(); foreach (var id in model.DeviceIDs) { var deviceid = Convert.ToInt32(id); DeviceItemInfoModel parameter = new DeviceItemInfoModel(); parameter.OrgID = userApi.Data.OrgID.ToString(); parameter.DeviceID = deviceid; DeviceInfoBLL device = new DeviceInfoBLL(); var getitem = device.GetEquipmentItemsList(parameter); if (getitem.Data != null) { var temp = getitem.Data; foreach (var item in getitem.Data) { if (item.PropertyLabel == model.DeviceItemPropertyLabel)//如果是该PropertyLabel的,则放到参数里面 { model.DeviceItemIDs.Add(item.ID); itemIdToDeviceId.Add(item.ID, id); break; } } } else { return(null); } } } if (model.DeviceItemIDs != null && model.DeviceItemIDs.Count > 0) { var count = 0; List <RetDeviceTableList> listtabledata = new List <RetDeviceTableList>(); List <string> listtimedata = new List <string>(); List <List <object> > listcordata = new List <List <object> >(); List <List <object> > listanodata = new List <List <object> >(); List <List <object> > listnordata = new List <List <object> >(); List <double> listdatadata = new List <double>(); List <RetDeviceTableData> listdata = new List <RetDeviceTableData>(); foreach (var item in model.DeviceItemIDs) { RetDeviceTableData chartdata = new RetDeviceTableData();//图表数据 datamodel.DeviceItemID = item; string id = ""; itemIdToDeviceId.TryGetValue(item, out id); if (id == null || id == "") { retdata.Code = -1; retdata.Msg = "在Dictionary中获取deviceId失败"; retdata.Data = null; return(InspurJson <List <RetDeviceTableData> >(retdata)); } datamodel.DeviceID = id; var get = data.GetEquipmentReportListDataByHandl(datamodel); if (get != null && get.Data != null) { chartdata.AllCoordination = get.Data.AllCoordination; chartdata.AnomCoordination = get.Data.AnomCoordination; chartdata.Data = get.Data.Data; chartdata.DeviceItemName = get.Data.DeviceItemName; chartdata.DeviceName = get.Data.DeviceName; chartdata.DeviceTableList = get.Data.DeviceTableList; chartdata.NormCoordination = get.Data.NormCoordination; chartdata.Time = get.Data.Time; chartdata.Unit = get.Data.Unit; chartdata.type = "2"; listdata.Add(chartdata); if (get.Data.DeviceTableList != null) { foreach (var listitem in get.Data.DeviceTableList) { listtabledata.Add(listitem); } } if (get.Data.Time != null) { foreach (var listtime in get.Data.Time) { listtimedata.Add(listtime); } } if (get.Data.AllCoordination != null) { foreach (var cooitem in get.Data.AllCoordination) { listcordata.Add(cooitem); } } if (get.Data.AnomCoordination != null) { foreach (var anoitem in get.Data.AnomCoordination) { listanodata.Add(anoitem); } } if (get.Data.NormCoordination != null) { foreach (var noritem in get.Data.NormCoordination) { listnordata.Add(noritem); } } if (get.Data.Data != null) { foreach (var dataitem in get.Data.Data) { listdatadata.Add(dataitem); } } count += get.Count; retdata.Code = get.Code; //retdata.Msg = get.Msg; retdata.Msg = "wahahaaaaaaaaa"; } } tabledata.DeviceTableList = listtabledata; tabledata.Time = listtimedata; tabledata.AllCoordination = listcordata; tabledata.AnomCoordination = listanodata; tabledata.NormCoordination = listnordata; tabledata.Data = listdatadata; tabledata.type = "1"; listdata.Add(tabledata);//添加列表数据 retdata.Data = listdata; retdata.Count = count; } return(InspurJson <List <RetDeviceTableData> >(retdata)); }
public IHttpActionResult GetEquipmentReportListDataByHandl(DeviceDataListModel model) { DeviceDataBLL data = new DeviceDataBLL(); RetDeviceTableData tabledata = new RetDeviceTableData(); ReturnItem <List <RetDeviceTableData> > retdata = new ReturnItem <List <RetDeviceTableData> >(); DeviceDataModel datamodel = new DeviceDataModel() { DeviceID = model.DeviceID, EndTime = model.EndTime, StartTime = model.StartTime, GetTogetherType = model.GetTogetherType, IntervalUnit = model.IntervalUnit, StatisticalInterval = model.StatisticalInterval }; if (model.DeviceItemIDs == null || model.DeviceItemIDs.Count == 0)//当前台不选属性时,将该设备所有的属性展示 { UserApi api = new UserApi(); var userApi = api.GetUserInfoByToken(); var deviceid = 0; if (model.DeviceID != null && model.DeviceID != "") { deviceid = Convert.ToInt32(model.DeviceID); } DeviceItemInfoModel parameter = new DeviceItemInfoModel(); parameter.OrgID = userApi.Data.OrgID.ToString(); parameter.DeviceID = deviceid; DeviceInfoBLL device = new DeviceInfoBLL(); var getitem = device.GetEquipmentItemsList(parameter); if (getitem.Data != null) { foreach (var item in getitem.Data) { model.DeviceItemIDs.Add(item.ID);//核心语句 } } else { return(null); } } if (model.DeviceItemIDs != null && model.DeviceItemIDs.Count > 0) { var count = 0; List <RetDeviceTableList> listtabledata = new List <RetDeviceTableList>(); List <string> listtimedata = new List <string>(); List <List <object> > listcordata = new List <List <object> >(); List <List <object> > listanodata = new List <List <object> >(); List <List <object> > listnordata = new List <List <object> >(); List <double> listdatadata = new List <double>(); List <RetDeviceTableData> listdata = new List <RetDeviceTableData>(); foreach (var item in model.DeviceItemIDs) { RetDeviceTableData chartdata = new RetDeviceTableData();//图表数据 datamodel.DeviceItemID = item; var get = data.GetEquipmentReportListDataByHandl(datamodel); if (get != null && get.Data != null) { chartdata.AllCoordination = get.Data.AllCoordination; chartdata.AnomCoordination = get.Data.AnomCoordination; chartdata.Data = get.Data.Data; chartdata.DeviceItemName = get.Data.DeviceItemName; chartdata.DeviceName = get.Data.DeviceName; chartdata.DeviceTableList = get.Data.DeviceTableList; chartdata.NormCoordination = get.Data.NormCoordination; chartdata.Time = get.Data.Time; chartdata.Unit = get.Data.Unit; chartdata.type = "2"; listdata.Add(chartdata); if (get.Data.DeviceTableList != null) { foreach (var listitem in get.Data.DeviceTableList) { listtabledata.Add(listitem); } } if (get.Data.Time != null) { foreach (var listtime in get.Data.Time) { listtimedata.Add(listtime); } } if (get.Data.AllCoordination != null) { foreach (var cooitem in get.Data.AllCoordination) { listcordata.Add(cooitem); } } if (get.Data.AnomCoordination != null) { foreach (var anoitem in get.Data.AnomCoordination) { listanodata.Add(anoitem); } } if (get.Data.NormCoordination != null) { foreach (var noritem in get.Data.NormCoordination) { listnordata.Add(noritem); } } if (get.Data.Data != null) { foreach (var dataitem in get.Data.Data) { listdatadata.Add(dataitem); } } count += get.Count; retdata.Code = get.Code; retdata.Msg = get.Msg; } } tabledata.DeviceTableList = listtabledata; tabledata.Time = listtimedata; tabledata.AllCoordination = listcordata; tabledata.AnomCoordination = listanodata; tabledata.NormCoordination = listnordata; tabledata.Data = listdatadata; tabledata.type = "1"; listdata.Add(tabledata);//添加列表数据 retdata.Data = listdata; retdata.Count = count; } //else //{ // datamodel.DeviceItemID = model.DeviceItemIDs[0]; // var get = data.GetEquipmentReportListDataByHandl(datamodel); // retdata = get; //} return(InspurJson <List <RetDeviceTableData> >(retdata)); }