/// <summary> /// 表格双击事件,调出病人基本信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvList_DoubleClick(object sender, EventArgs e) { if (dgvList.CurrentRow != null) { string selectSection = dgvList.CurrentRow.Cells["科室名称"].Value.ToString(); //危机值病人 string sql_sectionPatient = "select distinct a.pid 住院号,a.sick_bed_no 床号,a.patient_name 姓名,(case when a.gender_code='0' then '男' else '女' end) 性别,a.age 年龄 ,a.sick_doctor_name 管床医生,a.in_time 住院日期 from t_in_patient a " + " inner join t_lis_sample b on a.pid=b.mzh " + " inner join t_lis_result c on b.bblsh=c.bblsh" + " inner join t_inhospital_action d on a.id=d.pid" + " where (c.xmjg='阳性' or c.jgbz='L' or c.jgbz='H') and to_char(b.jyrq,'yyyy-MM-dd')='" + dtpTime.Value.ToString("yyyy-MM-dd") + "' and a.document_state is null and d.next_id=0 and d.action_type<>'出区' and a.section_name='" + selectSection + "'"; frmLis_Query frmlis = new frmLis_Query(sql_sectionPatient); frmlis.StartPosition = FormStartPosition.CenterParent; frmlis.ShowDialog(); //DataRow[] dr_patients = ds.Tables["patient"].Select("section_name='"+selectSection+"'"); ////数据行集合转DataTable //DataTable dt = ds.Tables["patient"].Clone(); //for (int i = 0; i < dr_patients.Length; i++) //{ // dt.ImportRow(dr_patients[i]); //} } }
//查询 private void buttonX_LisQuery_Click(object sender, EventArgs e) { string jgbz = ""; string sql = ""; //jgbz = GetjgbzString(jgbz); DateTime dt1 = Convert.ToDateTime(dateTimePicker1.Text); DateTime dt2 = Convert.ToDateTime(dateTimePicker2.Text).AddHours(23).AddMinutes(59).AddSeconds(59); int jcmc = checkedListBox_Right.Items.Count; string xmmc = ""; for (int i = 0; i < jcmc; i++) { if (xmmc == "") { xmmc = "'" + checkedListBox_Right.Items[i].ToString() + "'"; } else { xmmc += ",'" + checkedListBox_Right.Items[i].ToString() + "'"; } } if (radioButton1.Checked == true || radioButton2.Checked == true) { if (radioButton1.Checked == true) { jgbz = "H"; } else { jgbz = "L"; } sql = "select distinct bb.mzh 住院号,cc.sick_bed_no 床号,cc.patient_name 姓名,case when cc.gender_code='0' then '男' when cc.gender_code='1' then '女' end 性别,cc.age 年龄,cc.sick_doctor_name 管床医生,cc.in_time 入院时间 from t_lis_result t inner join t_lis_sample bb on t.bblsh=bb.bblsh inner join t_in_patient cc on bb.mzh=cc.pid where t.xmmc in (" + xmmc + ") and t.jgbz='" + jgbz + "' and to_date(t.cssj,'yyyy-MM-dd hh24:mi:ss') between to_date('" + dt1.ToString() + "','yyyy-MM-dd hh24:mi:ss') and to_date('" + dt2.ToString() + "','yyyy-MM-dd hh24:mi:ss')"; } else if (radioButton3.Checked == true) { jgbz = "阳性"; sql = "select distinct bb.mzh 住院号,cc.sick_bed_no 床号,cc.patient_name 姓名,case when cc.gender_code='0' then '男' when cc.gender_code='1' then '女' end 性别,cc.age 年龄,cc.sick_doctor_name 管床医生,cc.in_time 入院时间 from t_lis_result t inner join t_lis_sample bb on t.bblsh=bb.bblsh inner join t_in_patient cc on bb.mzh=cc.pid where t.xmmc in (" + xmmc + ") and t.xmjg='" + jgbz + "' and to_date(t.cssj,'yyyy-MM-dd hh24:mi:ss') between to_date('" + dt1.ToString() + "','yyyy-MM-dd hh24:mi:ss') and to_date('" + dt2.ToString() + "','yyyy-MM-dd hh24:mi:ss')"; } else if (radioButton4.Checked == true) { //xmjg jgbz = "阳性"; sql = "select distinct bb.mzh 住院号,cc.sick_bed_no 床号,cc.patient_name 姓名,case when cc.gender_code='0' then '男' when cc.gender_code='1' then '女' end 性别,cc.age 年龄,cc.sick_doctor_name 管床医生,cc.in_time 入院时间 from t_lis_result t inner join t_lis_sample bb on t.bblsh=bb.bblsh inner join t_in_patient cc on bb.mzh=cc.pid where t.xmmc in (" + xmmc + ") and (t.jgbz is not null or t.xmjg='" + jgbz + "')and to_date(t.cssj,'yyyy-MM-dd hh24:mi:ss') between to_date('" + dt1.ToString() + "','yyyy-MM-dd hh24:mi:ss') and to_date('" + dt2.ToString() + "','yyyy-MM-dd hh24:mi:ss')"; } if (sql != "") { frmLis_Query frmlis = new frmLis_Query(sql); frmlis.StartPosition = FormStartPosition.CenterParent; frmlis.ShowDialog(); } }