Ejemplo n.º 1
0
        /// <summary>
        /// 确认
        /// </summary>
        void Confirm()
        {
            if (this.cboSum.SelectedIndex > 0)
            {
                MessageBox.Show("请先选择药品明细.", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.cboSum.Focus();
                return;
            }
            EntityCureMed        vo       = null;
            List <EntityCureMed> lstOrder = new List <EntityCureMed>();

            for (int i = 0; i < this.dgvData.RowCount; i++)
            {
                if (this.dgvData.Rows[i].Selected && !string.IsNullOrEmpty(this.dgvData.Rows[i].Cells["orderId"].Value.ToString()) && string.IsNullOrEmpty(this.dgvData.Rows[i].Cells["checkOperName"].Value.ToString()))
                {
                    vo            = new EntityCureMed();
                    vo.orderId    = this.dgvData.Rows[i].Cells["orderId"].Value.ToString();
                    vo.orderName  = this.dgvData.Rows[i].Cells["orderName"].Value.ToString();
                    vo.execDeptId = this.dgvData.Rows[i].Cells["execDeptId"].Value.ToString();
                    vo.preAmount  = Convert.ToDecimal(this.dgvData.Rows[i].Cells["preAmount"].Value.ToString());
                    vo.registerId = this.dgvData.Rows[i].Cells["registerId"].Value.ToString();
                    lstOrder.Add(vo);
                }
            }
            if (lstOrder.Count > 0)
            {
                frmConfirmCureDaysPopup frm = new frmConfirmCureDaysPopup(lstOrder);
                frm.ShowDialog();
                if (frm.IsSave)
                {
                    Query();
                }
            }
            else
            {
                MessageBox.Show("请选择需要确认的疗程用药.药品!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 汇总
        /// </summary>
        void Sum()
        {
            if (this.cboSum.SelectedIndex == 0)
            {
                this.dgvData.DataSource = this.DataSource;
                this.SetRowBackColor();
            }
            else
            {
                List <string>        lstOrderDicId = new List <string>();
                EntityCureMed        vo            = null;
                List <EntityCureMed> tmpDataSource = new List <EntityCureMed>();
                // 按患者汇总
                if (this.cboSum.SelectedIndex == 1)
                {
                    for (int i = 0; i < this.DataSource.Count - 1; i++)
                    {
                        vo            = new EntityCureMed();
                        vo.patName    = this.DataSource[i].patName;
                        vo.orderDicId = this.DataSource[i].orderDicId;
                        vo.orderName  = this.DataSource[i].orderName;
                        vo.preAmount  = this.DataSource[i].preAmount;
                        vo.unit       = this.DataSource[i].unit;
                        if (lstOrderDicId.IndexOf(vo.patName + vo.orderDicId) >= 0)
                        {
                            continue;
                        }

                        for (int j = i + 1; j < this.DataSource.Count - 1; j++)
                        {
                            if (vo.patName == this.DataSource[j].patName && vo.orderDicId == this.DataSource[j].orderDicId)
                            {
                                vo.preAmount += this.DataSource[j].preAmount;
                            }
                        }
                        tmpDataSource.Add(vo);
                        lstOrderDicId.Add(vo.patName + vo.orderDicId);
                    }
                }
                // 按科室汇总
                else if (this.cboSum.SelectedIndex == 2)
                {
                    for (int i = 0; i < this.DataSource.Count - 1; i++)
                    {
                        vo            = new EntityCureMed();
                        vo.deptName   = this.DataSource[i].deptName;
                        vo.orderDicId = this.DataSource[i].orderDicId;
                        vo.orderName  = this.DataSource[i].orderName;
                        vo.preAmount  = this.DataSource[i].preAmount;
                        vo.unit       = this.DataSource[i].unit;
                        if (lstOrderDicId.IndexOf(vo.deptName + vo.orderDicId) >= 0)
                        {
                            continue;
                        }

                        for (int j = i + 1; j < this.DataSource.Count - 1; j++)
                        {
                            if (vo.deptName == this.DataSource[j].deptName && vo.orderDicId == this.DataSource[j].orderDicId)
                            {
                                vo.preAmount += this.DataSource[j].preAmount;
                            }
                        }
                        tmpDataSource.Add(vo);
                        lstOrderDicId.Add(vo.deptName + vo.orderDicId);
                    }
                }
                // 按项目汇总
                else if (this.cboSum.SelectedIndex == 3)
                {
                    for (int i = 0; i < this.DataSource.Count - 1; i++)
                    {
                        vo            = new EntityCureMed();
                        vo.orderDicId = this.DataSource[i].orderDicId;
                        vo.orderName  = this.DataSource[i].orderName;
                        vo.preAmount  = this.DataSource[i].preAmount;
                        vo.unit       = this.DataSource[i].unit;
                        if (lstOrderDicId.IndexOf(vo.orderDicId) >= 0)
                        {
                            continue;
                        }

                        for (int j = i + 1; j < this.DataSource.Count - 1; j++)
                        {
                            if (vo.orderDicId == this.DataSource[j].orderDicId)
                            {
                                vo.preAmount += this.DataSource[j].preAmount;
                            }
                        }
                        tmpDataSource.Add(vo);
                        lstOrderDicId.Add(vo.orderDicId);
                    }
                }
                int no = 0;
                foreach (EntityCureMed item in tmpDataSource)
                {
                    item.sortNo = ++no;
                }
                this.dgvData.DataSource = tmpDataSource;
            }
        }