api.md
@@ -5,8 +5,10 @@ [ 1.2获取全部补贴类型](#1.2) [2.首页](#2) [ 2.1获取区域津贴统计](#2.1) [ 2.2获取全部补贴类型](#1.2) [ 2.1补贴统计](#2.1) [ 2.2服务机构统计](#2.2) [ 2.3养老机构统计](#2.3) [ 2.4服务对象统计](#2.4) [3.补贴](#3) [ 3.1获取总统计数据](#3.1) [ 3.2年度月度统计数据](#3.2) @@ -125,6 +127,204 @@ ] } ``` <h3 id='2'>二、首页</h2> <h4 id='2.1'>2.1补贴统计</h4> ###### 接口功能 > 根据区域id获取补贴统计 ###### URL > /api/index/getSubsidyStatics ###### 支持格式 > JSON ###### HTTP请求方式 > GET ###### 请求参数 |参数|必选|类型|说明| |:----- |:-------|:-----|----- | | areaId | 否 |String | 区域id | ###### 返回字段 |返回字段|字段类型|说明 | |:----- |:------|:----------------------------- | | total | double | 补贴总金额 | | typeName | String | 补贴项目名称 | | sum | double | 补贴项目总金额 | ###### 接口示例 ``` java { "success": true, "message": "success", "code": 200, "timestamp": 1607665964425, "result": { "total": 2500, "list": [ { "typeName": "高龄老人生活补贴", "sum": 1500, "type": 2 }, { "typeName": "重度残疾人生活补贴", "sum": 1000, "type": 1 } ] } } ``` <h4 id='2.2'>2.2服务机构统计</h4> ###### 接口功能 > 根据区域id服务机构统计 ###### URL > /api/index/getOrgFWStatics ###### 支持格式 > JSON ###### HTTP请求方式 > GET ###### 请求参数 |参数|必选|类型|说明| |:----- |:-------|:-----|----- | | areaId | 否 |String | 区域id | ###### 返回字段 |返回字段|字段类型|说明 | |:----- |:------|:----------------------------- | | total | int | 服务机构总数 | | detail | String | 服务项目 | | num | int | 此服务项目总个数 | ###### 接口示例 ``` java { "success": true, "message": "success", "code": 200, "timestamp": 1607667809694, "result": { "total": 0, "list": [ { "num": 1, "detail": "康复服务" }, { "num": 1, "detail": "生活料理" } ] } } ``` <h4 id='2.3'>2.3养老机构统计</h4> ###### 接口功能 > 根据区域id获取养老机构统计 ###### URL > /api/index/getYlOrgYLStatics ###### 支持格式 > JSON ###### HTTP请求方式 > GET ###### 请求参数 |参数|必选|类型|说明| |:----- |:-------|:-----|----- | | areaId | 否 |String | 区域id | ###### 返回字段 |返回字段|字段类型|说明 | |:----- |:------|:----------------------------- | | total | int | 养老机构总个数 | | type0 | int | 养老院个数 | | type1 | int | 敬老院个数 | | type2 | int | 疗养院个数 | | square | double | 总面积 | | bedNumber | int | 床位个数 | | nurseNumber | int | 护理人员个数 | | duixiangNumber | int | 入住老人个数 | ###### 接口示例 ``` java { "success": true, "message": "success", "code": 200, "timestamp": 1607668287242, "result": { "square": 5100, "total": 2, "type2": 0, "duixiangNumber": 24, "type1": 0, "bedNumber": 20, "type0": 2, "nurseNumber": 57 } } ``` <h4 id='2.4'>2.4服务对象统计</h4> ###### 接口功能 > 根据区域id获取服务对象统计 ###### URL > /api/index/getFuwuPersonStatics ###### 支持格式 > JSON ###### HTTP请求方式 > GET ###### 请求参数 |参数|必选|类型|说明| |:----- |:-------|:-----|----- | | areaId | 否 |String | 区域id | ###### 返回字段 |返回字段|字段类型|说明 | |:----- |:------|:----------------------------- | | total | double | 服务对象总个数 | | typeName | String | 补贴项目名称 | | sum | int | 补贴项目总人数 | ###### 接口示例 ``` java { "success": true, "message": "success", "code": 200, "timestamp": 1607669982970, "result": { "total": 2, "list": [ { "num": 1, "typeName": "重度残疾人生活补贴", "type": 1 }, { "num": 1, "typeName": "高龄老人生活补贴", "type": 2 } ] } } ``` <h3 id='3'>三、补贴</h2> <h4 id='3.1'>3.1获取总统计数据</h4> ###### 接口功能 platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/IndexController.java
@@ -1,9 +1,27 @@ 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.OrgFuwu; import cn.cetc54.platform.zhyl.entity.OrgYanglao; import cn.cetc54.platform.zhyl.entity.SubsidyEmum; import cn.cetc54.platform.zhyl.service.IOrderService; import cn.cetc54.platform.zhyl.service.IOrgFuwuService; import cn.cetc54.platform.zhyl.service.IOrgYanglaoService; import cn.cetc54.platform.zhyl.service.ISubsidyLogService; 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.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author xfei @@ -14,5 +32,101 @@ @Api(description = "首页接口") @RequestMapping("/api/index") public class IndexController { @Autowired private IOrgYanglaoService iOrgYanglaoService; @Autowired private ISubsidyLogService iSubsidyLogService; @Autowired private IOrgFuwuService iOrgFuwuService; @Autowired private IOrderService iOrderService; @GetMapping("/getSubsidyStatics") @ApiOperation(value = "补贴统计") public Result getSubsidyStatics(String areaId){ double total = iSubsidyLogService.getTotalMoney(areaId,null); List<Map<String,Object>> list = iSubsidyLogService.getTypeMoney(areaId); list.forEach(e->{ int type = (int) e.get("type"); e.put("typeName", SubsidyEmum.values()[type].name()); }); Map<String,Object> resMap = new HashMap<>(); resMap.put("total",total); resMap.put("list",list); return ResultUtil.data(resMap); } @GetMapping("/getOrgFWStatics") @ApiOperation(value = "服务机构统计") public Result getOrgFWStatics(String areaId){ QueryWrapper<OrgFuwu> wrapper = new QueryWrapper<>(); wrapper.eq("area_id",areaId); int total = iOrgFuwuService.list(wrapper).size(); List list = iOrderService.getTypeStatics(areaId); Map<String,Object> resMap = new HashMap<>(); resMap.put("total",total); resMap.put("list",list); return ResultUtil.data(resMap); } @GetMapping("/getYlOrgYLStatics") @ApiOperation(value = "养老机构统计") public Result getYlOrgStatics(String areaId){ QueryWrapper<OrgYanglao> wrapper = new QueryWrapper<>(); if (StrUtil.isNotBlank(areaId)){ wrapper.eq("area_id",areaId); } List<OrgYanglao> list = iOrgYanglaoService.list(wrapper); int total = list.size();//养老机构总个数 int type0 =0;//养老院个数 int type1 =0;//敬老院个数 int type2 =0;//疗养院个数 double square =0;//总面积 int bedNumber = 0;//床位个数 int nurseNumber = 0;//护理人员个数 int duixiangNumber = 0;//入住老人个数 for (OrgYanglao org:list){ switch (org.getType()){ case 0: type0++; break; case 1: type1++; break; case 2: type2++; break; } square+=org.getSquare(); bedNumber+= org.getBedNumber(); nurseNumber+= org.getNurseNumber(); duixiangNumber+=org.getDuixiangNumber(); } Map<String,Object> resMap = new HashMap<>(); resMap.put("total",total); resMap.put("type0",type0); resMap.put("type1",type1); resMap.put("type2",type2); resMap.put("square",square); resMap.put("bedNumber",bedNumber); resMap.put("nurseNumber",nurseNumber); resMap.put("duixiangNumber",duixiangNumber); return ResultUtil.data(resMap); } @GetMapping("/getFuwuPersonStatics") @ApiOperation(value = "服务对象统计") public Result getFuwuPersonStatics(String areaId){ int total = iSubsidyLogService.getTotalNum(areaId,null); List<Map<String,Object>> list = iSubsidyLogService.getTypeNum(areaId); list.forEach(e->{ int type = (int) e.get("type"); e.put("typeName", SubsidyEmum.values()[type].name()); }); Map<String,Object> resMap = new HashMap<>(); resMap.put("total",total); resMap.put("list",list); return ResultUtil.data(resMap); } } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/FuwuDuixiang.java
@@ -46,14 +46,6 @@ @ApiModelProperty(value = "区域id") private String areaId; @Column( length = 20 ,name = "record_year") @ApiModelProperty(value = "登记年份") private String recordYear; @Column( length = 20 ,name = "record_month") @ApiModelProperty(value = "登记月份") private String recordMonth; @Column( length = 200 ,name = "subsidyIds") @ApiModelProperty(value = "补贴集合") private String subsidyIds; platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/Order.java
@@ -34,6 +34,10 @@ @ApiModelProperty(value = "服务详情id") private String detailId; @Column( length = 24 ,name = "detail") @ApiModelProperty(value = "服务详情") private String detail; @Column( length = 24 ,name = "duixiang_id") @ApiModelProperty(value = "服务对象id") private String duixiangId; platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/OrgYanglao.java
@@ -36,24 +36,24 @@ private String areaId; @Column( length = 1 ,name = "type") @ApiModelProperty(value = "类型") private Integer type; @ApiModelProperty(value = "类型 0/养老院 1/敬老院 2/疗养院") private int type; @Column( length = 10 ,name = "square") @ApiModelProperty(value = "面积") private String square; private double square; @Column( length = 10 ,name = "bed_number") @ApiModelProperty(value = "床位数") private Integer bedNumber; private int bedNumber; @Column( length = 10 ,name = "nurse_number") @ApiModelProperty(value = "护理人员数") private Integer nurseNumber; private int nurseNumber; @Column( length = 10 ,name = "duixiang_number") @ApiModelProperty(value = "入住老人数") private Integer duixiangNumber; private int duixiangNumber; } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/Subsidy.java
@@ -33,7 +33,7 @@ @Column( length = 1 ,name = "type") @ApiModelProperty(value = "补助类型") private Integer type; private int type; @Column( length = 10 ,name = "money") @ApiModelProperty(value = "补助金额") platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/SubsidyLog.java
@@ -31,13 +31,6 @@ @ApiModelProperty(value = "区域id") private String areaId; @Column( length = 20 ,name = "year") @ApiModelProperty(value = "登记年份") private String year; @Column( length = 20 ,name = "month") @ApiModelProperty(value = "登记月份") private String month; @Column( length = 1 ,name = "type") @ApiModelProperty(value = "补助类型") @@ -51,9 +44,6 @@ @ApiModelProperty(value = "服务对象id") private String duixiangId; @Column( length = 1 ,name = "state") @ApiModelProperty(value = "状态,") private Integer state; } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/OrderMapper.java
@@ -2,13 +2,34 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.cetc54.platform.zhyl.entity.Order; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; import java.util.Map; /** * 订单数据处理层 * @author */ public interface OrderMapper extends BaseMapper<Order> { /** * 获取某个区域的服务项目的个数 * @param areaId * @return */ @Select("<script>" + "select detail,count(*) as num " + "from" + "(select detail,person_id " + "from t_yl_order " + "<where>" + " <if test='areaId!= null'>" + "and area_id=#{areaId} " + " </if>" + "</where>" + "GROUP BY detail,person_id) t " + "GROUP BY detail ORDER BY num desc" + "</script>") List<Map<String,Object>> getTypeStatics(@Param("areaId") String areaId); } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/OrgFuwuMapper.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.cetc54.platform.zhyl.entity.OrgFuwu; import org.apache.ibatis.annotations.Select; import java.util.List; @@ -11,4 +12,5 @@ */ public interface OrgFuwuMapper extends BaseMapper<OrgFuwu> { } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java
@@ -27,7 +27,7 @@ " </where>" + " GROUP BY duixiang_id"+ " </script>") Integer getTotalNum(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); List<Integer> getTotalNum(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); /** * 获取总金额 @@ -45,7 +45,6 @@ " and type = #{type}" + " </if>" + " </where>" + " GROUP BY duixiang_id"+ " </script>") Double getTotalMoney(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); @@ -96,6 +95,7 @@ " </script>") List<Map<String,Object>> getYearTotal(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); /** *统计每种补贴的金额数 * @param areaId @@ -109,24 +109,26 @@ " and area_id = #{areaId}" + " </if>" + " </where>" + " GROUP BY type ORDER BY money desc"+ " GROUP BY type ORDER BY sum desc"+ " </script>") List<Map<String,Object>> getTypeMoney(@Param(value = "areaId")String areaId); /** * 每种补贴的次数 * 每种补贴的人数 * @param areaId * @return */ @Select("<script>" + " select type," + "conunt(id) as num FROM t_yl_subsidy_log" + "select type,count(duixiang_id) as num from (" + " select type,duixiang_id" + " FROM t_yl_subsidy_log" + " <where> " + " <if test='areaId!= null'>" + " and area_id = #{areaId}" + " </if>" + " </where>" + " GROUP BY type ORDER BY num desc"+ " GROUP BY type,duixiang_id) t GROUP BY type" + " ORDER BY num desc"+ " </script>") List<Map<String,Object>> getTypeNum(@Param(value = "areaId")String areaId); platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/IOrderService.java
@@ -10,5 +10,11 @@ * @author */ public interface IOrderService extends IService<Order> { /** * 获取某个区域的服务项目的个数 * @param areaId * @return */ List getTypeStatics(String areaId); } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/ISubsidyLogService.java
@@ -2,8 +2,6 @@ import com.baomidou.mybatisplus.extension.service.IService; import cn.cetc54.platform.zhyl.entity.SubsidyLog; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -44,4 +42,17 @@ */ List<Map<String,Object>> getYearTotal(String areaId,Integer type); /** *统计每种补贴的金额数 * @param areaId * @return */ List<Map<String,Object>> getTypeMoney(String areaId); /** * 每种补贴的次数 * @param areaId * @return */ List<Map<String,Object>> getTypeNum(String areaId); } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/IOrderServiceImpl.java
@@ -23,4 +23,9 @@ @Autowired private OrderMapper orderMapper; @Override public List getTypeStatics(String areaId) { return orderMapper.getTypeStatics(areaId); } } platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/ISubsidyLogServiceImpl.java
@@ -27,7 +27,7 @@ @Override public int getTotalNum(String areaId,Integer type) { Integer num = subsidyLogMapper.getTotalNum(areaId,type); Integer num = subsidyLogMapper.getTotalNum(areaId,type).size(); return num==null?0:num; } @@ -46,4 +46,14 @@ public List<Map<String, Object>> getYearTotal(String areaId, Integer type) { return subsidyLogMapper.getYearTotal(areaId,type); } @Override public List<Map<String, Object>> getTypeMoney(String areaId) { return subsidyLogMapper.getTypeMoney(areaId); } @Override public List<Map<String, Object>> getTypeNum(String areaId) { return subsidyLogMapper.getTypeNum(areaId); } }