/// <summary> /// 加载数据 /// </summary> public void GetData(string parentid = "0", string hotid = "0") { this.ShowWaitingPanel(() => { try { string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetNurData, new object[] { parentid, hotid }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } } catch { } return(null); }, x => { try { var dt = x as DataTable; FillTree(treeList1, dt); treeList1.CollapseAll(); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void GetData() { DataSet ds = TmoCommon.TmoShare.getDataSetFromXML(TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(TmoCommon.funCode.GettuiDataUser, new object[] { userIDDD, userTimesss })); btnsave.Text = "修改"; if (!TmoShare.DataSetIsNotEmpty(ds)) { btnsave.Text = "添加"; ds = TmoCommon.TmoShare.getDataSetFromXML(TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(TmoCommon.funCode.getTuiData, new object[] { "" })); } if (TmoShare.DataSetIsNotEmpty(ds)) { DataTable dt = ds.Tables[0]; if (!dt.Columns.Contains("user_id")) { dt.Columns.Add("user_id", typeof(string)); } if (!dt.Columns.Contains("user_times")) { dt.Columns.Add("user_times", typeof(string)); } foreach (DataRow row in dt.Rows) { row["user_id"] = userIDDD; row["user_times"] = userTimesss; } dgcTree.DataSource = ds.Tables[0]; if (gridView1.GroupCount > 0) { gridView1.ExpandAllGroups(); } gridView1.MoveFirst(); } }
public void Indata(string videoId) { if (!string.IsNullOrEmpty(videoId)) { this.Text = "视频修改"; btnAdd.Text = "确定修改"; isadd = videoId; string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetVideoId, new object[] { videoId }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(ds)) { if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; txtvideoUrl.Text = dr["video_url"].ToString(); txtvideoName.Text = dr["video_name"].ToString(); } } } else { this.Text = "视频添加"; btnAdd.Text = "确定添加"; isadd = ""; } }
/// <summary> /// 加载数据 /// </summary> public void GetData() { this.ShowWaitingPanel(() => { try { string projecttype = ""; string project = ""; if (!string.IsNullOrEmpty("全部类型")) { project = txtproject.Text; } string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProjectDic, new object[] { projecttype, project, "" }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } return(null); } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; // prodiclist.DataSource = dt; //treeListFood.ClearNodes(); //if (treeListFood.Nodes.Count == 0) //{ // treeListFood.AppendNode(new object[] { "膳食分类", "", "", "", "", "", "", "-1", "" }, -1); //} //else //{ // treeListFood.Nodes[0]["Fc_Name"] = "膳食分类"; // treeListFood.Nodes[0]["Fc_Pid"] = "-1"; //} if (dt == null) { return; } FillTree(prodiclist, dt); prodiclist.CollapseAll(); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void GetData() { this.ShowWaitingPanel(() => { try { DsQueryXml = TmoShare.getDataSetFromXML(SubmitXml, true); if (DsQueryXml.Tables[0].Rows.Count == 0) { DsQueryXml.Tables[0].Rows.Add(DsQueryXml.Tables[0].NewRow()); } DsQueryXml.Tables[0].Rows[0]["page_size"] = _pageSize.ToString(); DsQueryXml.Tables[0].Rows[0]["now_page"] = _currentPage.ToString(); DsQueryXml.Tables[0].Rows[0]["user_id"] = _uid; DsQueryXml.Tables[0].Rows[0]["mt_code"] = _dicCode; string dd = nurtype.EditValue.ToString(); string sqlWhere = "and a.mt_time>='" + this.startTime.EditValue + "'" + " and a.mt_time<='" + this.endDate.EditValue + "'"; DsQueryXml.Tables[0].Rows[0]["mt_time"] = sqlWhere; string selexml = TmoShare.getXMLFromDataSet(DsQueryXml); string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetMonitorDataBy, new object[] { selexml }); _dsGetDataResult = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(_dsGetDataResult)) { return(_dsGetDataResult.Tables[1]); } else { return(null); } } catch { } return(null); }, x => { try { var dt = x as DataTable; if (_dicCode != "99") { SetContorl(dt, _dicNamevalue); } else { SetXueYaContorl(dt); } } catch (Exception ex) { } }); }
public string GetBindId(string user_code) { string token = ""; string sql = "SELECT reg_login_token FROM tmo_userinfo_token WHERE user_id='" + user_code + "' and is_del='2' and token_source='weixin'"; DataSet ds = MySQLHelper.Query(sql); if (TmoShare.DataSetIsNotEmpty(ds)) { token = ds.Tables[0].Rows[0]["reg_login_token"].ToString(); } return(token); }
private void ComboBoxBind() { try { DataTable wzds = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.GetPublicList, "tmo_product_type", "is_del='1' ").Tables[0]; if (TmoShare.DataTableIsNotEmpty(wzds)) { this.BindDataTable(productType, wzds, "type_name", "type_id"); } DataTable ztdt = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.GetPublicList, "tmo_product_list", " is_del='1' ").Tables[0]; if (TmoShare.DataTableIsNotEmpty(ztdt)) { this.BindDataTable(productName, ztdt, "product_name", "product_id"); } DataTable ysdt = Tmo_FakeEntityClient.Instance.GetData("tmo_sell_list", new[] { "distinct(doc_code) as doc_code" }, "is_del='1'"); if (TmoShare.DataTableIsNotEmpty(ysdt)) { this.BindDataTable(docName, ysdt, "doc_code", "doc_code"); } var param = new FE_GetDataParam() { Columns = { "distinct(tmo_sell_list.identity)", "name" }, Sources = "tmo_sell_list", JoinConditions = { new JoinCondition() { JoinType = EmJoinType.LeftJoin, Table = "tmo_userinfo", OnCol = "identity" } } }; param.AddWhere("tmo_sell_list.is_del='1'"); DataSet ds = Tmo_FakeEntityClient.Instance.GetData(param); if (TmoShare.DataSetIsNotEmpty(ds)) { if (ds.Tables.Contains("tmo_data")) { DataTable yhdt = ds.Tables["tmo_data"]; if (TmoShare.DataTableIsNotEmpty(yhdt)) { this.BindDataTable(receiveCode, yhdt, "name", "identity"); } } } } catch (Exception) { } }
public void SetData(DataSet dsrisk, DataSet ds) { if (TmoShare.DataSetIsNotEmpty(ds) && TmoShare.DataSetIsNotEmpty(dsrisk)) { DataTable dt = ds.Tables[0]; dt.Columns.Add("dis_value", typeof(string)); dt.Columns.Add("dis_time", typeof(string)); foreach (DataRow row in ds.Tables[0].Rows) { foreach (DataRow riskRow in dsrisk.Tables[0].Rows) { string value = ""; try { if (riskRow[row["dis_code"].ToString().Trim()] != null && !string.IsNullOrWhiteSpace(riskRow[row["dis_code"].ToString().Trim()].ToString())) { value = riskRow[row["dis_code"].ToString()].ToString(); } } catch (Exception) { value = ""; } if (row["dis_type"] != null && row["dis_type"].ToString() == "int") { if (row["dis_rule"] != null && !string.IsNullOrWhiteSpace(row["dis_rule"].ToString())) { string[] rules = row["dis_rule"].ToString().Split(','); foreach (string rule in rules) { if (rule.Contains("/")) { if (value == rule.Split('/')[0]) { row["dis_value"] = rule.Split('/')[1]; } } } } } else if (row["dis_type"] != null && row["dis_type"].ToString() == "char") { row["dis_value"] = value; } row["dis_time"] = riskRow["input_time"]; } } } }
/// <summary> /// 加载数据 /// </summary> public void GetData() { this.ShowWaitingPanel(() => { try { string projecttype = ""; string project = ""; if (this.cmproType.Text != "全部类型") { projecttype = cmproType.Text; } if (!string.IsNullOrEmpty(txtproject.Text)) { project = txtproject.Text; } string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProjectDic, new object[] { projecttype, project, "" }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } return(null); } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dgcTree.DataSource = dt; if (gridView1.GroupCount > 0) { gridView1.ExpandAllGroups(); } gridView1.MoveFirst(); if (dt == null) { return; } } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void LoadData(string opt_ID) { DataSet ds = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.OptionalSelect, opt_ID); optId = opt_ID; if (TmoShare.DataSetIsNotEmpty(ds)) { opt_type.EditValue = Convert.ToInt32(ds.Tables[0].Rows[0]["opt_type"]); cmb_section_type.EditValue = Convert.ToInt32(ds.Tables[0].Rows[0]["section_type"].ToString()); opt_subject.Text = ds.Tables[0].Rows[0]["opt_subject"].ToString(); htmlEditorEx1.Html = ds.Tables[0].Rows[0]["opt_content"].ToString(); input_time.Text = ds.Tables[0].Rows[0]["input_time"].ToString(); } }
public void GetData() { this.ShowWaitingPanel(() => { try { _pageSize = 1; DsQueryXml = TmoShare.getDataSetFromXML(SubmitXml, true); if (DsQueryXml.Tables[0].Rows.Count == 0) { DsQueryXml.Tables[0].Rows.Add(DsQueryXml.Tables[0].NewRow()); } DsQueryXml.Tables[0].Rows[0]["page_size"] = _pageSize.ToString(); DsQueryXml.Tables[0].Rows[0]["now_page"] = _currentPage.ToString(); DsQueryXml.Tables[0].Rows[0]["user_id"] = _uid; DsQueryXml.Tables[0].Rows[0]["mt_code"] = _dicCode; DsQueryXml.Tables[0].Rows[0]["mt_time"] = Convert.ToDateTime(this.dateEdit1.EditValue).ToString("yyyy-MM-dd 00:00:00"); string selexml = TmoShare.getXMLFromDataSet(DsQueryXml); string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetMonitorData24, new object[] { selexml }); _dsGetDataResult = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(_dsGetDataResult)) { DataTable dtCount = _dsGetDataResult.Tables["Count"]; _count = dtCount.Rows[0]["totalRowCount"].ToString(); double countnum = double.Parse(_count) / _pageSize; _pageCount = Math.Ceiling(countnum).ToString(); return(_dsGetDataResult.Tables[1]); } else { return(null); } } catch { } return(null); }, x => { try { var dt = x as DataTable; SetContorl(dt, _dicNamevalue); } catch (Exception ex) { } }); }
public void SetControl(DataRowView drView) { string nurXml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetnurtypeItem, new object[] { "" }); DataSet nurDs = TmoShare.getDataSetFromXML(nurXml); if (TmoShare.DataSetIsNotEmpty(nurDs)) { foreach (DataRow row in nurDs.Tables[0].Rows) { var item = new ImageComboBoxItem { Description = row["nurtype"].ToString(), Value = row["id"].ToString() }; nurtype.Properties.Items.Add(item); } if (drView["nurtype"] != null && drView["nurtype"].ToString() != "") { nurtype.SelectItemByDescription(drView["nurtype"].ToString()); } else { nurtype.SelectedIndex = 0; } } string hotXml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetHotDic, new object[] { "" }); DataSet hotDs = TmoShare.getDataSetFromXML(hotXml); if (TmoShare.DataSetIsNotEmpty(hotDs)) { foreach (DataRow row in hotDs.Tables[0].Rows) { var item = new ImageComboBoxItem { Description = row["hotvalue"].ToString(), Value = row["id"].ToString() }; hottype.Properties.Items.Add(item); } if (drView["hotvalue"] != null && drView["hotvalue"].ToString() != "") { hottype.SelectItemByDescription(drView["hotvalue"].ToString()); } else { hottype.SelectedIndex = 0; } } }
public void GetData() { DataSet asds = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.LoadAuoutUs, about_us.Name, "bnys"); if (TmoShare.DataSetIsNotEmpty(asds)) { about_us.Html = DESEncrypt.Decrypt(asds.Tables[0].Rows[0]["field_value"].ToString()); } DataSet csds = TmoServiceClient.InvokeServerMethodT <DataSet>(funCode.LoadAuoutUs, contact_us.Name, "bnys"); if (TmoShare.DataSetIsNotEmpty(csds)) { contact_us.Html = DESEncrypt.Decrypt(csds.Tables[0].Rows[0]["field_value"].ToString()); } }
public DataTable GetData() { string sql = "select id as dic_id,dicname,dicvalue,input_time from tmo_tuijian"; DataSet ds = MySQLHelper.Query(sql); if (TmoShare.DataSetIsNotEmpty(ds)) { ds.Tables[0].TableName = "dddd"; return(ds.Tables[0]); } else { return(null); } }
public DataTable GetDataUser(string userId, string userTime) { string sql = "select * from tmo_tuijian_user where user_id='" + userId + "' and user_times='" + userTime + "'"; DataSet ds = MySQLHelper.Query(sql); if (TmoShare.DataSetIsNotEmpty(ds)) { ds.Tables[0].TableName = "ccc"; return(ds.Tables[0]); } else { return(null); } }
/// <summary> /// 加载数据 /// </summary> public void GetData() { this.ShowWaitingPanel(() => { try { string name = txtName.Text; string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GeVideoList, new object[] { name, "" }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } return(null); } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dgcTree.DataSource = dt; if (gridView1.GroupCount > 0) { gridView1.ExpandAllGroups(); } gridView1.MoveFirst(); if (dt == null) { return; } } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
void Getdata(string user_id, string user_times) { this.ShowWaitingPanel(() => { try { string xmlreturn = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProResult, new object[] { user_id, user_times, "" }); DataSet ds = TmoShare.getDataSetFromXML(xmlreturn); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dtPro = dt; dgcTree.DataSource = dt; if (gridView2.GroupCount > 0) { gridView2.ExpandAllGroups(); } gridView2.MoveFirst(); if (dt == null) { return; } } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void SetControl() { string nurXml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetnurtypeItem, new object[] { "" }); DataSet nurDs = TmoShare.getDataSetFromXML(nurXml); if (TmoShare.DataSetIsNotEmpty(nurDs)) { var item1 = new ImageComboBoxItem { Description = "全部", Value = 0 }; nurtype.Properties.Items.Add(item1); foreach (DataRow row in nurDs.Tables[0].Rows) { var item = new ImageComboBoxItem { Description = row["nurtype"].ToString(), Value = row["id"].ToString() }; nurtype.Properties.Items.Add(item); } nurtype.SelectedIndex = 0; } string hotXml = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetHotDic, new object[] { "" }); DataSet hotDs = TmoShare.getDataSetFromXML(hotXml); if (TmoShare.DataSetIsNotEmpty(hotDs)) { var item2 = new ImageComboBoxItem { Description = "全部", Value = 0 }; hottype.Properties.Items.Add(item2); foreach (DataRow row in hotDs.Tables[0].Rows) { var item = new ImageComboBoxItem { Description = row["hotvalue"].ToString(), Value = row["id"].ToString() }; hottype.Properties.Items.Add(item); } hottype.SelectedIndex = 0; } }
protected override bool BeforeSubmitData(Dictionary <string, object> dicData) { if (userNum.Visible) { dicData[nameof(dev_sn)] = dicData[nameof(dev_sn)] + userNum.EditValue.ToString(); } FE_GetDataParam param = new FE_GetDataParam() { Columns = { "tmo_userinfo.user_id,tmo_userinfo.name,tmo_userinfo.is_del" }, Sources = TableName, JoinConditions = { new JoinCondition() { JoinType = EmJoinType.LeftJoin, Table = "tmo_userinfo", OnCol = "user_id", MainCol = "dev_userid" } } }; param.DicWhere.Add(PrimaryKey, dicData[PrimaryKey].ToString()); param.DicWhere.Add(dev_type.Name, dicData[dev_type.Name].ToString()); DataSet ds = Tmo_FakeEntityClient.Instance.GetData(param); if (TmoShare.DataSetIsNotEmpty(ds)) { if (_user_id == ds.Tables[0].Rows[0]["user_id"].ToString()) { DXMessageBox.ShowWarning("设备已绑定,请勿重复绑定!"); return(false); } DXMessageBox.ShowWarning(string.Format("设备已经被用户【{0}】绑定!\n[{1}]", ds.Tables[0].Rows[0]["name"], ds.Tables[0].Rows[0]["user_id"])); return(false); } bool same = Tmo_FakeEntityClient.Instance.ExistSameValue(TableName, PrimaryKey, dicData[PrimaryKey].ToString(), dev_type.Name + "=" + dicData[dev_type.Name]); if (same) { DbOperaType = DBOperateType.Update; PrimaryKeyValue = dicData[PrimaryKey].ToString(); } dicData.Add("dev_userid", _user_id); dicData.Add("doc_name", TmoComm.login_docInfo.doc_name); dicData.Add("dev_bindtime", DateTime.Now); return(true); }
public void AddWxMsg(object obj) { DataSet dt = (DataSet)obj; #region 获取doc_code DataRow row = dt.Tables[0].Rows[0]; string doc_code = "admin"; string sql1 = " select doc_code from tmo_userinfo where user_code in(select user_code from tmo_userinfo_token where reg_login_token=?reg_login_token)"; MySqlParameter parameter = new MySqlParameter("?reg_login_token", MySqlDbType.VarChar, 100); string token_open_id = row["token_open_id"].ToString(); parameter.Value = token_open_id; DataSet ds = MySQLHelper.Query(sql1, parameter); if (TmoShare.DataSetIsNotEmpty(ds)) { doc_code = ds.Tables[0].Rows[0]["doc_code"].ToString(); } #endregion string MsgId = row["MsgId"].ToString(); string wx_type = "1"; if (string.IsNullOrEmpty(row["wx_type"].ToString())) { wx_type = "1"; } else { wx_type = row["wx_type"].ToString(); } string sqls = "insert into tmo_weixin_content (doc_code,token_open_id,message_content,create_time,input_time,wm_id,is_del,r_mark,wx_type,media_id,format,MsgId,picturedata)" + " SELECT '" + doc_code + "','" + token_open_id + "','" + row["message_content"].ToString() + "','" + row["create_time"].ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + row["wm_id"].ToString() + "',1,'" + row["r_mark"].ToString() + "'," + wx_type + ",'" + row["media_id"].ToString() + "','" + row["format"].ToString() + "','" + MsgId + "', " + "?picturedata FROM DUAL where NOT EXISTS(SELECT MsgId FROM tmo_weixin_content WHERE MsgId = '" + MsgId + "')"; MySqlParameter myparameter = new MySqlParameter("?picturedata", MySqlDbType.MediumBlob); if (wx_type == "2") { myparameter.Value = GetMultimedia(row["message_content"].ToString()); } else { myparameter.Value = DBNull.Value; } int num = MySQLHelper.ExecuteSql(sqls, myparameter); }
void Getdata(string user_id, string user_times) { this.ShowWaitingPanel(() => { try { string xmlreturn = TmoServiceClient.InvokeServerMethodT <string>(funCode.medicQuery, new object[] { "" }); DataSet ds = TmoShare.getDataSetFromXML(xmlreturn); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dt.Columns.Add("cur_value", typeof(string)); FillTree(prodiclist, dt); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void GetData() { this.ShowWaitingPanel(() => { try { _dsQueryXml = TmoShare.getDataSetFromXML(SubmitXml, true); if (_dsQueryXml.Tables[0].Rows.Count == 0) { _dsQueryXml.Tables[0].Rows.Add(_dsQueryXml.Tables[0].NewRow()); } _dsQueryXml.Tables[0].Rows[0]["doc_code"] = TmoComm.login_docInfo.children_docid; _dsQueryXml.Tables[0].Rows[0]["page_size"] = _pageSize.ToString(); _dsQueryXml.Tables[0].Rows[0]["now_page"] = _currentPage.ToString(); if (!string.IsNullOrEmpty(this.userID.Text)) { _dsQueryXml.Tables[0].Rows[0]["user_id"] = this.userID.Text; } if (!string.IsNullOrEmpty(this.txtName.Text)) { _dsQueryXml.Tables[0].Rows[0]["name"] = this.txtName.Text; } if (Time.Checked) { _dsQueryXml.Tables[0].Rows[0]["date_start"] = datestart.EditValue.ToString(); _dsQueryXml.Tables[0].Rows[0]["date_end"] = dateend.EditValue.ToString(); } string selexml = TmoShare.getXMLFromDataSet(_dsQueryXml); string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetSportDiaryList, new object[] { selexml }); _dsGetDataResult = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(_dsGetDataResult)) { DataTable dtCount = _dsGetDataResult.Tables["Count"]; count = dtCount.Rows[0]["totalRowCount"].ToString(); double countnum = double.Parse(count) / _pageSize; pageCount = Math.Ceiling(countnum).ToString(); return(_dsGetDataResult.Tables[1]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dgcTree.DataSource = dt; if (gridView1.GroupCount > 0) { gridView1.ExpandAllGroups(); } gridView1.MoveFirst(); if (dt == null) { return; } lblCount.Text = string.Format("共[{0}]条", count); lblPageIndex.Text = string.Format("第[{0}]页,共[{1}]页", _currentPage.ToString(), _pageSize.ToString()); txtPageIndex.Text = _currentPage.ToString(); txtPageSize.Text = _pageSize.ToString(); llblUp.Enabled = _currentPage > 1; llblDown.Enabled = _currentPage < int.Parse(pageCount); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void Indata(string project_id) { if (!string.IsNullOrEmpty(project_id)) { this.Text = "方案修改"; btnAdd.Text = "确定修改"; isadd = project_id; string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProjectDic, new object[] { "", "", project_id }); DataSet ds = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(ds)) { if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; this.cmproType.Text = dr["project_type"].ToString(); txtTypeName.Text = dr["project_name"].ToString(); typeAnswer.Text = dr["solve_content"].ToString(); string disname = dr["disease_name"].ToString(); if (disname.Contains(',')) { string[] disnames = disname.Split(','); foreach (string discname in disnames) { switch (discname) { case "易患病阶段": chckeasy.Checked = true; break; case "极易患病阶段": chckSoeasy.Checked = true; break; case "糖尿病Ⅴ期肾病": chcktnV.Checked = true; break; case "将患病阶段": chckjh.Checked = true; break; case "糖尿病视网膜病变背景期": chckswbjq.Checked = true; break; case "糖尿病视网膜病变增殖期": chckswzsq.Checked = true; break; case "糖尿病Ⅲ期肾病": chcktnbIII.Checked = true; break; case "糖尿病Ⅳ期肾病": chcktnIV.Checked = true; break; case "糖尿病神经病变": chcktnjsb.Checked = true; break; case "糖尿病阶段": chcktnb.Checked = true; break; case "糖尿病足": chcktnbz.Checked = true; break; case "糖尿病脑血管病变": chcknxgb.Checked = true; break; case "糖尿病心血管病变": chckxxg.Checked = true; break; default: break; } } } } } } else { this.Text = "方案添加"; btnAdd.Text = "确定添加"; isadd = ""; Clear(); } }
/// <summary> /// 获取本次体检数据 /// </summary> /// <returns></returns> public void GetNowRisk(string userId, string user_times) { DataSet ds = TmoCommon.TmoShare.getDataSetFromXML(TmoLinkServer.TmoServiceClient.InvokeServerMethodT <string>(TmoCommon.funCode.GettuiDataUser, new object[] { userId, user_times })); if (TmoShare.DataSetIsNotEmpty(ds)) { foreach (DataRow row in ds.Tables[0].Rows) { string id = row["dic_id"].ToString(); switch (id) { case "18b39361ca0e4003b80aadd9e586be6b": //HbA1c(%) hb.Text = row["dicvalue"].ToString(); break; case "19fc63c7ac35483bbd4b36f75a101316": //TC(mmol/L) tc.Text = row["dicvalue"].ToString(); break; case "1b1fc8684a294e129806f9af58dff5c7": //HDL-C (mmol/L) 男性 hdm.Text = row["dicvalue"].ToString(); break; case "264f761e371747379b14e3109d5fb5c7": //HDL-C (mmol/L) 女性性 hdn.Text = row["dicvalue"].ToString(); break; case "2a4a0ac0e41c4b9796be7449610bc5af": //TG(mmol/L) tg.Text = row["dicvalue"].ToString(); break; case "3e66fbffddcb4249adc43bfda413cf19": //LDL-C (mmol/L)女性 ldnv.Text = row["dicvalue"].ToString(); break; case "41bd36b815f94bb690f870cee6a92ef2": //LDL-C (mmol/L) 男性 ldm.Text = row["dicvalue"].ToString(); break; case "52e77b3317a34c1da6d02d40197c12d5": //尿白蛋白/肌酐比(mg/mmol 女 niaonv.Text = row["dicvalue"].ToString(); break; case "52e77b3317a34c1da6d02d40197c12d34": //尿白蛋白排泄率 niaom.Text = row["dicvalue"].ToString(); break; case "5367ed592bcd4abbbfc381fae7651177": pai.Text = row["dicvalue"].ToString(); break; case "5367ed592bcd4abbbfc381fae7651179": tongxing.Text = row["dicvalue"].ToString(); break; case "5367ed592bcd4abbbfc381fae7651178": qita.Text = row["dicvalue"].ToString(); break; } } } }
void Getdata(string user_id, string user_times) { this.ShowWaitingPanel(() => { try { string xmlreturn = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetProResult, new object[] { user_id, user_times, "" }); DataSet ds = TmoShare.getDataSetFromXML(xmlreturn); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dtPro = dt; if (dt == null) { return; } // prodiclist.DataSource = dt; prodiclist.ClearNodes(); int intCount = (dttype != null) ? dttype.Rows.Count : 0; Dictionary <string, string> dics = new Dictionary <string, string>(); if (intCount > 0) { for (int i = 0; i < intCount; i++) { DataRow row = dt.NewRow(); dics.Add(dttype.Rows[i]["project_type"].ToString(), dttype.Rows[i]["project_typeid"].ToString()); row["project_id"] = dttype.Rows[i]["project_typeid"].ToString(); row["project_name"] = dttype.Rows[i]["project_type"].ToString(); row["project_type"] = dttype.Rows[i]["project_type"].ToString(); row["solve_content"] = ""; row["user_times"] = user_times; row["user_id"] = user_id; row["modify"] = "--"; row["del"] = "--"; dt.Rows.Add(row); } } FillTree(prodiclist, dt, dics); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
void Getdata() { this.ShowWaitingPanel(() => { try { string xmlreturn = TmoServiceClient.InvokeServerMethodT <string>(funCode.medicQuery, new object[] { "" }); DataSet ds = TmoShare.getDataSetFromXML(xmlreturn); if (TmoShare.DataSetIsNotEmpty(ds)) { return(ds.Tables[0]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; dtPro = dt; dt.Columns.Add("check", System.Type.GetType("System.Boolean")); foreach (DataRow row in dt.Rows) { string value = row["control_type"] == null ? "" : row["control_type"].ToString(); string text = ""; try { text = dics[value]; } catch (Exception) { text = ""; } row["control_type"] = text; row["check"] = false; } dgcTree.DataSource = dt; if (gridView2.GroupCount > 0) { gridView2.ExpandAllGroups(); } gridView2.MoveFirst(); if (dt == null) { return; } } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
/// <summary> /// 加载数据 /// </summary> public void GetData() { this.ShowWaitingPanel(() => { try { _dsQueryXml = TmoShare.getDataSetFromXML(SubmitXml, true); if (_dsQueryXml.Tables[0].Rows.Count == 0) { _dsQueryXml.Tables[0].Rows.Add(_dsQueryXml.Tables[0].NewRow()); } _dsQueryXml.Tables[0].Rows[0]["doc_code"] = TmoComm.login_docInfo.children_docid; _dsQueryXml.Tables[0].Rows[0]["page_size"] = _pageSize.ToString(); _dsQueryXml.Tables[0].Rows[0]["now_page"] = _currentPage.ToString(); if (!string.IsNullOrEmpty(this.user_codetxt.Text)) { _dsQueryXml.Tables[0].Rows[0]["user_id"] = this.user_codetxt.Text; } if (!string.IsNullOrEmpty(this.user_timestxt.Text)) { _dsQueryXml.Tables[0].Rows[0]["user_times"] = this.user_timestxt.Text; } if (!string.IsNullOrEmpty(this.user_nametxt.Text)) { _dsQueryXml.Tables[0].Rows[0]["name"] = this.user_nametxt.Text; } string gender = cmgender.EditValue.ToString(); if (gender == "男") { _dsQueryXml.Tables[0].Rows[0]["gender"] = "1"; } if (gender == "女") { _dsQueryXml.Tables[0].Rows[0]["gender"] = "2"; } if (birchb.Checked) { _dsQueryXml.Tables[0].Rows[0]["birth_date_begin"] = birth_datestart.EditValue.ToString(); _dsQueryXml.Tables[0].Rows[0]["birth_date_end"] = birth_dateend.EditValue.ToString(); } if (checkEdit2.Checked) { _dsQueryXml.Tables[0].Rows[0]["reg_time_begin"] = exam_timestart.EditValue.ToString(); _dsQueryXml.Tables[0].Rows[0]["reg_time_end"] = exam_timeend.EditValue.ToString(); } string selexml = TmoShare.getXMLFromDataSet(_dsQueryXml); string strmlx = TmoServiceClient.InvokeServerMethodT <string>(funCode.GetNewReportData, new object[] { selexml }); _dsGetDataResult = TmoShare.getDataSetFromXML(strmlx); if (TmoShare.DataSetIsNotEmpty(_dsGetDataResult)) { DataTable dtCount = _dsGetDataResult.Tables["Count"]; count = dtCount.Rows[0]["totalRowCount"].ToString(); double countnum = double.Parse(count) / _pageSize; pageCount = Math.Ceiling(countnum).ToString(); return(_dsGetDataResult.Tables[1]); } else { return(null); } } catch { } return(null); }, x => { try { DataTable dt = x as DataTable; if (dt == null) { return; } dt.Columns.Add("wei", typeof(string)); dt.Columns.Add("lookluru", typeof(string)); dt.Columns.Add("luru", typeof(string)); foreach (DataRow row in dt.Rows) { row["look_report"] = "维护"; row["wei"] = "推荐维护"; row["lookluru"] = "查看录入指标"; row["luru"] = "录入指标"; } dgcTree.DataSource = dt; if (gridView1.GroupCount > 0) { gridView1.ExpandAllGroups(); } gridView1.MoveFirst(); lblCount.Text = string.Format("共[{0}]条", count); lblPageIndex.Text = string.Format("第[{0}]页,共[{1}]页", _currentPage.ToString(), _pageSize.ToString()); txtPageIndex.Text = _currentPage.ToString(); txtPageSize.Text = _pageSize.ToString(); llblUp.Enabled = _currentPage > 1; llblDown.Enabled = _currentPage < int.Parse(pageCount); } catch (Exception ex) { LogHelper.Log.Error("实体加载数据出错", ex); DXMessageBox.ShowWarning2("数据加载失败!请重试!"); } }); }
public void RefData(string userId, string user_times) { #region 初始化数据结构 DataTable tmo_targetd = new DataTable(); tmo_targetd.Columns.Add("fbg", typeof(string)); tmo_targetd.Columns.Add("pbg", typeof(string)); tmo_targetd.Columns.Add("dbp", typeof(string)); tmo_targetd.Columns.Add("sbp", typeof(string)); tmo_targetd.Columns.Add("ogtt", typeof(string)); tmo_targetd.Columns.Add("weight", typeof(string)); tmo_targetd.Columns.Add("waistline", typeof(string)); tmo_targetd.Columns.Add("thirsty", typeof(string)); tmo_targetd.Columns.Add("vision", typeof(string)); tmo_targetd.Columns.Add("perspire", typeof(string)); tmo_targetd.Columns.Add("edema", typeof(string)); tmo_targetd.Columns.Add("vasr", typeof(string)); tmo_targetd.Columns.Add("claudication", typeof(string)); tmo_targetd.Columns.Add("palpitation", typeof(string)); tmo_targetd.Columns.Add("hdl", typeof(string)); tmo_targetd.Columns.Add("ldl", typeof(string)); tmo_targetd.Columns.Add("tg", typeof(string)); tmo_targetd.Columns.Add("chol", typeof(string)); tmo_targetd.Columns.Add("sbperror", typeof(string)); tmo_targetd.TableName = "tmo_target"; DataRow tmo_targetrow = tmo_targetd.NewRow(); DataTable tmo_targetupd = new DataTable(); tmo_targetupd.Columns.Add("fbg", typeof(string)); tmo_targetupd.Columns.Add("pbg", typeof(string)); tmo_targetupd.Columns.Add("dbp", typeof(string)); tmo_targetupd.Columns.Add("sbp", typeof(string)); tmo_targetupd.Columns.Add("ogtt", typeof(string)); tmo_targetupd.Columns.Add("weight", typeof(string)); tmo_targetupd.Columns.Add("waistline", typeof(string)); tmo_targetupd.Columns.Add("thirsty", typeof(string)); tmo_targetupd.Columns.Add("vision", typeof(string)); tmo_targetupd.Columns.Add("perspire", typeof(string)); tmo_targetupd.Columns.Add("edema", typeof(string)); tmo_targetupd.Columns.Add("vasr", typeof(string)); tmo_targetupd.Columns.Add("claudication", typeof(string)); tmo_targetupd.Columns.Add("palpitation", typeof(string)); tmo_targetupd.Columns.Add("hdl", typeof(string)); tmo_targetupd.Columns.Add("ldl", typeof(string)); tmo_targetupd.Columns.Add("tg", typeof(string)); tmo_targetupd.Columns.Add("chol", typeof(string)); tmo_targetupd.Columns.Add("sbperror", typeof(string)); tmo_targetupd.TableName = "tmo_targetup"; DataRow tmo_targetuptrow = tmo_targetupd.NewRow(); #endregion DataSet ds = GetNowRisk(userId, user_times); #region 本次体检结果数据填充 if (TmoShare.DataSetIsNotEmpty(ds)) { DataRow dr = ds.Tables[0].Rows[0]; DataRow drindicator = ds.Tables[1].Rows[0]; tmo_targetrow["fbg"] = drindicator["fbg"] == null || string.IsNullOrEmpty(drindicator["fbg"].ToString()) ? "----" : drindicator["fbg"].ToString(); tmo_targetrow["pbg"] = drindicator["pbg"] == null || string.IsNullOrEmpty(drindicator["pbg"].ToString()) ? "----" : drindicator["pbg"].ToString(); if (drindicator["sbp"] == null || string.IsNullOrEmpty(drindicator["sbp"].ToString())) { tmo_targetrow["sbp"] = "----"; tmo_targetrow["sbperror"] = "1"; } else { int dbpvalue = Convert.ToInt32(drindicator["sbp"].ToString()); tmo_targetrow["sbp"] = dbpvalue; if (dbpvalue < 90 || dbpvalue > 140) { tmo_targetrow["sbperror"] = "2"; } else { tmo_targetrow["sbperror"] = "1"; } } if (drindicator["dbp"] == null || string.IsNullOrEmpty(drindicator["dbp"].ToString())) { tmo_targetrow["dbp"] = "----"; } else { tmo_targetrow["dbp"] = Convert.ToInt32(drindicator["dbp"].ToString()); } tmo_targetrow["ogtt"] = drindicator["ogtt"] == null || string.IsNullOrEmpty(drindicator["ogtt"].ToString()) ? "----" : drindicator["ogtt"].ToString(); tmo_targetrow["weight"] = drindicator["weight"] == null || string.IsNullOrEmpty(drindicator["weight"].ToString()) ? "----" : drindicator["weight"].ToString(); tmo_targetrow["waistline"] = drindicator["waistline"] == null || string.IsNullOrEmpty(drindicator["waistline"].ToString()) ? "----" : drindicator["waistline"].ToString(); tmo_targetrow["hdl"] = drindicator["hdl"] == null || string.IsNullOrEmpty(drindicator["hdl"].ToString()) ? "----" : drindicator["hdl"].ToString(); tmo_targetrow["ldl"] = drindicator["ldl"] == null || string.IsNullOrEmpty(drindicator["ldl"].ToString()) ? "----" : drindicator["ldl"].ToString(); tmo_targetrow["tg"] = drindicator["tg"] == null || string.IsNullOrEmpty(drindicator["tg"].ToString()) ? "----" : drindicator["tg"].ToString(); tmo_targetrow["chol"] = drindicator["chol"] == null || string.IsNullOrEmpty(drindicator["chol"].ToString()) ? "----" : drindicator["chol"].ToString(); if (dr["vision_blurring"] != null || dr["vision_diminution"].ToString() == "1") { tmo_targetrow["thirsty"] = "是"; } else { tmo_targetrow["thirsty"] = "否"; } if (dr["photophobia"].ToString() == "1" || dr["walkhard"].ToString() == "1" || dr["vision_flog"].ToString() == "1" || dr["floater"].ToString() == "1" || dr["floater"].ToString() == "1" || dr["floater"].ToString() == "1") { tmo_targetrow["vision"] = "异常"; } else { tmo_targetrow["vision"] = "正常"; } if (dr["perspire"].ToString() == "1") { tmo_targetrow["perspire"] = "异常"; } else { tmo_targetrow["perspire"] = "正常"; } if (dr["edema"].ToString() == "1" || dr["edema_aggravated"].ToString() == "1") { tmo_targetrow["edema"] = "是"; } else { tmo_targetrow["edema"] = "否"; } if (drindicator["vasr"].ToString() == "1") { tmo_targetrow["vasr"] = "是"; } else { tmo_targetrow["vasr"] = "否"; } if (drindicator["claudication"].ToString() == "1") { tmo_targetrow["claudication"] = "是"; } else { tmo_targetrow["claudication"] = "否"; } if (dr["palpitation"].ToString() == "1") { tmo_targetrow["palpitation"] = "是"; } else { tmo_targetrow["palpitation"] = "否"; } } else { tmo_targetrow["fbg"] = "----"; tmo_targetrow["pbg"] = "----"; tmo_targetrow["dbp"] = "----"; tmo_targetrow["sbp"] = "----"; tmo_targetrow["ogtt"] = "----"; tmo_targetrow["weight"] = "----"; tmo_targetrow["waistline"] = "----"; tmo_targetrow["hdl"] = "----"; tmo_targetrow["ldl"] = "----"; tmo_targetrow["tg"] = "----"; tmo_targetrow["chol"] = "----"; tmo_targetrow["thirsty"] = "----"; tmo_targetrow["vision"] = "----"; tmo_targetrow["perspire"] = "----"; tmo_targetrow["edema"] = "----"; tmo_targetrow["vasr"] = "----"; tmo_targetrow["claudication"] = "----"; tmo_targetrow["palpitation"] = "----"; } #endregion #region 次体检结果数据 DataSet dsup = GetUprisk(userId, user_times); if (TmoShare.DataSetIsNotEmpty(dsup)) { DataRow dr = dsup.Tables[0].Rows[0]; DataRow drindicator = dsup.Tables[1].Rows[0]; tmo_targetuptrow["fbg"] = drindicator["fbg"] == null || string.IsNullOrEmpty(drindicator["fbg"].ToString()) ? "----" : drindicator["fbg"].ToString(); tmo_targetuptrow["pbg"] = drindicator["pbg"] == null || string.IsNullOrEmpty(drindicator["pbg"].ToString()) ? "----" : drindicator["pbg"].ToString(); if (drindicator["dbp"] == null || string.IsNullOrEmpty(drindicator["dbp"].ToString())) { tmo_targetuptrow["dbp"] = "----"; } else { tmo_targetuptrow["dbp"] = Convert.ToInt32(drindicator["dbp"].ToString()); } if (drindicator["sbp"] == null || string.IsNullOrEmpty(drindicator["sbp"].ToString())) { tmo_targetuptrow["sbp"] = "----"; tmo_targetuptrow["sbperror"] = "1"; } else { int dbpvalue = Convert.ToInt32(drindicator["sbp"].ToString()); tmo_targetuptrow["sbp"] = dbpvalue; if (dbpvalue < 90 || dbpvalue > 140) { tmo_targetuptrow["sbperror"] = "2"; } else { tmo_targetuptrow["sbperror"] = "1"; } } tmo_targetuptrow["ogtt"] = drindicator["ogtt"] == null || string.IsNullOrEmpty(drindicator["ogtt"].ToString()) ? "----" : drindicator["ogtt"].ToString(); tmo_targetuptrow["weight"] = drindicator["weight"] == null || string.IsNullOrEmpty(drindicator["weight"].ToString()) ? "----" : drindicator["weight"].ToString(); tmo_targetuptrow["waistline"] = drindicator["waistline"] == null || string.IsNullOrEmpty(drindicator["waistline"].ToString()) ? "----" : drindicator["waistline"].ToString(); tmo_targetuptrow["hdl"] = drindicator["hdl"] == null || string.IsNullOrEmpty(drindicator["hdl"].ToString()) ? "----" : drindicator["hdl"].ToString(); tmo_targetuptrow["ldl"] = drindicator["ldl"] == null || string.IsNullOrEmpty(drindicator["ldl"].ToString()) ? "----" : drindicator["ldl"].ToString(); tmo_targetuptrow["tg"] = drindicator["tg"] == null || string.IsNullOrEmpty(drindicator["tg"].ToString()) ? "----" : drindicator["tg"].ToString(); tmo_targetuptrow["chol"] = drindicator["chol"] == null || string.IsNullOrEmpty(drindicator["chol"].ToString()) ? "----" : drindicator["chol"].ToString(); if (dr["vision_blurring"] != null || dr["vision_diminution"].ToString() == "1") { tmo_targetuptrow["thirsty"] = "是"; } else { tmo_targetuptrow["thirsty"] = "否"; } if (dr["photophobia"].ToString() == "1" || dr["walkhard"].ToString() == "1" || dr["vision_flog"].ToString() == "1" || dr["floater"].ToString() == "1" || dr["floater"].ToString() == "1" || dr["floater"].ToString() == "1") { tmo_targetuptrow["vision"] = "异常"; } else { tmo_targetuptrow["vision"] = "正常"; } if (dr["perspire"].ToString() == "1") { tmo_targetuptrow["perspire"] = "异常"; } else { tmo_targetuptrow["perspire"] = "正常"; } if (dr["edema"].ToString() == "1" || dr["edema_aggravated"].ToString() == "1") { tmo_targetuptrow["edema"] = "是"; } else { tmo_targetuptrow["edema"] = "否"; } if (drindicator["vasr"].ToString() == "1") { tmo_targetuptrow["vasr"] = "是"; } else { tmo_targetuptrow["vasr"] = "否"; } if (drindicator["claudication"].ToString() == "1") { tmo_targetuptrow["claudication"] = "是"; } else { tmo_targetuptrow["claudication"] = "否"; } if (dr["palpitation"].ToString() == "1") { tmo_targetuptrow["palpitation"] = "是"; } else { tmo_targetuptrow["palpitation"] = "否"; } } else { tmo_targetuptrow["fbg"] = "----"; tmo_targetuptrow["pbg"] = "----"; tmo_targetuptrow["dbp"] = "----"; tmo_targetuptrow["sbp"] = "----"; tmo_targetuptrow["ogtt"] = "----"; tmo_targetuptrow["weight"] = "----"; tmo_targetuptrow["waistline"] = "----"; tmo_targetuptrow["hdl"] = "----"; tmo_targetuptrow["ldl"] = "----"; tmo_targetuptrow["tg"] = "----"; tmo_targetuptrow["chol"] = "----"; tmo_targetuptrow["thirsty"] = "----"; tmo_targetuptrow["vision"] = "----"; tmo_targetuptrow["perspire"] = "----"; tmo_targetuptrow["edema"] = "----"; tmo_targetuptrow["vasr"] = "----"; tmo_targetuptrow["claudication"] = "----"; tmo_targetuptrow["palpitation"] = "----"; } #endregion tmo_targetd.Rows.Add(tmo_targetrow); tmo_targetupd.Rows.Add(tmo_targetuptrow); tmo_target1.Tables.Clear(); tmo_target1.Tables.Add(tmo_targetd.Copy()); tmo_target1.Tables.Add(tmo_targetupd.Copy()); }
/// <summary> /// 监测数据推送微信 /// </summary> /// <param name="state"></param> private void MonitorSendWe(object state) { string data = @"<data> <first> <value></value> <color></color> </first> <keyword1> <value></value> <color></color> </keyword1> <keyword2> <value></value> <color></color> </keyword2> <keyword3> <value></value> <color></color> </keyword3> <remark> <value></value> <color></color> </remark> </data>"; string result = ""; string testName = ""; if ((DateTime.Now - lastMonitorSendWeTime).TotalSeconds >= 30) //30秒查询一次 { var dtUser = Tmo_FakeEntityManager.Instance.GetData("tmo_monitor", new[] { "user_id", "mt_code", "mt_valueint", "mt_time", "mt_valuefloat", "mt_isnormal", "id", "mt_timestamp" }, "mt_code in (100,101,102,103) and we_send ='2' and mt_time>=date_add(NOW(), interval -7 day)", null, null, null, false, 1000); if (TmoShare.DataTableIsNotEmpty(dtUser)) { List <string> skipIds = new List <string>(); foreach (DataRow dr in dtUser.Rows) { string id = dr.GetDataRowStringValue("id"); if (skipIds.Contains(id)) { continue; //跳过处理过的血压数据 } string userid = dr.GetDataRowStringValue("user_id"); if (string.IsNullOrWhiteSpace(userid)) { continue; } //查询微信绑定 string myweixin = tmo_userinfo_tokenManager.Instance.GetBindId(userid); //查询亲友是否绑定微信 DataSet familyds = tmo_userinfoManager.Instance.IsBindFamily(userid); if (string.IsNullOrWhiteSpace(myweixin) && TmoShare.DataSetIsEmpty(familyds)) { continue; //没有绑定微信 跳过 } List <string> ids = new List <string>(); ids.Add(id); string timestamp = dr.GetDataRowStringValue("mt_timestamp"); #region 组织发送内容 switch (dr["mt_code"].ToString()) { case "100": //舒张压 DataRow[] rows = dtUser.Select(string.Format("mt_code=101 and user_id='{0}' and mt_timestamp='{1}'", userid, timestamp)); string ssy = null; if (rows.Length > 0) { ssy = rows[0].GetDataRowStringValue("mt_valueint"); string ssyid = rows[0].GetDataRowStringValue("id"); skipIds.Add(ssyid); ids.Add(ssyid); } if (ssy == null) { result = "【舒张压】" + dr["mt_valueint"].ToString() + "mmHg"; } else { result = ssy + "/" + dr.GetDataRowStringValue("mt_valueint") + " mmHg"; } testName = "血压"; break; case "101": //收缩压 DataRow[] row1s = dtUser.Select(string.Format("mt_code=100 and user_id='{0}' and mt_timestamp='{1}'", userid, timestamp)); string szy = null; if (row1s.Length > 0) { szy = row1s[0].GetDataRowStringValue("mt_valueint"); string szyid = row1s[0].GetDataRowStringValue("id"); skipIds.Add(szyid); ids.Add(szyid); } if (szy == null) { result = "【收缩压】" + dr["mt_valueint"].ToString() + "mmHg"; } else { result = dr.GetDataRowStringValue("mt_valueint") + "/" + szy + " mmHg"; } testName = "血压"; break; case "102": //心率 result = dr["mt_valueint"].ToString() + "次/分钟"; testName = "心率"; break; case "103": //血糖 result = dr["mt_valuefloat"].ToString() + "mmol/L"; testName = "血糖"; break; default: break; } #endregion #region 发送给自己 //查询自己是否绑定微信 if (!string.IsNullOrEmpty(myweixin)) { DataSet ds = TmoShare.getDataSetFromXML(data); ds.Tables["first"].Rows[0]["value"] = "尊敬的用户,您刚刚完成的测量:"; ds.Tables["first"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray); ds.Tables["keyword1"].Rows[0]["value"] = string.Format("[{0}]", testName); ds.Tables["keyword1"].Rows[0]["color"] = "#507ED3"; ds.Tables["keyword2"].Rows[0]["value"] = dr.GetDataRowDateTimeValue("mt_time").ToString("yyyy年MM月dd日 HH:mm:ss"); ds.Tables["keyword2"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray); ds.Tables["keyword3"].Rows[0]["value"] = result; ds.Tables["keyword3"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Green); ds.Tables["remark"].Rows[0]["value"] = "建议您养成定期测量" + testName + "的习惯,感谢您的使用!"; ds.Tables["remark"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray); string content = TmoCommon.TmoShare.GetXml_NO_TITLE(ds); string idstr = string.Join(",", ids); Dictionary <string, object> dicVals = new Dictionary <string, object>(); dicVals.Add("push_id", idstr); dicVals.Add("user_code", userid); dicVals.Add("push_type", 6); dicVals.Add("push_address", myweixin); dicVals.Add("content_type", "1"); dicVals.Add("content_title", "健康监测消息推送"); dicVals.Add("content_value", content); dicVals.Add("push_status", 1); dicVals.Add("doc_code", "admin"); dicVals.Add("remark", "weMonitor"); bool suc = tmo_push_listManager.Instance.AddToPushList(dicVals); if (suc) { tmo_monitorManager.Instance.UpdateWXState(idstr, 3); //推送中 } } #endregion #region 发送给绑定的家人 if (TmoShare.DataSetIsNotEmpty(familyds)) { #region 用户信息 string username = userid; Userinfo user = tmo_userinfoManager.Instance.GetUserInfoByID(userid); if (user != null) { username = user.name; } #endregion for (int i = 0; i < familyds.Tables[0].Columns.Count; i++) { DataColumn cloum = familyds.Tables[0].Columns[i]; string key = cloum.ColumnName; string familyId = familyds.Tables[0].Rows[0][key].ToString(); if (string.IsNullOrEmpty(familyId)) { continue; } string familyweixin = tmo_userinfo_tokenManager.Instance.GetBindId(familyId); if (!string.IsNullOrWhiteSpace(familyweixin)) { DataSet ds = TmoShare.getDataSetFromXML(data); ds.Tables["first"].Rows[0]["value"] = "尊敬的用户,您的亲人" + username + "刚刚完成的测量:"; ds.Tables["first"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray); ds.Tables["keyword1"].Rows[0]["value"] = string.Format("[{0}]", testName); ds.Tables["keyword1"].Rows[0]["color"] = "#507ED3"; ds.Tables["keyword2"].Rows[0]["value"] = dr.GetDataRowDateTimeValue("mt_time").ToString("yyyy年MM月dd日 HH:mm:ss"); ds.Tables["keyword2"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray); ds.Tables["keyword3"].Rows[0]["value"] = result; ds.Tables["keyword3"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Green); ds.Tables["remark"].Rows[0]["value"] = "感谢您的使用!"; ds.Tables["remark"].Rows[0]["color"] = TmoShare.RGBToWebColor(Color.Gray); string content = TmoCommon.TmoShare.GetXml_NO_TITLE(ds); string idstr = string.Join(",", ids); Dictionary <string, object> dicVals = new Dictionary <string, object>(); dicVals.Add("push_id", idstr + "," + -1 * (i + 1)); dicVals.Add("user_code", userid); dicVals.Add("push_type", 6); dicVals.Add("push_address", familyweixin); dicVals.Add("content_type", "1"); dicVals.Add("content_title", "健康监测消息推送"); dicVals.Add("content_value", content); dicVals.Add("push_status", 1); dicVals.Add("doc_code", "admin"); dicVals.Add("remark", "weMonitor"); bool suc = tmo_push_listManager.Instance.AddToPushList(dicVals); if (suc) { tmo_monitorManager.Instance.UpdateWXState(idstr, 3); //推送中 } } } } #endregion } } lastMonitorSendWeTime = DateTime.Now; } ((ManualResetEvent)((object[])state)[0]).Set(); }
private DateTime lastMianTime = DateTime.MinValue; //面访上次提醒日期 /// <summary> /// 定时执行干预任务 /// </summary> /// <param name="state"></param> private void ExecIntervene(object state) { FE_GetDataParam param = new FE_GetDataParam() { Sources = "tmo_intervene", PrimaryKey = "inte_id", Columns = { "tmo_userinfo.name", "tmo_userinfo.gender", "tmo_userinfo.age", "tmo_userinfo.phone", "tmo_intervene.*" }, JoinConditions = { new JoinCondition() { JoinType = EmJoinType.LeftJoin, Table = "tmo_userinfo", OnCol = "user_id" } } }; param.AddWhere("inte_status in (1,2)"); var ds = Tmo_FakeEntityManager.Instance.GetData(param); //获取未执行的干预 if (TmoShare.DataSetIsNotEmpty(ds)) { bool canNotice = (DateTime.Now - lastNoticeTime).TotalSeconds >= 30; var dt = ds.Tables["tmo_data"]; for (int i = 0; i < dt.Rows.Count; i++) { var dr = dt.Rows[i]; string inte_id = dr.GetDataRowStringValue("inte_id"); try { string inte_content = dr.GetDataRowStringValue("inte_content"); int inte_way = dr.GetDataRowIntValue("inte_way"); //干预方式 1-邮件 2-短信 3-电话 4-面访 int doc_id = dr.GetDataRowIntValue("doc_id"); string inte_addr = dr.GetDataRowStringValue("inte_addr"); DateTime inte_plantime = dr.GetDataRowDateTimeValue("inte_plantime"); TimeSpan diffSpan = DateTime.Now - inte_plantime; //现在时间距离计划时间的时间差 int failMin = 30; //过期时间 单位:分钟 if (Debugger.IsAttached) { failMin = 60 * 24 * 3; } if (inte_way == 3) { failMin = 60 * 12; //电话12小时过期 } if (inte_way == 4) { failMin = 60 * 24; //面访24小时过期 if (diffSpan.TotalMinutes > -failMin && diffSpan.TotalMinutes < 0) //提前24小时提醒 { if ((DateTime.Now - lastMianTime).TotalMinutes >= 30) { string str = string.Format("面访任务提醒\n时间 [{0}]\n客户信息 [{1},{2},{3}岁]\n手机号码 {4}\n面访地址 {5}\n请提前做好准备!", inte_plantime.ToString("yyyy年MM月dd日HH点mm分"), dr.GetDataRowStringValue("name"), dr.GetDataRowIntValue("gender") == 1 ? "男" : "女", dr.GetDataRowStringValue("age"), dr.GetDataRowStringValue("phone"), inte_addr); bool sendsuc = PushInvoke.SendDocInvoke(doc_id.ToString(), 0, str); if (sendsuc) { lastMianTime = DateTime.Now; } } continue; } } if (diffSpan.Ticks < 0) { continue; //未到执行时间 } if (diffSpan.TotalMinutes > failMin) //干预过期 { tmo_interveneManager.Instance.SetInterveneFailed(inte_id, "干预过期"); continue; } int inte_status = dr.GetDataRowIntValue("inte_status"); //更改执行状态 if (inte_status == 1) { tmo_interveneManager.Instance.SetInterveneExecing(inte_id); continue; } PushType pushtype = PushType.doc_wechat; //默认类型 此类型无效 switch (inte_way) { case 1: pushtype = PushType.user_mail; break; case 2: pushtype = PushType.user_sms; break; case 3: //电话干预 if (canNotice) { string title = "请执行电话干预"; string msg = string.Format("有一个电话干预需要执行:\n时间 [{0}]\n客户信息 [{1},{2},{3}岁]\n电话号码 [{4}]\n点击查看详情并填写执行结果!", inte_plantime.ToString("yyyy年MM月dd日HH点mm分"), dr.GetDataRowStringValue("name"), dr.GetDataRowIntValue("gender") == 1 ? "男" : "女", dr.GetDataRowStringValue("age"), inte_addr); string sendStr = title + ";" + msg + ";" + inte_id; bool sendsuc = PushInvoke.SendDocInvoke(doc_id.ToString(), 100, sendStr); if (sendsuc) { lastNoticeTime = DateTime.Now; } } break; case 4: //面访干预 if (canNotice) { string title = "请执行面访干预"; string msg = string.Format("有一个面访干预需要执行:\n时间 [{0}]\n客户信息 [{1},{2},{3}岁]\n手机号码 [{4}]\n面访地址 {5}\n点击查看详情并填写执行结果!", inte_plantime.ToString("yyyy年MM月dd日HH点mm分"), dr.GetDataRowStringValue("name"), dr.GetDataRowIntValue("gender") == 1 ? "男" : "女", dr.GetDataRowStringValue("age"), dr.GetDataRowStringValue("phone"), inte_addr); string sendStr = title + ";" + msg + ";" + inte_id; bool sendsuc = PushInvoke.SendDocInvoke(doc_id.ToString(), 101, sendStr); if (sendsuc) { lastNoticeTime = DateTime.Now; } } break; default: throw new Exception("干预方式参数无效"); } if (pushtype == PushType.doc_wechat || pushtype == PushType.None) { continue; //未知方式取消推送 } string inte_reason = dr.GetDataRowStringValue("inte_reason"); if (inte_reason == "sending") { continue; //发送中跳过 } string inte_title = dr.GetDataRowStringValue("inte_title"); if (string.IsNullOrWhiteSpace(inte_title)) { inte_title = "健康干预"; } string user_id = dr.GetDataRowStringValue("user_id"); Dictionary <string, object> dicVals = new Dictionary <string, object>(); dicVals.Add("push_id", inte_id); dicVals.Add("user_code", user_id); dicVals.Add("push_type", (int)pushtype); dicVals.Add("push_address", inte_addr); dicVals.Add("content_type", "1"); dicVals.Add("content_title", inte_title); dicVals.Add("content_value", inte_content); dicVals.Add("push_status", 1); dicVals.Add("doc_code", doc_id); bool suc = tmo_push_listManager.Instance.AddToPushList(dicVals); if (suc) { dicVals.Clear(); dicVals.Add("inte_reason", "sending"); Tmo_FakeEntityManager.Instance.SubmitData(DBOperateType.Update, "tmo_intervene", "inte_id", inte_id, dicVals); } } catch (Exception ex) { LogHelper.Log.Error("干预任务解析失败!", ex); tmo_interveneManager.Instance.SetInterveneFailed(inte_id, "干预任务解析失败:" + ex.Message); } } } ((ManualResetEvent)((object[])state)[0]).Set(); }