Add report pase, save and delete. Add upsoft version, account.
Showing
19 changed files
with
513 additions
and
101 deletions
@@ -19,4 +19,13 @@ public class Constants { | @@ -19,4 +19,13 @@ public class Constants { | ||
19 | * 存放Authorization的header字段 | 19 | * 存放Authorization的header字段 |
20 | */ | 20 | */ |
21 | public static final String AUTHORIZATION = "authorization"; | 21 | public static final String AUTHORIZATION = "authorization"; |
22 | + | ||
23 | + public static final int MALE = 0; | ||
24 | + public static final int FEMALE = 1; | ||
25 | + | ||
26 | + public static final int NORMAL = 0; | ||
27 | + public static final int LOWER = 1; | ||
28 | + public static final int HIGHER = 2; | ||
29 | + | ||
30 | + | ||
22 | } | 31 | } |
@@ -14,7 +14,16 @@ public enum ResultStatus { | @@ -14,7 +14,16 @@ public enum ResultStatus { | ||
14 | 14 | ||
15 | // 111开头的都是与amp报告上传软件相关的 | 15 | // 111开头的都是与amp报告上传软件相关的 |
16 | AMP_KEY_ERROR(-11100, "AMP密钥不匹配"), | 16 | AMP_KEY_ERROR(-11100, "AMP密钥不匹配"), |
17 | - REPORT_FORMAT_ERROR(-11140,"报告格式错误"); | 17 | + REPORT_FORMAT_ERROR(-11140,"报告格式错误"), |
18 | + REPORT_EXISTED_ERROR(-11141,"报告重复上传"), | ||
19 | + REPORT_INVALID__ERROR(-11142,"报告在数据库中不存在"), | ||
20 | + | ||
21 | + INVALID_USER_ERROR(-11150,"报告所属用户未注册"), | ||
22 | + INVALID_ADMIN_RPDEL_ERROR(-11151,"报告非此操作员创建,无权删除!"), | ||
23 | + | ||
24 | + DB_ERROR(-11160,"服务器错误,无法写入数据库"); | ||
25 | + | ||
26 | + | ||
18 | 27 | ||
19 | /** | 28 | /** |
20 | * 返回码 | 29 | * 返回码 |
@@ -40,15 +40,17 @@ public class TokenController { | @@ -40,15 +40,17 @@ public class TokenController { | ||
40 | Assert.notNull(username, "username can not be empty"); | 40 | Assert.notNull(username, "username can not be empty"); |
41 | Assert.notNull(password, "password can not be empty"); | 41 | Assert.notNull(password, "password can not be empty"); |
42 | 42 | ||
43 | - User user = userRepository.findByUsername(username); | 43 | + User user = userRepository.findByLoginAccount(username); |
44 | 44 | ||
45 | - if (user == null){ //用户不存在 | 45 | + if (user == null) { //用户不存在 |
46 | return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND); | 46 | return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND); |
47 | - }else{ | 47 | + } else { |
48 | String salt = user.getSalt(); | 48 | String salt = user.getSalt(); |
49 | - String pass_in_db= user.getPassword(); | ||
50 | - String pass=SecurityTool.getPassword(username,password,salt); | ||
51 | - if(!pass.equals(pass_in_db)) | 49 | + String pass_in_db = user.getLoginPwd(); |
50 | + String pass = SecurityTool.getPassword(username, password, salt); | ||
51 | + if (!pass.equals(pass_in_db)) | ||
52 | + // TODO: 2016/11/26 use pwd with salt | ||
53 | + // if(!password.equals(pass_in_db)) // for test | ||
52 | return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND); | 54 | return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR), HttpStatus.NOT_FOUND); |
53 | } | 55 | } |
54 | //生成一个token,保存用户登录状态 | 56 | //生成一个token,保存用户登录状态 |
@@ -39,18 +39,18 @@ public class UserInfoController { | @@ -39,18 +39,18 @@ public class UserInfoController { | ||
39 | Assert.notNull(username, "username can not be empty"); | 39 | Assert.notNull(username, "username can not be empty"); |
40 | Assert.notNull(password, "password can not be empty"); | 40 | Assert.notNull(password, "password can not be empty"); |
41 | 41 | ||
42 | - User user = userRepository.findByUsername(username); | 42 | + User user = userRepository.findByLoginAccount(username); |
43 | if (user != null ) { //用户已注册 | 43 | if (user != null ) { //用户已注册 |
44 | return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_IS_EXIT), HttpStatus.NOT_FOUND); | 44 | return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_IS_EXIT), HttpStatus.NOT_FOUND); |
45 | }else{ | 45 | }else{ |
46 | String salt= SecurityTool.genSalt(); | 46 | String salt= SecurityTool.genSalt(); |
47 | String pass=SecurityTool.getPassword(username,password,salt); | 47 | String pass=SecurityTool.getPassword(username,password,salt); |
48 | user = new User(); | 48 | user = new User(); |
49 | - user.setMember_id("aaa"); | ||
50 | - user.setUsername(username); | ||
51 | - user.setPassword(pass); | 49 | + user.setMemberId(2); |
50 | + user.setLoginAccount(username); | ||
51 | + user.setLoginPwd(pass); | ||
52 | user.setSalt(salt); | 52 | user.setSalt(salt); |
53 | - user.setState(true); | 53 | + user.setStatus(true); |
54 | userRepository.save(user); | 54 | userRepository.save(user); |
55 | } | 55 | } |
56 | return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); | 56 | return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); |
@@ -66,8 +66,8 @@ public class UserInfoController { | @@ -66,8 +66,8 @@ public class UserInfoController { | ||
66 | public ResponseEntity<ResultModel> modPassword(@CurrentUser User user,@RequestParam String password) { | 66 | public ResponseEntity<ResultModel> modPassword(@CurrentUser User user,@RequestParam String password) { |
67 | Assert.notNull(password, "password can not be empty"); | 67 | Assert.notNull(password, "password can not be empty"); |
68 | String salt= SecurityTool.genSalt(); | 68 | String salt= SecurityTool.genSalt(); |
69 | - String pass=SecurityTool.getPassword(user.getUsername(),password,salt); | ||
70 | - user.setPassword(pass); | 69 | + String pass=SecurityTool.getPassword(user.getLoginAccount(),password,salt); |
70 | + user.setLoginPwd(pass); | ||
71 | user.setSalt(salt); | 71 | user.setSalt(salt); |
72 | userRepository.save(user); | 72 | userRepository.save(user); |
73 | tokenManager.deleteToken(user.getId());//退出登录 | 73 | tokenManager.deleteToken(user.getId());//退出登录 |
@@ -81,7 +81,7 @@ public class UserInfoController { | @@ -81,7 +81,7 @@ public class UserInfoController { | ||
81 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | 81 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), |
82 | }) | 82 | }) |
83 | public ResponseEntity<ResultModel> getUserNickName(@CurrentUser User user) { | 83 | public ResponseEntity<ResultModel> getUserNickName(@CurrentUser User user) { |
84 | - String dickName=user.getMember_id(); | 84 | + String dickName=user.getLoginAccount(); |
85 | return new ResponseEntity<>(ResultModel.ok(dickName), HttpStatus.OK); | 85 | return new ResponseEntity<>(ResultModel.ok(dickName), HttpStatus.OK); |
86 | } | 86 | } |
87 | 87 |
@@ -5,19 +5,27 @@ import com.wordnik.swagger.annotations.ApiImplicitParams; | @@ -5,19 +5,27 @@ import com.wordnik.swagger.annotations.ApiImplicitParams; | ||
5 | import com.wordnik.swagger.annotations.ApiOperation; | 5 | import com.wordnik.swagger.annotations.ApiOperation; |
6 | import com.xkl.authorization.annotation.Authorization; | 6 | import com.xkl.authorization.annotation.Authorization; |
7 | import com.xkl.authorization.annotation.CurrentAdmin; | 7 | import com.xkl.authorization.annotation.CurrentAdmin; |
8 | -import com.xkl.domain.Admin; | 8 | +import com.xkl.config.Constants; |
9 | +import com.xkl.config.ResultStatus; | ||
10 | +import com.xkl.domain.*; | ||
11 | +import com.xkl.model.ReportIdModel; | ||
9 | import com.xkl.model.ResultModel; | 12 | import com.xkl.model.ResultModel; |
10 | -import com.xkl.repository.UpSoftVersionRepository; | 13 | +import com.xkl.repository.*; |
14 | +import com.xkl.security.AntiXSS; | ||
15 | +import com.xkl.security.SecurityTool; | ||
16 | +import com.xkl.service.IReportService; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
18 | +import org.springframework.data.redis.core.RedisTemplate; | ||
12 | import org.springframework.http.HttpStatus; | 19 | import org.springframework.http.HttpStatus; |
13 | import org.springframework.http.ResponseEntity; | 20 | import org.springframework.http.ResponseEntity; |
14 | import org.springframework.web.bind.annotation.RequestMapping; | 21 | import org.springframework.web.bind.annotation.RequestMapping; |
15 | import org.springframework.web.bind.annotation.RequestMethod; | 22 | import org.springframework.web.bind.annotation.RequestMethod; |
16 | import org.springframework.web.bind.annotation.RequestParam; | 23 | import org.springframework.web.bind.annotation.RequestParam; |
17 | import org.springframework.web.bind.annotation.RestController; | 24 | import org.springframework.web.bind.annotation.RestController; |
18 | -import com.alibaba.fastjson.*; | 25 | + |
19 | import java.util.List; | 26 | import java.util.List; |
20 | 27 | ||
28 | + | ||
21 | /** | 29 | /** |
22 | * 上传报告及删除报告接口。 | 30 | * 上传报告及删除报告接口。 |
23 | */ | 31 | */ |
@@ -28,26 +36,118 @@ public class ReportController { | @@ -28,26 +36,118 @@ public class ReportController { | ||
28 | @Autowired | 36 | @Autowired |
29 | private UpSoftVersionRepository upSoftVersionRepository; | 37 | private UpSoftVersionRepository upSoftVersionRepository; |
30 | 38 | ||
39 | + @Autowired | ||
40 | + private IReportService reportService; | ||
41 | + | ||
42 | + @Autowired | ||
43 | + private ReportRepository reportRepository; | ||
44 | + | ||
45 | + @Autowired | ||
46 | + private ReportDetailRepository reportDetailRepository; | ||
47 | + | ||
48 | + // 存储报告相关md5,防止重复上传已存在报告,防止重复上传错误报告。 | ||
49 | + private RedisTemplate<String, String> redis; | ||
50 | + | ||
51 | + @Autowired | ||
52 | + public void setRedis(RedisTemplate redis) { | ||
53 | + this.redis = redis; | ||
54 | + } | ||
55 | + | ||
56 | + @Autowired | ||
57 | + private UserRepository userRepository; | ||
58 | + | ||
59 | + @Autowired | ||
60 | + private AdminRepository adminRepository; | ||
61 | + | ||
31 | @RequestMapping(method = RequestMethod.POST) | 62 | @RequestMapping(method = RequestMethod.POST) |
63 | + @AntiXSS | ||
32 | @Authorization | 64 | @Authorization |
33 | - @ApiOperation(value = "上传报告") | 65 | + @ApiOperation(value = "上传并存储报告") |
34 | @ApiImplicitParams({ | 66 | @ApiImplicitParams({ |
35 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | 67 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), |
36 | }) | 68 | }) |
37 | public ResponseEntity<ResultModel> save(@CurrentAdmin Admin admin, @RequestParam String json_report) { | 69 | public ResponseEntity<ResultModel> save(@CurrentAdmin Admin admin, @RequestParam String json_report) { |
70 | + // 验证存在性 | ||
71 | + String reportMd5 = SecurityTool.encode("MD5", json_report); | ||
72 | + // 验证是否有对应的会员 | ||
73 | + String reportWithNoUser = reportMd5 + "Member"; | ||
74 | + // 验证报告格式是否有问题 | ||
75 | + String reportWrongFormat = reportMd5 + "Format"; | ||
76 | + /* | ||
77 | + * 如果已经处理过的报告,不再进行处理。 | ||
78 | + */ | ||
79 | + AMPReport report = reportRepository.findByMd5(reportMd5); | ||
80 | + if (report != null && report.getStatus() > 0) { | ||
81 | + // 返回,报告已存在。 | ||
82 | + return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(report.getId())), HttpStatus.OK); | ||
83 | + } else if (redis.hasKey(reportWithNoUser)) { | ||
84 | + // 返回,报告对应会员不存在。 | ||
85 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.NOT_FOUND); | ||
86 | + } else if (redis.hasKey(reportWrongFormat)) { | ||
87 | + // 返回,报告格式有问题。 | ||
88 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.NOT_FOUND); | ||
89 | + } | ||
90 | + /* | ||
91 | + * 解析报告数据 | ||
92 | + */ | ||
93 | + ReportData reportData = reportService.parseReport(json_report, reportMd5); | ||
94 | + /* | ||
95 | + * 检验报告格式 | ||
96 | + */ | ||
97 | + if (reportData == null) { | ||
98 | + redis.boundValueOps(reportWrongFormat).set(""); | ||
99 | + // 返回,报告格式有问题。 | ||
100 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.NOT_FOUND); | ||
101 | + } | ||
102 | + /* | ||
103 | + * 检验会员存在性 | ||
104 | + */ | ||
105 | + User user = userRepository.findByLoginAccount(reportData.getAmpReport().getAccount_str()); | ||
106 | + if (user == null) { | ||
107 | + redis.boundValueOps(reportWithNoUser).set(""); | ||
108 | + // 返回,报告对应会员不存在。 | ||
109 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.NOT_FOUND); | ||
110 | + } | ||
38 | 111 | ||
39 | - return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); | 112 | + /* |
113 | + * 存储报告 | ||
114 | + */ | ||
115 | + int reportId = reportService.saveReport(reportData, admin, user); | ||
116 | + if (reportId > 0) { | ||
117 | + // 返回,报告存储成功,报告id | ||
118 | + return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK); | ||
119 | + } else { | ||
120 | + // 返回,服务器存储问题。 | ||
121 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR), HttpStatus.NOT_FOUND); | ||
122 | + } | ||
40 | } | 123 | } |
41 | 124 | ||
42 | @RequestMapping(method = RequestMethod.DELETE) | 125 | @RequestMapping(method = RequestMethod.DELETE) |
126 | + @AntiXSS | ||
43 | @Authorization | 127 | @Authorization |
44 | @ApiOperation(value = "删除报告") | 128 | @ApiOperation(value = "删除报告") |
45 | @ApiImplicitParams({ | 129 | @ApiImplicitParams({ |
46 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), | 130 | @ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"), |
47 | }) | 131 | }) |
48 | - public ResponseEntity<ResultModel> delete(@CurrentAdmin Admin admin, @RequestParam int report_id) { | 132 | + public ResponseEntity<ResultModel> delete(@CurrentAdmin Admin admin, @RequestParam long report_id) { |
133 | + // 1. 得到report,验证报告存在性 | ||
134 | + AMPReport report = reportRepository.findById((int) report_id); | ||
135 | + if (report == null) { | ||
136 | + // 报告不存在,返回 | ||
137 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_INVALID__ERROR), HttpStatus.NOT_FOUND); | ||
138 | + } | ||
49 | 139 | ||
140 | + // 2. 验证admin | ||
141 | + if (report.getCreate_by() != admin.getId()) { | ||
142 | + // 非此admin创建,不能删除,返回 | ||
143 | + return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.NOT_FOUND); | ||
144 | + } | ||
145 | + // 3. 删除report和detail,返回ok | ||
146 | + reportRepository.delete(report); | ||
147 | + List<AMPReportDetail> detailList = reportDetailRepository.findByReportId(report.getId()); | ||
148 | + reportDetailRepository.delete(detailList); | ||
50 | return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); | 149 | return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK); |
150 | + | ||
51 | } | 151 | } |
52 | 152 | ||
53 | } | 153 | } |
@@ -21,7 +21,7 @@ import java.util.List; | @@ -21,7 +21,7 @@ import java.util.List; | ||
21 | * AMP报告上传软件客户端获取最新软件版本。 | 21 | * AMP报告上传软件客户端获取最新软件版本。 |
22 | */ | 22 | */ |
23 | @RestController | 23 | @RestController |
24 | -@RequestMapping("/version") | 24 | +@RequestMapping("/upsoftversion") |
25 | public class SoftVersionController { | 25 | public class SoftVersionController { |
26 | 26 | ||
27 | @Autowired | 27 | @Autowired |
@@ -29,7 +29,7 @@ public class SoftVersionController { | @@ -29,7 +29,7 @@ public class SoftVersionController { | ||
29 | 29 | ||
30 | 30 | ||
31 | @RequestMapping(method = RequestMethod.GET) | 31 | @RequestMapping(method = RequestMethod.GET) |
32 | - @ApiOperation(value = "获取最新软件版本信息") | 32 | + @ApiOperation(value = "获取最新软件版本信息,返回值中,version_num为版本号") |
33 | public ResponseEntity<ResultModel> getVersionInfo() { | 33 | public ResponseEntity<ResultModel> getVersionInfo() { |
34 | List<UpSoftVersion> versionList = upSoftVersionRepository.findAllVersion(); | 34 | List<UpSoftVersion> versionList = upSoftVersionRepository.findAllVersion(); |
35 | UpSoftVersion version = versionList.get(versionList.size() - 1); | 35 | UpSoftVersion version = versionList.get(versionList.size() - 1); |
@@ -28,8 +28,8 @@ import org.springframework.web.bind.annotation.RestController; | @@ -28,8 +28,8 @@ import org.springframework.web.bind.annotation.RestController; | ||
28 | * 获取和删除token的请求地址,在Restful设计中其实就对应着登录和退出登录的资源映射 | 28 | * 获取和删除token的请求地址,在Restful设计中其实就对应着登录和退出登录的资源映射 |
29 | */ | 29 | */ |
30 | @RestController | 30 | @RestController |
31 | -@RequestMapping("/uploadsoftwareaccount") | ||
32 | -public class UploadSoftwareAccountController { | 31 | +@RequestMapping("/upsoftaccount") |
32 | +public class UpSoftAccountController { | ||
33 | 33 | ||
34 | @Autowired | 34 | @Autowired |
35 | private AdminRepository adminRepository; | 35 | private AdminRepository adminRepository; |
@@ -2,10 +2,7 @@ package com.xkl.domain; | @@ -2,10 +2,7 @@ package com.xkl.domain; | ||
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | -import javax.persistence.Column; | ||
6 | -import javax.persistence.Entity; | ||
7 | -import javax.persistence.Id; | ||
8 | -import javax.persistence.Table; | 5 | +import javax.persistence.*; |
9 | import java.sql.Timestamp; | 6 | import java.sql.Timestamp; |
10 | 7 | ||
11 | /** | 8 | /** |
@@ -18,6 +15,7 @@ public class AMPReport { | @@ -18,6 +15,7 @@ public class AMPReport { | ||
18 | //用户id | 15 | //用户id |
19 | @Id | 16 | @Id |
20 | @Column(name = "id") | 17 | @Column(name = "id") |
18 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
21 | private int id; | 19 | private int id; |
22 | 20 | ||
23 | @Column(name = "member_id") | 21 | @Column(name = "member_id") |
@@ -108,7 +106,7 @@ public class AMPReport { | @@ -108,7 +106,7 @@ public class AMPReport { | ||
108 | private float score; | 106 | private float score; |
109 | // 所属公司id | 107 | // 所属公司id |
110 | @Column(name = "company_id") | 108 | @Column(name = "company_id") |
111 | - private String company_id; | 109 | + private int company_id; |
112 | // 报告状态 0,失效;1有效。 | 110 | // 报告状态 0,失效;1有效。 |
113 | @Column(name = "status") | 111 | @Column(name = "status") |
114 | private int status; | 112 | private int status; |
@@ -117,7 +115,7 @@ public class AMPReport { | @@ -117,7 +115,7 @@ public class AMPReport { | ||
117 | Timestamp uptime, String account_str, int sex, int age, | 115 | Timestamp uptime, String account_str, int sex, int age, |
118 | int weight, int pulse, int breath_rate, float atmos_pressure, | 116 | int weight, int pulse, int breath_rate, float atmos_pressure, |
119 | float LCA, float RCA, float LAC, float RAC, float ABD, float temp_sum, | 117 | float LCA, float RCA, float LAC, float RAC, float ABD, float temp_sum, |
120 | - int stable, String md5, String conclusion) { | 118 | + int stable, String md5,String machine_num, String conclusion) { |
121 | this.name = name; | 119 | this.name = name; |
122 | this.title = title; | 120 | this.title = title; |
123 | this.check_time = check_time; | 121 | this.check_time = check_time; |
@@ -137,7 +135,9 @@ public class AMPReport { | @@ -137,7 +135,9 @@ public class AMPReport { | ||
137 | this.temp_sum = temp_sum; | 135 | this.temp_sum = temp_sum; |
138 | this.stable = stable; | 136 | this.stable = stable; |
139 | this.md5 = md5; | 137 | this.md5 = md5; |
138 | + this.machine_num = machine_num; | ||
140 | this.conclusion = conclusion; | 139 | this.conclusion = conclusion; |
140 | + this.status = 1; //默认为有效。 | ||
141 | } | 141 | } |
142 | 142 | ||
143 | public int getId() { | 143 | public int getId() { |
@@ -380,11 +380,12 @@ public class AMPReport { | @@ -380,11 +380,12 @@ public class AMPReport { | ||
380 | this.score = score; | 380 | this.score = score; |
381 | } | 381 | } |
382 | 382 | ||
383 | - public String getCompany_id() { | 383 | + |
384 | + public int getCompany_id() { | ||
384 | return company_id; | 385 | return company_id; |
385 | } | 386 | } |
386 | 387 | ||
387 | - public void setCompany_id(String company_id) { | 388 | + public void setCompany_id(int company_id) { |
388 | this.company_id = company_id; | 389 | this.company_id = company_id; |
389 | } | 390 | } |
390 | 391 |
1 | package com.xkl.domain; | 1 | package com.xkl.domain; |
2 | 2 | ||
3 | -import javax.persistence.Column; | ||
4 | -import javax.persistence.Entity; | ||
5 | -import javax.persistence.Id; | ||
6 | -import javax.persistence.Table; | 3 | +import org.hibernate.annotations.Cascade; |
4 | + | ||
5 | +import javax.persistence.*; | ||
7 | 6 | ||
8 | /** | 7 | /** |
9 | * 用户数据的domain类 | 8 | * 用户数据的domain类 |
@@ -15,19 +14,20 @@ public class AMPReportDetail { | @@ -15,19 +14,20 @@ public class AMPReportDetail { | ||
15 | //自增id | 14 | //自增id |
16 | @Id | 15 | @Id |
17 | @Column(name = "id") | 16 | @Column(name = "id") |
17 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
18 | private long id; | 18 | private long id; |
19 | 19 | ||
20 | // 报告id | 20 | // 报告id |
21 | @Column(name = "report_id") | 21 | @Column(name = "report_id") |
22 | - private int report_id; | 22 | + private int reportId; |
23 | 23 | ||
24 | // 指标id | 24 | // 指标id |
25 | @Column(name = "item_id") | 25 | @Column(name = "item_id") |
26 | - private int item_id; | 26 | + private int itemId; |
27 | 27 | ||
28 | // 指标值 | 28 | // 指标值 |
29 | @Column(name = "item_value") | 29 | @Column(name = "item_value") |
30 | - private float item_value; | 30 | + private float itemValue; |
31 | 31 | ||
32 | 32 | ||
33 | // 0, normal; 1, lower; 2, higher. | 33 | // 0, normal; 1, lower; 2, higher. |
@@ -42,28 +42,28 @@ public class AMPReportDetail { | @@ -42,28 +42,28 @@ public class AMPReportDetail { | ||
42 | this.id = id; | 42 | this.id = id; |
43 | } | 43 | } |
44 | 44 | ||
45 | - public int getReport_id() { | ||
46 | - return report_id; | 45 | + public int getReportId() { |
46 | + return reportId; | ||
47 | } | 47 | } |
48 | 48 | ||
49 | - public void setReport_id(int report_id) { | ||
50 | - this.report_id = report_id; | 49 | + public void setReportId(int reportId) { |
50 | + this.reportId = reportId; | ||
51 | } | 51 | } |
52 | 52 | ||
53 | - public int getItem_id() { | ||
54 | - return item_id; | 53 | + public int getItemId() { |
54 | + return itemId; | ||
55 | } | 55 | } |
56 | 56 | ||
57 | - public void setItem_id(int item_id) { | ||
58 | - this.item_id = item_id; | 57 | + public void setItemId(int itemId) { |
58 | + this.itemId = itemId; | ||
59 | } | 59 | } |
60 | 60 | ||
61 | - public float getItem_value() { | ||
62 | - return item_value; | 61 | + public float getItemValue() { |
62 | + return itemValue; | ||
63 | } | 63 | } |
64 | 64 | ||
65 | - public void setItem_value(float item_value) { | ||
66 | - this.item_value = item_value; | 65 | + public void setItemValue(float itemValue) { |
66 | + this.itemValue = itemValue; | ||
67 | } | 67 | } |
68 | 68 | ||
69 | public int getStatus() { | 69 | public int getStatus() { |
1 | +package com.xkl.domain; | ||
2 | + | ||
3 | +import javax.persistence.Column; | ||
4 | +import javax.persistence.Entity; | ||
5 | +import javax.persistence.Id; | ||
6 | +import javax.persistence.Table; | ||
7 | + | ||
8 | +/** | ||
9 | + * 指标数据标准的domain类 | ||
10 | + */ | ||
11 | +@Entity | ||
12 | +@Table(name = "xkl_amp_report_meta_items") | ||
13 | +public class ReportMetaItem { | ||
14 | + // id | ||
15 | + @Id | ||
16 | + @Column(name = "id") | ||
17 | + private long id; | ||
18 | + | ||
19 | + // item_id | ||
20 | + @Column(name = "item_id") | ||
21 | + private int item_id; | ||
22 | + | ||
23 | + // type | ||
24 | + @Column(name = "type") | ||
25 | + private String type; | ||
26 | + | ||
27 | + // title | ||
28 | + @Column(name = "title") | ||
29 | + private String title; | ||
30 | + | ||
31 | + // standard_low_male | ||
32 | + @Column(name = "standard_low_male") | ||
33 | + private float standard_low_male; | ||
34 | + | ||
35 | + // standard_high_male | ||
36 | + @Column(name = "standard_high_male") | ||
37 | + private float standard_high_male; | ||
38 | + | ||
39 | + // standard_low_female | ||
40 | + @Column(name = "standard_low_female") | ||
41 | + private float standard_low_female; | ||
42 | + | ||
43 | + // standard_high_female | ||
44 | + @Column(name = "standard_high_female") | ||
45 | + private float standard_high_female; | ||
46 | + | ||
47 | + // explain_low | ||
48 | + @Column(name = "explain_low") | ||
49 | + private String explain_low; | ||
50 | + | ||
51 | + // explain_high | ||
52 | + @Column(name = "explain_high") | ||
53 | + private String explain_high; | ||
54 | + | ||
55 | + // explain_normal | ||
56 | + @Column(name = "explain_normal") | ||
57 | + private String explain_normal; | ||
58 | + | ||
59 | + public long getId() { | ||
60 | + return id; | ||
61 | + } | ||
62 | + | ||
63 | + public void setId(long id) { | ||
64 | + this.id = id; | ||
65 | + } | ||
66 | + | ||
67 | + public int getItem_id() { | ||
68 | + return item_id; | ||
69 | + } | ||
70 | + | ||
71 | + public void setItem_id(int item_id) { | ||
72 | + this.item_id = item_id; | ||
73 | + } | ||
74 | + | ||
75 | + public String getType() { | ||
76 | + return type; | ||
77 | + } | ||
78 | + | ||
79 | + public void setType(String type) { | ||
80 | + this.type = type; | ||
81 | + } | ||
82 | + | ||
83 | + public String getTitle() { | ||
84 | + return title; | ||
85 | + } | ||
86 | + | ||
87 | + public void setTitle(String title) { | ||
88 | + this.title = title; | ||
89 | + } | ||
90 | + | ||
91 | + public float getStandard_low_male() { | ||
92 | + return standard_low_male; | ||
93 | + } | ||
94 | + | ||
95 | + public void setStandard_low_male(float standard_low_male) { | ||
96 | + this.standard_low_male = standard_low_male; | ||
97 | + } | ||
98 | + | ||
99 | + public float getStandard_high_male() { | ||
100 | + return standard_high_male; | ||
101 | + } | ||
102 | + | ||
103 | + public void setStandard_high_male(float standard_high_male) { | ||
104 | + this.standard_high_male = standard_high_male; | ||
105 | + } | ||
106 | + | ||
107 | + public float getStandard_low_female() { | ||
108 | + return standard_low_female; | ||
109 | + } | ||
110 | + | ||
111 | + public void setStandard_low_female(float standard_low_female) { | ||
112 | + this.standard_low_female = standard_low_female; | ||
113 | + } | ||
114 | + | ||
115 | + public float getStandard_high_female() { | ||
116 | + return standard_high_female; | ||
117 | + } | ||
118 | + | ||
119 | + public void setStandard_high_female(float standard_high_female) { | ||
120 | + this.standard_high_female = standard_high_female; | ||
121 | + } | ||
122 | + | ||
123 | + public String getExplain_low() { | ||
124 | + return explain_low; | ||
125 | + } | ||
126 | + | ||
127 | + public void setExplain_low(String explain_low) { | ||
128 | + this.explain_low = explain_low; | ||
129 | + } | ||
130 | + | ||
131 | + public String getExplain_high() { | ||
132 | + return explain_high; | ||
133 | + } | ||
134 | + | ||
135 | + public void setExplain_high(String explain_high) { | ||
136 | + this.explain_high = explain_high; | ||
137 | + } | ||
138 | + | ||
139 | + public String getExplain_normal() { | ||
140 | + return explain_normal; | ||
141 | + } | ||
142 | + | ||
143 | + public void setExplain_normal(String explain_normal) { | ||
144 | + this.explain_normal = explain_normal; | ||
145 | + } | ||
146 | +} |
@@ -16,11 +16,11 @@ import javax.persistence.Table; | @@ -16,11 +16,11 @@ import javax.persistence.Table; | ||
16 | public class User { | 16 | public class User { |
17 | //用户名 | 17 | //用户名 |
18 | @Column(name = "login_account") | 18 | @Column(name = "login_account") |
19 | - private String username; | 19 | + private String loginAccount; |
20 | 20 | ||
21 | //密码 | 21 | //密码 |
22 | @Column(name = "login_pwd") | 22 | @Column(name = "login_pwd") |
23 | - private String password; | 23 | + private String loginPwd; |
24 | 24 | ||
25 | //用户id | 25 | //用户id |
26 | @Id | 26 | @Id |
@@ -30,26 +30,26 @@ public class User { | @@ -30,26 +30,26 @@ public class User { | ||
30 | @Column(name = "salt") | 30 | @Column(name = "salt") |
31 | private String salt; | 31 | private String salt; |
32 | 32 | ||
33 | - @Column(name = "state") | ||
34 | - private boolean state; | 33 | + @Column(name = "status") |
34 | + private boolean status; | ||
35 | 35 | ||
36 | @Column(name = "member_id") | 36 | @Column(name = "member_id") |
37 | - private String member_id; | 37 | + private int memberId; |
38 | 38 | ||
39 | - public String getUsername() { | ||
40 | - return username; | 39 | + public String getLoginAccount() { |
40 | + return loginAccount; | ||
41 | } | 41 | } |
42 | 42 | ||
43 | - public void setUsername(String username) { | ||
44 | - this.username = username; | 43 | + public void setLoginAccount(String loginAccount) { |
44 | + this.loginAccount = loginAccount; | ||
45 | } | 45 | } |
46 | 46 | ||
47 | - public String getPassword() { | ||
48 | - return password; | 47 | + public String getLoginPwd() { |
48 | + return loginPwd; | ||
49 | } | 49 | } |
50 | 50 | ||
51 | - public void setPassword(String password) { | ||
52 | - this.password = password; | 51 | + public void setLoginPwd(String loginPwd) { |
52 | + this.loginPwd = loginPwd; | ||
53 | } | 53 | } |
54 | 54 | ||
55 | public long getId() { | 55 | public long getId() { |
@@ -68,19 +68,19 @@ public class User { | @@ -68,19 +68,19 @@ public class User { | ||
68 | this.salt = salt; | 68 | this.salt = salt; |
69 | } | 69 | } |
70 | 70 | ||
71 | - public boolean isState() { | ||
72 | - return state; | 71 | + public boolean isStatus() { |
72 | + return status; | ||
73 | } | 73 | } |
74 | 74 | ||
75 | - public void setState(boolean state) { | ||
76 | - this.state = state; | 75 | + public void setStatus(boolean status) { |
76 | + this.status = status; | ||
77 | } | 77 | } |
78 | 78 | ||
79 | - public String getMember_id() { | ||
80 | - return member_id; | 79 | + public int getMemberId() { |
80 | + return memberId; | ||
81 | } | 81 | } |
82 | 82 | ||
83 | - public void setMember_id(String member_id) { | ||
84 | - this.member_id = member_id; | 83 | + public void setMemberId(int memberId) { |
84 | + this.memberId = memberId; | ||
85 | } | 85 | } |
86 | } | 86 | } |
1 | +package com.xkl.model; | ||
2 | + | ||
3 | + | ||
4 | +public class ReportIdModel { | ||
5 | + | ||
6 | + // Report Id | ||
7 | + private int reportId; | ||
8 | + | ||
9 | + | ||
10 | + public ReportIdModel(int reportId) { | ||
11 | + this.reportId = reportId; | ||
12 | + } | ||
13 | + | ||
14 | + public int getReportId() { | ||
15 | + return reportId; | ||
16 | + } | ||
17 | + | ||
18 | + public void setReportId(int reportId) { | ||
19 | + this.reportId = reportId; | ||
20 | + } | ||
21 | +} |
1 | +package com.xkl.repository; | ||
2 | + | ||
3 | +import com.xkl.domain.AMPReport; | ||
4 | +import com.xkl.domain.AMPReportDetail; | ||
5 | +import org.springframework.data.repository.CrudRepository; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * AMPReportDetail类的CRUD操作 | ||
11 | + * | ||
12 | + * @see AMPReportDetail | ||
13 | + */ | ||
14 | +public interface ReportDetailRepository extends CrudRepository<AMPReportDetail, Long> { | ||
15 | + public List<AMPReportDetail> findByReportId(int reportId); | ||
16 | +} |
1 | +package com.xkl.repository; | ||
2 | + | ||
3 | +import com.xkl.domain.ReportMetaItem; | ||
4 | +import com.xkl.domain.User; | ||
5 | +import org.springframework.data.repository.CrudRepository; | ||
6 | + | ||
7 | +/** | ||
8 | + * ReportMetaItems类的CRUD操作 | ||
9 | + * @see User | ||
10 | + */ | ||
11 | +public interface ReportMetaItemsRepository extends CrudRepository<ReportMetaItem, Long> { | ||
12 | +} |
1 | +package com.xkl.repository; | ||
2 | + | ||
3 | +import com.xkl.domain.AMPReport; | ||
4 | +import com.xkl.domain.Admin; | ||
5 | +import org.springframework.data.repository.CrudRepository; | ||
6 | + | ||
7 | +/** | ||
8 | + * AMPReport类的CRUD操作 | ||
9 | + * | ||
10 | + * @see AMPReport | ||
11 | + */ | ||
12 | +public interface ReportRepository extends CrudRepository<AMPReport, Long> { | ||
13 | + public AMPReport findByMd5(String md5); | ||
14 | + | ||
15 | + public AMPReport findById(int id); | ||
16 | + | ||
17 | +} |
@@ -9,5 +9,5 @@ import org.springframework.data.repository.CrudRepository; | @@ -9,5 +9,5 @@ import org.springframework.data.repository.CrudRepository; | ||
9 | */ | 9 | */ |
10 | public interface UserRepository extends CrudRepository<User, Long> { | 10 | public interface UserRepository extends CrudRepository<User, Long> { |
11 | 11 | ||
12 | - public User findByUsername(String username); | 12 | + public User findByLoginAccount(String username); |
13 | } | 13 | } |
1 | +package com.xkl.service; | ||
2 | + | ||
3 | +import com.xkl.domain.Admin; | ||
4 | +import com.xkl.domain.ReportData; | ||
5 | +import com.xkl.domain.User; | ||
6 | + | ||
7 | +/** | ||
8 | + * Created by zhao yue on 2016/11/26. | ||
9 | + */ | ||
10 | +public interface IReportService { | ||
11 | + public ReportData parseReport(String reportJson, String md5); | ||
12 | + public int saveReport(ReportData report, Admin admin, User user); | ||
13 | + | ||
14 | +} |
1 | package com.xkl.service; | 1 | package com.xkl.service; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | -import com.xkl.domain.AMPReport; | ||
5 | -import com.xkl.domain.AMPReportDetail; | ||
6 | -import com.xkl.domain.ReportData; | 4 | +import com.xkl.config.Constants; |
5 | +import com.xkl.domain.*; | ||
6 | +import com.xkl.repository.ReportDetailRepository; | ||
7 | +import com.xkl.repository.ReportMetaItemsRepository; | ||
8 | +import com.xkl.repository.ReportRepository; | ||
9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
8 | 11 | ||
9 | import java.sql.Timestamp; | 12 | import java.sql.Timestamp; |
10 | -import java.util.ArrayList; | ||
11 | -import java.util.List; | 13 | +import java.util.*; |
12 | 14 | ||
13 | /** | 15 | /** |
14 | * Created by zhao yue on 2016/11/13. | 16 | * Created by zhao yue on 2016/11/13. |
15 | */ | 17 | */ |
16 | @Service | 18 | @Service |
17 | -public class ReportService { | 19 | +public class ReportService implements IReportService { |
20 | + @Autowired | ||
21 | + private ReportMetaItemsRepository reportMetaItemsRepository; | ||
22 | + @Autowired | ||
23 | + private ReportRepository reportRepository; | ||
24 | + | ||
25 | + @Autowired | ||
26 | + private ReportDetailRepository reportDetailRepository; | ||
27 | + | ||
28 | + private static Map<Integer, ReportMetaItem> rpMetaItemMap = new HashMap<Integer, ReportMetaItem>(); | ||
29 | + | ||
18 | /* | 30 | /* |
19 | - 1. 验证md5 | ||
20 | - 3. 获取report | ||
21 | - 4. 获取detail | ||
22 | - 5. 评判detail | ||
23 | - 1. 验证member | ||
24 | - 2. 获取admin | 31 | + 验证md5 |
32 | + 获取report | ||
33 | + 获取detail | ||
34 | + 评判detail | ||
35 | + 验证member | ||
36 | + 获取admin | ||
25 | */ | 37 | */ |
26 | - // 需要程喆增加 title,account字段,String,修改set字段为int,0男,1女。 | 38 | + // 需要程喆增加 title,account,machine_num字段 String; 修改set字段为int,0男,1女。 |
39 | + // 125项目,改为float类型。 | ||
27 | public ReportData parseReport(String reportJson, String md5) { | 40 | public ReportData parseReport(String reportJson, String md5) { |
28 | ReportData reportData = new ReportData(); | 41 | ReportData reportData = new ReportData(); |
29 | AMPReport ampReport = new AMPReport(); | 42 | AMPReport ampReport = new AMPReport(); |
30 | List<AMPReportDetail> detailList = new ArrayList<>(); | 43 | List<AMPReportDetail> detailList = new ArrayList<>(); |
44 | + int sex; | ||
45 | + | ||
31 | /* | 46 | /* |
32 | - * 获取report基础信息 | 47 | + * 2. 获取report基础信息 |
33 | */ | 48 | */ |
34 | try { | 49 | try { |
35 | JSONObject rpJson = JSONObject.parseObject(reportJson); | 50 | JSONObject rpJson = JSONObject.parseObject(reportJson); |
51 | + sex = rpJson.getInteger("sex").intValue(); | ||
36 | ampReport.setReport(rpJson.getString("name"), | 52 | ampReport.setReport(rpJson.getString("name"), |
37 | rpJson.getString("title"),/// "AMP快速无创身心健康评估报告", | 53 | rpJson.getString("title"),/// "AMP快速无创身心健康评估报告", |
38 | - rpJson.getTimestamp("report_date"), | 54 | + Timestamp.valueOf(rpJson.getString("report_date")), |
39 | new Timestamp(System.currentTimeMillis()), | 55 | new Timestamp(System.currentTimeMillis()), |
40 | rpJson.getString("account"),/// | 56 | rpJson.getString("account"),/// |
41 | rpJson.getInteger("sex").intValue(),/// | 57 | rpJson.getInteger("sex").intValue(),/// |
@@ -43,7 +59,7 @@ public class ReportService { | @@ -43,7 +59,7 @@ public class ReportService { | ||
43 | rpJson.getInteger("weight").intValue(), | 59 | rpJson.getInteger("weight").intValue(), |
44 | rpJson.getInteger("pulse").intValue(), | 60 | rpJson.getInteger("pulse").intValue(), |
45 | rpJson.getInteger("respiratory_rate").intValue(), | 61 | rpJson.getInteger("respiratory_rate").intValue(), |
46 | - rpJson.getInteger("atmospheric_pressure").intValue(), | 62 | + rpJson.getFloat("atmospheric_pressure").floatValue(), |
47 | rpJson.getFloat("LCA").floatValue(), | 63 | rpJson.getFloat("LCA").floatValue(), |
48 | rpJson.getFloat("RCA").floatValue(), | 64 | rpJson.getFloat("RCA").floatValue(), |
49 | rpJson.getFloat("LAC").floatValue(), | 65 | rpJson.getFloat("LAC").floatValue(), |
@@ -51,28 +67,77 @@ public class ReportService { | @@ -51,28 +67,77 @@ public class ReportService { | ||
51 | rpJson.getFloat("ABD").floatValue(), | 67 | rpJson.getFloat("ABD").floatValue(), |
52 | rpJson.getFloat("total").floatValue(), | 68 | rpJson.getFloat("total").floatValue(), |
53 | rpJson.getInteger("stable").intValue(), | 69 | rpJson.getInteger("stable").intValue(), |
54 | - md5, rpJson.getString("basic_result")); | 70 | + md5, rpJson.getString("machine_num"), rpJson.getString("basic_result")); |
55 | /* | 71 | /* |
56 | - * 获取detail信息 | 72 | + * 3. 获取detail信息,id,float类型 |
57 | */ | 73 | */ |
58 | JSONObject rpDetails = rpJson.getJSONObject("detail"); | 74 | JSONObject rpDetails = rpJson.getJSONObject("detail"); |
59 | for (int item_id = 1; item_id <= 125; item_id++) { | 75 | for (int item_id = 1; item_id <= 125; item_id++) { |
60 | - String val = rpDetails.getString(String.valueOf(item_id)); | ||
61 | - if (val == null || val.equals("")) { | ||
62 | - continue; | ||
63 | - } | ||
64 | - val = val.trim().replace(" ", "").replace("``", "").replace("`", "."); | ||
65 | - float valFloat = Float.parseFloat(val); | 76 | + float val = rpDetails.getFloat(String.valueOf(item_id)).floatValue(); |
66 | AMPReportDetail detail = new AMPReportDetail(); | 77 | AMPReportDetail detail = new AMPReportDetail(); |
67 | - detail.setItem_value(valFloat); | ||
68 | - detail.setItem_id(item_id); | 78 | + detail.setItemValue(val); |
79 | + detail.setItemId(item_id); | ||
69 | detailList.add(detail); | 80 | detailList.add(detail); |
70 | } | 81 | } |
71 | } catch (Exception e) { | 82 | } catch (Exception e) { |
72 | return null; | 83 | return null; |
73 | } | 84 | } |
85 | + markItemStatus(sex, detailList); | ||
74 | reportData.setAmpReport(ampReport); | 86 | reportData.setAmpReport(ampReport); |
75 | reportData.setRpDetailList(detailList); | 87 | reportData.setRpDetailList(detailList); |
76 | return reportData; | 88 | return reportData; |
77 | } | 89 | } |
90 | + | ||
91 | + /* | ||
92 | + * 存储报告 | ||
93 | + */ | ||
94 | + public int saveReport(ReportData report, Admin admin, User user) { | ||
95 | + report.getAmpReport().setCreate_by((int) admin.getId()); | ||
96 | + report.getAmpReport().setCompany_id(admin.getCoid()); | ||
97 | + report.getAmpReport().setMember_id(user.getMemberId()); | ||
98 | + AMPReport ampReport = reportRepository.save(report.getAmpReport()); | ||
99 | + for (AMPReportDetail detail : report.getRpDetailList()) { | ||
100 | + detail.setReportId(ampReport.getId()); | ||
101 | + } | ||
102 | + reportDetailRepository.save(report.getRpDetailList()); | ||
103 | + return ampReport.getId(); | ||
104 | + } | ||
105 | + | ||
106 | + /* | ||
107 | + * 判断detail是正常,高于标准或低于标准。 | ||
108 | + */ | ||
109 | + private void markItemStatus(int sex, List<AMPReportDetail> detailList) { | ||
110 | + // load ReportMetaItems into memory. | ||
111 | + synchronized (this) { | ||
112 | + if (rpMetaItemMap.size() == 0) { | ||
113 | + Iterator<ReportMetaItem> rpMetaIter = reportMetaItemsRepository.findAll().iterator(); | ||
114 | + while (rpMetaIter.hasNext()) { | ||
115 | + ReportMetaItem rpMetaItem = rpMetaIter.next(); | ||
116 | + rpMetaItemMap.put(rpMetaItem.getItem_id(), rpMetaItem); | ||
117 | + } | ||
118 | + } | ||
119 | + } | ||
120 | + // mark status | ||
121 | + for (AMPReportDetail detail : detailList) { | ||
122 | + float lowSt; | ||
123 | + float highSt; | ||
124 | + // get standard | ||
125 | + if (sex == Constants.MALE) { // male | ||
126 | + lowSt = rpMetaItemMap.get(detail.getItemId()).getStandard_low_male(); | ||
127 | + highSt = rpMetaItemMap.get(detail.getItemId()).getStandard_high_male(); | ||
128 | + } else { // female | ||
129 | + lowSt = rpMetaItemMap.get(detail.getItemId()).getStandard_low_female(); | ||
130 | + highSt = rpMetaItemMap.get(detail.getItemId()).getStandard_high_female(); | ||
131 | + } | ||
132 | + int status; | ||
133 | + if (detail.getItemValue() < lowSt) { | ||
134 | + status = Constants.LOWER; | ||
135 | + } else if (detail.getItemValue() > highSt) { | ||
136 | + status = Constants.HIGHER; | ||
137 | + } else { | ||
138 | + status = Constants.NORMAL; | ||
139 | + } | ||
140 | + detail.setStatus(status); | ||
141 | + } | ||
142 | + } | ||
78 | } | 143 | } |
-
Please register or login to post a comment