예제 #1
0
        /// <summary>
        /// Stat
        /// </summary>
        void Stat()
        {
            string beginDate = this.dteRq1.Value.ToString("yyyy-MM-dd");
            string endDate   = this.dteRq2.Value.ToString("yyyy-MM-dd");

            if (Convert.ToDateTime(beginDate + " 00:00:01") > Convert.ToDateTime(endDate + " 00:00:01"))
            {
                MessageBox.Show("开始日期不能大于结束日期。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            try
            {
                int flagId = this.cboType.SelectedIndex + 1;
                this.dwRep.SetRedrawOff();
                this.dwRep.Reset();
                clsPublic.PlayAvi("数据查询中,请稍候...");
                clsDcl_Charge dclCharge = new clsDcl_Charge();
                DataTable     dtList    = dclCharge.GetRefundReasonList(flagId);
                dclCharge = null;
                clsDcl_Report rpt      = new clsDcl_Report();
                DataTable     dtResult = rpt.GetRptInvoiceRefundReason(flagId, beginDate, endDate);
                rpt = null;
                int     countXj = 0;
                decimal sumHj   = 0;
                foreach (DataRow dr in dtList.Rows)
                {
                    int    rowIndex = this.dwRep.InsertRow();
                    string reason   = dr["freason"].ToString();
                    this.dwRep.SetItemString(rowIndex, "col1", dr["fno"].ToString());
                    this.dwRep.SetItemString(rowIndex, "col2", reason);

                    if (dtResult != null && dtResult.Rows.Count > 0)
                    {
                        DataView dv = new DataView(dtResult);
                        dv.RowFilter = string.Format("reason = '{0}'", reason);
                        if (dv.Count > 0)
                        {
                            decimal mny = 0;
                            this.dwRep.SetItemString(rowIndex, "col3", dv.Count.ToString());
                            for (int i = 0; i < dv.Count; i++)
                            {
                                mny += Math.Abs(clsPublic.ConvertObjToDecimal(dv[i]["invomny"]));
                            }
                            this.dwRep.SetItemString(rowIndex, "col4", mny.ToString("0.00"));

                            countXj += dv.Count;
                            sumHj   += mny;
                        }
                    }
                }

                if (dtResult != null && dtResult.Rows.Count > 0)
                {
                    #region bak

                    /*
                     * int no = 0;
                     * int rowIndex = 0;
                     * string flagId = string.Empty;
                     * string flagName = string.Empty;
                     * foreach (DataRow dr in dtResult.Rows)
                     * {
                     *  flagId = dr["flagid"].ToString();
                     *  if (flagId == "1")
                     *      flagName = "门诊";
                     *  else if (flagId == "2")
                     *      flagName = "住院";
                     *  else if (flagId == "3")
                     *      flagName = "预交金";
                     *
                     *  rowIndex = this.dwRep.InsertRow();
                     *  this.dwRep.SetItemString(rowIndex, "col1", Convert.ToString(++no));
                     *  this.dwRep.SetItemString(rowIndex, "col2", flagName);
                     *  this.dwRep.SetItemString(rowIndex, "col3", dr["invono"].ToString());
                     *  this.dwRep.SetItemString(rowIndex, "col4", dr["invomny"].ToString());
                     *  this.dwRep.SetItemString(rowIndex, "col5", Convert.ToDateTime(dr["operdate"].ToString()).ToString("yyyy-MM-dd HH:mm"));
                     *  this.dwRep.SetItemString(rowIndex, "col6", dr["patno"].ToString());
                     *  this.dwRep.SetItemString(rowIndex, "col7", dr["patname"].ToString());
                     *  this.dwRep.SetItemString(rowIndex, "col8", dr["sex"].ToString());
                     *  this.dwRep.SetItemString(rowIndex, "col9", dr["birth_dat"] == DBNull.Value ? "" : clsCalculateAge.s_strCalAge(Convert.ToDateTime(dr["birth_dat"].ToString())));
                     *  this.dwRep.SetItemString(rowIndex, "col10", dr["deptname"].ToString());
                     *  this.dwRep.SetItemString(rowIndex, "col11", dr["reason"].ToString());
                     * }
                     * if (this.dwRep.RowCount == 0)
                     * {
                     *  MessageBox.Show("查无记录.");
                     * }*/
                    #endregion
                }
                else
                {
                    MessageBox.Show("查无记录.");
                }
                this.dwRep.Modify("t_date.text='" + beginDate + "至" + endDate + "'");
                if (countXj > 0)
                {
                    this.dwRep.Modify("t_sum_xj.text='" + countXj + "'");
                    this.dwRep.Modify("t_sum_hj.text='" + sumHj.ToString("0.00") + "'");
                }
                else
                {
                    this.dwRep.Modify("t_sum_xj.text=''");
                    this.dwRep.Modify("t_sum_hj.text=''");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                clsPublic.CloseAvi();
                this.dwRep.SetRedrawOn();
                this.dwRep.Refresh();
            }
        }
예제 #2
0
 public frmBabyRegisterlReport()
 {
     InitializeComponent();
     m_objManage = new clsDcl_Report();
 }
예제 #3
0
 public frmPatientInHospitalReport()
 {
     InitializeComponent();
     m_objManage = new clsDcl_Report();
 }
예제 #4
0
 public clsCtl_Shiyingsetting()
 {
     m_objDomain = new clsDcl_Report();
 }
예제 #5
0
        /// <summary>
        /// Stat
        /// </summary>
        void Stat()
        {
            string beginDate = this.dteRq1.Value.ToString("yyyy-MM-dd");
            string endDate   = this.dteRq2.Value.ToString("yyyy-MM-dd");

            if (Convert.ToDateTime(beginDate + " 00:00:01") > Convert.ToDateTime(endDate + " 00:00:01"))
            {
                MessageBox.Show("开始日期不能大于结束日期。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string deptIdArr = string.Empty;

            if (this.lstDeptId.Count > 0)
            {
                foreach (string deptid in this.lstDeptId)
                {
                    deptIdArr += "'" + deptid + "',";
                }
                deptIdArr = deptIdArr.TrimEnd(',');
            }

            //全部
            //医疗
            //生育
            //工伤
            //省内-异地就医
            //省外-异地就医
            int sbTypeId = this.cboType.SelectedIndex;

            if (sbTypeId == 2)
            {
                sbTypeId = 4;
            }
            else if (sbTypeId == 3)
            {
                sbTypeId = 2;
            }
            else if (sbTypeId == 4)
            {
                sbTypeId = 5;
            }
            else if (sbTypeId == 5)
            {
                sbTypeId = 6;
            }

            try
            {
                this.dwRep.SetRedrawOff();
                this.dwRep.Reset();
                clsPublic.PlayAvi("数据查询中,请稍候...");
                clsDcl_Report rpt      = new clsDcl_Report();
                DataTable     dtResult = rpt.GetRptSbRegister(beginDate, endDate, deptIdArr);
                rpt = null;
                if (dtResult != null && dtResult.Rows.Count > 0)
                {
                    Dictionary <int, int> dicNum = new Dictionary <int, int>();
                    dicNum.Add(1, 0);
                    dicNum.Add(2, 0);
                    dicNum.Add(4, 0);
                    dicNum.Add(5, 0);
                    dicNum.Add(6, 0);
                    string typeId = string.Empty;
                    string cbdId  = string.Empty;
                    foreach (DataRow dr in dtResult.Rows)
                    {
                        int flagId = 0;
                        typeId = dr["zylb_vchr"].ToString();
                        cbdId  = (dr["cbdtcqbm"] == DBNull.Value || dr["cbdtcqbm"].ToString().Trim() == string.Empty) ? "" : dr["cbdtcqbm"].ToString().Trim();
                        if (cbdId.Length < 4 || cbdId.StartsWith("4419")) // 东莞市
                        {
                            if (typeId == "1")                            // 1-医疗住院
                            {
                                flagId = 1;
                            }
                            else if (typeId == "2")         // 2-工伤住院
                            {
                                flagId = 2;
                            }
                            else if (typeId == "4")         // 4-生育住院
                            {
                                flagId = 4;
                            }
                            else
                            {
                                flagId = 1;
                            }
                        }
                        else
                        {
                            cbdId = cbdId.Substring(0, 4);
                            if (this.dicRegionCode.ContainsKey(cbdId))      // 省内
                            {
                                flagId = 5;
                            }
                            else  // 省外
                            {
                                flagId = 6;
                            }
                        }
                        dr["flag"] = flagId;
                        dicNum[flagId]++;
                    }
                    int      rowIndex = 0;
                    string   typeName = string.Empty;
                    DataView dv       = new DataView(dtResult);
                    dv.Sort = "flag asc";
                    DataTable dtTmp = dv.ToTable();
                    foreach (DataRow dr in dtTmp.Rows)
                    {
                        typeId = dr["flag"].ToString();
                        if (typeId == "1")
                        {
                            typeName = "医疗";
                        }
                        else if (typeId == "2")
                        {
                            typeName = "工伤";
                        }
                        else if (typeId == "4")
                        {
                            typeName = "生育";
                        }
                        else if (typeId == "5")
                        {
                            typeName = "异地就医(省内)";
                        }
                        else if (typeId == "6")
                        {
                            typeName = "异地就医(省外)";
                        }
                        if (sbTypeId > 0)
                        {
                            if (sbTypeId != Convert.ToInt32(typeId))
                            {
                                continue;
                            }
                        }

                        DateTime inDate  = Convert.ToDateTime(dr["inDate"].ToString());
                        DateTime regDate = dr["regDate2"] == DBNull.Value ? Convert.ToDateTime(dr["regDate"].ToString()) : Convert.ToDateTime(dr["regDate2"].ToString());
                        bool     isB     = regDate.Subtract(inDate).Days > 3 ? true : false;

                        rowIndex = this.dwRep.InsertRow();
                        this.dwRep.SetItemString(rowIndex, "col1", typeName);
                        this.dwRep.SetItemDecimal(rowIndex, "col2", dicNum[Convert.ToInt32(dr["flag"].ToString())]);
                        this.dwRep.SetItemString(rowIndex, "col3", dr["patName"].ToString());
                        this.dwRep.SetItemString(rowIndex, "col4", dr["sex_chr"].ToString());
                        this.dwRep.SetItemString(rowIndex, "col5", dr["birth_dat"] == DBNull.Value ? "" : clsCalculateAge.s_strCalAge(Convert.ToDateTime(dr["birth_dat"].ToString())));
                        this.dwRep.SetItemString(rowIndex, "col6", dr["ipNo"].ToString());
                        this.dwRep.SetItemString(rowIndex, "col7", dr["areaName"].ToString());
                        this.dwRep.SetItemString(rowIndex, "col8", dr["bedNo"].ToString());
                        this.dwRep.SetItemDecimal(rowIndex, "col9", dr["premoney"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["premoney"].ToString()));
                        this.dwRep.SetItemString(rowIndex, "col10", inDate.ToString("yyyy-MM-dd HH:mm"));
                        this.dwRep.SetItemString(rowIndex, "col11", regDate.ToString("yyyy-MM-dd HH:mm"));
                        this.dwRep.SetItemString(rowIndex, "col12", (isB ? "否" : "是"));
                        this.dwRep.SetItemString(rowIndex, "col13", dr["operName"].ToString());
                    }
                    if (this.dwRep.RowCount == 0)
                    {
                        MessageBox.Show("查无记录.");
                    }
                }
                else
                {
                    MessageBox.Show("查无记录.");
                }
                this.dwRep.Modify("t_date.text='" + beginDate + " 至 " + endDate + "'");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                clsPublic.CloseAvi();
                this.dwRep.SetRedrawOn();
                this.dwRep.Refresh();
            }
        }
예제 #6
0
        /// <summary>
        /// Stat
        /// </summary>
        void Stat()
        {
            string beginDate = this.dteRq1.Value.ToString("yyyy-MM-dd");
            string endDate   = this.dteRq2.Value.ToString("yyyy-MM-dd");

            if (Convert.ToDateTime(beginDate + " 00:00:01") > Convert.ToDateTime(endDate + " 00:00:01"))
            {
                MessageBox.Show("开始日期不能大于结束日期。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            try
            {
                // 0 汇总; 1 明细
                int flagId = this.cboType.SelectedIndex;
                this.dwRep.SetRedrawOff();
                this.dwRep.Reset();
                clsPublic.PlayAvi("数据统计中,请稍候...");

                #region 构造表
                DataTable dtRpt = new DataTable();
                dtRpt.Columns.Add("patientId", typeof(string));
                dtRpt.Columns.Add("patName", typeof(string));
                dtRpt.Columns.Add("chargeDate", typeof(string));
                dtRpt.Columns.Add("orderDicId", typeof(string));
                dtRpt.Columns.Add("orderName", typeof(string));
                dtRpt.Columns.Add("orderPrice", typeof(string));
                dtRpt.Columns.Add("orderQty", typeof(string));
                dtRpt.Columns.Add("orderTotal", typeof(string));
                dtRpt.Columns.Add("outSideUnit", typeof(string));
                dtRpt.Columns.Add("cardNo", typeof(string));
                dtRpt.Columns.Add("ipNo", typeof(string));
                dtRpt.Columns.Add("deptName", typeof(string));
                dtRpt.Columns.Add("doctName", typeof(string));
                #endregion

                clsDcl_Report rpt      = new clsDcl_Report();
                DataTable     dtCharge = rpt.GetOutsideChargeItem(beginDate, endDate);
                rpt = null;

                string    outsideUnit = string.Empty;
                string    patientId   = string.Empty;
                string    chargeDate  = string.Empty;
                string    orderDicId  = string.Empty;
                string    orderPrice  = string.Empty;
                string    deptName    = string.Empty;
                string    doctName    = string.Empty;
                DataRow[] drr         = null;
                int       rowIndex    = 0;

                #region 汇总

                if (flagId == 0 && dtCharge != null && dtCharge.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtCharge.Rows)
                    {
                        outsideUnit = dr["outsideunit"].ToString();
                        orderDicId  = dr["orderdicid_chr"].ToString();
                        orderPrice  = dr["orderPrice"].ToString();
                        drr         = dtRpt.Select(string.Format("outSideUnit = '{0}' and orderDicId = '{1}' and orderPrice = '{2}'", outsideUnit, orderDicId, orderPrice));
                        if (drr == null || drr.Length == 0)
                        {
                            DataRow dr2 = dtRpt.NewRow();
                            dr2["outSideUnit"] = dr["outsideunit"];
                            dr2["orderDicId"]  = orderDicId;
                            dr2["orderName"]   = dr["orderName"];
                            dr2["orderPrice"]  = orderPrice;
                            dr2["orderQty"]    = dr["orderQty"];
                            dr2["orderTotal"]  = dr["orderTotal"];
                            dtRpt.Rows.Add(dr2.ItemArray);
                        }
                        else
                        {
                            drr[0]["orderQty"]   = Convert.ToString(Convert.ToDecimal(drr[0]["orderQty"]) + Convert.ToDecimal(dr["orderQty"]));
                            drr[0]["orderTotal"] = Convert.ToString(Convert.ToDecimal(drr[0]["orderTotal"]) + Convert.ToDecimal(dr["orderTotal"]));
                        }
                        dtRpt.AcceptChanges();
                    }
                    if (dtRpt.Rows.Count > 0)
                    {
                        decimal orderTotal = 0;
                        Dictionary <string, decimal> dicRpt = new Dictionary <string, decimal>();
                        foreach (DataRow dr3 in dtRpt.Rows)
                        {
                            outsideUnit = dr3["outsideunit"].ToString();
                            orderTotal  = Convert.ToDecimal(dr3["orderTotal"].ToString());
                            if (dicRpt.ContainsKey(outsideUnit))
                            {
                                dicRpt[outsideUnit] += orderTotal;
                            }
                            else
                            {
                                dicRpt.Add(outsideUnit, orderTotal);
                            }
                        }

                        DataView dv = new DataView(dtRpt);
                        dv.Sort = "outSideUnit asc, orderName asc";
                        DataTable dtTmp = dv.ToTable();
                        foreach (DataRow dr3 in dtTmp.Rows)
                        {
                            outsideUnit = dr3["outsideunit"].ToString();
                            // 外送检验中心	检验项目	单价	数量	单项合计	外送检验中心合计
                            rowIndex = this.dwRep.InsertRow();
                            this.dwRep.SetItemString(rowIndex, "col1", outsideUnit);
                            this.dwRep.SetItemString(rowIndex, "col2", dr3["orderName"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col3", dr3["orderPrice"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col4", dr3["orderQty"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col5", dr3["orderTotal"].ToString());
                            if (dicRpt.ContainsKey(outsideUnit))
                            {
                                this.dwRep.SetItemString(rowIndex, "col6", dicRpt[outsideUnit].ToString("0.00"));
                            }
                        }
                    }
                }
                #endregion

                #region 明细

                if (flagId == 1 && dtCharge != null && dtCharge.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtCharge.Rows)
                    {
                        chargeDate = Convert.ToDateTime(dr["recipeDate"]).ToString("yyyy-MM-dd");
                        patientId  = dr["pid"].ToString();
                        orderDicId = dr["orderdicid_chr"].ToString();
                        orderPrice = dr["orderPrice"].ToString();
                        deptName   = dr["deptName"].ToString();
                        doctName   = dr["doctName"].ToString();
                        object[] objs = new object[6];
                        objs[0] = chargeDate;
                        objs[1] = patientId;
                        objs[2] = orderDicId;
                        objs[3] = orderPrice;
                        objs[4] = deptName;
                        objs[5] = doctName;
                        drr     = dtRpt.Select(string.Format("chargeDate = '{0}' and patientId = '{1}' and orderDicId = '{2}' and orderPrice = '{3}' and deptName = '{4}' and doctName = '{5}'", objs));
                        if (drr == null || drr.Length == 0)
                        {
                            DataRow dr2 = dtRpt.NewRow();
                            dr2["patientId"]   = patientId;
                            dr2["patName"]     = dr["patName"];
                            dr2["chargeDate"]  = chargeDate;
                            dr2["orderDicId"]  = orderDicId;
                            dr2["orderName"]   = dr["orderName"];
                            dr2["orderPrice"]  = orderPrice;
                            dr2["orderQty"]    = dr["orderQty"];
                            dr2["orderTotal"]  = dr["orderTotal"];
                            dr2["outSideUnit"] = dr["outsideunit"];
                            dr2["cardNo"]      = dr["cardNo"];
                            dr2["ipNo"]        = dr["ipNo"];
                            dr2["deptName"]    = deptName;
                            dr2["doctName"]    = doctName;
                            dtRpt.Rows.Add(dr2.ItemArray);
                        }
                        else
                        {
                            drr[0]["orderQty"]   = Convert.ToString(Convert.ToDecimal(drr[0]["orderQty"]) + Convert.ToDecimal(dr["orderQty"]));
                            drr[0]["orderTotal"] = Convert.ToString(Convert.ToDecimal(drr[0]["orderTotal"]) + Convert.ToDecimal(dr["orderTotal"]));
                        }
                        dtRpt.AcceptChanges();
                    }
                    if (dtRpt.Rows.Count > 0)
                    {
                        DataView dv = new DataView(dtRpt);
                        dv.Sort = "chargeDate asc, orderName asc";
                        DataTable dtTmp = dv.ToTable();
                        foreach (DataRow dr3 in dtTmp.Rows)
                        {
                            // 检验日期	姓名	就诊号	住院号	科室  医生	检验项目	价格	小计
                            rowIndex = this.dwRep.InsertRow();
                            this.dwRep.SetItemString(rowIndex, "col1", dr3["chargeDate"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col2", dr3["patName"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col3", dr3["cardNo"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col4", dr3["ipNo"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col5", dr3["deptName"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col6", dr3["doctName"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col7", dr3["orderName"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col8", dr3["orderPrice"].ToString());
                            this.dwRep.SetItemString(rowIndex, "col9", dr3["orderTotal"].ToString());
                        }
                    }
                }
                #endregion

                if (dtCharge == null || dtCharge.Rows.Count == 0)
                {
                    MessageBox.Show("查无记录.");
                }
                this.dwRep.Modify("t_date.text='" + beginDate + "至" + endDate + "'");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                clsPublic.CloseAvi();
                this.dwRep.SetRedrawOn();
                this.dwRep.Refresh();
            }
        }
예제 #7
0
 /// <summary>
 /// 构造
 /// </summary>
 public frmYB_LJExport()
 {
     InitializeComponent();
     objSvc = new clsDcl_Report();
 }