예제 #1
0
        public List <Forecast_data> GetHospitals(double forecast_time)
        {
            List <Forecast_data> list = new List <Forecast_data>();

            Forecast_data current = null;

            for (int i = 0; i < Results.Count; i += 3)
            {
                current = new Forecast_data();
                IS8Result itemB = Results[i];
                IS8Result itemW = Results[i + 1];
                IS8Result itemI = Results[i + 2];

                current.Hospital_ID   = itemB.Name.Substring(1, 2);
                current.Forecast_Time = forecast_time;

                current.HpF_BED  = new double[] { itemB.Mean, itemB.get_ConfLimit(-95), itemB.get_ConfLimit(95) };
                current.HpF_WARN = new double[] { itemW.Mean, itemW.get_ConfLimit(-95), itemW.get_ConfLimit(95) };
                current.HpF_ICU  = new double[] { itemI.Mean, itemI.get_ConfLimit(-95), itemI.get_ConfLimit(95) };

                list.Add(current);
            }

            return(list);
        }
예제 #2
0
        public List <Forecast_data> GetHospitals(double forecast_time)
        {
            List <Forecast_data> list = new List <Forecast_data>();

            Forecast_data current   = null;
            int           timestamp = Convert.ToInt32(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);


            for (int i = 0; i < Results.Count; i += 3)
            {
                current = new Forecast_data();
                IS8Result itemB = Results[i];
                IS8Result itemW = Results[i + 1];
                IS8Result itemI = Results[i + 2];

                int length = itemB.Name.IndexOf('B') - 1;
                current.Hospital_ID   = itemB.Name.Substring(1, length);
                current.Forecast_Time = forecast_time;
                current.Basetime      = timestamp;

                current.HpF_BED  = new double[] { itemB.Mean, itemB.get_ConfLimit(-95), itemB.get_ConfLimit(95) };
                current.HpF_WARN = new double[] { itemW.Mean, itemW.get_ConfLimit(-95), itemW.get_ConfLimit(95) };
                current.HpF_ICU  = new double[] { itemI.Mean, itemI.get_ConfLimit(-95), itemI.get_ConfLimit(95) };

                list.Add(current);
            }

            return(list);
        }
예제 #3
0
        public string GetJSON(double forecast_time)
        {
            List <Forecast_data> list = new List <Forecast_data>();

            Forecast_data current = null;
            //int timeStamp = Convert.ToInt32(DateTime.UtcNow.AddHours(8).Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
            long timeStamp = Convert.ToInt64(DateTime.UtcNow.AddMinutes(forecast_time).Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds);

            for (int i = 0; i < Results.Count; i += 3)
            {
                current = new Forecast_data();
                IS8Result itemB  = Results[i];
                IS8Result itemW  = Results[i + 1];
                IS8Result itemI  = Results[i + 2];
                int       length = itemB.Name.IndexOf('B') - 1;
                current.Hospital_ID   = itemB.Name.Substring(1, length);
                current.Forecast_Time = forecast_time;
                current.time          = timeStamp;// +(long)(forecast_time * 60000);


                current.HpF_BED  = new double[] { itemB.Mean, itemB.get_ConfLimit(-95), itemB.get_ConfLimit(95) };
                current.HpF_WARN = new double[] { itemW.Mean, itemW.get_ConfLimit(-95), itemW.get_ConfLimit(95) };
                current.HpF_ICU  = new double[] { itemI.Mean, itemI.get_ConfLimit(-95), itemI.get_ConfLimit(95) };

                list.Add(current);
            }

            return(JsonConvert.SerializeObject(list));
        }
예제 #4
0
        public string GetJSON(double forecast_time)
        {
            List <Forecast_data> list = new List <Forecast_data>();

            Forecast_data current   = null;
            int           timestamp = Convert.ToInt32(DateTime.UtcNow.AddHours(8).Subtract(new DateTime(1970, 1, 1)).TotalSeconds);


            for (int i = 0; i < Results.Count; i += 3)
            {
                current = new Forecast_data();
                IS8Result itemB = Results[i];
                IS8Result itemW = Results[i + 1];
                IS8Result itemI = Results[i + 2];

                current.Hospital_ID   = itemB.Name.Substring(1, 2);
                current.Forecast_Time = forecast_time;
                current.Basetime      = timestamp;

                current.HpF_BED  = new double[] { itemB.Mean, itemB.get_ConfLimit(-95), itemB.get_ConfLimit(95) };
                current.HpF_WARN = new double[] { itemW.Mean, itemW.get_ConfLimit(-95), itemW.get_ConfLimit(95) };
                current.HpF_ICU  = new double[] { itemI.Mean, itemI.get_ConfLimit(-95), itemI.get_ConfLimit(95) };

                list.Add(current);
            }

            return(JsonConvert.SerializeObject(list));
        }