|
|
|
package com.docus.bgts.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.docus.bgts.entity.CommonResult;
|
|
|
|
import com.docus.bgts.facade.IAfCollectTaskService;
|
|
|
|
import com.docus.bgts.facade.IBgtsService;
|
|
|
|
import com.docus.bgts.utils.FileUtils;
|
|
|
|
import com.docus.bgts.utils.XmlUtils;
|
|
|
|
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.dom4j.Element;
|
|
|
|
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;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
@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);
|
|
|
|
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
|
|
|
|
logger.info("------------采集结束-----------");
|
|
|
|
} 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)
|
|
|
|
})
|
|
|
|
@GetMapping("/collectByExamNo")
|
|
|
|
public CommonResult<String> collectByExamNo(@RequestParam("emamNo") String emamNo,
|
|
|
|
@RequestParam("empId") String empId){
|
|
|
|
try {
|
|
|
|
logger.info("按需采集接口接受参数:\nempId--"+empId+"\nemamNo--"+emamNo);
|
|
|
|
bgtsService.collectByExamNo(emamNo,empId);
|
|
|
|
// afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
|
|
|
|
}catch (RuntimeException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return CommonResult.failed(e.getMessage());
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
return CommonResult.success("ok");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|