...
|
...
|
@@ -7,6 +7,8 @@ import com.xkl.authorization.annotation.Authorization; |
|
|
import com.xkl.authorization.annotation.CurrentUser;
|
|
|
import com.xkl.config.Constants;
|
|
|
import com.xkl.domain.*;
|
|
|
import com.xkl.model.ReportDetailModel;
|
|
|
import com.xkl.model.ReportModel;
|
|
|
import com.xkl.model.ResultModel;
|
|
|
import com.xkl.repository.XklAmpReportDetailRespository;
|
|
|
import com.xkl.repository.XklAmpReportHealthScoreRespository;
|
...
|
...
|
@@ -34,14 +36,14 @@ public class ReportController { |
|
|
private XklAmpReportRespository xklAmpReportRespository;
|
|
|
@Autowired
|
|
|
private XklAmpReportDetailRespository xklAmpReportDetailRespository;
|
|
|
|
|
|
@Autowired
|
|
|
private XklAmpReportHealthScoreRespository xklAmpReportHealthScoreRespository;
|
|
|
|
|
|
@Autowired
|
|
|
private IScoreService scoreService;
|
|
|
|
|
|
@RequestMapping(value="/list",method = RequestMethod.GET)
|
|
|
//@Authorization
|
|
|
@Authorization
|
|
|
//@Sign
|
|
|
@ApiOperation(value = "体检报告列表查询接口")
|
|
|
@ApiImplicitParams({
|
...
|
...
|
@@ -54,19 +56,83 @@ public class ReportController { |
|
|
return new ResponseEntity<>(ResultModel.ok(xklAmpReportEntity), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value="/detail",method = RequestMethod.GET)
|
|
|
@Authorization
|
|
|
//@Sign
|
|
|
@ApiOperation(value = "体检报告详情查询接口")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
|
|
public ResponseEntity<ResultModel> getReportDetail(HttpServletRequest request, @CurrentUser User user,@RequestParam long report_id,
|
|
|
@RequestParam String sign, @RequestParam long t, @RequestParam int type) {
|
|
|
XklAmpReportEntity report=xklAmpReportRespository.findOne(report_id);
|
|
|
List<ReportDetailModel> reportDetailModelList = new ArrayList<>();
|
|
|
if(report != null ){
|
|
|
if(report.getScore()==0){//首次调用接口,score为0
|
|
|
//TODO:可以在上传时直接打分?
|
|
|
scoreService.getScore(report_id);
|
|
|
}
|
|
|
List<XklAmpReportDetailEntity> reportDetailEntityList=xklAmpReportDetailRespository.findAllByReportId(report_id);
|
|
|
for(XklAmpReportDetailEntity detail:reportDetailEntityList){
|
|
|
int itemId=detail.getItemId();
|
|
|
ReportDetailModel reportDetail = new ReportDetailModel();
|
|
|
reportDetail.setItemId(itemId);
|
|
|
reportDetail.setItemValue(detail.getItemValue());
|
|
|
reportDetail.setStatus(detail.getStatus());
|
|
|
|
|
|
XklAmpReportMetaItemsEntity metaItems=Constants.itemMetaMap.get(itemId);
|
|
|
reportDetail.setTitle(metaItems.getTitle());
|
|
|
reportDetail.setNormal(metaItems.getStandardLowMale()+" - "+metaItems.getStandardHighMale());
|
|
|
reportDetail.setNormalNv(metaItems.getStandardLowFemale()+ " - "+metaItems.getStandardHighFemale());
|
|
|
reportDetail.setType(metaItems.getType());
|
|
|
|
|
|
XklAmpReportHealthScoreEntity scoreEntity = xklAmpReportHealthScoreRespository.findByReportIdAndType(report_id,metaItems.getType());
|
|
|
if(scoreEntity!=null)
|
|
|
reportDetail.setTypeHealthScore(scoreEntity.getTypeHealthScore());
|
|
|
reportDetailModelList.add(reportDetail);
|
|
|
}
|
|
|
}
|
|
|
ReportModel reportModel = new ReportModel(report,reportDetailModelList);
|
|
|
return new ResponseEntity<>(ResultModel.ok(reportModel), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value="/score",method = RequestMethod.GET)
|
|
|
@Authorization
|
|
|
//@Sign
|
|
|
@ApiOperation(value = "健康评分接口")
|
|
|
@ApiOperation(value = "健康评分接口(测试service用,后续可以注释掉)")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
|
|
public ResponseEntity<ResultModel> getReportScore(HttpServletRequest request, @CurrentUser User user,@RequestParam long report_id,
|
|
|
@RequestParam String sign, @RequestParam long t, @RequestParam int type) {
|
|
|
//单独测试需要删除xkl_amp_report_health_scroe表中数据
|
|
|
scoreService.getScore(report_id);
|
|
|
return new ResponseEntity<>(ResultModel.ok(), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value="/itemInfo",method = RequestMethod.GET)
|
|
|
@Authorization
|
|
|
//@Sign
|
|
|
@ApiOperation(value = "指标解释查询接口")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "authorization", value = "请输入登录返回信息:userId_tokens", required = true, dataType = "string", paramType = "header"),
|
|
|
})
|
|
|
public ResponseEntity<ResultModel> getReportItemInfo(HttpServletRequest request, @CurrentUser User user,@RequestParam int itemId,@RequestParam int status,
|
|
|
@RequestParam String sign, @RequestParam long t, @RequestParam int type) {
|
|
|
XklAmpReportMetaItemsEntity metaItems = Constants.itemMetaMap.get(itemId);
|
|
|
String result="";
|
|
|
//0, normal,1, lower,2, higher
|
|
|
if(status == 0){
|
|
|
result = metaItems.getExplainNormal();
|
|
|
}else if(status == 1){
|
|
|
result = metaItems.getExplainLow();
|
|
|
}else if(status == 2){
|
|
|
result = metaItems.getExplainHigh();
|
|
|
}else{
|
|
|
result = "没有此status相关信息";
|
|
|
}
|
|
|
return new ResponseEntity<>(ResultModel.ok(result), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|