Esempio n. 1
0
        private void SaveZz()
        {
            try
            {
                /*转诊需要先验证挂号金额,如果挂号金额不一致则不允许转诊 */
                #region 限制转诊
                if (dt_ghxx == null || dt_ghxx.Rows.Count <= 0)
                {
                    MessageBox.Show("未获取挂号信息!转诊失败!", "提示");
                    return;
                }
                if (this.cmbks.SelectedValue == null)
                {
                    MessageBox.Show("请选择转入科室!", "提示");
                    return;
                }
                if (this.cmbys.SelectedValue == null)
                {
                    MessageBox.Show("请选择指定医生!", "提示");
                    return;
                }

                int ghlb    = Convert.ToInt32(dt_ghxx.Rows[0]["GHLB"]);
                int oldghks = Convert.ToInt32(lblghks.Tag);
                int oldghjb = Convert.ToInt32(lblghjb.Tag);
                int oldghys = Convert.ToInt32(lblghys.Tag);
                Jgbm = TrasenFrame.Forms.FrmMdiMain.Jgbm;
                int     err_code = 0;
                string  err_text = "";
                decimal oldghje  = 0;
                decimal newghje  = 0;

                /*先获取原有科室的挂号费用*/
                DataSet mxds = mz_ghxx.mzgh_get_sfmx(ghlb, 1, 0, oldghks, oldghjb, oldghys, "", 0, 0, Guid.Empty, Jgbm, out err_code, out err_text, "", InstanceForm.BDatabase);
                if (err_code != 0)
                {
                    MessageBox.Show(err_text, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                oldghje = Convert.ToDecimal(mxds.Tables[0].Compute("sum(zje)", ""));    //计算结果集1表的总金额

                int newghks = Convert.ToInt32(this.cmbks.SelectedValue);
                int newghys = Convert.ToInt32(this.cmbys.SelectedValue);

                DataSet dset = mz_ghxx.mzgh_get_sfmx(ghlb, 1, 0, newghks, oldghjb, newghys, "", 0, 0, Guid.Empty, Jgbm, out err_code, out err_text, "", InstanceForm.BDatabase);
                if (err_code != 0)
                {
                    MessageBox.Show(err_text, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
                }
                newghje = Convert.ToDecimal(dset.Tables[0].Compute("sum(zje)", ""));    //计算结果集1表的总金额
                if (new SystemCfg(3110).Config != "1")
                {
                    if (oldghje != newghje)
                    {
                        MessageBox.Show("挂号金额不同!不允许转诊!", "提示");
                        return;
                    }
                }
                #endregion
                /*金额相同,那还需要处理候诊号问题 将mzhs_fzjl的候诊号设置为0 将pdsj设置为转诊目的科室的最后时间*/
                Guid _Zzid = Guid.NewGuid();

                MZHS_FZJL.HsZzSave(newghks, newghys, _CurrentGhxxid, InstanceForm.BDatabase);
                //转诊记录更新为存储到MZYS_JZJL Modify By zp 2013-11-04
                err_code = -1;
                err_text = "";
                Guid   jzid = Guid.Empty;
                string date = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString("yyyy-MM-dd HH:mm:ss");
                //Modify By ZJ 2012-11-13 登记时间加格式化处理
                ts_mzys_class.mzys_jzjl.jz(Jgbm, _CurrentGhxxid,
                                           newghys, newghks, date,
                                           "转诊", out jzid, out err_code, out err_text, 0, InstanceForm.BDatabase);
                if (err_code != 0)
                {
                    throw new Exception(err_text);
                }
                // MZHS_FZJL.SetMzZzJl(oldghks, oldghys, newghks, newghys, InstanceForm.BCurrentUser.EmployeeId, _Zzid,_CurrentGhxxid, InstanceForm.BDatabase);

                MessageBox.Show("转诊成功!", "提示");
                this.Close();
            }
            catch (Exception ea)
            {
                MessageBox.Show("出现异常!原因:" + ea.Message, "错误");
            }
        }