增加手麻补偿采集接口

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

@ -53,10 +53,22 @@
<version>1.16.14</version> <version>1.16.14</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.spring4all</groupId> <groupId>io.springfox</groupId>
<artifactId>swagger-spring-boot-starter</artifactId> <artifactId>springfox-swagger2</artifactId>
<version>1.9.0.RELEASE</version> <version>2.9.2</version>
</dependency> </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 --> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>

@ -74,15 +74,15 @@ public class MyScheduling {
* / * /
* 10 * 10
*/ */
// @Scheduled(fixedRate = 1000 * 60 * 10) @Scheduled(fixedRate = 1000 * 60 * 10)
// public void collect() { public void collect() {
// String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
// if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) { if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) {
// return; return;
// } }
// bgtsService.timerCollect(); bgtsService.timerCollect();
// } }
//
// // 时间 // // 时间
// private static List<String> date = new ArrayList<>(); // private static List<String> date = new ArrayList<>();
// // 上次任务执行时间 // // 上次任务执行时间
@ -95,9 +95,9 @@ public class MyScheduling {
// myScheduling.collectByExamNo(); // myScheduling.collectByExamNo();
// TimeUnit.MILLISECONDS.sleep(500); // TimeUnit.MILLISECONDS.sleep(500);
// } // }
//
//// System.out.println(date); // System.out.println(date);
//// System.out.println(currentIndex); // System.out.println(currentIndex);
// } // }
// private static void initDate() throws Exception { // private static void initDate() throws Exception {
// String configStart = String.valueOf(FileUtils.getJsonByName("collectStartDate")); // String configStart = String.valueOf(FileUtils.getJsonByName("collectStartDate"));
@ -113,7 +113,7 @@ public class MyScheduling {
// localDate = localDate.plusDays(1); // localDate = localDate.plusDays(1);
// } // }
// } // }
//
/** /**
@ -160,24 +160,24 @@ public class MyScheduling {
// } // }
// //
// } // }
//
@Scheduled(cron ="0 0 0 * * ?") // @Scheduled(cron ="0 0 0 * * ?")
public void collect(){ // public void collect(){
String intervalDayOpen = String.valueOf(FileUtils.getJsonByName("intervalDayOpen")); // String intervalDayOpen = String.valueOf(FileUtils.getJsonByName("intervalDayOpen"));
if (intervalDayOpen.equals("1")){ // if (intervalDayOpen.equals("1")){
try{ // try{
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); // String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
int day = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("intervalDay"))); // int day = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("intervalDay")));
logger.info("0点采集前"+day+"天出院数据"); // logger.info("0点采集前"+day+"天出院数据");
Map<String, String> dateCollectionTime = getDateCollectionTime(new Date(), day); // Map<String, String> dateCollectionTime = getDateCollectionTime(new Date(), day);
logger.info("采集"+dateCollectionTime.get("startDate")+"至-------"+dateCollectionTime.get("endDate")+"数据"); // logger.info("采集"+dateCollectionTime.get("startDate")+"至-------"+dateCollectionTime.get("endDate")+"数据");
bgtsService.collectByDate(dateCollectionTime.get("startDate"),dateCollectionTime.get("endDate"),collectorid,String.valueOf(0)); // bgtsService.collectByDate(dateCollectionTime.get("startDate"),dateCollectionTime.get("endDate"),collectorid,String.valueOf(0));
}catch (Exception e) { // }catch (Exception e) {
logger.error("pacs二次采集出错---"+e.getMessage()); // 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@Api(value = "采集接口", tags = "采集接口") @Api(value = "采集接口", tags = "采集接口")
@RestController @RestController
@ -34,120 +36,202 @@ public class BgtsController {
@Autowired @Autowired
IAfCollectTaskService afCollectTaskService; IAfCollectTaskService afCollectTaskService;
@ApiOperation("完整性同步程序开关0关闭 1开启") // @ApiOperation("完整性同步程序开关0关闭 1开启")
@GetMapping("/onOffSync") // @GetMapping("/onOffSync")
public void onOffSync(@RequestParam(value = "flag",defaultValue = "0") String flag){ // public void onOffSync(@RequestParam(value = "flag",defaultValue = "0") String flag){
MyScheduling.syncFlag=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") // @ApiOperation("采集接口")
public void addSyncIntegrality(@RequestParam("startDate")String startDate,String endDate){ // @ApiImplicitParams({
checkIntegrityService.addSyncIntegrality(startDate,endDate); // @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") // @ApiOperation("动态心电采集接口")
public CommonResult<String> addSyncIntegrality(@RequestParam("jzhs")String jzhs){ // @ApiImplicitParams({
if(jzhs.split(",").length > 100){ // @ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class),
return CommonResult.failed("jzh个数不能超过100个"); // @ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true),
} // @ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
checkIntegrityService.addSyncIntegralityByJzhs(jzhs); // @ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
return CommonResult.success("完成"); // @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), // * @param emamNo
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true) // * @return
}) // */
@GetMapping("/collect") // @ApiOperation("按需采集接口")
public CommonResult<String> collect(@RequestParam("collectSubId") String collectSubId, // @ApiImplicitParams({
@RequestParam("empId") String empId) { // @ApiImplicitParam(name = "emamNo",value = "报告单号",required = true,dataTypeClass = String.class),
try { // @ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class)
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId); // })
bgtsService.collect(empId); // @GetMapping("/collectByExamNo")
logger.info("采集完成"); // public CommonResult<String> collectByExamNo(@RequestParam("emamNo") String emamNo,
afCollectTaskService.updateInterfaceCollect(collectSubId, 1); // @RequestParam("empId") String empId){
logger.info("------------采集结束-----------"); // try {
} catch (RuntimeException e) { // logger.info("按需采集接口接受参数:\nempId--"+empId+"\nemamNo--"+emamNo);
e.printStackTrace(); // bgtsService.collectByExamNo(emamNo,empId);
try { //// afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
afCollectTaskService.updateInterfaceCollect(collectSubId, 0); // }catch (RuntimeException e) {
}catch (Exception e1) { // e.printStackTrace();
logger.info(e1.getMessage()); // return CommonResult.failed(e.getMessage());
return CommonResult.failed(e1.getMessage()); // }
} // catch (Exception e) {
return CommonResult.failed(e.getMessage()); // e.printStackTrace();
} // }
catch (Exception e) { // return CommonResult.success("ok");
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), // @GetMapping("/collectByEx")
@ApiImplicitParam(name = "admissDate",value = "入院时间",required = true), // public CommonResult<String> collectByEx(@RequestParam("empId") String empId){
@ApiImplicitParam(name = "disDate",value = "出院时间",required = true), // try{
@ApiImplicitParam(name = "times",value = "住院次数",required = true) // bgtsService.collect(empId);
}) // }catch (Exception e){
@GetMapping("/collectPacs") // e.printStackTrace();
public CommonResult<String> collect(@RequestParam("collectSubId") String collectSubId, // return CommonResult.failed(e.getMessage());
@RequestParam("empId") String empId, // }
@RequestParam("admissDate") String admissDate, // return CommonResult.success("ok");
@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");
}
// /**
// * 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({ @ApiImplicitParams({
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class), @ApiImplicitParam(name = "startDate",value = "开始时间",required = true),
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true), @ApiImplicitParam(name = "endDate",value = "结束时间",required = true)
@ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
@ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
@ApiImplicitParam(name = "times",value = "住院次数",required = true)
}) })
@GetMapping("/collectEcg") @GetMapping("/collectPacsCompensate")
public CommonResult<String> collectEcg(@RequestParam("collectSubId") String collectSubId, public CommonResult<String> collectSm(
@RequestParam("empId") String empId, @RequestParam("startDate") String startDate,
@RequestParam("admissDate") String admissDate, @RequestParam("endDate") String endDate){
@RequestParam("disDate") String disDate,
@RequestParam("times") String times){
try { try {
logger.info("采集接口接收到参数:\nempId--"+empId+"\ncollectSubId--"+collectSubId); bgtsService.collectSmByDate(startDate,endDate);
bgtsService.collectEcg(empId,admissDate,disDate,times);
logger.info("采集完成");
afCollectTaskService.updateInterfaceCollect(collectSubId, 1);
logger.info("------------采集结束-----------");
} catch (RuntimeException e) { } catch (RuntimeException e) {
e.printStackTrace(); e.printStackTrace();
try { try {
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
}catch (Exception e1) { }catch (Exception e1) {
logger.info(e1.getMessage()); logger.info(e1.getMessage());
return CommonResult.failed(e1.getMessage()); return CommonResult.failed(e1.getMessage());
@ -159,62 +243,68 @@ public class BgtsController {
} }
return CommonResult.success("ok"); return CommonResult.success("ok");
} }
//
/** // @ApiOperation("Pacs补偿采集接口")
* // @ApiImplicitParams({
* @param emamNo // @ApiImplicitParam(name = "empId",value = "住院号",required = true,dataTypeClass = String.class),
* @return // @ApiImplicitParam(name = "admissDate",value = "入院时间",required = true),
*/ // @ApiImplicitParam(name = "disDate",value = "出院时间",required = true),
@ApiOperation("按需采集接口") // @ApiImplicitParam(name = "times",value = "住院次数",required = true)
@ApiImplicitParams({ // })
@ApiImplicitParam(name = "emamNo",value = "报告单号",required = true,dataTypeClass = String.class), // @GetMapping("/collectPacsCompensate")
@ApiImplicitParam(name = "empId",value = "患者主索引号",required = true,dataTypeClass = String.class) // public CommonResult<String> collectPacs(
}) // @RequestParam("empId") String empId,
@GetMapping("/collectByExamNo") // @RequestParam("admissDate") String admissDate,
public CommonResult<String> collectByExamNo(@RequestParam("emamNo") String emamNo, // @RequestParam("disDate") String disDate,
@RequestParam("empId") String empId){ // @RequestParam("times") String times){
try { // try {
logger.info("按需采集接口接受参数:\nempId--"+empId+"\nemamNo--"+emamNo); // logger.info("采集接口接收到参数:\nempId--"+empId);
bgtsService.collectByExamNo(emamNo,empId); // bgtsService.collectPacs(empId,admissDate,disDate,times);
// afCollectTaskService.updateInterfaceCollect(collectSubId, 1); // logger.info("采集完成");
}catch (RuntimeException e) { // logger.info("------------采集结束-----------");
e.printStackTrace(); // } catch (RuntimeException e) {
return CommonResult.failed(e.getMessage()); // e.printStackTrace();
} // try {
catch (Exception e) { // }catch (Exception e1) {
e.printStackTrace(); // logger.info(e1.getMessage());
} // return CommonResult.failed(e1.getMessage());
return CommonResult.success("ok"); // }
} // return CommonResult.failed(e.getMessage());
// }
/** // catch (Exception e) {
* // e.printStackTrace();
*/ // }
@GetMapping("/collectByEx") // return CommonResult.success("ok");
public CommonResult<String> collectByEx(@RequestParam("empId") String empId){ // }
try{ //
bgtsService.collect(empId); // @ApiOperation("Pacs根据出院时间区间补偿采集接口")
}catch (Exception e){ // @ApiImplicitParams({
e.printStackTrace(); // @ApiImplicitParam(name = "startDate",value = "开始时间",required = true),
return CommonResult.failed(e.getMessage()); // @ApiImplicitParam(name = "endDate",value = "结束时间",required = true)
} // })
return CommonResult.success("ok"); // @GetMapping("/collectPacsByDate")
} // public CommonResult<String> collectPacsByDate(
// @RequestParam("startDate") String startDate,
/** // @RequestParam("endDate") String endDate){
* pacs // try {
*/ // logger.info("根据出院时间区间补偿采集接口收到参数:\n"+startDate+"\t"+endDate);
@ApiOperation("pacs按需采集接口") // bgtsService.collectPacsByDate(startDate,endDate);
@GetMapping("/collectByPacs") // logger.info("采集完成");
public CommonResult<String> collectByPacs(){ // logger.info("------------采集结束-----------");
try{ // } catch (RuntimeException e) {
bgtsService.collectPacss(); // e.printStackTrace();
}catch (Exception e){ // try {
e.printStackTrace(); // }catch (Exception e1) {
return CommonResult.failed(e.getMessage()); // logger.info(e1.getMessage());
} // return CommonResult.failed(e1.getMessage());
return CommonResult.success("ok"); // }
} // return CommonResult.failed(e.getMessage());
// }
// catch (Exception e) {
// e.printStackTrace();
// }
// return CommonResult.success("ok");
// }

@ -1,4 +1,7 @@
package com.docus.bgts.facade; package com.docus.bgts.facade;
import java.util.Date;
public interface IBgtsService { public interface IBgtsService {
/** /**
* id * id
@ -50,7 +53,17 @@ public interface IBgtsService {
*/ */
void collectSealEcg(String sealId) throws Exception; 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 collectPacss();
void collectPacsByDate(String startDate, String endDate);
/** /**
* *
* @param emamNo * @param emamNo

@ -274,25 +274,29 @@ public class BgtsServiceImpl implements IBgtsService {
} }
@Override @Override
public void collectPacs(String empId, String admissDate, String disDate, String times) throws Exception { public void collectPacs(String empId, String admissDate, String disDate, String times) {
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd"); try {
Date ad = sim.parse(admissDate); SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
Date di = sim.parse(disDate); Date ad = sim.parse(admissDate);
String admiss = sim.format(ad); Date di = sim.parse(disDate);
String dis = sim.format(di); String admiss = sim.format(ad);
//通过empId获取报告单号集合 String dis = sim.format(di);
List<String[]> exams = getExamNoByInpNo(empId, admiss, dis); //通过empId获取报告单号集合
String jzh = afCollectTaskService.getJzhByInpatientNo(empId,times); List<String[]> exams = getExamNoByInpNo(empId, admiss, dis);
if (null == jzh) { String jzh = afCollectTaskService.getJzhByInpatientNo(empId, times);
logger.info("通过住院号与住院次数未匹配到患者"); if (null == jzh) {
return; 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 @Override
@ -417,6 +421,13 @@ public class BgtsServiceImpl implements IBgtsService {
logger.info("--------------全量采集结束------------------"); logger.info("--------------全量采集结束------------------");
} }
@Override
public void collectSmByDate(String startDate, String endDate) {
logger.info("----------手麻采集开始时间:"+startDate+" 结束时间:"+endDate+"------");
collectByDates(startDate, endDate);
logger.info("----------手麻采集结束-");
}
@Override @Override
public void collectPacss(){ public void collectPacss(){
logger.info("按需采集任务执行----"); 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 @Override
public void timerCollect() { public void timerCollect() {
logger.info("------采集器开始采集---------"); logger.info("------采集器开始采集---------");
@ -484,46 +536,84 @@ public class BgtsServiceImpl implements IBgtsService {
public void collectByDate(String startDate, String endDate, String collectorId,String isDead) { public void collectByDate(String startDate, String endDate, String collectorId,String isDead) {
logger.info("按需采集开始----------开始时间---" + startDate + "------结束时间---" + endDate); logger.info("按需采集开始----------开始时间---" + startDate + "------结束时间---" + endDate);
//页码 //页码
int startrow; // int startrow;
//每页10条数据 // //每页10条数据
int endrow = 10; // int endrow = 10;
//2.获取第一页10条数据开始采集 // //2.获取第一页10条数据开始采集
try{ try{
List<Map> patientIds; // List<Map> patientIds;
for (startrow = 0; ; startrow += 10) { // for (startrow = 0; ; startrow += 10) {
if (("1").equals(isDead)){ // if (("1").equals(isDead)){
patientIds=afCollectTaskService.getjzhByDateAndIsDead(startDate, endDate, startrow, endrow); // 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("按需采集死亡患者----"); logger.info("按需采集死亡患者----");
}else { } else {
patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow); patientIds = afCollectTaskService.getjzhByDate(startDate, endDate, startrow, endrow);
} }
if (null == patientIds || patientIds.size() <= 0) { if (patientIds == null || patientIds.isEmpty()) {
logger.info("未查询到按需采集患者!"); logger.info("未查询到按需采集患者!");
break; hasMoreData = false;
} } else {
for (Map patientId : patientIds) { for (Map patientId : patientIds) {
if (patientId != null) { if (patientId != null) {
try { try {
logger.info("按需采集------患者" + patientId.get("inpatient_no")); logger.info("按需采集------患者" + patientId.get("inpatient_no"));
logger.info("处理按需采集第" + startrow + "条数据----"); logger.info("处理按需采集第" + startrow + "条数据----");
if (collectorId.equals("3")) { if (collectorId.equals("3")) {
collectPacs(String.valueOf(patientId.get("inpatient_no")), String.valueOf(patientId.get("admiss_date")) 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")));
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times"))); } else if (collectorId.equals("4") || collectorId.equals("23")) {
} 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")));
collectEcg(String.valueOf(patientId.get("jzh")), String.valueOf(patientId.get("admiss_date")) } else {
, String.valueOf(patientId.get("dis_date")), String.valueOf(patientId.get("admiss_times"))); collect(String.valueOf(patientId.get("jzh")));
} 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){ }catch (Exception e){
logger.error(e.getMessage()); logger.error(e.getMessage());
}catch (Throwable t) { }catch (Throwable t) {

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

Loading…
Cancel
Save