Example #1
0
        /// <summary>对照项目
        ///
        /// </summary>
        /// <param name="Hrow">医院选中行</param>
        /// <param name="Drow">达安选中行</param>
        /// <returns>是否成功</returns>
        private bool Save(DataGridViewRow Hrow, DataGridViewRow Drow)
        {
            bool b = true;

            try
            {
                VDAListests      Hosptest    = Hrow.DataBoundItem as VDAListests;
                DADicttestitem   Daantest    = Drow.DataBoundItem as DADicttestitem;
                List <DATestmap> testmapList = new List <DATestmap>();
                DATestmap        testmap     = new DATestmap();
                //取出列表值,用于保存
                testmap.Customertestcode = Hosptest.Testcode;
                testmap.Customertestname = Hosptest.Testname;
                testmap.Datestcode       = Daantest.Datestcode;
                testmap.Datestname       = Daantest.Datestname;
                testmapList.Add(testmap);
                if (testmapBll.SaveDATestmapList(testmapList))
                {
                    ShowMessageHelper.ShowBoxMsg("保存对照成功!");
                    cacheMapList = new DATestmapBLL().GetDATestmapList(null);
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("保存对照失败!");
                    b = false;
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("保存对照出错:" + ex.Message);
                b = false;
            }
            return(b);
        }
Example #2
0
        private bool Cencel(VDAListests _test)
        {
            bool b = true;

            try
            {
                if (ShowMessageHelper.ShowBoxMsg("您是否要取消该项目的对照关系?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                {
                    return(false);
                }
                if (testmapBll.DelTestmapByID(_test.Testcode) > 0)
                {
                    ShowMessageHelper.ShowBoxMsg("取消对照成功!");
                    cacheMapList = new DATestmapBLL().GetDATestmapList(null);
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("取消对照失败!");
                    b = false;
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("取消对照出错:" + ex.Message);
                b = false;
            }
            return(b);
        }
Example #3
0
        /// 选中医院明细项目,选中对应的达安明细项目,没有则不选中
        private void gvItemHospital_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            gvItemDaan.ClearSelection();

            if (gvItemHospital.SelectedRows.Count <= 0)
            {
                return;                                        //无选中行
            }
            VDAListests _listtest = gvItemHospital.SelectedRows[0].DataBoundItem as VDAListests;

            if (!_listtest.IsSelect)
            {
                return;
            }                                   //没有对照好

            List <DADicttestitem> _list = dicttestitemBll.SelectDADicttestitemByHospCode(new Hashtable()
            {
                { "customertestcode", _listtest.Testcode }
            });

            if (_list.Count <= 0)
            {
                return;
            }                                //找不到对照的项目

            BindingCollection <DADicttestitem> list = bsDaItem.DataSource as BindingCollection <DADicttestitem>;

            if (list == null || list.Count <= 0)
            {
                return;
            }                                               //列表中无项目

            int i = list.ToList().FindIndex(c => c.Datestcode == _list[0].Datestcode);

            if (i >= 0)
            {
                //索引相同bs的 Position就不会选中,改用gv的selected
                if (bsDaItem.Position == i)
                {
                    gvItemDaan.Rows[i].Selected = true;
                }
                else
                {
                    bsDaItem.Position = i;
                }
            }
        }
Example #4
0
        //取消组合对照
        private void btnCancelGroup_Click(object sender, EventArgs e)
        {
            if (gvGroupHospital.SelectedRows.Count <= 0)
            {
                ShowMessageHelper.ShowBoxMsg("请选择要取消对照的医院组合!"); return;
            }
            VDAListests _test = gvGroupHospital.SelectedRows[0].DataBoundItem as VDAListests;

            if (!_test.IsSelect)
            {
                ShowMessageHelper.ShowBoxMsg("您选择的组合还没有对照!"); return;
            }
            int rowindex = gvGroupHospital.SelectedRows[0].Index;

            if (Cencel(_test))
            {
                BindDataHospitalGroup(string.Empty);
                bsHospitalGroup.Position = rowindex;
                gvGroupHospital.Rows[rowindex].Selected = false;
                gvGroupDaan.ClearSelection();
            }
        }
        //数据绑定
        private void BindData()
        {
            Hashtable ht = new Hashtable();

            ht.Add("strKey", tbxSearchKey.Text.ToString());
            gvItemHospitalAndDaan.AutoGenerateColumns = false;
            #region 把存在对应关系的数据合并到序列里,再绑定
            //获取数据
            cacheVDAList = dalisttestsBll.GetDaListestsList(ht);
            List <VDAListests> List = cacheVDAList;
            cacheMapList = new DATestmapBLL().GetDATestmapList(ht);
            //保存多个对照的列表
            List <VDAListests> mulVL = new List <VDAListests>();
            int cacheCount           = cacheVDAList.Count;
            for (int j = 0; j < cacheCount; j++)
            {
                VDAListests vdl = cacheVDAList[j];
                //选择存在对应关系的序列值
                var result = (from a in cacheMapList
                              where a.Customertestcode == vdl.Testcode
                              group a by new { a.Testmapid, a.Datestname, a.Datestcode, a.Customertestcode, a.Customertestname } into g
                              select new
                {
                    g.Key.Testmapid,
                    g.Key.Datestname,
                    g.Key.Datestcode,
                    g.Key.Customertestcode,
                    g.Key.Customertestname
                }).ToArray();
                if (result.Length > 0)
                {
                    for (int i = 0; i < result.Length; i++)
                    {
                        //if (i != 0)
                        //{
                        //    VDAListests dl = new VDAListests();
                        //    dl.Testmapid = vdl.Testmapid;
                        //    dl.Testcode = vdl.Testcode;
                        //    dl.Testname = vdl.Testname;
                        //    dl.Isgroup = vdl.Isgroup;
                        //    dl.Shortname = vdl.Shortname;
                        //    dl.Fastcode = vdl.Fastcode;
                        //    dl.Englishname = vdl.Englishname;
                        //    dl.Engshortname = vdl.Engshortname;
                        //    dl.Testtype = vdl.Testtype;
                        //    dl.Testmethod = vdl.Testmethod;
                        //    dl.Testmapid = result[i].Testmapid;
                        //    dl.Datestcode = result[i].Datestcode.ToString();
                        //    dl.Datestname = result[i].Datestname.ToString();
                        //    dl.Customertestcode = result[i].Customertestcode.ToString();
                        //    dl.Customertestname = result[i].Customertestname.ToString();
                        //    cacheVDAList.Add(dl);
                        //}
                        //else
                        //{
                        //    vdl.Testmapid = result[i].Testmapid;
                        //    vdl.Datestcode = result[i].Datestcode.ToString();
                        //    vdl.Datestname = result[i].Datestname.ToString();
                        //    vdl.Customertestcode = result[i].Customertestcode.ToString();
                        //    vdl.Customertestname = result[i].Customertestname.ToString();
                        //}

                        vdl.Testmapid        = result[i].Testmapid;
                        vdl.Datestcode      += i == result.Length - 1 ? result[i].Datestcode.ToString() : result[i].Datestcode.ToString() + " ,";
                        vdl.Datestname      += i == result.Length - 1 ? result[i].Datestname.ToString() : result[i].Datestname.ToString() + " ,";
                        vdl.Customertestcode = result[i].Customertestcode.ToString();
                        vdl.Customertestname = result[i].Customertestname.ToString();
                    }
                }
            }
            #endregion
            //默认对序列按项目名字排序
            var v = from c in cacheVDAList orderby c.Testname select c;
            cacheVDAList = v.ToList();
            //实现List排序,否则无法点击表头按列重新排序
            BindingCollection <VDAListests> list = new BindingCollection <VDAListests>();
            foreach (VDAListests vdl in cacheVDAList)
            {
                list.Add(vdl);
            }
            bsItemHospitalAndDaan.DataSource        = list;
            gvItemHospitalAndDaan.Columns[0].Frozen = true;
            lblRecord.Text = string.Format("共 {0} 条记录", list.Count);
        }
Example #6
0
        /// 点击医院组合时,过滤出组合下的明细
        private void gvGruopHospital_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (gvGroupHospital.SelectedRows.Count <= 0)
            {
                return;
            }
            VDAListests grouptest = gvGroupHospital.SelectedRows[0].DataBoundItem as VDAListests;

            List <VDAListests> _list = new VDAListestsBLL().GetVDaListestsresultByCode(new Hashtable()
            {
                { "Testcode", grouptest.Testcode }
            });
            BindingCollection <VDAListests> list = new BindingCollection <VDAListests>();

            foreach (VDAListests item in _list)
            {
                item.Testcode = item.Subtestcode;
                item.Testname = item.Subtestname;
                item.Isgroup  = "0";
                //存在对照表,勾选加底色
                if (cacheMapList.FindIndex(c => c.Customertestcode == item.Testcode) > 0)
                {
                    item.IsSelect = true;
                }

                list.Add(item);
            }
            bsHospitalItem.DataSource = list;
            gvItemHospital.ClearSelection();

            //匹配组合对应
            gvGroupDaan.ClearSelection();
            if (!grouptest.IsSelect)
            {
                return;
            }                                   //没有对照好

            List <DADicttestitem> _dalist = dicttestitemBll.SelectDADicttestitemByHospCode(new Hashtable()
            {
                { "customertestcode", grouptest.Testcode }
            });

            if (_dalist.Count <= 0)
            {
                return;
            }                                  //找不到对照的项目

            BindingCollection <DADicttestitem> dalist = bsDaGroup.DataSource as BindingCollection <DADicttestitem>;

            if (dalist == null || dalist.Count <= 0)
            {
                return;
            }                                                   //列表中无项目

            int i = dalist.ToList().FindIndex(c => c.Datestcode == _dalist[0].Datestcode);

            if (i >= 0)
            {
                //索引相同bs的 Position就不会选中,改用gv的selected
                if (bsDaGroup.Position == i)
                {
                    gvGroupDaan.Rows[i].Selected = true;
                }
                else
                {
                    bsDaGroup.Position = i;
                }
            }
        }