增加手麻补偿采集接口

docus-active-query-service_1.3
tan 10 months ago
parent fb362efd4d
commit 4804784e74

@ -53,10 +53,22 @@
<version>1.16.14</version>
</dependency>
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>swagger-spring-boot-starter</artifactId>
<version>1.9.0.RELEASE</version>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- springfox-swagger-ui -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>

@ -74,15 +74,15 @@ public class MyScheduling {
* /
* 10
*/
// @Scheduled(fixedRate = 1000 * 60 * 10)
// public void collect() {
// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
// if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) {
// return;
// }
// bgtsService.timerCollect();
// }
@Scheduled(fixedRate = 1000 * 60 * 10)
public void collect() {
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) {
return;
}
bgtsService.timerCollect();
}
//
// // 时间
// private static List<String> date = new ArrayList<>();
// // 上次任务执行时间
@ -95,9 +95,9 @@ public class MyScheduling {
// myScheduling.collectByExamNo();
// TimeUnit.MILLISECONDS.sleep(500);
// }
//
//// System.out.println(date);
//// System.out.println(currentIndex);
// System.out.println(date);
// System.out.println(currentIndex);
// }
// private static void initDate() throws Exception {
// String configStart = String.valueOf(FileUtils.getJsonByName("collectStartDate"));
@ -113,7 +113,7 @@ public class MyScheduling {
// localDate = localDate.plusDays(1);
// }
// }
//
/**
@ -160,24 +160,24 @@ public class MyScheduling {
// }
//
// }
@Scheduled(cron ="0 0 0 * * ?")
public void collect(){
String intervalDayOpen = String.valueOf(FileUtils.getJsonByName("intervalDayOpen"));
if (intervalDayOpen.equals("1")){
try{
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
int day = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("intervalDay")));
logger.info("0点采集前"+day+"天出院数据");
Map<String, String> dateCollectionTime = getDateCollectionTime(new Date(), day);
logger.info("采集"+dateCollectionTime.get("startDate")+"至-------"+dateCollectionTime.get("endDate")+"数据");
bgtsService.collectByDate(dateCollectionTime.get("startDate"),dateCollectionTime.get("endDate"),collectorid,String.valueOf(0));
}catch (Exception e) {
logger.error("pacs二次采集出错---"+e.getMessage());
}
}
}
//
// @Scheduled(cron ="0 0 0 * * ?")
// public void collect(){
// String intervalDayOpen = String.valueOf(FileUtils.getJsonByName("intervalDayOpen"));
// if (intervalDayOpen.equals("1")){
// try{
// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
// int day = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("intervalDay")));
// logger.info("0点采集前"+day+"天出院数据");
// Map<String, String> dateCollectionTime = getDateCollectionTime(new Date(), day);
// logger.info("采集"+dateCollectionTime.get("startDate")+"至-------"+dateCollectionTime.get("endDate")+"数据");
// bgtsService.collectByDate(dateCollectionTime.get("startDate"),dateCollectionTime.get("endDate"),collectorid,String.valueOf(0));
// }catch (Exception e) {
// logger.error("pacs二次采集出错---"+e.getMessage());
// }
//
// }
// }
/**

@ -0,0 +1,42 @@
package com.docus.bgts.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
/*
* 1.
* 2.
* */
//Docket封装接口文档信息
@Bean
public Docket getDocket(){
//创建封面信息对象
ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
apiInfoBuilder.title("查询采集接口说明")
.description("")
.version("v 1.0.0");
ApiInfo apiInfo = apiInfoBuilder.build();
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo)
.select()
.apis(RequestHandlerSelectors.basePackage("com.docus.bgts.controller"))
.build();
return docket;
}
}

@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@Api(value = "采集接口", tags = "采集接口")
@RestController
@ -34,120 +36,202 @@ public class BgtsController {
@Autowired
IAfCollectTaskService afCollectTaskService;
@ApiOperation("完整性同步程序开关0关闭 1开启")
@GetMapping("/onOffSync")
public void onOffSync(@RequestParam(value = "flag",defaultValue = "0") String flag){
MyScheduling.syncFlag=flag;
}
// @ApiOperation("完整性同步程序开关0关闭 1开启")
// @GetMapping("/onOffSync")
// public void onOffSync(@RequestParam(value = "flag",defaultValue = "0") String flag){
// MyScheduling.syncFlag=flag;
// }
//
// @GetMapping("/addSyncIntegrality")
// public void addSyncIntegrality(@RequestParam("startDate")String startDate,String endDate){
// checkIntegrityService.addSyncIntegrality(startDate,endDate);
// }
//
// @GetMapping("/addSyncIntegralityByJzhs")
// public CommonResult<String> addSyncIntegrality(@RequestParam("jzhs")String jzhs){
// if(jzhs.split(",").length > 100){
// return CommonResult.failed("jzh个数不能超过100个");
// }
// checkIntegrityService.addSyncIntegralityByJzhs(jzhs);
// return CommonResult.success("完成");
// }
@GetMapping("/addSyncIntegrality")
public void addSyncIntegrality(@RequestParam("startDate")String startDate,String endDate){
checkIntegrityService.addSyncIntegrality(startDate,endDate);
}
// @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("collectSubId") String collectSubId,
// @RequestParam("empId") String empId) {
// try {
// logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
// bgtsService.collect(empId);
// logger.info("采集完成");
// afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
// logger.info("------------采集结束-----------");
// } catch (RuntimeException e) {
// e.printStackTrace();
// try {
// afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
// }catch (Exception e1) {
// logger.info(e1.getMessage());
// return CommonResult.failed(e1.getMessage());
// }
// return CommonResult.failed(e.getMessage());
// }
// catch (Exception e) {
// e.printStackTrace();
// }catch (Throwable t){
// t.printStackTrace();
// logger.error("throwable{}", t.getMessage());
// }
// return CommonResult.success("ok");
// }
//
// @ApiOperation("Pacs采集接口")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
// @ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true),
// @ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
// @ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
// @ApiImplicitParam(name = "times",value = "住院次数",required = true)
// })
// @GetMapping("/collectPacs")
// public CommonResult<String> collect(@RequestParam("collectSubId") String collectSubId,
// @RequestParam("empId") String empId,
// @RequestParam("admissDate") String admissDate,
// @RequestParam("disDate") String disDate,
// @RequestParam("times") String times){
// try {
// logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
// bgtsService.collectPacs(empId,admissDate,disDate,times);
// logger.info("采集完成");
// afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
// logger.info("------------采集结束-----------");
// } catch (RuntimeException e) {
// e.printStackTrace();
// try {
// afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
// }catch (Exception e1) {
// logger.info(e1.getMessage());
// return CommonResult.failed(e1.getMessage());
// }
// return CommonResult.failed(e.getMessage());
// }
// catch (Exception e) {
// e.printStackTrace();
// }
// return CommonResult.success("ok");
// }
//
@GetMapping("/addSyncIntegralityByJzhs")
public CommonResult<String> addSyncIntegrality(@RequestParam("jzhs")String jzhs){
if(jzhs.split(",").length > 100){
return CommonResult.failed("jzh个数不能超过100个");
}
checkIntegrityService.addSyncIntegralityByJzhs(jzhs);
return CommonResult.success("完成");
}
// @ApiOperation("动态心电采集接口")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
// @ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true),
// @ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
// @ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
// @ApiImplicitParam(name = "times",value = "住院次数",required = true)
// })
// @GetMapping("/collectEcg")
// public CommonResult<String> collectEcg(@RequestParam("collectSubId") String collectSubId,
// @RequestParam("empId") String empId,
// @RequestParam("admissDate") String admissDate,
// @RequestParam("disDate") String disDate,
// @RequestParam("times") String times){
// try {
// logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
// bgtsService.collectEcg(empId,admissDate,disDate,times);
// logger.info("采集完成");
// afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
// logger.info("------------采集结束-----------");
// } catch (RuntimeException e) {
// e.printStackTrace();
// try {
// afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
// }catch (Exception e1) {
// logger.info(e1.getMessage());
// return CommonResult.failed(e1.getMessage());
// }
// return CommonResult.failed(e.getMessage());
// }
// catch (Exception e) {
// e.printStackTrace();
// }
// return CommonResult.success("ok");
// }
@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("collectSubId") String collectSubId,
@RequestParam("empId") String empId) {
try {
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
bgtsService.collect(empId);
logger.info("采集完成");
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
logger.info("------------采集结束-----------");
} catch (RuntimeException e) {
e.printStackTrace();
try {
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
}catch (Exception e1) {
logger.info(e1.getMessage());
return CommonResult.failed(e1.getMessage());
}
return CommonResult.failed(e.getMessage());
}
catch (Exception e) {
e.printStackTrace();
}catch (Throwable t){
t.printStackTrace();
logger.error("throwable{}", t.getMessage());
}
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");
// }
@ApiOperation("Pacs采集接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true),
@ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
@ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
@ApiImplicitParam(name = "times",value = "住院次数",required = true)
})
@GetMapping("/collectPacs")
public CommonResult<String> collect(@RequestParam("collectSubId") String collectSubId,
@RequestParam("empId") String empId,
@RequestParam("admissDate") String admissDate,
@RequestParam("disDate") String disDate,
@RequestParam("times") String times){
try {
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
bgtsService.collectPacs(empId,admissDate,disDate,times);
logger.info("采集完成");
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
logger.info("------------采集结束-----------");
} catch (RuntimeException e) {
e.printStackTrace();
try {
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
}catch (Exception e1) {
logger.info(e1.getMessage());
return CommonResult.failed(e1.getMessage());
}
return CommonResult.failed(e.getMessage());
}
catch (Exception e) {
e.printStackTrace();
}
return CommonResult.success("ok");
}
// /**
// * 按需采集
// */
// @GetMapping("/collectByEx")
// public CommonResult<String> collectByEx(@RequestParam("empId") String empId){
// try{
// bgtsService.collect(empId);
// }catch (Exception e){
// e.printStackTrace();
// return CommonResult.failed(e.getMessage());
// }
// return CommonResult.success("ok");
// }
// /**
// * pacs按需采集
// */
// @ApiOperation("pacs按需采集接口")
// @GetMapping("/collectByPacs")
// public CommonResult<String> collectByPacs(){
// try{
// bgtsService.collectPacss();
// }catch (Exception e){
// e.printStackTrace();
// return CommonResult.failed(e.getMessage());
// }
// return CommonResult.success("ok");
// }
@ApiOperation("动态心电采集接口")
@ApiOperation("手麻根据出院时间区间补偿采集接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true),
@ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
@ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
@ApiImplicitParam(name = "times",value = "住院次数",required = true)
@ApiImplicitParam(name = "startDate",value = "开始时间",required = true),
@ApiImplicitParam(name = "endDate",value = "结束时间",required = true)
})
@GetMapping("/collectEcg")
public CommonResult<String> collectEcg(@RequestParam("collectSubId") String collectSubId,
@RequestParam("empId") String empId,
@RequestParam("admissDate") String admissDate,
@RequestParam("disDate") String disDate,
@RequestParam("times") String times){
@GetMapping("/collectPacsCompensate")
public CommonResult<String> collectSm(
@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate){
try {
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId);
bgtsService.collectEcg(empId,admissDate,disDate,times);
logger.info("采集完成");
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
logger.info("------------采集结束-----------");
bgtsService.collectSmByDate(startDate,endDate);
} catch (RuntimeException e) {
e.printStackTrace();
try {
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
}catch (Exception e1) {
logger.info(e1.getMessage());
return CommonResult.failed(e1.getMessage());
@ -159,62 +243,68 @@ public class BgtsController {
}
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");
}
/**
*
*/
@GetMapping("/collectByEx")
public CommonResult<String> collectByEx(@RequestParam("empId") String empId){
try{
bgtsService.collect(empId);
}catch (Exception e){
e.printStackTrace();
return CommonResult.failed(e.getMessage());
}
return CommonResult.success("ok");
}
/**
* pacs
*/
@ApiOperation("pacs按需采集接口")
@GetMapping("/collectByPacs")
public CommonResult<String> collectByPacs(){
try{
bgtsService.collectPacss();
}catch (Exception e){
e.printStackTrace();
return CommonResult.failed(e.getMessage());
}
return CommonResult.success("ok");
}
//
// @ApiOperation("Pacs补偿采集接口")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "empId",value = "住院号",required = true,dataTypeClass = String.class),
// @ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
// @ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
// @ApiImplicitParam(name = "times",value = "住院次数",required = true)
// })
// @GetMapping("/collectPacsCompensate")
// public CommonResult<String> collectPacs(
// @RequestParam("empId") String empId,
// @RequestParam("admissDate") String admissDate,
// @RequestParam("disDate") String disDate,
// @RequestParam("times") String times){
// try {
// logger.info("采集接口接收到参数:\nempId--"+empId);
// bgtsService.collectPacs(empId,admissDate,disDate,times);
// logger.info("采集完成");
// logger.info("------------采集结束-----------");
// } catch (RuntimeException e) {
// e.printStackTrace();
// try {
// }catch (Exception e1) {
// logger.info(e1.getMessage());
// return CommonResult.failed(e1.getMessage());
// }
// return CommonResult.failed(e.getMessage());
// }
// catch (Exception e) {
// e.printStackTrace();
// }
// return CommonResult.success("ok");
// }
//
// @ApiOperation("Pacs根据出院时间区间补偿采集接口")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "startDate",value = "开始时间",required = true),
// @ApiImplicitParam(name = "endDate",value = "结束时间",required = true)
// })
// @GetMapping("/collectPacsByDate")
// public CommonResult<String> collectPacsByDate(
// @RequestParam("startDate") String startDate,
// @RequestParam("endDate") String endDate){
// try {
// logger.info("根据出院时间区间补偿采集接口收到参数:\n"+startDate+"\t"+endDate);
// bgtsService.collectPacsByDate(startDate,endDate);
// logger.info("采集完成");
// logger.info("------------采集结束-----------");
// } catch (RuntimeException e) {
// e.printStackTrace();
// try {
// }catch (Exception e1) {
// logger.info(e1.getMessage());
// return CommonResult.failed(e1.getMessage());
// }
// return CommonResult.failed(e.getMessage());
// }
// catch (Exception e) {
// e.printStackTrace();
// }
// return CommonResult.success("ok");
// }

@ -1,4 +1,7 @@
package com.docus.bgts.facade;
import java.util.Date;
public interface IBgtsService {
/**
* id
@ -50,7 +53,17 @@ public interface IBgtsService {
*/
void collectSealEcg(String sealId) throws Exception;
/**
* @date 2024/9/26 18:00
*
* @param startDate
* @param endDate
*/
void collectSmByDate(String startDate, String endDate);
void collectPacss();
void collectPacsByDate(String startDate, String endDate);
/**
*
* @param emamNo

@ -274,25 +274,29 @@ public class BgtsServiceImpl implements IBgtsService {
}
@Override
public void collectPacs(String empId, String admissDate, String disDate, String times) throws Exception {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
Date ad = sim.parse(admissDate);
Date di = sim.parse(disDate);
String admiss = sim.format(ad);
String dis = sim.format(di);
//通过empId获取报告单号集合
List<String[]> exams = getExamNoByInpNo(empId, admiss, dis);
String jzh = afCollectTaskService.getJzhByInpatientNo(empId,times);
if (null == jzh) {
logger.info("通过住院号与住院次数未匹配到患者");
return;
public void collectPacs(String empId, String admissDate, String disDate, String times) {
try {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
Date ad = sim.parse(admissDate);
Date di = sim.parse(disDate);
String admiss = sim.format(ad);
String dis = sim.format(di);
//通过empId获取报告单号集合
List<String[]> exams = getExamNoByInpNo(empId, admiss, dis);
String jzh = afCollectTaskService.getJzhByInpatientNo(empId, times);
if (null == jzh) {
logger.info("通过住院号与住院次数未匹配到患者");
return;
}
//获取插入表数据
ReportDownDto reportDownDto = getUrlCreateReportDto(exams, jzh);
//插入文件af_collect_task表数据
afCollectTaskService.insert(reportDownDto);
//通过报告单号集合采集
collectExams(exams, empId, reportDownDto);
}catch (Exception e) {
logger.info(empId,":采集出错!",e.getMessage());
}
//获取插入表数据
ReportDownDto reportDownDto = getUrlCreateReportDto(exams, jzh);
//插入文件af_collect_task表数据
afCollectTaskService.insert(reportDownDto);
//通过报告单号集合采集
collectExams(exams, empId, reportDownDto);
}
@Override
@ -417,6 +421,13 @@ public class BgtsServiceImpl implements IBgtsService {
logger.info("--------------全量采集结束------------------");
}
@Override
public void collectSmByDate(String startDate, String endDate) {
logger.info("----------手麻采集开始时间:"+startDate+" 结束时间:"+endDate+"------");
collectByDates(startDate, endDate);
logger.info("----------手麻采集结束-");
}
@Override
public void collectPacss(){
logger.info("按需采集任务执行----");
@ -458,6 +469,47 @@ public class BgtsServiceImpl implements IBgtsService {
}
@Override
public void collectPacsByDate(String startDate, String endDate) {
logger.info("按需采集任务执行----");
// if (CollUtil.isEmpty(date)) {
// try {
// initDate();
// } catch (Exception e) {
// logger.error(e.getMessage());
// return;
// }
// }
// if (currentIndex >= date.size()) {
// currentIndex = 0;
// }
// logger.info("index:{},Thread {}", currentIndex, Thread.currentThread().getName());
// String collectStartDate = date.get(currentIndex);
// String collectEndDate = collectStartDate + "\t23:59:59";
String collectStartDate = String.valueOf(startDate)+"\t00:00:00";
String collectEndDate = String.valueOf(endDate)+"\t23:59:59";
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
String isDead = String.valueOf(FileUtils.getJsonByName("isDead"));
CountDownLatch countDownLatch = new CountDownLatch(1);
threadPoolExecutor.execute(() -> {
try {
collectByDate(collectStartDate, collectEndDate, collectorid,isDead);
}catch (Exception e) {
logger.info("按需采集出错{}",e.getMessage());
}
countDownLatch.countDown();
});
try {
countDownLatch.await();
} catch (Exception e) {
logger.error("JUC countDownLatch error {}", e.getMessage());
}
logger.info("{},采集结束----", collectStartDate);
// currentIndex++;
System.gc();
}
@Override
public void timerCollect() {
logger.info("------采集器开始采集---------");
@ -484,46 +536,84 @@ public class BgtsServiceImpl implements IBgtsService {
public void collectByDate(String startDate, String endDate, String collectorId,String isDead) {
logger.info("按需采集开始----------开始时间---" + startDate + "------结束时间---" + endDate);
//页码
int startrow;
//每页10条数据
int endrow = 10;
//2.获取第一页10条数据开始采集
// int startrow;
// //每页10条数据
// int endrow = 10;
// //2.获取第一页10条数据开始采集
try{
List<Map> patientIds;
for (startrow = 0; ; startrow += 10) {
if (("1").equals(isDead)){
patientIds=afCollectTaskService.getjzhByDateAndIsDead(startDate, endDate, startrow, endrow);
// List<Map> patientIds;
// for (startrow = 0; ; startrow += 10) {
// if (("1").equals(isDead)){
// patientIds=afCollectTaskService.getjzhByDateAndIsDead(startDate, endDate, startrow, endrow);
// logger.info("按需采集死亡患者----");
// }else {
// patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow);
// }
//
// if (null == patientIds || patientIds.size() <= 0) {
// logger.info("未查询到按需采集患者!");
// break;
// }
// for (Map patientId : patientIds) {
// if (patientId != null) {
// try {
// logger.info("按需采集------患者" + patientId.get("inpatient_no"));
// logger.info("处理按需采集第" + startrow + "条数据----");
// if (collectorId.equals("3")) {
// collectPacs(String.valueOf(patientId.get("inpatient_no")), String.valueOf(patientId.get("admiss_date"))
// , String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
// } else if (collectorId.equals("4") || collectorId.equals("23")) {
// collectEcg(String.valueOf(patientId.get("jzh")), String.valueOf(patientId.get("admiss_date"))
// , String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
// } else {
// collect(String.valueOf(patientId.get("jzh")));
// }
//
// } catch (Exception e) {
// logger.error("按需采集-患者inpatient_no{},collectPacs() Error:{}", patientId.get("inpatient_no"), e.getMessage());
// }
// }
// }
// patientIds.clear();
// }
int startrow = 0;
int endrow = 10;
boolean hasMoreData = true;
while (hasMoreData) {
List<Map> patientIds;
if ("1".equals(isDead)) {
patientIds = afCollectTaskService.getjzhByDateAndIsDead(startDate, endDate, startrow, endrow);
logger.info("按需采集死亡患者----");
}else {
} else {
patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow);
}
if (null == patientIds || patientIds.size() <= 0) {
if (patientIds == null || patientIds.isEmpty()) {
logger.info("未查询到按需采集患者!");
break;
}
for (Map patientId : patientIds) {
if (patientId != null) {
try {
logger.info("按需采集------患者" + patientId.get("inpatient_no"));
logger.info("处理按需采集第" + startrow + "条数据----");
if (collectorId.equals("3")) {
collectPacs(String.valueOf(patientId.get("inpatient_no")), String.valueOf(patientId.get("admiss_date"))
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
} else if (collectorId.equals("4") || collectorId.equals("23")) {
collectEcg(String.valueOf(patientId.get("jzh")), String.valueOf(patientId.get("admiss_date"))
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
} else {
collect(String.valueOf(patientId.get("jzh")));
hasMoreData = false;
} else {
for (Map patientId : patientIds) {
if (patientId != null) {
try {
logger.info("按需采集------患者" + patientId.get("inpatient_no"));
logger.info("处理按需采集第" + startrow + "条数据----");
if (collectorId.equals("3")) {
collectPacs(String.valueOf(patientId.get("inpatient_no")), String.valueOf(patientId.get("admiss_date")), String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
} else if (collectorId.equals("4") || collectorId.equals("23")) {
collectEcg(String.valueOf(patientId.get("jzh")), String.valueOf(patientId.get("admiss_date")), String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times")));
} else {
collect(String.valueOf(patientId.get("jzh")));
}
} catch (Exception e) {
logger.error("按需采集-患者inpatient_no{},collectPacs() Error:{}", patientId.get("inpatient_no"), e.getMessage());
}
} catch (Exception e) {
logger.error("按需采集-患者inpatient_no{},collectPacs() Error:{}", patientId.get("inpatient_no"), e.getMessage());
}
}
startrow += 10;
}
patientIds.clear();
}
}catch (Exception e){
logger.error(e.getMessage());
}catch (Throwable t) {

@ -21,8 +21,8 @@
<!-- 活动文件的名字会根据fileNamePattern的值每隔一段时间改变一次 -->
<!-- 文件名log/demo.2017-12-05.0.log -->
<fileNamePattern>log/demo.%d.%i.log</fileNamePattern>
<!-- 每产生一个日志文件,该日志文件的保存期限为30天 -->
<maxHistory>30</maxHistory>
<!-- 每产生一个日志文件,该日志文件的保存期限为180天 -->
<maxHistory>180</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- maxFileSize:这是活动文件的大小默认值是10MB测试时可改成1KB看效果 -->
<maxFileSize>10MB</maxFileSize>

Loading…
Cancel
Save