Ejemplo n.º 1
0
        private string GetTargetReport_Child(HospDistMst Hosp)
        {
            IF_Service service = new IF_Service();

            ExtReports hospRep = new ExtReports();

            hospRep.Cd = Hosp.Hospital.Cd;

            List <ModReports> modLists = new List <ModReports>();

            var dispCd     = "";
            var childWhere = "";

            foreach (var mst in HospDistMsts)
            {
                if (mst.Hosp == null)
                {
                    continue;
                }

                foreach (var hos in mst.Hosp)
                {
                    if (hos.Target == Hosp.Hospital.Cd)
                    {
                        dispCd      = mst.Hospital.Name_DB;
                        childWhere += " AND " + hos.Where;
                    }
                }
            }

            foreach (var mod in ModalityList)
            {
                ModReports tmpReps = new ModReports();
                tmpReps.Mod = mod.Value;

                string modWhere = "";
                modWhere += " Modality = '" + mod.Key + "'";

                if (Hosp.Sheet != null)
                {
                    var isData = false;
                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Sum == mod.Key)
                        {
                            modWhere += " OR ( Modality = '" + sheet.Target + "'";
                            modWhere += " AND " + sheet.Where + ")";
                            isData    = true;
                        }
                    }
                    if (isData)
                    {
                        modWhere = " AND (" + modWhere + ")";
                    }
                    else
                    {
                        modWhere = " AND " + modWhere;
                    }

                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Target == mod.Key)
                        {
                            modWhere += " AND NOT " + sheet.Where;
                        }
                    }
                }
                else
                {
                    modWhere = " AND " + modWhere;
                }

                if (Hosp.Hosp != null)
                {
                    foreach (var mst in Hosp.Hosp)
                    {
                        modWhere += " AND NOT " + mst.Where;
                    }
                }

                tmpReps.Reports = service.GetReport(dispCd, start, end, childWhere + modWhere);

                if (tmpReps.Reports != null)
                {
                    tmpReps.Count  = tmpReps.Reports.Length;
                    hospRep.Count += tmpReps.Reports.Length;
                    modLists.Add(tmpReps);
                }
            }

            hospRep.ModReports = modLists.ToArray();

            HospReports.Add(hospRep);

            return(dispCd);
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   レポートデータ取得(親施設)
        /// </summary>
        /// <param name="Hosp"></param>
        private void GetTargetReport(HospDistMst Hosp)
        {
            IF_Service service = new IF_Service();

            ExtReports hospRep = new ExtReports();

            hospRep.Cd = Hosp.Hospital.Cd;

            List <ModReports> modLists = new List <ModReports>();

            foreach (var mod in ModalityList)
            {
                ModReports tmpReps = new ModReports();
                tmpReps.Mod = mod.Value;


                string modWhere = "";
                modWhere += " Modality = '" + mod.Key + "'";

                if (Hosp.Sheet != null)
                {
                    var isData = false;
                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Sum == mod.Key)
                        {
                            modWhere      += " OR ( Modality = '" + sheet.Target + "'";
                            modWhere      += " AND " + sheet.Where + ")";
                            tmpReps.DocMod = sheet.DocMod;

                            isData = true;
                        }
                    }
                    if (isData)
                    {
                        modWhere = " AND (" + modWhere + ")";
                    }
                    else
                    {
                        modWhere = " AND " + modWhere;
                    }

                    foreach (var sheet in Hosp.Sheet)
                    {
                        if (sheet.Target == mod.Key)
                        {
                            modWhere += " AND NOT " + sheet.Where;
                        }
                    }
                }
                else
                {
                    modWhere = " AND " + modWhere;
                }

                if (Hosp.Hosp != null)
                {
                    foreach (var mst in Hosp.Hosp)
                    {
                        modWhere += " AND NOT " + mst.Where;
                    }
                }

                tmpReps.Reports = service.GetReport(Hosp.Hospital.Name_DB, start, end, modWhere);

                if (tmpReps.Reports != null)
                {
                    tmpReps.Count  = tmpReps.Reports.Length;
                    hospRep.Count += tmpReps.Reports.Length;
                    modLists.Add(tmpReps);
                }
            }

            hospRep.ModReports = modLists.ToArray();

            HospReports.Add(hospRep);
        }