| | |
| | | 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 |
| | |
| | | @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); |
| | | } |
| | | |
| | | |
| | | } |