コード例 #1
0
ファイル: frmAntiApply.cs プロジェクト: timsanc/HIS
        /// <summary>
        /// Confirm
        /// </summary>
        void Confirm()
        {
            if (this.txtMedName.Tag == null)
            {
                MessageBox.Show("手术申请还未保存,不能审核。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            EntityBihSadcApply applyVo = this.txtMedName.Tag as EntityBihSadcApply;

            applyVo.drugname         = this.txtMedName.Text.Trim();
            applyVo.pathcheck        = this.chkYes.Checked ? 1 : 0;
            applyVo.pathdesc         = this.txtNoDesc.Text.Trim();
            applyVo.clinicdiag       = this.txtDiag.Text.Trim();
            applyVo.medhistory       = this.txtIllNess.Text.Trim();
            applyVo.applyreason      = this.txtApplyDesc.Text.Trim();
            applyVo.applyopername    = this.txtApplyDoct.Text.Trim();
            applyVo.applydate        = this.dtpApplyDate.Value;
            applyVo.directoropinion  = this.txtConfirmDesc.Text.Trim();
            applyVo.directorname     = this.txtConfirmDoct.Text.Trim();
            applyVo.directorsigndate = this.dtpConfirmDate.Value;

            List <EntityBihSadcExperts> lstExperts = new List <EntityBihSadcExperts>();

            if (this.lvExperts.Items.Count == 0)
            {
                MessageBox.Show("邀请专家不能为空", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                EntityBihSadcExperts expertVo = null;
                for (int i = 0; i < this.lvExperts.Items.Count; i++)
                {
                    if (this.lvExperts.Items[i].Tag == null)
                    {
                        expertVo            = new EntityBihSadcExperts();
                        expertVo.deptname   = this.lvExperts.Items[i].SubItems[0].Text;
                        expertVo.expertname = this.lvExperts.Items[i].SubItems[1].Text;
                        expertVo.deptid     = this.lvExperts.Items[i].SubItems[2].Text;
                        expertVo.expertid   = this.lvExperts.Items[i].SubItems[3].Text;
                    }
                    else
                    {
                        expertVo = this.lvExperts.Items[i].Tag as EntityBihSadcExperts;
                    }
                    lstExperts.Add(expertVo);
                }
            }
            if (applyVo.drugname == string.Empty)
            {
                MessageBox.Show("抗菌药物通用名不能为空", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtMedName.Focus();
                return;
            }
            if (applyVo.applyreason == string.Empty)
            {
                MessageBox.Show("申请理由不能为空", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtApplyDesc.Focus();
                return;
            }
            if (applyVo.applyopername == string.Empty)
            {
                MessageBox.Show("申请人不能为空", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtApplyDoct.Focus();
                return;
            }
            if (applyVo.applydate <= Convert.ToDateTime("2018-01-01 00:00:00"))
            {
                MessageBox.Show("申请日期不能小于2018-01-01", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.dtpApplyDate.Focus();
                return;
            }
            if (applyVo.directorname == string.Empty)
            {
                MessageBox.Show("审核人不能为空", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtConfirmDoct.Focus();
                return;
            }
            if (applyVo.directoropinion == string.Empty)
            {
                MessageBox.Show("科主任审核意见不能为空", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtConfirmDesc.Focus();
                return;
            }
            if (applyVo.directorsigndate <= Convert.ToDateTime("2018-01-01 00:00:00"))
            {
                MessageBox.Show("审核日期不能小于2018-01-01", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.dtpConfirmDate.Focus();
                return;
            }

            try
            {
                decimal  applyId  = 0;
                DateTime openDate = DateTime.Now;
                this.Cursor = Cursors.WaitCursor;
                clsBIHOrderService svc = new clsDcl_GetSvcObject().m_GetOrderSvcObject();
                applyVo.applyopername = applyVo.applyopername.Replace("主任医师", "").Replace("副主任医师", "").Replace("主治医师", "").Replace("医师", "");
                applyVo.applyoperid   = svc.GetEmployeeId(applyVo.applyopername.Trim());
                DataTable dt = svc.GetEmployeeByEmpId(applyVo.applyoperid);
                if (dt != null && dt.Rows.Count > 0)
                {
                    applyVo.applydeptid   = dt.Rows[0]["deptid_chr"].ToString();
                    applyVo.applydeptname = dt.Rows[0]["deptname_vchr"].ToString();
                }
                if (string.IsNullOrEmpty(applyVo.applydeptid))
                {
                    applyVo.applydeptid = LoginInfo.m_strDepartmentID;
                }
                if (string.IsNullOrEmpty(applyVo.applydeptname))
                {
                    applyVo.applydeptname = LoginInfo.m_strdepartmentName;
                }
                applyVo.directorname = applyVo.directorname.Replace("主任医师", "").Replace("副主任医师", "").Replace("主治医师", "").Replace("医师", "");
                applyVo.directorid   = svc.GetEmployeeId(applyVo.directorname.Trim());
                int ret = svc.SaveSadcApply(applyVo, lstExperts, out applyId);
                svc = null;
                if (ret > 0)
                {
                    MessageBox.Show("审核成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("审核失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "审核异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }