示例#1
0
        /// <summary>
        /// コンボボックスに施設名称を追加するメソッド
        /// </summary>
        private void AddCmbFacility()
        {
            IF_Service service = new IF_Service();

            //コンボボックスに追加
            DataTable table  = new DataTable();
            DataTable table2 = new DataTable();

            table.Columns.Add("Display", typeof(string));
            table.Columns.Add("Value", typeof(string));
            table2.Columns.Add("Display", typeof(string));
            table2.Columns.Add("Value", typeof(string));

            table.Rows.Add("", "");

            foreach (var hosp in RetHospList)
            {
                table.Rows.Add(hosp.Name, hosp.Cd);
                table2.Rows.Add(hosp.Name, hosp.Cd);
                var      dat   = service.GetHospitalConfig(hosp.Cd);
                string[] confs = null;
                for (int i = 0; i < dat.Length; i++)
                {
                    if (dat[i].Key == "Hosp" && !String.IsNullOrEmpty(dat[i].Value))
                    {
                        confs = dat[i].Value.Split('@');
                    }
                    else if (dat[i].Key == "Dist" && !String.IsNullOrEmpty(dat[i].Value) && dat[i].Value == "1")
                    {
                        SysList.Add(hosp.Cd);
                    }
                }
                if (confs == null)
                {
                    continue;
                }

                List <HospMst> list = new List <HospMst>();
                foreach (var conf in confs)
                {
                    var     datas = conf.Split(':');
                    HospMst mst   = new AggregateTool.HospMst();
                    mst.Target = datas[0];
                    var wheres = datas[1].Split(',');
                    mst.Where = wheres[0] + " " + wheres[1] + " '" + wheres[2] + "'";

                    list.Add(mst);
                }
                HospMst[hosp.Name_DB] = list.ToArray();
            }

            table.Rows.Add("システム連携施設", "SYSTEM");
            table.Rows.Add("システム連携施設 以外", "OTHER");


            Cmb_Facility.DataSource    = table;
            Cmb_Facility.ValueMember   = "Value";
            Cmb_Facility.DisplayMember = "Display";
            Office.DataSource          = table2;
            Office.ValueMember         = "Value";
            Office.DisplayMember       = "Display";

//            Cmb_Facility.SelectedIndex = -1;
        }
        public Form_OutPutAggregate()
        {
            InitializeComponent();

            IF_Service service = new IF_Service();

            RetHospList  = service.GetHospital().ToList();
            RetdocList   = service.GetDoctor().ToList();
            SystemConfig = service.GetSystemConfig().ToList();

            ModalityList    = new Dictionary <string, string>();
            ModalityDocList = new Dictionary <string, string>();
            HospDistMsts    = new List <HospDistMst>();

            string[] modList    = null;
            string[] modDocList = null;

            foreach (var conf in SystemConfig)
            {
                if (conf.Key == "Modality")
                {
                    modList = conf.Value.Split(',');
                }
                else if (conf.Key == "Modality_Doc")
                {
                    modDocList = conf.Value.Split(',');
                }
            }
            ModalityList = new Dictionary <string, string>();
            for (int i = 0; i < modList.Length; i++)
            {
                string[] modVal = modList[i].Split(':');

                ModalityList.Add(modVal[1], modVal[2]);
            }

            ModalityDocList = new Dictionary <string, string>();
            for (int i = 0; i < modDocList.Length; i++)
            {
                string[] modVal = modDocList[i].Split(':');

                ModalityDocList.Add(modVal[1], modVal[2]);
            }

            foreach (var hosp in RetHospList)
            {
                var         dat     = service.GetHospitalConfig(hosp.Cd);
                string[]    confs   = null;
                HospDistMst tmpData = new HospDistMst();
                tmpData.Hospital = hosp;

                for (int i = 0; i < dat.Length; i++)
                {
                    confs = null;

                    if (!String.IsNullOrEmpty(dat[i].Value))
                    {
                        switch (dat[i].Key)
                        {
                        case "Cost":
                            tmpData.Cost = dat[i].Value;
                            break;

                        case "Dist":
                            tmpData.Dist = dat[i].Value;
                            break;

                        default:
                            confs = dat[i].Value.Split('@');
                            break;
                        }
                    }

                    if (confs == null)
                    {
                        continue;
                    }

                    switch (dat[i].Key)
                    {
                    case "Hosp":
                        List <HospMst> list = new List <HospMst>();
                        foreach (var conf in confs)
                        {
                            var     datas = conf.Split(':');
                            HospMst mst   = new AggregateTool.HospMst();
                            mst.Target = datas[0];
                            var wheres = datas[1].Split(',');
                            mst.Where = wheres[0] + " " + wheres[1] + " '" + wheres[2] + "'";

                            list.Add(mst);
                        }
                        tmpData.Hosp = list.ToArray();
                        break;

                    case "Sheet":
                        List <ModarityMst> listMod = new List <ModarityMst>();
                        foreach (var conf in confs)
                        {
                            var         datas = conf.Split(':');
                            ModarityMst mst   = new ModarityMst();
                            mst.Sum    = datas[0];
                            mst.Target = datas[1];
                            var wheres = datas[2].Split(',');
                            mst.Where = wheres[0] + " " + wheres[1] + " '" + wheres[2] + "'";
                            if (datas.Length > 3)
                            {
                                mst.DocMod = datas[3];
                            }
                            listMod.Add(mst);
                        }
                        tmpData.Sheet = listMod.ToArray();
                        break;

                    case "Kaikei":
                        tmpData.Yayoi = confs;
                        break;

                    default:
                        continue;
                    }
                }

                HospDistMsts.Add(tmpData);
            }
        }