public List <ParameterInfoEntity> GetParameterList_Clinic()
        {
            string homeindex_redisKey = SystemManageConst.HOMEINDEXCLINIC_KEY;
            var    dataResult         = new List <ParameterInfoEntity>();

            using (var redisdb = _redisDbContext.GetRedisIntance())
            {
                dataResult = redisdb.Get <List <ParameterInfoEntity> >(homeindex_redisKey);//从缓存里取
                if (dataResult == null)
                {
                    using (var db = _dbContext.GetIntance()) //从数据库中
                    {
                        ParameterInfoEntity parameterInfoEntity = new ParameterInfoEntity();
                        parameterInfoEntity.ClinicInfoCount           = db.Ado.GetInt("SELECT COUNT(1) FROM YB_ClinicInfo");
                        parameterInfoEntity.ClinicInfoCheckCount      = db.Ado.GetInt("SELECT COUNT(1) FROM YB_ClinicInfo WHERE States != '1'");
                        parameterInfoEntity.ClinicInfoCheckErrorCount = db.Ado.GetInt("SELECT COUNT(1) FROM Check_ResultInfo WHERE DataType = '1'");
                        dataResult = new List <ParameterInfoEntity>();
                        dataResult.Add(parameterInfoEntity);
                    }
                    if (dataResult != null)//加入缓存
                    {
                        redisdb.Set(homeindex_redisKey, dataResult);
                        redisdb.Expire(homeindex_redisKey, 86400);//设置缓存时间
                    }
                }
            }
            return(dataResult);
        }
        public bool AddHomeIndexParameterRedis()
        {
            string homeindex_redisKey = SystemManageConst.HomeIndex_KEY;
            var    dataResult         = new List <ParameterInfoEntity>();

            using (var redisdb = _redisDbContext.GetRedisIntance())
            {
                var list = redisdb.Get <List <ParameterInfoEntity> >(homeindex_redisKey);//从缓存里取
                if (list == null)
                {
                    using (var db = _dbContext.GetIntance()) //从数据库中
                    {
                        ParameterInfoEntity parameterInfoEntity = new ParameterInfoEntity();
                        var YBHosInfoEntityList = db.Queryable <YBHosInfoEntity>().ToList();
                        parameterInfoEntity.HosInfoCount           = YBHosInfoEntityList.Count();
                        parameterInfoEntity.HosInfoCheckCount      = YBHosInfoEntityList.Where(it => it.States != "1").Count();
                        parameterInfoEntity.HosInfoCheckErrorCount = db.Queryable <CheckResultInfoEntity>().ToList().Where(it => it.DataType == "2").Count();
                        var YBClinicInfoEntityList = db.Queryable <YBClinicInfoEntity>().ToList();
                        parameterInfoEntity.ClinicInfoCount           = YBClinicInfoEntityList.Count();
                        parameterInfoEntity.ClinicInfoCheckCount      = YBClinicInfoEntityList.Where(it => it.States != "1").Count();
                        parameterInfoEntity.ClinicInfoCheckErrorCount = db.Queryable <CheckResultInfoEntity>().ToList().Where(it => it.DataType == "1").Count();
                        int checkcount = db.Queryable <CheckResultInfoEntity>().ToList().Count();

                        var group = db.Queryable <CheckResultInfoEntity>().GroupBy(it => new { it.InstitutionCode, it.RegisterCode })
                                    .Select(it => new CheckResultInfoEntity
                        {
                            InstitutionCode = it.InstitutionCode,
                            RegisterCode    = it.RegisterCode
                        });
                        var     yyxxList1  = db.Queryable <YYXXEntity>().Where(it => it.YLJGDJBM == "8"); //一级
                        var     yyxxList2  = db.Queryable <YYXXEntity>().Where(it => it.YLJGDJBM == "5"); //二级
                        var     yyxxList3  = db.Queryable <YYXXEntity>().Where(it => it.YLJGDJBM == "2"); //三级
                        decimal onecount   = db.Queryable(group, yyxxList1, (j1, j2) => j1.InstitutionCode == j2.YYDMYYDM).Select((j1, j2) => j1.InstitutionCode).ToList().Count().ObjToDecimal();
                        decimal twocount   = db.Queryable(group, yyxxList2, (j1, j2) => j1.InstitutionCode == j2.YYDMYYDM).Select((j1, j2) => j1.InstitutionCode).ToList().Count().ObjToDecimal();
                        decimal threecount = db.Queryable(group, yyxxList3, (j1, j2) => j1.InstitutionCode == j2.YYDMYYDM).Select((j1, j2) => j1.InstitutionCode).ToList().Count().ObjToDecimal();
                        parameterInfoEntity.OneProportion   = Math.Floor(Math.Round(decimal.Parse((onecount / checkcount).ToString("0.000")), 2) * 100).ToString() + '%';
                        parameterInfoEntity.TwoProportion   = Math.Floor(Math.Round(decimal.Parse((twocount / checkcount).ToString("0.000")), 2) * 100).ToString() + '%';
                        parameterInfoEntity.ThreeProportion = Math.Floor(Math.Round(decimal.Parse((threecount / checkcount).ToString("0.000")), 2) * 100).ToString() + '%';
                        dataResult.Add(parameterInfoEntity);
                    }
                    if (dataResult != null)//加入缓存
                    {
                        redisdb.Set(homeindex_redisKey, dataResult);
                        redisdb.Expire(homeindex_redisKey, 86400);//设置缓存时间
                        return(true);
                    }
                }
            }
            return(false);
        }
        public List <ParameterInfoEntity> GetParameterList()
        {
            string homeindex_redisKey = SystemManageConst.HomeIndex_KEY;
            var    dataResult         = new List <ParameterInfoEntity>();

            using (var redisdb = _redisDbContext.GetRedisIntance())
            {
                dataResult = redisdb.Get <List <ParameterInfoEntity> >(homeindex_redisKey);//从缓存里取
                if (dataResult == null)
                {
                    using (var db = _dbContext.GetIntance()) //从数据库中
                    {
                        ParameterInfoEntity parameterInfoEntity = new ParameterInfoEntity();
                        parameterInfoEntity.HosInfoCount           = db.Ado.GetInt("SELECT COUNT(1) FROM YB_HosInfo");
                        parameterInfoEntity.HosInfoCheckCount      = db.Ado.GetInt("SELECT COUNT(1) FROM YB_HosInfo WHERE States != '1'");
                        parameterInfoEntity.HosInfoCheckErrorCount = db.Ado.GetInt("SELECT COUNT(1) FROM Check_ResultInfo WHERE DataType = '2'");
                        //审核列表
                        List <CheckResultInfoDto> checklist = db.Ado.SqlQuery <CheckResultInfoDto>(@"SELECT a1.CheckResultInfoCode,a1.RegisterCode,a1.PersonalCode,a1.InstitutionCode,a1.InstitutionName,a2.YLJGDJBM,a2.YLJGDJMC 
                                                             FROM dbo.Check_ResultInfo a1 LEFT JOIN dbo.HIS_YYXX a2 ON a1.InstitutionCode = a2.YYDMYYDM");
                        int checkcount = checklist.Count();
                        int onecount   = 0;
                        int twocount   = 0;
                        int threecount = 0;
                        if (checklist != null)
                        {
                            onecount   = checklist.Where(it => it.YLJGDJBM == SystemManageConst.AONE).Count();   //一级
                            twocount   = checklist.Where(it => it.YLJGDJBM == SystemManageConst.ATWO).Count();   //二级
                            threecount = checklist.Where(it => it.YLJGDJBM == SystemManageConst.ATHREE).Count(); //三级
                        }
                        parameterInfoEntity.OneProportion   = Math.Floor(Math.Round(decimal.Parse(((decimal)onecount / checkcount).ToString("0.000")), 2) * 100).ToString() + '%';
                        parameterInfoEntity.TwoProportion   = Math.Floor(Math.Round(decimal.Parse(((decimal)twocount / checkcount).ToString("0.000")), 2) * 100).ToString() + '%';
                        parameterInfoEntity.ThreeProportion = Math.Floor(Math.Round(decimal.Parse(((decimal)threecount / checkcount).ToString("0.000")), 2) * 100).ToString() + '%';
                        dataResult = new List <ParameterInfoEntity>();
                        dataResult.Add(parameterInfoEntity);
                    }
                    if (dataResult != null)//加入缓存
                    {
                        redisdb.Set(homeindex_redisKey, dataResult);
                        redisdb.Expire(homeindex_redisKey, 86400);//设置缓存时间
                    }
                }
            }
            return(dataResult);
        }