|
@@ -72,10 +72,10 @@ public class ReportService implements IReportService { |
|
@@ -72,10 +72,10 @@ public class ReportService implements IReportService { |
72
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_EXISTED_ERROR, new ReportIdModel(report.getId())), HttpStatus.OK);
|
72
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_EXISTED_ERROR, new ReportIdModel(report.getId())), HttpStatus.OK);
|
73
|
} else if (redis.hasKey(reportWithNoUser)) {
|
73
|
} else if (redis.hasKey(reportWithNoUser)) {
|
74
|
// 返回,报告对应会员不存在。
|
74
|
// 返回,报告对应会员不存在。
|
75
|
- return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
|
75
|
+ return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
|
76
|
} else if (redis.hasKey(reportWrongFormat)) {
|
76
|
} else if (redis.hasKey(reportWrongFormat)) {
|
77
|
// 返回,报告格式有问题。
|
77
|
// 返回,报告格式有问题。
|
78
|
- return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK);
|
78
|
+ return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
|
79
|
}
|
79
|
}
|
80
|
/*
|
80
|
/*
|
81
|
* 解析报告数据
|
81
|
* 解析报告数据
|
|
@@ -87,7 +87,7 @@ public class ReportService implements IReportService { |
|
@@ -87,7 +87,7 @@ public class ReportService implements IReportService { |
87
|
if (reportData == null) {
|
87
|
if (reportData == null) {
|
88
|
redis.boundValueOps(reportWrongFormat).set("");
|
88
|
redis.boundValueOps(reportWrongFormat).set("");
|
89
|
// 返回,报告格式有问题。
|
89
|
// 返回,报告格式有问题。
|
90
|
- return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK);
|
90
|
+ return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
|
91
|
}
|
91
|
}
|
92
|
/*
|
92
|
/*
|
93
|
* 检验会员存在性
|
93
|
* 检验会员存在性
|
|
@@ -96,7 +96,7 @@ public class ReportService implements IReportService { |
|
@@ -96,7 +96,7 @@ public class ReportService implements IReportService { |
96
|
if (user == null) {
|
96
|
if (user == null) {
|
97
|
redis.boundValueOps(reportWithNoUser).set("");
|
97
|
redis.boundValueOps(reportWithNoUser).set("");
|
98
|
// 返回,报告对应会员不存在。
|
98
|
// 返回,报告对应会员不存在。
|
99
|
- return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
|
99
|
+ return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
|
100
|
}
|
100
|
}
|
101
|
|
101
|
|
102
|
/*
|
102
|
/*
|
|
@@ -108,7 +108,7 @@ public class ReportService implements IReportService { |
|
@@ -108,7 +108,7 @@ public class ReportService implements IReportService { |
108
|
return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK);
|
108
|
return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK);
|
109
|
} else {
|
109
|
} else {
|
110
|
// 返回,服务器存储问题。
|
110
|
// 返回,服务器存储问题。
|
111
|
- return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR),HttpStatus.OK);
|
111
|
+ return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR), HttpStatus.OK);
|
112
|
}
|
112
|
}
|
113
|
}
|
113
|
}
|
114
|
|
114
|
|
|
@@ -126,7 +126,7 @@ public class ReportService implements IReportService { |
|
@@ -126,7 +126,7 @@ public class ReportService implements IReportService { |
126
|
// 2. 验证admin
|
126
|
// 2. 验证admin
|
127
|
if (report.getCreateBy() != admin.getId()) {
|
127
|
if (report.getCreateBy() != admin.getId()) {
|
128
|
// 非此admin创建,不能删除,返回
|
128
|
// 非此admin创建,不能删除,返回
|
129
|
- return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR),HttpStatus.OK);
|
129
|
+ return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.OK);
|
130
|
}
|
130
|
}
|
131
|
// 3. 删除report和detail,返回ok
|
131
|
// 3. 删除report和detail,返回ok
|
132
|
reportRepository.delete(report);
|
132
|
reportRepository.delete(report);
|
|
@@ -153,6 +153,7 @@ public class ReportService implements IReportService { |
|
@@ -153,6 +153,7 @@ public class ReportService implements IReportService { |
153
|
List<XklAmpReportDetailEntity> detailList = new ArrayList<>();
|
153
|
List<XklAmpReportDetailEntity> detailList = new ArrayList<>();
|
154
|
List<XklAmpReportResultEntity> basicResList = new ArrayList<>();
|
154
|
List<XklAmpReportResultEntity> basicResList = new ArrayList<>();
|
155
|
int sex;
|
155
|
int sex;
|
|
|
156
|
+ int age;
|
156
|
|
157
|
|
157
|
/*
|
158
|
/*
|
158
|
* 2. 获取report基础信息
|
159
|
* 2. 获取report基础信息
|
|
@@ -160,6 +161,13 @@ public class ReportService implements IReportService { |
|
@@ -160,6 +161,13 @@ public class ReportService implements IReportService { |
160
|
try {
|
161
|
try {
|
161
|
JSONObject rpJson = JSONObject.parseObject(reportJson);
|
162
|
JSONObject rpJson = JSONObject.parseObject(reportJson);
|
162
|
sex = rpJson.getInteger("sex").intValue();
|
163
|
sex = rpJson.getInteger("sex").intValue();
|
|
|
164
|
+ age = rpJson.getInteger("age").intValue();
|
|
|
165
|
+ if (sex != Constants.FEMALE && sex != Constants.MALE) {
|
|
|
166
|
+ return null;
|
|
|
167
|
+ }
|
|
|
168
|
+ if (age < 0 || age > 127) {
|
|
|
169
|
+ return null;
|
|
|
170
|
+ }
|
163
|
ampReport.setReport(rpJson.getString("name"),
|
171
|
ampReport.setReport(rpJson.getString("name"),
|
164
|
rpJson.getString("title"),/// "AMP快速无创身心健康评估报告",
|
172
|
rpJson.getString("title"),/// "AMP快速无创身心健康评估报告",
|
165
|
new Timestamp(rpJson.getLong("report_date")),
|
173
|
new Timestamp(rpJson.getLong("report_date")),
|
|
@@ -230,7 +238,7 @@ public class ReportService implements IReportService { |
|
@@ -230,7 +238,7 @@ public class ReportService implements IReportService { |
230
|
for (XklAmpReportDetailEntity detail : report.getRpDetailList()) {
|
238
|
for (XklAmpReportDetailEntity detail : report.getRpDetailList()) {
|
231
|
detail.setReportId(ampReport.getId());
|
239
|
detail.setReportId(ampReport.getId());
|
232
|
}
|
240
|
}
|
233
|
- for (XklAmpReportResultEntity rpRes : report.getBasicResList()){
|
241
|
+ for (XklAmpReportResultEntity rpRes : report.getBasicResList()) {
|
234
|
rpRes.setReportId(ampReport.getId());
|
242
|
rpRes.setReportId(ampReport.getId());
|
235
|
}
|
243
|
}
|
236
|
reportDetailRepository.save(report.getRpDetailList());
|
244
|
reportDetailRepository.save(report.getRpDetailList());
|