Authored by fangyeqing

ADD:add report list interface

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="NewPersistenceUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.url" value=""/>
<property name="hibernate.connection.driver_class" value=""/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
... ...
... ... @@ -40,12 +40,12 @@ public class SignAspect {
* @return
*/
private String getKeyByType(int type){
int id = 0;
long id = 0;
if(type == 1)
id = 1;
else
id = 2;
return xklInterKeyRespository.findById(id).getKey();
return xklInterKeyRespository.findOne(id).getKey();
}
/**
* 定义切点,定位到@Sign注解的地方
... ...
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);
}
}
... ...
... ... @@ -39,6 +39,7 @@ public class UserInfoController {
@Autowired
private XklMemberRespository xklMemberRespository;
@AntiXSS
//@Sign
@RequestMapping(method = RequestMethod.POST)
... ... @@ -56,7 +57,9 @@ public class UserInfoController {
String pass=SecurityTool.getPassword(username,password,salt);
user = new User();
/**
* TODO:暂时都为1
* TODO:
* 1. sign检测注解@Sign先注释掉 ,便于测试
* 2. 暂时把所有注册的用户的member表member_id都设置为1
*/
user.setMember_id(1);
user.setUsername(username);
... ... @@ -91,6 +94,7 @@ public class UserInfoController {
@RequestMapping(method = RequestMethod.GET)
@Authorization
//@Sign
@ApiOperation(value = "个人信息查询接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
... ...
package com.xkl.domain;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* Created by win7 on 2016/11/20.
*/
@Data
@Entity
@Table(name = "xkl_amp_report", schema = "hanhe_test", catalog = "")
public class XklAmpReportEntity {
@Id
@Column(name = "id")
private long id;
@Basic
@Column(name = "member_id")
private long memberId;
@Basic
@Column(name = "name")
private String name;
@Basic
@Column(name = "title")
private String title;
@Basic
@Column(name = "check_time")
private String checkTime;
@Basic
@Column(name = "uptime")
private String uptime;
@Basic
@Column(name = "account_str")
private String accountStr;
@Basic
@Column(name = "sex")
private Byte sex;
@Basic
@Column(name = "age")
private Byte age;
@Basic
@Column(name = "weight")
private long weight;
@Basic
@Column(name = "pulse")
private long pulse;
@Basic
@Column(name = "breath_rate")
private long breathRate;
@Basic
@Column(name = "atmos_pressure")
private Double atmosPressure;
@Basic
@Column(name = "LCA")
private Double lca;
@Basic
@Column(name = "RCA")
private Double rca;
@Basic
@Column(name = "LAC")
private Double lac;
@Basic
@Column(name = "RAC")
private Double rac;
@Basic
@Column(name = "ABD")
private Double abd;
@Basic
@Column(name = "temp_sum")
private Double tempSum;
@Basic
@Column(name = "stable")
private long stable;
@Basic
@Column(name = "md5")
private String md5;
@Basic
@Column(name = "create_by")
private long createBy;
@Basic
@Column(name = "machine_num")
private String machineNum;
@Basic
@Column(name = "T0")
private String t0;
@Basic
@Column(name = "T1")
private String t1;
@Basic
@Column(name = "T2")
private String t2;
@Basic
@Column(name = "T3")
private String t3;
@Basic
@Column(name = "T4")
private String t4;
@Basic
@Column(name = "conclusion")
private String conclusion;
@Basic
@Column(name = "score")
private Double score;
@Basic
@Column(name = "company_id")
private long companyId;
@Basic
@Column(name = "status")
private Byte status;
}
... ...
... ... @@ -13,7 +13,7 @@ import javax.persistence.*;
public class XklInterKeyEntity {
@Id
@Column(name = "id")
private int id;
private long id;
@Basic
@Column(name = "key")
private String key;
... ... @@ -25,5 +25,5 @@ public class XklInterKeyEntity {
private String note;
@Basic
@Column(name = "company_id")
private int companyId;
private long companyId;
}
... ...
... ... @@ -36,19 +36,19 @@ public class XklMemberEntity {
private String registerTime;
@Basic
@Column(name = "company_id")
private int companyId;
private long companyId;
@Basic
@Column(name = "province")
private int province;
private long province;
@Basic
@Column(name = "city")
private int city;
private long city;
@Basic
@Column(name = "country")
private int country;
private long country;
@Basic
@Column(name = "register_by")
private int registerBy;
private long registerBy;
@Basic
@Column(name = "status")
private Byte status;
... ...
package com.xkl.repository;
import com.xkl.domain.User;
import com.xkl.domain.XklAmpReportEntity;
import com.xkl.domain.XklMemberEntity;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
/**
* Created by win7 on 2016/11/20.
*/
public interface XklAmpReportRespository extends CrudRepository<XklAmpReportEntity, Long> {
//member_id
public List<XklAmpReportEntity> findByMemberId(long member_id);
}
... ...
... ... @@ -8,5 +8,5 @@ import org.springframework.data.repository.CrudRepository;
* Created by win7 on 2016/11/20.
*/
public interface XklInterKeyRespository extends CrudRepository<XklInterKeyEntity, Long> {
public XklInterKeyEntity findById(int companyId);
}
... ...