You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
3.7 KiB
Java
93 lines
3.7 KiB
Java
4 years ago
|
package com.docus.bgts.controller;
|
||
|
|
||
|
|
||
|
import com.docus.bgts.entity.CommonResult;
|
||
|
import com.docus.bgts.facade.IAfCollectTaskService;
|
||
|
import com.docus.bgts.facade.IBgtsService;
|
||
|
import io.swagger.annotations.Api;
|
||
|
import io.swagger.annotations.ApiImplicitParam;
|
||
|
import io.swagger.annotations.ApiImplicitParams;
|
||
|
import io.swagger.annotations.ApiOperation;
|
||
|
import org.apache.ibatis.annotations.Param;
|
||
|
import org.apache.logging.log4j.LogManager;
|
||
|
import org.apache.logging.log4j.Logger;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
|
||
|
@Api(value = "采集接口", tags = "采集接口")
|
||
|
@RestController
|
||
|
public class BgtsController {
|
||
|
|
||
|
Logger logger= LogManager.getLogger(BgtsController.class);
|
||
|
|
||
|
@Autowired
|
||
|
IBgtsService bgtsService;
|
||
|
|
||
|
@Autowired
|
||
|
IAfCollectTaskService afCollectTaskService;
|
||
|
|
||
|
@ApiOperation("采集接口")
|
||
|
@ApiImplicitParams({
|
||
|
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
|
||
|
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true)
|
||
|
})
|
||
|
@GetMapping("/collect")
|
||
|
public CommonResult<String> collect(@RequestParam("empId") String empId, @Param("collectSubId") String collectSubId) {
|
||
|
try {
|
||
|
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
|
||
|
bgtsService.collect(empId,collectSubId);
|
||
|
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
|
||
|
} catch (RuntimeException e) {
|
||
|
e.printStackTrace();
|
||
|
try {
|
||
|
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
|
||
|
}catch (Exception e1){
|
||
|
return CommonResult.failed(e1.getMessage());
|
||
|
}
|
||
|
return CommonResult.failed(e.getMessage());
|
||
|
}
|
||
|
catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
return CommonResult.success("ok");
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 按需采集
|
||
|
* @param emamNo
|
||
|
* @return
|
||
|
*/
|
||
|
@ApiOperation("按需采集接口")
|
||
|
@ApiImplicitParams({
|
||
|
@ApiImplicitParam(name = "emamNo",value = "报告单号",required = true,dataTypeClass = String.class),
|
||
|
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
|
||
|
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true)
|
||
|
})
|
||
|
@GetMapping("/collectByExamNo")
|
||
|
public CommonResult<String> collectByExamNo(@RequestParam("emamNo") String emamNo,
|
||
|
@RequestParam("empId") String empId,
|
||
|
@Param("collectSubId") String collectSubId){
|
||
|
try {
|
||
|
logger.info("按需采集接口接受参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId+"\nemamNo--"+emamNo);
|
||
|
bgtsService.collectByExamNo(emamNo,empId,collectSubId);
|
||
|
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
|
||
|
}catch (RuntimeException e) {
|
||
|
e.printStackTrace();
|
||
|
try {
|
||
|
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
|
||
|
}catch (Exception e1){
|
||
|
return CommonResult.failed(e1.getMessage());
|
||
|
}
|
||
|
return CommonResult.failed(e.getMessage());
|
||
|
}
|
||
|
catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
return CommonResult.success("ok");
|
||
|
}
|
||
|
|
||
|
}
|