|  |  | 
 |  |  |         "count": 3 | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | 、、、 | 
 |  |  | ``` | 
 |  |  |  | 
 |  |  |  | 
 |  |  | <h3 id='6'>六、养老机构</h2> | 
 |  |  | <h4 id='6.1'>6.1获取统计数据</h4> | 
 |  |  | ###### 接口功能 | 
 |  |  | > 获取统计数据 | 
 |  |  |  | 
 |  |  | ###### URL | 
 |  |  | > /api/fwyl/getStaticsData | 
 |  |  |  | 
 |  |  | ###### 支持格式 | 
 |  |  | > JSON | 
 |  |  |  | 
 |  |  | ###### HTTP请求方式 | 
 |  |  | > GET | 
 |  |  |  | 
 |  |  | ###### 请求参数 | 
 |  |  | |参数|必选|类型|说明| | 
 |  |  | |:-----  |:-------|:-----|-----                               | | 
 |  |  | |  areaId  |  是  |String |     区域id                    | | 
 |  |  |  | 
 |  |  | ###### 返回字段 | 
 |  |  | |返回字段|字段类型|说明                              | | 
 |  |  | |:-----   |:------|:-----------------------------   | | 
 |  |  | | sum  |  int  |  养老机构总数 | | 
 |  |  | | square  |  int  |  面积 | | 
 |  |  | | bedNumber  |  int  |  床位数 | | 
 |  |  | | nurseNumber  |  int  |  护理人员数 | | 
 |  |  | | type0Num  |  int  |  养老院个数 | | 
 |  |  | | type1Num  |  int  |  敬老院个数 | | 
 |  |  | | type2Num  |  int  |  疗养院个数 | | 
 |  |  |  | 
 |  |  | ###### 接口示例 | 
 |  |  | ``` java | 
 |  |  | { | 
 |  |  |     "success": true, | 
 |  |  |     "message": "success", | 
 |  |  |     "code": 200, | 
 |  |  |     "timestamp": 1607839952762, | 
 |  |  |     "result": { | 
 |  |  |         "sum": 3, | 
 |  |  |         "square": 10100, | 
 |  |  |         "bedNumber": 4020, | 
 |  |  |         "nurseNumber": 557, | 
 |  |  |         "type0Num": 3, | 
 |  |  |         "type1Num": 0, | 
 |  |  |         "type2Num": 0 | 
 |  |  |     } | 
 |  |  | ```  | 
 |  |  | <h4 id='6.2'>6.2床位个数排名</h4> | 
 |  |  | ###### 接口功能 | 
 |  |  | > 床位个数排名 | 
 |  |  |  | 
 |  |  | ###### URL | 
 |  |  | > /api/fwyl/getBedNumList | 
 |  |  |  | 
 |  |  | ###### 支持格式 | 
 |  |  | > JSON | 
 |  |  |  | 
 |  |  | ###### HTTP请求方式 | 
 |  |  | > GET | 
 |  |  |  | 
 |  |  | ###### 请求参数 | 
 |  |  | |参数|必选|类型|说明| | 
 |  |  | |:-----  |:-------|:-----|-----                               | | 
 |  |  | |  areaId  |  是  |String |     区域id                    | | 
 |  |  |  | 
 |  |  | ###### 返回字段 | 
 |  |  | |返回字段|字段类型|说明                              | | 
 |  |  | |:-----   |:------|:-----------------------------   | | 
 |  |  | | name  |  String  |  养老机构名称 | | 
 |  |  | | bedNumber  |  int  |  床位数 | | 
 |  |  |  | 
 |  |  | ###### 接口示例 | 
 |  |  | ``` java | 
 |  |  | { | 
 |  |  |     "success": true, | 
 |  |  |     "message": "success", | 
 |  |  |     "code": 200, | 
 |  |  |     "timestamp": 1607840268824, | 
 |  |  |     "result": [ | 
 |  |  |         { | 
 |  |  |             "id": "3", | 
 |  |  |             "createBy": null, | 
 |  |  |             "createTime": null, | 
 |  |  |             "updateBy": null, | 
 |  |  |             "updateTime": null, | 
 |  |  |             "delFlag": 0, | 
 |  |  |             "name": "养老院3", | 
 |  |  |             "areaId": "1", | 
 |  |  |             "type": 0, | 
 |  |  |             "square": 5000, | 
 |  |  |             "bedNumber": 4000, | 
 |  |  |             "nurseNumber": 500, | 
 |  |  |             "duixiangNumber": 3000 | 
 |  |  |         }, | 
 |  |  |         { | 
 |  |  |             "id": "1", | 
 |  |  |             "createBy": null, | 
 |  |  |             "createTime": null, | 
 |  |  |             "updateBy": null, | 
 |  |  |             "updateTime": null, | 
 |  |  |             "delFlag": 0, | 
 |  |  |             "name": "养老院1", | 
 |  |  |             "areaId": "1", | 
 |  |  |             "type": 0, | 
 |  |  |             "square": 100, | 
 |  |  |             "bedNumber": 10, | 
 |  |  |             "nurseNumber": 13, | 
 |  |  |             "duixiangNumber": 12 | 
 |  |  |         }, | 
 |  |  |         { | 
 |  |  |             "id": "2", | 
 |  |  |             "createBy": null, | 
 |  |  |             "createTime": null, | 
 |  |  |             "updateBy": null, | 
 |  |  |             "updateTime": null, | 
 |  |  |             "delFlag": 0, | 
 |  |  |             "name": "养老院2", | 
 |  |  |             "areaId": "1", | 
 |  |  |             "type": 0, | 
 |  |  |             "square": 5000, | 
 |  |  |             "bedNumber": 10, | 
 |  |  |             "nurseNumber": 44, | 
 |  |  |             "duixiangNumber": 12 | 
 |  |  |         } | 
 |  |  |     ] | 
 |  |  | ```  | 
 |  |  | <h4 id='6.3'>6.3床位使用率排名</h4> | 
 |  |  | ###### 接口功能 | 
 |  |  | > 床位使用率排名 | 
 |  |  |  | 
 |  |  | ###### URL | 
 |  |  | > /api/fwyl/getBedUseList | 
 |  |  |  | 
 |  |  | ###### 支持格式 | 
 |  |  | > JSON | 
 |  |  |  | 
 |  |  | ###### HTTP请求方式 | 
 |  |  | > GET | 
 |  |  |  | 
 |  |  | ###### 请求参数 | 
 |  |  | |参数|必选|类型|说明| | 
 |  |  | |:-----  |:-------|:-----|-----                               | | 
 |  |  | |  areaId  |  是  |String |     区域id                    | | 
 |  |  |  | 
 |  |  | ###### 返回字段 | 
 |  |  | |返回字段|字段类型|说明                              | | 
 |  |  | |:-----   |:------|:-----------------------------   | | 
 |  |  | | name  |  String  |  养老机构名称 | | 
 |  |  | | num  |  int  |  使用率(%) | | 
 |  |  |  | 
 |  |  | ###### 接口示例 | 
 |  |  | ``` java | 
 |  |  | { | 
 |  |  |     "success": true, | 
 |  |  |     "message": "success", | 
 |  |  |     "code": 200, | 
 |  |  |     "timestamp": 1607840400599, | 
 |  |  |     "result": [ | 
 |  |  |         { | 
 |  |  |             "name": "养老院1", | 
 |  |  |             "num": 98 | 
 |  |  |         }, | 
 |  |  |         { | 
 |  |  |             "name": "养老院2", | 
 |  |  |             "num": 97 | 
 |  |  |         }, | 
 |  |  |         { | 
 |  |  |             "name": "养老院3", | 
 |  |  |             "num": 96 | 
 |  |  |         } | 
 |  |  |     ] | 
 |  |  | } | 
 |  |  | ```  | 
 |  |  | <h4 id='6.4'>6.4历史数据</h4> | 
 |  |  | ###### 接口功能 | 
 |  |  | > 历史数据 | 
 |  |  |  | 
 |  |  | ###### URL | 
 |  |  | > /api/fwyl/getHistoryData | 
 |  |  |  | 
 |  |  | ###### 支持格式 | 
 |  |  | > JSON | 
 |  |  |  | 
 |  |  | ###### HTTP请求方式 | 
 |  |  | > GET | 
 |  |  |  | 
 |  |  | ###### 请求参数 | 
 |  |  | |参数|必选|类型|说明| | 
 |  |  | |:-----  |:-------|:-----|-----                               | | 
 |  |  | |  areaId  |  是  |String |     区域id                    | | 
 |  |  |  | 
 |  |  | ###### 返回字段 | 
 |  |  | |返回字段|字段类型|说明                              | | 
 |  |  | |:-----   |:------|:-----------------------------   | | 
 |  |  | | month  |  int  |  月份 | | 
 |  |  | | num  |  int  |  使用床位数 | | 
 |  |  | | num1  |  int  |  千人养老床位 | | 
 |  |  | | num2 |  int  |  同比变化 | | 
 |  |  | | num3  |  int  |  环比变化 | | 
 |  |  |  | 
 |  |  | ###### 接口示例 | 
 |  |  | ``` java | 
 |  |  | { | 
 |  |  |     "success": true, | 
 |  |  |     "message": "success", | 
 |  |  |     "code": 200, | 
 |  |  |     "timestamp": 1607840559733, | 
 |  |  |     "result": { | 
 |  |  |         "month": [ | 
 |  |  |             1, | 
 |  |  |             2, | 
 |  |  |             3, | 
 |  |  |             4, | 
 |  |  |             5, | 
 |  |  |             6, | 
 |  |  |             7, | 
 |  |  |             8, | 
 |  |  |             9, | 
 |  |  |             10, | 
 |  |  |             11, | 
 |  |  |             12 | 
 |  |  |         ], | 
 |  |  |         "num": [ | 
 |  |  |             11898, | 
 |  |  |             9702, | 
 |  |  |             9954, | 
 |  |  |             12690, | 
 |  |  |             9270, | 
 |  |  |             10980, | 
 |  |  |             11466, | 
 |  |  |             14238, | 
 |  |  |             12492, | 
 |  |  |             14292, | 
 |  |  |             10584, | 
 |  |  |             9558 | 
 |  |  |         ], | 
 |  |  |         "num1": 8, | 
 |  |  |         "num2": 1, | 
 |  |  |         "num3": -6 | 
 |  |  |     } | 
 |  |  | } | 
 |  |  | ```  | 
 
| New file | 
 |  |  | 
 |  |  | package cn.cetc54.platform.zhyl.api; | 
 |  |  |  | 
 |  |  | import cn.cetc54.platform.core.common.utils.ResultUtil; | 
 |  |  | import cn.cetc54.platform.core.common.vo.Result; | 
 |  |  | import cn.cetc54.platform.zhyl.entity.OrgYanglao; | 
 |  |  | import cn.cetc54.platform.zhyl.service.IOrgYanglaoService; | 
 |  |  | import cn.hutool.core.util.NumberUtil; | 
 |  |  | import cn.hutool.core.util.StrUtil; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import lombok.Data; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.web.bind.annotation.CrossOrigin; | 
 |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author xfei | 
 |  |  |  * @date 2020/12/13 | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @RestController | 
 |  |  | @Api(description = "养老机构") | 
 |  |  | @RequestMapping("/api2/fwyl") | 
 |  |  | @Transactional | 
 |  |  | @CrossOrigin("*") | 
 |  |  | public class FwylController { | 
 |  |  |     @Autowired | 
 |  |  |     private IOrgYanglaoService iOrgYanglaoService; | 
 |  |  |  | 
 |  |  |     @GetMapping("getStaticsData") | 
 |  |  |     @ApiOperation(value = "获取统计数据") | 
 |  |  |     public Result getStaticsData(String areaId){ | 
 |  |  |         if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){ | 
 |  |  |             //如果是全市 areaId设置未空 | 
 |  |  |             areaId = null; | 
 |  |  |         } | 
 |  |  |         QueryWrapper<OrgYanglao> wrapper = new QueryWrapper<>(); | 
 |  |  |         if (StrUtil.isNotEmpty(areaId)){ | 
 |  |  |             wrapper.lambda().eq(OrgYanglao::getAreaId,areaId); | 
 |  |  |         } | 
 |  |  |         List<OrgYanglao> list = iOrgYanglaoService.list(wrapper); | 
 |  |  |         StaticsDataVo vo = new StaticsDataVo(); | 
 |  |  |         vo.sum = list.size(); | 
 |  |  |         list.forEach(e->{ | 
 |  |  |             vo.bedNumber += e.getBedNumber(); | 
 |  |  |             vo.square += e.getSquare(); | 
 |  |  |             vo.nurseNumber += e.getNurseNumber(); | 
 |  |  |             switch (e.getType()){ | 
 |  |  |                 case 0: | 
 |  |  |                     vo.type0Num++; | 
 |  |  |                     break; | 
 |  |  |                 case 1: | 
 |  |  |                     vo.type1Num++; | 
 |  |  |                     break; | 
 |  |  |                 case 2: | 
 |  |  |                     vo.type2Num++; | 
 |  |  |                     break; | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |         return ResultUtil.data(vo); | 
 |  |  |     } | 
 |  |  |     @GetMapping("getBedNumList") | 
 |  |  |     @ApiOperation(value = "床位个数排名") | 
 |  |  |     public Result getBedNumList(String areaId){ | 
 |  |  |         if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){ | 
 |  |  |             //如果是全市 areaId设置未空 | 
 |  |  |             areaId = null; | 
 |  |  |         } | 
 |  |  |         QueryWrapper<OrgYanglao> wrapper = new QueryWrapper<>(); | 
 |  |  |         if (StrUtil.isNotEmpty(areaId)){ | 
 |  |  |             wrapper.lambda().eq(OrgYanglao::getAreaId,areaId); | 
 |  |  |         } | 
 |  |  |         wrapper.lambda().orderByDesc(OrgYanglao::getBedNumber); | 
 |  |  |         wrapper.last(" limit 10 "); | 
 |  |  |         List<OrgYanglao> list = iOrgYanglaoService.list(wrapper); | 
 |  |  |         return ResultUtil.data(list); | 
 |  |  |     } | 
 |  |  |     @GetMapping("getBedUseList") | 
 |  |  |     @ApiOperation(value = "床位使用率排名") | 
 |  |  |     public Result getBedUseList(String areaId){ | 
 |  |  |         if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){ | 
 |  |  |             //如果是全市 areaId设置未空 | 
 |  |  |             areaId = null; | 
 |  |  |         } | 
 |  |  |         QueryWrapper<OrgYanglao> wrapper = new QueryWrapper<>(); | 
 |  |  |         if (StrUtil.isNotEmpty(areaId)){ | 
 |  |  |             wrapper.lambda().eq(OrgYanglao::getAreaId,areaId); | 
 |  |  |         } | 
 |  |  |         wrapper.last(" limit 10 "); | 
 |  |  |         List<OrgYanglao> list = iOrgYanglaoService.list(wrapper); | 
 |  |  |         List<BeadUseVo> resList = new ArrayList<>(); | 
 |  |  |  | 
 |  |  |         int v = 99; | 
 |  |  |         int i = 0; | 
 |  |  |         for (OrgYanglao o:list){ | 
 |  |  |             i++; | 
 |  |  |             BeadUseVo vo = new BeadUseVo(); | 
 |  |  |             vo.name = o.getName(); | 
 |  |  |             vo.num = v-i; | 
 |  |  |             resList.add(vo); | 
 |  |  |         } | 
 |  |  |         return ResultUtil.data(resList); | 
 |  |  |     } | 
 |  |  |     @GetMapping("getHistoryData") | 
 |  |  |     @ApiOperation(value = "历史数据") | 
 |  |  |     public Result getHistoryData(String areaId){ | 
 |  |  |         if (StrUtil.isNotBlank(areaId)&&areaId.equals("130100")){ | 
 |  |  |             //如果是全市 areaId设置未空 | 
 |  |  |             areaId = null; | 
 |  |  |         } | 
 |  |  |         HistoryVo vo = new HistoryVo(); | 
 |  |  |         for (int i=0;i<12;i++){ | 
 |  |  |             int num = NumberUtil.generateBySet(500,800,1)[0]; | 
 |  |  |             if (StrUtil.isEmpty(areaId)){ | 
 |  |  |                 num = num*18; | 
 |  |  |             } | 
 |  |  |             vo.num.add(num); | 
 |  |  |         } | 
 |  |  |         vo.num1 = NumberUtil.generateBySet(6,12,1)[0]; | 
 |  |  |         vo.num2 = NumberUtil.generateBySet(-9,9,1)[0]; | 
 |  |  |         vo.num3 = NumberUtil.generateBySet(-9,9,1)[0]; | 
 |  |  |         return ResultUtil.data(vo); | 
 |  |  |     } | 
 |  |  |     @Data | 
 |  |  |     class HistoryVo{ | 
 |  |  |         int[] month = {1,2,3,4,5,6,7,8,9,10,11,12};//月份 | 
 |  |  |         List num = new ArrayList();//床位数 | 
 |  |  |         int num1;//千人养老床位 | 
 |  |  |         int num2;//同比变化 | 
 |  |  |         int num3;//环比变化 | 
 |  |  |     } | 
 |  |  |     @Data | 
 |  |  |     class StaticsDataVo{ | 
 |  |  |         int sum;//养老机构总数 | 
 |  |  |         double square;//面积 | 
 |  |  |         int bedNumber;//床位数 | 
 |  |  |         int nurseNumber;//护理人员数 | 
 |  |  |         int type0Num;//养老院个数 | 
 |  |  |         int type1Num;//敬老院个数 | 
 |  |  |         int type2Num;//疗养院个数 | 
 |  |  |     } | 
 |  |  |     @Data | 
 |  |  |     class BeadUseVo{ | 
 |  |  |         String name;//名称 | 
 |  |  |         int num;//使用率 | 
 |  |  |     } | 
 |  |  | } |