New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.vaccines.VaccinesEnrollByAppDTO; |
| | | import com.panzhihua.common.model.dtos.vaccines.VaccinesEnrollUserByAppDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.vaccines.VaccinesByAppVO; |
| | | import com.panzhihua.common.model.vos.vaccines.VaccinesEnrollUserByAppVO; |
| | | import com.panzhihua.common.model.vos.vaccines.VaccinesUserInoculationByAppVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @auther lyq |
| | | * @create 2021-05-19 14:25:49 |
| | | * @describe 疫苗服务API |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/vaccines/") |
| | | @Api(tags = {"疫苗服务"}) |
| | | public class VaccinesApi extends BaseController { |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "疫苗分类列表", response = VaccinesByAppVO.class) |
| | | @PostMapping("list") |
| | | public R getVaccinesListByApp() { |
| | | return communityService.getVaccinesListByApp(); |
| | | } |
| | | |
| | | @ApiOperation(value = "疫苗类型对应家庭成员接种列表", response = VaccinesEnrollUserByAppVO.class) |
| | | @PostMapping("user/list") |
| | | public R getVaccinesUserListByApp(@RequestBody VaccinesEnrollUserByAppDTO enrollUserByAppDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | if (loginUserInfo == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | enrollUserByAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | return communityService.getVaccinesUserListByApp(enrollUserByAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户疫苗报名") |
| | | @PostMapping("enroll") |
| | | public R VaccinesEnrollByApp(@RequestBody VaccinesEnrollByAppDTO enrollByAppDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | if (loginUserInfo == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | enrollByAppDTO.setUserId(loginUserInfo.getUserId()); |
| | | enrollByAppDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | return communityService.VaccinesEnrollByApp(enrollByAppDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户家庭接种记录", response = VaccinesUserInoculationByAppVO.class) |
| | | @PostMapping("user/inoculation/list") |
| | | public R getVaccinesUserInoculationListByApp() { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | if (loginUserInfo == null) { |
| | | return R.fail("请先登录"); |
| | | } |
| | | return communityService.getVaccinesUserInoculationListByApp(loginUserInfo.getUserId()); |
| | | } |
| | | |
| | | } |