Пример #1
0
        private void btnCxtj_Click(object sender, EventArgs e)
        {
            DataTable dt = xtbiz.GetTjxmByDwAndTjrq(txtDw.Tag.ToString(), comn.DateTimeChange(dtpFrom.Value.AddDays(-1)) + " 23:59:59",
                    comn.DateTimeChange(dtpTo.Value) + " 23:59:59");
            if(dt.Rows.Count == 0)
            {
                Clear();
                return;
            }
            StringBuilder zhxm = new StringBuilder("问诊");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                zhxm.Append("、" + dt.Rows[i][0].ToString().Trim());
            }
            txtTjxm.Text = zhxm.ToString();

            int count = xtbiz.GetTjrs(txtDw.Tag.ToString(), comn.DateTimeChange(dtpFrom.Value.AddDays(-1)) + " 23:59:59",
                comn.DateTimeChange(dtpTo.Value) + " 23:59:59");
            txtTjrs.Text = count.ToString();

            //明细
            dtTjhz = new DataTable();
            dtTjhz = xtbiz.GetTjhz(txtDw.Tag.ToString(), comn.DateTimeChange(dtpFrom.Value.AddDays(-1)) + " 23:59:59",
                comn.DateTimeChange(dtpTo.Value) + " 23:59:59");
            dgvTjhz.DataSource = dtTjhz;

            //结论
            StringBuilder jl = new StringBuilder("本次在岗期间职业健康体检,");
            for (int i = 0; i < dtTjhz.Rows.Count; i++)
            {
                //bgid,maxdate,mindate,sjdw,tjrs,tjxm,tjjl,gz,zrs,jkycrs,zyycrs,dwmc,rylb,whys
                string str_whysbz = "";
                if (dtTjhz.Rows[i]["whys"].ToString().Trim() == "")
                {
                    str_whysbz = "无接触的主要职业危害因素,";
                }
                else
                {
                    str_whysbz = "接触的主要职业病危害因素是" + dtTjhz.Rows[i]["whys"].ToString().Trim()+",";
                }

                jl.Append(dtTjhz.Rows[i]["gz"].ToString().Trim() + "共" + dtTjhz.Rows[i]["rs"]
                    + "人,"+str_whysbz+"职业相关健康异常" + dtTjhz.Rows[i]["zyjkyc"].ToString().Trim() + "人;");
            }
            //txtTjjl.Text = jl.ToString();
            richTextBox1.Text = jl.ToString();
            dt = new DataTable();
            dt = xtbiz.GetWjrs(txtDw.Tag.ToString(), comn.DateTimeChange(dtpFrom.Value.AddDays(-1)) + " 23:59:59",
                comn.DateTimeChange(dtpTo.Value) + " 23:59:59");
            if (dt.Rows.Count > 0)
            {
                string wjrs = dt.Rows[0]["wjrs"].ToString().Trim();
                string wzjrs = dt.Rows[0]["wzjrs"].ToString().Trim();
                this.Text = "职业健康体检报告【未检人数:" + wjrs + ";未总检人数:" + wzjrs + "】";
            }

            //获取最大时间
            dt = new DataTable();
            dt = tzs.GetTjrq_new2(txtDw.Tag.ToString(), comn.DateTimeChange(dtpFrom.Value.AddDays(-1)) + " 23:59:59",
                comn.DateTimeChange(dtpTo.Value) + " 23:59:59");
            if (dt.Rows.Count > 0)
            {
                maxdate = Convert.ToDateTime(dt.Rows[0]["maxdate"].ToString().Trim());
                mindate = Convert.ToDateTime(dt.Rows[0]["mindate"].ToString().Trim());
            }
            else
            {
                maxdate = dtpFrom.Value;
                mindate = dtpTo.Value;
            }
        }