ReportController.java 1.93 KB
package com.xkl.controller;

import com.wordnik.swagger.annotations.ApiImplicitParam;
import com.wordnik.swagger.annotations.ApiImplicitParams;
import com.wordnik.swagger.annotations.ApiOperation;
import com.xkl.authorization.annotation.Authorization;
import com.xkl.authorization.annotation.CurrentUser;
import com.xkl.domain.User;
import com.xkl.domain.XklAmpReportEntity;
import com.xkl.domain.XklMemberEntity;
import com.xkl.model.ResultModel;
import com.xkl.repository.XklAmpReportRespository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by win7 on 2016/11/20.
 */
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private XklAmpReportRespository xklAmpReportRespository;

    @RequestMapping(method = RequestMethod.GET)
    @Authorization
    //@Sign
    @ApiOperation(value = "体检报告列表查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
    })
    public ResponseEntity<ResultModel> getUserInfo(HttpServletRequest request, @CurrentUser User user,
                                                   @RequestParam String sign, @RequestParam long t, @RequestParam int type) {
        long member_id=user.getMember_id();
        List<XklAmpReportEntity> xklAmpReportEntity=xklAmpReportRespository.findByMemberId(member_id);
        return new ResponseEntity<>(ResultModel.ok(xklAmpReportEntity), HttpStatus.OK);
    }
}