//补充上传病人剩余未上传费用 private void btnSupplyLoad_Click(object sender, EventArgs e) { this.Cursor = PubStaticFun.WaitCursor(); try { string zyh = txtZyh.Text.Trim(); if (string.IsNullOrEmpty(zyh)) { MessageBox.Show("请输入住院号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strSql = string.Format("select INPATIENT_ID from ZY_INPATIENT where INPATIENT_NO ='{0}' and DEPT_ID='{1}' ", zyh, InstanceForm.BCurrentDept.DeptId); string inp = ""; try { inp = database.GetDataResult(strSql).ToString(); } catch (Exception ex) { MessageBox.Show("未在本科室找到该住院号:" + zyh + " 的病人信息\r" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } bool CanAudit = ClsAuditCheck.CheckIsAuditCheck(inp, database);//是否需要智审 if (!CanAudit) { MessageBox.Show("该病人不满足进行智审判断条件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("确认补传 住院号:" + zyh + " 该病人未上传费用吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) { return; } string strMsg = ""; bool bSuc = DoVaildYbFee(new DataTable(), 9, 0, new Guid(inp), 0, true, out strMsg); if (!bSuc) { MessageBox.Show(strMsg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } MessageBox.Show("补传病人费用成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { } finally { this.Cursor = Cursors.Arrow; } }
//删除重审 private void btnReLoad_Click(object sender, EventArgs e) { this.Cursor = PubStaticFun.WaitCursor(); try { string zyh = txtZyh.Text.Trim(); if (string.IsNullOrEmpty(zyh)) { MessageBox.Show("请输入住院号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strSql = string.Format("select INPATIENT_ID from VI_ZY_VINPATIENT_ALL where INPATIENT_NO ='{0}' and {2}='{1}' ", zyh, _iYsHs == 0 ? InstanceForm.BCurrentDept.DeptId.ToString() : InstanceForm.BCurrentDept.WardId, _iYsHs == 0 ? "DEPT_ID" : "ward_id"); string inp = ""; try { inp = database.GetDataResult(strSql).ToString(); } catch (Exception ex) { MessageBox.Show("未在本科室找到该住院号:" + zyh + " 的病人信息\r" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } bool CanAudit = ClsAuditCheck.CheckIsAuditCheck(inp, database);//是否需要智审 if (!CanAudit) { MessageBox.Show("该病人不满足进行智审判断条件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //1、清除已有主单据 //2、上传该病人现有所有费用明细 //当天新开 医嘱预审保存不计费 需要提示 if (MessageBox.Show("建议执行完所有 今天新开医嘱 后再进行该操作!\r\r是否确认重传住院号:" + zyh + "所有费用?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) { return; } DoVaildYbFee(zyh, inp); } catch { } finally { this.Cursor = Cursors.Arrow; } }
//保存按钮 private void btsave_Click(object sender, EventArgs e) { try { DataTable tb = (DataTable)dgvyzxm.DataSource; if (tb.Rows.Count == 0) { MessageBox.Show("没有确认的费用", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ; //验证病人的状态,如果出区或结算,不能修改费用 Modify By Tany 2015-06-16 string ssql = "select * from zy_inpatient(nolock) where inpatient_id in (select INPATIENT_ID from ZY_ORDERRECORD(nolock) where ORDER_ID='" + order_id + "')"; DataTable tbpa = _DataBase.GetDataTable(ssql); if (tbpa.Rows.Count > 0) { //出院病人不能修改费用 if (tbpa.Rows[0]["flag"].ToString() == "5" || tbpa.Rows[0]["flag"].ToString() == "2" || tbpa.Rows[0]["flag"].ToString() == "6" || tbpa.Rows[0]["flag"].ToString() == "10") { MessageBox.Show("该病人已经定义出院,不能执行该操作!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } //Modify by jchl 2016-12-30 不允许医技科室2016-12-31 18:00:00 到 2017-01-01 00:10:00 操作费用 string _yblx = tbpa.Rows[0]["YBLX"].ToString().Trim(); if (_yblx.Trim().Equals("1")) { DateTime serDate = DateManager.ServerDateTimeByDBType(_DataBase); DateTime dtMin = DateTime.Parse("2016-12-31 18:00:00"); DateTime dtMax = DateTime.Parse("2017-01-01 00:10:00"); if (serDate >= dtMin && serDate <= dtMax) { MessageBox.Show("因为年底大调价,根据医院的统一部署安排,12月31日 18点 至 次日0:10分 医保病人不允许操作费用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } ssql = "select * from zy_fee_speci(nolock) where order_id='" + order_id + "' and delete_bit=0 "; DataTable tbfee = _DataBase.GetDataTable(ssql); if (tbfee.Rows.Count > 0) { if (tbfee.Rows[0]["discharge_bit"].ToString() == "1") { MessageBox.Show("该费用已结算,不能执行该操作", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Modify By Tany 2015-06-16 将这段代码移到外层 //ssql = "select * from zy_inpatient(nolock) where inpatient_id='" + tbfee.Rows[0]["inpatient_id"].ToString() + "' "; //tbpa = _DataBase.GetDataTable(ssql); //if (tbpa.Rows.Count > 0) //{ // //出院病人不能修改费用 // if (tbpa.Rows[0]["flag"].ToString() == "5" || tbpa.Rows[0]["flag"].ToString() == "2" || tbpa.Rows[0]["flag"].ToString() == "6" || tbpa.Rows[0]["flag"].ToString() == "10") // { // MessageBox.Show("该病人定义出院,不能执行该操作", "", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; // } //} } if (new Guid(Convertor.IsNull(yjqrid, Guid.Empty.ToString())) != Guid.Empty) { ssql = "select * from yj_zysq(nolock) where zxid='" + orderexec_id + "' and bscbz=0 and btfbz<>0"; DataTable tbtf = _DataBase.GetDataTable(ssql); if (tbtf.Rows.Count > 0) { MessageBox.Show("该申请有退费信息,请先确认退费信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } DataTable tbmx = select.SelectTopFee(new Guid(order_id), _DataBase); if (tbmx.Rows.Count == 0) { MessageBox.Show("没有找到该申请的原记录", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ; string sDate = DateManager.ServerDateTimeByDBType(_DataBase).ToString();//登记时间 Guid inpatient_id = new Guid(tbmx.Rows[0]["inpatient_id"].ToString()); long baby_id = Convert.ToInt64(tbmx.Rows[0]["baby_id"]); //Guid orderexec_id = new Guid(tbmx.Rows[0]["orderexec_id"].ToString()); Guid prescription_id = new Guid(tbmx.Rows[0]["prescription_id"].ToString()); decimal presc_no = Convert.ToDecimal(tbmx.Rows[0]["presc_no"].ToString()); string presc_date = Convert.ToString(tbmx.Rows[0]["presc_date"].ToString()); int doc_id = Convert.ToInt32(tbmx.Rows[0]["doc_id"].ToString()); int dept_id = Convert.ToInt32(tbmx.Rows[0]["dept_id"].ToString()); int dept_br = Convert.ToInt32(tbmx.Rows[0]["dept_br"].ToString()); int execdept_id = Convert.ToInt32(tbmx.Rows[0]["execdept_id"].ToString()); int dept_ly = Convert.ToInt32(tbmx.Rows[0]["dept_ly"].ToString()); try { _DataBase.BeginTransaction(); //添加或取消费用 bool _bok = false; decimal qrje = 0; for (int i = 0; i <= tb.Rows.Count - 1; i++) { string id = Convertor.IsNull(tb.Rows[i]["id"], ""); string y_cz_id = Convertor.IsNull(tb.Rows[i]["y_cz_id"], ""); string delete_bit = Convertor.IsNull(tb.Rows[i]["delete_bit"], ""); if (id == "") { string cz_id = Convertor.IsNull(tb.Rows[i]["cz_id"], ""); string statitem_code = Convert.ToString(tb.Rows[i]["statitem_code"].ToString()); long xmid = Convert.ToInt64(tb.Rows[i]["xmid"].ToString()); string subcode = Convert.ToString(tb.Rows[i]["code"].ToString()); string item_name = Convert.ToString(tb.Rows[i]["name"].ToString()); string unit = Convert.ToString(tb.Rows[i]["item_unit"].ToString()); decimal price = Convert.ToDecimal(tb.Rows[i]["price"].ToString()); decimal num = Convert.ToDecimal(tb.Rows[i]["num"].ToString()); decimal je = Convert.ToDecimal(tb.Rows[i]["je"].ToString()); qrje = qrje + je; Guid NewID = Guid.Empty; int err_code = -1; string err_text = ""; yjqr.SaveFee(inpatient_id, baby_id, new Guid(order_id), new Guid(orderexec_id), prescription_id, presc_no, presc_date, sDate, TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId, statitem_code, xmid, subcode, item_name, unit, price, num, je, new Guid(Convertor.IsNull(cz_id, Guid.Empty.ToString())), doc_id, dept_id, dept_br, execdept_id, dept_ly, jgbm, out NewID, out err_code, out err_text, _DataBase); if (err_code != 0 || NewID == Guid.Empty) { throw new Exception(err_text); } _bok = true; } if (delete_bit == "1") { decimal je = Convert.ToDecimal(tb.Rows[i]["je"].ToString()); qrje = qrje + (-1) * je; yjqr.DeleteFee(new Guid(id), new Guid(Convertor.IsNull(y_cz_id, Guid.Empty.ToString())), _DataBase, new Guid(orderexec_id)); } } //控制签收问题 ssql = "select * from yj_zysq where zxid='" + orderexec_id + "' and bqsbz=1"; DataTable tbbbqs = _DataBase.GetDataTable(ssql); if (tbbbqs.Rows.Count > 0 && new SystemCfg(10011, _DataBase).Config == "1") { throw new Exception("该申请标本已签收,不能修改费用"); } //产生医技确认记灵 Guid NewQrid = Guid.Empty; if (yjqrid != "" && (qrje != 0 || _bok == true)) { int err_code = -1; string err_text = ""; DataTable tbsq = select.SelectZYSQ(new Guid(yjsqid), _DataBase); if (tbsq.Rows.Count == 0) { throw new Exception("没有找到原申请记录"); } yjqr.yj_zysq_qrjl(new Guid(order_id), new Guid(orderexec_id), new Guid(yjsqid), qrje, TrasenFrame.Forms.FrmMdiMain.CurrentDept.DeptId, sDate, TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId, 0, Convertor.IsNull(tbsq.Rows[0]["jcrq"], ""), Convert.ToInt32(Convertor.IsNull(tbsq.Rows[0]["jcys"], "0")), "", out NewQrid, out err_code, out err_text, 0, _DataBase); if (err_code != 0 || NewQrid == Guid.Empty) { throw new Exception(err_text); } btsave.Enabled = false; btadd.Enabled = false; btdel.Enabled = false; btcancel.Enabled = false; } _DataBase.CommitTransaction(); #region "医保智审调用" try { bool CanAudit = ClsAuditCheck.CheckIsAuditCheck(inpatient_id.ToString(), _DataBase);//是否需要智审 if (CanAudit) { if (baby_id == 0) { string strMsg = ""; bool bSuc = DoVaildYbFee(new DataTable(), 1, 1, inpatient_id, baby_id, out strMsg); if (!bSuc) { MessageBox.Show(strMsg, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch { } #endregion if (NewQrid != Guid.Empty) { yjqrid = NewQrid.ToString(); } loaddata(); } catch (System.Exception err) { _DataBase.RollbackTransaction(); throw new Exception(err.Message); } } catch (System.Exception err) { MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//重审已上传数据 private void btnReCheck_Click(object sender, EventArgs e) { this.Cursor = PubStaticFun.WaitCursor(); BmiAuditClass clsAdtChk = new BmiAuditClass(); try { string zyh = txtZyh.Text.Trim(); if (string.IsNullOrEmpty(zyh)) { MessageBox.Show("请输入住院号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string strSql = string.Format("select INPATIENT_ID,YBLX,XZLX from VI_ZY_VINPATIENT_ALL where INPATIENT_NO ='{0}' and {2}='{1}' ", zyh, _iYsHs == 0 ? InstanceForm.BCurrentDept.DeptId.ToString() : InstanceForm.BCurrentDept.WardId, _iYsHs == 0 ? "DEPT_ID" : "ward_id"); string inp = ""; string yblx = ""; string ybzlx = ""; string mainID = ""; try { DataTable dtInp = database.GetDataTable(strSql); if (dtInp == null || dtInp.Rows.Count <= 0) { throw new Exception("未在本科室找到该住院号:" + zyh + " 的病人信息\r"); } inp = dtInp.Rows[0]["INPATIENT_ID"].ToString().Trim(); yblx = dtInp.Rows[0]["YBLX"].ToString().Trim(); ybzlx = dtInp.Rows[0]["XZLX"].ToString().Trim(); } catch (Exception ex) { throw new Exception("未在本科室找到该住院号:" + zyh + " 的病人信息\r" + ex.Message); } bool CanAudit = ClsAuditCheck.CheckIsAuditCheck(inp, database);//是否需要智审 if (!CanAudit) { MessageBox.Show("该病人不满足进行智审判断条件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string inAGENCIES_ID = ""; if (yblx.Equals("1")) { inAGENCIES_ID = "1"; mainID = inp; } else if (yblx.Equals("3") && ybzlx.Equals("55")) { inAGENCIES_ID = "2"; //获取医保主单 DataTable dtYbDjInfo = ClsAuditCheck.GetOldYbdjInfo(zyh, yblx, ybzlx, database); mainID = dtYbDjInfo.Rows[0]["akc190"] == null ? "" : dtYbDjInfo.Rows[0]["akc190"].ToString().Trim(); } //inAGENCIES_ID :保险ID 1市直医保 2省直医保 string sRet = clsAdtChk.ReCheckLoadInfo(mainID, inAGENCIES_ID); if (sRet.Trim().Equals("0")) { MessageBox.Show("审核返回错误,请重新操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (sRet.Trim().Equals("1")) { MessageBox.Show("已上传费用审核通过", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("审核出错" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { this.Cursor = Cursors.Arrow; } }