//首页左侧数据 public HomeInformation GetHomeInformation() { #region 直接给值 int hour = DateTime.Now.Hour; int[] DoctorRegisteredQuantyAm = { 0, 0, 0, 0, 0, 0, 5, 20, 121, 176, 180, 203, 203, 203 }; int[] DoctorRegisteredQuantyPm = { 97, 135, 148, 166, 166, 166 }; HomeInformation homeInformation = new HomeInformation(); if (hour < 13)//超过12点 ,13点开始 { homeInformation.DoctorTotalQuantyAm = 211; homeInformation.DoctorRegisteredQuantyAm = DoctorRegisteredQuantyAm[hour]; homeInformation.RegistrationRateAm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyAm / (double)homeInformation.DoctorTotalQuantyAm, 2);//96% homeInformation.DoctorTotalQuantyPm = 172; homeInformation.DoctorRegisteredQuantyPm = 0; homeInformation.RegistrationRatePm = (float)0; } else if (hour >= 13 && hour < 18) { homeInformation.DoctorTotalQuantyAm = 211; homeInformation.DoctorRegisteredQuantyAm = 203; homeInformation.RegistrationRateAm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyAm / (double)homeInformation.DoctorTotalQuantyAm, 2);//96% homeInformation.DoctorTotalQuantyPm = 172; homeInformation.DoctorRegisteredQuantyPm = DoctorRegisteredQuantyPm[hour - 13]; homeInformation.RegistrationRatePm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyPm / (double)homeInformation.DoctorTotalQuantyPm, 2);//66% } else { homeInformation.DoctorTotalQuantyAm = 211; homeInformation.DoctorRegisteredQuantyAm = 203; homeInformation.RegistrationRateAm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyAm / (double)homeInformation.DoctorTotalQuantyAm, 2);//96% homeInformation.DoctorTotalQuantyPm = 172; homeInformation.DoctorRegisteredQuantyPm = 166; homeInformation.RegistrationRatePm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyPm / (double)homeInformation.DoctorTotalQuantyPm, 2);//66% } homeInformation.WaitingQuantity = 1781; homeInformation.CompletedTreatQuanty = 6606; homeInformation.SevereObservingQuanty = 46; homeInformation.FirstAidQuanty = 24; homeInformation.HospitalizedQuanty = 3892; homeInformation.YesterdayLeaveHospitalQuanty = 811; homeInformation.YesterdayAdminttedHospitalQuanty = 765; homeInformation.RatedEmptyBedQuanty = 482; homeInformation.ExtraBedQuanty = 498; homeInformation.VirtualBedQuanty = 681; return(homeInformation); #endregion }
//首页左侧数据 public HomeInformation GetHomeInformation() { #region 直接给值 HomeInformation homeInformation = new HomeInformation(); homeInformation.DoctorTotalQuantyAm = 652; homeInformation.DoctorRegisteredQuantyAm = 588; homeInformation.RegistrationRateAm = (Single)Math.Round((Single)homeInformation.DoctorRegisteredQuantyAm / (Single)homeInformation.DoctorTotalQuantyAm, 2); homeInformation.DoctorTotalQuantyPm = 321; homeInformation.DoctorRegisteredQuantyPm = 200; homeInformation.RegistrationRatePm = (Single)Math.Round((Single)homeInformation.DoctorRegisteredQuantyPm / (Single)homeInformation.DoctorTotalQuantyPm, 2); homeInformation.WaitingQuantity = 520; homeInformation.CompletedTreatQuanty = 5314; homeInformation.SevereObservingQuanty = 88; homeInformation.FirstAidQuanty = 54; homeInformation.HospitalizedQuanty = 3866; homeInformation.YesterdayLeaveHospitalQuanty = 58; homeInformation.YesterdayAdminttedHospitalQuanty = 623; homeInformation.RatedEmptyBedQuanty = 622; homeInformation.ExtraBedQuanty = 100; homeInformation.VirtualBedQuanty = 321; return(homeInformation); #endregion }
/// <summary> /// 获取页面主页数据 /// </summary> /// <returns></returns> //1获取主页数据 public HomeInformation GetHomeInformation() { HomeInformation homeInformation = new HomeInformation(); for (int i = 6; i < 17; i++) { #region switch判断,医生签到率的处理 /* * switch (i) * { * case 3: //上午医生签到率 * if (homeInformation.DoctorTotalQuantyAm != 0) * homeInformation.RegistrationRateAm = (Single)Math.Round((Single)homeInformation.DoctorRegisteredQuantyAm / (Single)homeInformation.DoctorTotalQuantyAm, 2); * else { homeInformation.RegistrationRateAm = (float)0; } * break; * case 6: //下午医生签到率 * if (homeInformation.DoctorTotalQuantyPm!= 0) * homeInformation.RegistrationRatePm = (Single)Math.Round((Single)homeInformation.DoctorRegisteredQuantyPm / (Single)homeInformation.DoctorTotalQuantyPm, 2); * else { homeInformation.RegistrationRatePm = (Single)0; } * break; * default: * break; * } * if (i == 3 || i == 6 ) { continue; }//医生签到率计算不需要查询数据库,直接跳出本次循环 */ switch (i) { case 6: //上午医生签到率 #region 直接给值 int hour = DateTime.Now.Hour; int[] DoctorRegisteredQuantyAm = { 0, 0, 0, 0, 0, 0, 5, 20, 121, 176, 180, 203, 203, 203 }; int[] DoctorRegisteredQuantyPm = { 97, 135, 148, 166, 166, 166 }; if (hour < 13) //超过12点 ,13点开始 { homeInformation.DoctorTotalQuantyAm = 211; homeInformation.DoctorRegisteredQuantyAm = DoctorRegisteredQuantyAm[hour]; homeInformation.RegistrationRateAm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyAm / (double)homeInformation.DoctorTotalQuantyAm, 2); //96% homeInformation.DoctorTotalQuantyPm = 172; homeInformation.DoctorRegisteredQuantyPm = 0; homeInformation.RegistrationRatePm = (float)0; } else if (hour >= 13 && hour < 18) { homeInformation.DoctorTotalQuantyAm = 211; homeInformation.DoctorRegisteredQuantyAm = 203; homeInformation.RegistrationRateAm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyAm / (double)homeInformation.DoctorTotalQuantyAm, 2); //96% homeInformation.DoctorTotalQuantyPm = 172; homeInformation.DoctorRegisteredQuantyPm = DoctorRegisteredQuantyPm[hour - 13]; homeInformation.RegistrationRatePm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyPm / (double)homeInformation.DoctorTotalQuantyPm, 2); //66% } else { homeInformation.DoctorTotalQuantyAm = 211; homeInformation.DoctorRegisteredQuantyAm = 203; homeInformation.RegistrationRateAm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyAm / (double)homeInformation.DoctorTotalQuantyAm, 2); //96% homeInformation.DoctorTotalQuantyPm = 172; homeInformation.DoctorRegisteredQuantyPm = 166; homeInformation.RegistrationRatePm = (Single)Math.Round((double)homeInformation.DoctorRegisteredQuantyPm / (double)homeInformation.DoctorTotalQuantyPm, 2); //66% } #endregion break; default: break; } if (i == 6) { continue; } //医生签到率计算不需要查询数据库,直接跳出本次循环 #endregion int temp = 0; String command = GetHomeInformation(i.ToString()); DbCommand queryCommand = db.GetSqlStringCommand(command); using (IDataReader reader = db.ExecuteReader(queryCommand)) { while (reader.Read()) { #region switch判断,赋值 switch (i) { #region 注释 /* * case 1: //上午有排班医生总数 * homeInformation.DoctorTotalQuantyAm = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); * break; * case 2: //上午已签到医生数 * homeInformation.DoctorRegisteredQuantyAm = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); * break; * //case 3: //上午医生签到率 * // homeInformation.RegistrationRateAm = (Single)Math.Round((Single)homeInformation.DoctorTotalQuantyAm/(Single)homeInformation.DoctorTotalQuantyAm,2); * // break; * case 4: //下午有排班医生总数 * homeInformation.DoctorTotalQuantyPm = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); * break; * case 5: //下午已签到医生数 * homeInformation.DoctorRegisteredQuantyPm = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); * break; * //case 6: //下午医生签到率 * // homeInformation.RegistrationRatePm = (Single)Math.Round((Single)homeInformation.DoctorTotalQuantyPm / (Single)homeInformation.DoctorRegisteredQuantyPm, 2); * // break; */ #endregion case 7: //候诊人数 homeInformation.WaitingQuantity = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 8: //已完成就诊人数 homeInformation.CompletedTreatQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 9: //重症留观人数 homeInformation.SevereObservingQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 10: //急救中人数 homeInformation.FirstAidQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 11: //在院人数 homeInformation.HospitalizedQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 12: //昨日出院人数 homeInformation.YesterdayLeaveHospitalQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 13: //昨日入院人数 homeInformation.YesterdayAdminttedHospitalQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 14: //全院额定的空床数 homeInformation.RatedEmptyBedQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 15: //全院加床的空床数 homeInformation.ExtraBedQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; case 16: //全院虚拟的空床数 homeInformation.VirtualBedQuanty = reader[0] is DBNull ? 0 : Convert.ToInt32(reader[0]); break; default: break; } #endregion } } } return(homeInformation); }