示例#1
0
        /// <summary>
        /// 查找
        /// </summary>
        private void m_mthFind()
        {
            //查询条件
            string sqlwhere = "";
            //条件组合逻辑
            string Jion = "";

            if (this.rdoAnd.Checked)
            {
                Jion = " and ";
            }
            else if (this.rdoOr.Checked)
            {
                Jion = " or ";
            }

            //卡号
            if (this.txtCardno.Enabled && this.txtCardno.Text.Trim() != "")
            {
                sqlwhere += "(f.patientcardid_chr = '" + this.txtCardno.Text.Trim() + "') " + Jion;
            }

            //姓名
            if (this.txtName.Enabled && this.txtName.Text.Trim() != "")
            {
                sqlwhere += "(b.name_vchr like '" + this.txtName.Text.Trim() + "%') " + Jion;
            }

            //性别
            if (this.cboSex.Enabled && this.cboSex.Text.Trim() != "")
            {
                sqlwhere += "(b.sex_chr = '" + this.cboSex.Text.Trim() + "') " + Jion;
            }

            //手术者
            if (this.m_txtFinddoct.Enabled && this.m_txtFinddoct.txtValuse.Trim() != "")
            {
                sqlwhere += "(h.opsdoctor_chr like '" + this.m_txtFinddoct.txtValuse.Trim() + "%') " + Jion;
            }

            //手术科室
            if (this.txtDept.Enabled && this.txtDept.txtValuse.Trim() != "")
            {
                sqlwhere += "(e.deptname_vchr like '" + this.txtDept.txtValuse.Trim() + "%') " + Jion;
            }

            //手术名称
            if (this.txtOPSName.Enabled && this.txtOPSName.Text.Trim() != "")
            {
                sqlwhere += "(h.opsname_vchr like '%" + this.txtOPSName.Text.Trim() + "%') " + Jion;
            }

            //手术时间
            if (this.dtpBegindate.Enabled)
            {
                sqlwhere += "(to_char(h.opsdate_dat,'yyyy-mm-dd') between '" + this.dtpBegindate.Value.ToString("yyyy-MM-dd") + "' and '" + this.dtpEnddate.Value.ToString("yyyy-MM-dd") + "')";
            }

            if ((sqlwhere = sqlwhere.Trim()) == "")
            {
                return;
            }
            else
            {
                if (sqlwhere.Substring(sqlwhere.Length - 3, 3).ToLower() == "and" || sqlwhere.Substring(sqlwhere.Length - 3, 3).ToLower() == " or")
                {
                    sqlwhere = sqlwhere.Substring(0, sqlwhere.Length - 3).Trim();
                }
            }

            sqlwhere = " and (" + sqlwhere + ") order by applyid_vchr";

            DataTable dtRecord = new DataTable();
            clsDcl_DoctorWorkstation objSvc = new clsDcl_DoctorWorkstation();
            long ret = objSvc.m_lngGetopsreports(sqlwhere, out dtRecord);

            if (ret > 0)
            {
                this.Column1.DataPropertyName  = "applyid_vchr";
                this.Column2.DataPropertyName  = "name_vchr";
                this.Column3.DataPropertyName  = "sex_chr";
                this.Column4.DataPropertyName  = "birth_dat";
                this.Column5.DataPropertyName  = "patientcardid_chr";
                this.Column6.DataPropertyName  = "deptname_vchr";
                this.Column7.DataPropertyName  = "opsname_vchr";
                this.Column8.DataPropertyName  = "opsdate_dat";
                this.Column9.DataPropertyName  = "opsdoctor_chr";
                this.Column10.DataPropertyName = "opsresult_vchr";

                this.dataGridView.DataSource = dtRecord;
            }
        }