...
|
...
|
@@ -72,10 +72,10 @@ public class ReportService implements IReportService { |
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_EXISTED_ERROR, new ReportIdModel(report.getId())), HttpStatus.OK);
|
|
|
} else if (redis.hasKey(reportWithNoUser)) {
|
|
|
// 返回,报告对应会员不存在。
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
|
|
|
} else if (redis.hasKey(reportWrongFormat)) {
|
|
|
// 返回,报告格式有问题。
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK);
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
|
|
|
}
|
|
|
/*
|
|
|
* 解析报告数据
|
...
|
...
|
@@ -87,7 +87,7 @@ public class ReportService implements IReportService { |
|
|
if (reportData == null) {
|
|
|
redis.boundValueOps(reportWrongFormat).set("");
|
|
|
// 返回,报告格式有问题。
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR),HttpStatus.OK);
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.REPORT_FORMAT_ERROR), HttpStatus.OK);
|
|
|
}
|
|
|
/*
|
|
|
* 检验会员存在性
|
...
|
...
|
@@ -96,7 +96,7 @@ public class ReportService implements IReportService { |
|
|
if (user == null) {
|
|
|
redis.boundValueOps(reportWithNoUser).set("");
|
|
|
// 返回,报告对应会员不存在。
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR),HttpStatus.OK);
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_USER_ERROR), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
/*
|
...
|
...
|
@@ -108,7 +108,7 @@ public class ReportService implements IReportService { |
|
|
return new ResponseEntity<>(ResultModel.ok(new ReportIdModel(reportId)), HttpStatus.OK);
|
|
|
} else {
|
|
|
// 返回,服务器存储问题。
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR),HttpStatus.OK);
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.DB_ERROR), HttpStatus.OK);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -126,7 +126,7 @@ public class ReportService implements IReportService { |
|
|
// 2. 验证admin
|
|
|
if (report.getCreateBy() != admin.getId()) {
|
|
|
// 非此admin创建,不能删除,返回
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR),HttpStatus.OK);
|
|
|
return new ResponseEntity<>(ResultModel.error(ResultStatus.INVALID_ADMIN_RPDEL_ERROR), HttpStatus.OK);
|
|
|
}
|
|
|
// 3. 删除report和detail,返回ok
|
|
|
reportRepository.delete(report);
|
...
|
...
|
@@ -153,6 +153,7 @@ public class ReportService implements IReportService { |
|
|
List<XklAmpReportDetailEntity> detailList = new ArrayList<>();
|
|
|
List<XklAmpReportResultEntity> basicResList = new ArrayList<>();
|
|
|
int sex;
|
|
|
int age;
|
|
|
|
|
|
/*
|
|
|
* 2. 获取report基础信息
|
...
|
...
|
@@ -160,6 +161,13 @@ public class ReportService implements IReportService { |
|
|
try {
|
|
|
JSONObject rpJson = JSONObject.parseObject(reportJson);
|
|
|
sex = rpJson.getInteger("sex").intValue();
|
|
|
age = rpJson.getInteger("age").intValue();
|
|
|
if (sex != Constants.FEMALE && sex != Constants.MALE) {
|
|
|
return null;
|
|
|
}
|
|
|
if (age < 0 || age > 127) {
|
|
|
return null;
|
|
|
}
|
|
|
ampReport.setReport(rpJson.getString("name"),
|
|
|
rpJson.getString("title"),/// "AMP快速无创身心健康评估报告",
|
|
|
new Timestamp(rpJson.getLong("report_date")),
|
...
|
...
|
@@ -230,7 +238,7 @@ public class ReportService implements IReportService { |
|
|
for (XklAmpReportDetailEntity detail : report.getRpDetailList()) {
|
|
|
detail.setReportId(ampReport.getId());
|
|
|
}
|
|
|
for (XklAmpReportResultEntity rpRes : report.getBasicResList()){
|
|
|
for (XklAmpReportResultEntity rpRes : report.getBasicResList()) {
|
|
|
rpRes.setReportId(ampReport.getId());
|
|
|
}
|
|
|
reportDetailRepository.save(report.getRpDetailList());
|
...
|
...
|
|