/// <summary> /// 设定选中项目 /// </summary> /// <param name="selectvalue"></param> public void setItemSelect() { AddFormBll addformbll = new AddFormBll(); DataTable dt_tm_rq = addformbll.GetMoHuList(string.Format(" and T_JK_TM_zdRQ.YLJGBM='{0}' and T_JK_TM_zdRQ.ZDRQ='{1}'", UserInfo.Yybm, zdrq_para), "sql100"); if (dt_tm_rq != null && dt_tm_rq.Rows.Count > 0) { DataTable dt = (DataTable)checkedListBox1.DataSource; if (dt == null || dt.Rows.Count == 0) { return; } for (int i = 0; i < dt_tm_rq.Rows.Count; i++) { for (int j = 0; j < dt.Rows.Count; j++) { if (dt_tm_rq.Rows[i]["tmbm"].ToString().Equals(dt.Rows[j]["tmbm"].ToString())) { checkedListBox1.SetItemChecked(j, true); break; } } } } }
/// <summary> /// 初始化条码 /// </summary> private void initCheck() { AddFormBll addformbll = new AddFormBll(); DataTable dt_tm = addformbll.GetMoHuList(string.Format(" and SFDY='1' and YLJGBM='{0}'", UserInfo.Yybm), "sql030"); checkedListBox1.DataSource = dt_tm; checkedListBox1.DisplayMember = "tmmc"; checkedListBox1.ValueMember = "tmbm"; //设定选中项目 setItemSelect(); }
/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MedexList_Load(object sender, EventArgs e) { AddFormBll addformbll_cz = new AddFormBll(); DataTable dtCunzhuang = addformbll_cz.GetMoHuList(string.Format(" and YLJGBM='{0}' ", UserInfo.Yybm), "sql038_cunzhuang"); //绑定村庄 DataRow dtRow = dtCunzhuang.NewRow(); dtRow["B_RGID"] = ""; dtRow["B_NAME"] = "--请选择--"; dtCunzhuang.Rows.InsertAt(dtRow, 0); comboBox_cunzhuang.DataSource = dtCunzhuang; comboBox_cunzhuang.DisplayMember = "B_NAME"; comboBox_cunzhuang.ValueMember = "B_RGID"; comboBox_cunzhuang.SelectedValue = 0; comboBox_cunzhuang.Focus(); }
/// <summary> /// 按照条件获取信息 /// </summary> /// <param name="sqlWhere"></param> /// <param name="Errmsg"></param> /// <returns></returns> public bool getRyxxByWhere(string sqlWhere, ref string Errmsg) { Errmsg = ""; try { //按照条件检索 AddFormBll addformbll = new AddFormBll(); DataTable dt_jktj = addformbll.GetMoHuList(sqlWhere, "sql050_1"); //dataGridView_list.DataSource = dt_jktj; dt_tem = dt_jktj; if (dt_jktj == null || dt_jktj.Rows.Count == 0) { Errmsg = "没有取到数据!"; //数据绑定 BindDgv(); return(false); } else { DataColumn datacolumn = new DataColumn("select_zt", System.Type.GetType("System.Int32")); datacolumn.DefaultValue = 0; dt_jktj.Columns.Add(datacolumn); //数据绑定 BindDgv(); } this.pager1.init(); //初始化 this.pager1.Bind(); //绑定 } catch (Exception ex) { Errmsg = ex.Message; return(false); } return(true); }
/// <summary> /// 检索 /// </summary> /// <returns></returns> public bool jkda_select() { string sqlWhere = ""; try { //医疗机构编码 sqlWhere = sqlWhere + " and YLJGBM = '" + UserInfo.Yybm + "'"; //村庄 if (comboBox_cunzhuang.SelectedValue != null && comboBox_cunzhuang.SelectedValue.ToString().Length > 0) { sqlWhere = sqlWhere + " and CZBM = '" + comboBox_cunzhuang.SelectedValue.ToString() + "'"; } //体检时间 if (dateTimePicker_tjsj.Checked == true) { sqlWhere = sqlWhere + " and TJSJ = '" + dateTimePicker_tjsj.Value.ToString("yyy-MM-dd") + "'"; } //体检号 if (textBox_TJBH.Text.Trim().Length > 0) { sqlWhere = sqlWhere + " and (TJBM like '%" + textBox_TJBH.Text.Trim() + "%' or TJBH_TEM like '%" + textBox_TJBH.Text.Trim() + "%')"; } //姓名 if (textBox_xm.Text.Trim().Length > 0) { sqlWhere = sqlWhere + " and XM like '%" + textBox_xm.Text.Trim() + "%'"; } //体检状态 string strTJZT = "TJZT in ('{0}','{1}')"; if (checkBox_wtj.Checked == true) { strTJZT = strTJZT.Replace("{0}", "2"); } if (checkBox_ytj.Checked == true) { strTJZT = strTJZT.Replace("{1}", "1"); } if (checkBox_wtj.Checked == true || checkBox_ytj.Checked == true) { sqlWhere = sqlWhere + " and " + strTJZT; } //按照条件检索 AddFormBll addformbll = new AddFormBll(); DataTable dt_jktj = addformbll.GetMoHuList(sqlWhere, "sql092"); dataGridView_list.DataSource = dt_jktj; dt_tem = dt_jktj; if (dt_jktj == null || dt_jktj.Rows.Count == 0) { MessageBox.Show("没有取到数据!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } return(true); }
/// <summary> /// 检索 /// </summary> /// <returns></returns> public bool jkda_select() { string sqlWhere = ""; try { //医疗机构编码 sqlWhere = sqlWhere + " and YLJGBM = '" + UserInfo.Yybm + "'"; //村庄 if (comboBox_cunzhuang.SelectedValue != null && comboBox_cunzhuang.SelectedValue.ToString().Length > 0) { //sqlWhere = sqlWhere + " and CZBM = '" + comboBox_cunzhuang.SelectedValue.ToString() + "'"; sqlWhere = sqlWhere + " and PRGID = '" + comboBox_cunzhuang.SelectedValue + "'"; } //体检号 if (textBox_TJBH.Text.Trim().Length > 0) { sqlWhere = sqlWhere + " and (TJBM like '%" + textBox_TJBH.Text.Trim() + "%' or TJBH_TEM like '%" + textBox_TJBH.Text.Trim() + "%')"; } //姓名 if (textBox_xm.Text.Trim().Length > 0) { sqlWhere = sqlWhere + " and XM like '%" + textBox_xm.Text.Trim() + "%'"; } //体检状态 string strWhere_jktj = ""; //健康体检 if (checkBox_jktj.Checked == true) { if (!((checkBox_wtj.Checked == true && checkBox_ytj.Checked == true) || (checkBox_wtj.Checked == false && checkBox_ytj.Checked == false))) { if (checkBox_wtj.Checked == true) { strWhere_jktj = "and ZT_jktj is null "; } else { strWhere_jktj = " and ZT_jktj='1' "; } } //体检时间 if (dateTimePicker_tjsj.Checked == true) { strWhere_jktj = strWhere_jktj + " and TJSJ_jktj = '" + dateTimePicker_tjsj.Value.ToString("yyy-MM-dd") + "'"; } } //体质辨识 string strWhere_tzbs = ""; if (checkBox_tzbs.Checked == true) { if (!((checkBox_wtj.Checked == true && checkBox_ytj.Checked == true) || (checkBox_wtj.Checked == false && checkBox_ytj.Checked == false))) { if (checkBox_wtj.Checked == true) { strWhere_tzbs = "and ZT_tzbs is null "; } else { strWhere_tzbs = " and ZT_tzbs='1' "; } } //体检时间 if (dateTimePicker_tjsj.Checked == true) { strWhere_tzbs = strWhere_tzbs + " and TJSJ_tzbs = '" + dateTimePicker_tjsj.Value.ToString("yyy-MM-dd") + "'"; } } //自理行为能力评估 string strWhere_zlnlpg = ""; if (checkBox_zlnlpg.Checked == true) { if (!((checkBox_wtj.Checked == true && checkBox_ytj.Checked == true) || (checkBox_wtj.Checked == false && checkBox_ytj.Checked == false))) { if (checkBox_wtj.Checked == true) { strWhere_zlnlpg = "and ZT_zlpg is null "; } else { strWhere_zlnlpg = " and ZT_zlpg='1' "; } } //体检时间 if (dateTimePicker_tjsj.Checked == true) { strWhere_zlnlpg = strWhere_zlnlpg + " and TJSJ_zlpg = '" + dateTimePicker_tjsj.Value.ToString("yyy-MM-dd") + "'"; } } //人员状态 //登记 if (checkBox_dj.Checked == true) { //TJSJ_dj //ZT_dj sqlWhere = sqlWhere + " and ZT_dj = '" + Common.ZT.确定状态 + "'"; if (dateTimePicker_tjsj.Checked == true) { sqlWhere = sqlWhere + " and TJSJ_dj = '" + dateTimePicker_tjsj.Value.ToString("yyyy-MM-dd") + "'"; } } //新建档 if (checkBox_add.Checked == true) { //TJSJ_dj //ZT_dj if (checkBox_update.Checked == true) { sqlWhere = sqlWhere + " and (isnewdoc = '1' or fl='2' )"; } else { sqlWhere = sqlWhere + " and isnewdoc = '1' "; } } else if (checkBox_update.Checked == true) { sqlWhere = sqlWhere + " and ( isnewdoc = '0' and fl='2' )"; } sqlWhere = sqlWhere + strWhere_jktj + strWhere_tzbs + strWhere_zlnlpg; //按照条件检索 AddFormBll addformbll = new AddFormBll(); DataTable dt_jktj = addformbll.GetMoHuList(sqlWhere, "sql803"); //dataGridView_list.DataSource = dt_jktj; dt_tem = dt_jktj; if (dt_jktj == null || dt_jktj.Rows.Count == 0) { MessageBox.Show("没有取到数据!"); } else { BindDgv(); } this.pager1.init(); //初始化 this.pager1.Bind(); //绑定 } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } return(true); }