按需采集更新

docus-active-query-service_1.3
tan 3 years ago
parent c71c830113
commit e3bcc934d4

@ -11,6 +11,8 @@
"downurl":"WEB_ADDRESS", "downurl":"WEB_ADDRESS",
//id //id
"assortid":"15E7FE7803F545CB81390BC88E725240", "assortid":"15E7FE7803F545CB81390BC88E725240",
//,
"filterReport":"病理送检标签,处方笺,麻醉处方精二-1,麻醉处方精二-2,术后镇痛",
//id //id
"collectorid":"14", "collectorid":"14",
//( 1:2) //( 1:2)

@ -17,6 +17,7 @@ public class MyConstruct {
@Autowired @Autowired
IBgtsService bgtsService; IBgtsService bgtsService;
private Logger logger = LogManager.getLogger(MyConstruct.class);
/** /**
* *
@ -35,15 +36,16 @@ public class MyConstruct {
/** /**
* *
*/ */
@PostConstruct // @PostConstruct
public void startCollectAll(){ // public void startCollectAll(){
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); // logger.info("全量采集开始------");
String startCollectTime = String.valueOf(FileUtils.getJsonByName("startCollectTime")); // String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect")); // String startCollectTime = String.valueOf(FileUtils.getJsonByName("startCollectTime"));
if(collectorid.equals(Codes.ZZCODE.getCode())&& StringUtils.isNotBlank(startCollectTime)&&isStartCollect!=null&&isStartCollect.equals("1")){ // String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect"));
bgtsService.collectAll(); // if(collectorid.equals(Codes.ZZCODE.getCode())&& StringUtils.isNotBlank(startCollectTime)&&isStartCollect!=null&&isStartCollect.equals("1")){
} // bgtsService.collectAll();
} // }
// }

@ -3,6 +3,7 @@ package com.docus.bgts.config;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.docus.bgts.entity.TableJsonRead; import com.docus.bgts.entity.TableJsonRead;
import com.docus.bgts.enums.Codes;
import com.docus.bgts.facade.IBgtsService; import com.docus.bgts.facade.IBgtsService;
import com.docus.bgts.service.CheckIntegrityService; import com.docus.bgts.service.CheckIntegrityService;
import com.docus.bgts.utils.FileUtils; import com.docus.bgts.utils.FileUtils;
@ -29,9 +30,9 @@ public class MyScheduling {
private final String tempDataFileName="collectTimeTemp"; private final String tempDataFileName="collectTimeTemp";
private final String lastTimeStr="lastTime"; private final String lastTimeStr="lastTime";
static { // static {
syncFlag=FileUtils.getJsonByName("syncFlag").toString(); // syncFlag=FileUtils.getJsonByName("syncFlag").toString();
} // }
@Autowired @Autowired
IBgtsService bgtsService; IBgtsService bgtsService;
@ -42,7 +43,7 @@ public class MyScheduling {
private Logger logger = LogManager.getLogger(MyScheduling.class); private Logger logger = LogManager.getLogger(MyScheduling.class);
//5分钟执行一次心跳 //5分钟执行一次心跳
/*@Scheduled(fixedRate = 1000 * 60 * 5) @Scheduled(fixedRate = 1000 * 60 * 5)
public void beat() { public void beat() {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid"))); params.put("code", String.valueOf(FileUtils.getJsonByName("collectorid")));
@ -52,7 +53,8 @@ public class MyScheduling {
e.printStackTrace(); e.printStackTrace();
logger.info("心跳推送出错,可能是住院服务没有开启"); logger.info("心跳推送出错,可能是住院服务没有开启");
} }
}*/ }
/** /**
@ -62,10 +64,6 @@ public class MyScheduling {
// @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"));
// String isStartCollect = String.valueOf(FileUtils.getJsonByName("isStartCollect"));
// if (isStartCollect.equals("0")) {
// return;
// }
// if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) { // if ((!collectorid.equals(Codes.SMCODE.getCode())) && (!collectorid.equals(Codes.ZZCODE.getCode()))) {
// return; // return;
// } // }
@ -74,9 +72,9 @@ public class MyScheduling {
/** /**
* *
* 5 * 10
*/ */
@Scheduled(fixedRate = 1000 * 5 ) @Scheduled(fixedRate = 1000 * 60 *10 )
public void collectByExamNo(){ public void collectByExamNo(){
String collectOpen = String.valueOf(FileUtils.getJsonByName("collectOpen")); String collectOpen = String.valueOf(FileUtils.getJsonByName("collectOpen"));
if (collectOpen.equals("1")){ if (collectOpen.equals("1")){
@ -91,42 +89,42 @@ public class MyScheduling {
/** /**
* *
*/ */
@Scheduled(fixedRate = 1000 * 5 * 60) // @Scheduled(fixedRate = 1000 * 5 * 60)
public void syncIntegrality() { // public void syncIntegrality() {
if (null == syncFlag || "0".equals(syncFlag)) { // if (null == syncFlag || "0".equals(syncFlag)) {
//
} else { // } else {
//获取最后时间 // //获取最后时间
String lastDate = getLastDate(); // String lastDate = getLastDate();
if(StringUtils.isNotBlank(lastDate)) { // if(StringUtils.isNotBlank(lastDate)) {
Date date = new Date(); // Date date = new Date();
boolean flag = checkIntegrityService.addSyncIntegrality(lastDate, null); // boolean flag = checkIntegrityService.addSyncIntegrality(lastDate, null);
if(flag) { // if(flag) {
refreshLastDate(date); // refreshLastDate(date);
} // }
}else{ // }else{
logger.info("采集时间为空"); // logger.info("采集时间为空");
} // }
} // }
} // }
/** /**
* *
* @return * @return
*/ */
private String getLastDate(){ // private String getLastDate(){
TableJsonRead tableJsonRead = new TableJsonRead(); // TableJsonRead tableJsonRead = new TableJsonRead();
Map<String,String> map = tableJsonRead.Read(tempfilePrefix, tempDataFileName,Map.class); // Map<String,String> map = tableJsonRead.Read(tempfilePrefix, tempDataFileName,Map.class);
return map.get(lastTimeStr); // return map.get(lastTimeStr);
} // }
/** /**
* *
*/ */
private void refreshLastDate(Date lastDate){ // private void refreshLastDate(Date lastDate){
String lastTime = DateUtil.format(lastDate, "yyyy-MM-dd HH:mm:ss"); // String lastTime = DateUtil.format(lastDate, "yyyy-MM-dd HH:mm:ss");
TableJsonRead tableJsonRead = new TableJsonRead(); // TableJsonRead tableJsonRead = new TableJsonRead();
Map<String, String> map = new HashMap<>(); // Map<String, String> map = new HashMap<>();
map.put(lastTimeStr, lastTime); // map.put(lastTimeStr, lastTime);
tableJsonRead.Save(tempfilePrefix, tempDataFileName, JSON.toJSONString(map)); // tableJsonRead.Save(tempfilePrefix, tempDataFileName, JSON.toJSONString(map));
} // }
} }

@ -14,7 +14,7 @@ public interface AfCollectAddMapper extends BaseMapper<AfCollectAdd> {
/** /**
* *
*/ */
Date getTimeByAdd(); Date getTimeByAdd(Integer classIfy);
/** /**
* jzh * jzh

@ -70,7 +70,7 @@ public class BgtsServiceImpl implements IBgtsService {
//插入文件af_collect_task表数据 //插入文件af_collect_task表数据
afCollectTaskService.insert(reportDownDto); afCollectTaskService.insert(reportDownDto);
//通过报告单号集合采集 //通过报告单号集合采集
collectExams(exams, empId,reportDownDto); collectExams(exams, empId, reportDownDto);
} }
@Override @Override
@ -85,7 +85,7 @@ public class BgtsServiceImpl implements IBgtsService {
exams.add(strings); exams.add(strings);
//获取插入表数据 //获取插入表数据
ReportDownDto reportDownDto = getUrlCreateReportDto(exams, empId); ReportDownDto reportDownDto = getUrlCreateReportDto(exams, empId);
collectExams(exams, empId,reportDownDto); collectExams(exams, empId, reportDownDto);
} }
@Override @Override
@ -112,7 +112,7 @@ public class BgtsServiceImpl implements IBgtsService {
* @param startDate * @param startDate
* @param endDate * @param endDate
*/ */
/* private void collectByDates(String startDate, String endDate) { private void collectByDates(String startDate, String endDate) {
//页码 //页码
int current; int current;
//每页10条数据 //每页10条数据
@ -128,10 +128,10 @@ public class BgtsServiceImpl implements IBgtsService {
String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum")); String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum"));
String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle")); String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle"));
String downurl = String.valueOf(FileUtils.getJsonByName("downurl")); String downurl = String.valueOf(FileUtils.getJsonByName("downurl"));
List<String> fieldArr=new ArrayList<>(); List<String> fieldArr = new ArrayList<>();
fieldArr.add(indexFlag); fieldArr.add(indexFlag);
fieldArr.add(serialnum); fieldArr.add(serialnum);
if(StringUtils.isNotBlank(filetitle)){ if (StringUtils.isNotBlank(filetitle)) {
fieldArr.add(filetitle); fieldArr.add(filetitle);
} }
fieldArr.add(downurl); fieldArr.add(downurl);
@ -142,16 +142,26 @@ public class BgtsServiceImpl implements IBgtsService {
//2.获取第一页10条数据开始采集 //2.获取第一页10条数据开始采集
for (current = 1; ; current++) { for (current = 1; ; current++) {
size = 10 * current; size = 10 * current;
maps = vDocumentPdfMapper.listCollectPage(size-10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName); maps = vDocumentPdfMapper.listCollectPage(size - 10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
logger.info("处理采集数据:"+maps); logger.info("处理采集数据:" + maps);
if (null == maps || maps.size() <= 0) { if (null == maps || maps.size() <= 0) {
break; break;
} }
maps.stream().forEach(map -> { maps:
for (Map map : maps) {
//获取过滤报告单
String[] filterReports = String.valueOf(FileUtils.getJsonByName("filterReport")).split(",");
if (filterReports.length > 0) {
for (String filterReport : filterReports) {
//需要过滤的报告单存在则不采集
if (String.valueOf(map.get(filetitle)).equals(filterReport)) {
continue maps;
}
}
}
ReportDownDto reportDownDto = new ReportDownDto(); ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setCollectorid(collectorid); reportDownDto.setCollectorid(collectorid);
reportDownDto.setAssortid(assortid); reportDownDto.setAssortid(assortid);
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag))); reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
reportDownDto.setPatient(reportDownPatientDto); reportDownDto.setPatient(reportDownPatientDto);
@ -161,14 +171,15 @@ public class BgtsServiceImpl implements IBgtsService {
reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl))); reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
reportDownScanFileDto.setFilestoragetype(filestoragetype); reportDownScanFileDto.setFilestoragetype(filestoragetype);
reportDownScanFileDto.setFilesource(filesource); reportDownScanFileDto.setFilesource(filesource);
reportDownScanFileDto.setFiletitle(map.get(filetitle)==null?"重症"+(System.currentTimeMillis()):String.valueOf(map.get(filetitle))); reportDownScanFileDto.setFiletitle(map.get(filetitle) == null ? "重症" + (System.currentTimeMillis()) : String.valueOf(map.get(filetitle)));
reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId())); reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum))) ? String.valueOf(map.get(serialnum)) : String.valueOf(idWorker.nextId()));
reportDownScanFileDtos.add(reportDownScanFileDto); reportDownScanFileDtos.add(reportDownScanFileDto);
reportDownDto.setScanfiles(reportDownScanFileDtos); reportDownDto.setScanfiles(reportDownScanFileDtos);
String post; String post;
try { try {
afCollectTaskService.insert(reportDownDto); afCollectTaskService.insert(reportDownDto);
//String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector")); //String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
//调用下载接口
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class)); post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
Map resMap = JSON.parseObject(post, Map.class); Map resMap = JSON.parseObject(post, Map.class);
logger.info(reportDownDto); logger.info(reportDownDto);
@ -177,105 +188,111 @@ public class BgtsServiceImpl implements IBgtsService {
} }
} catch (Exception e) { } catch (Exception e) {
//打印错误日志 //打印错误日志
logger.info("采集出错:"+reportDownDto); logger.info("采集出错:" + reportDownDto);
logger.info(e); logger.info(e);
String stackTrace = ExceptionUtils.getStackTrace(e); String stackTrace = ExceptionUtils.getStackTrace(e);
logger.info("错误信息----------"+stackTrace); logger.info("错误信息----------" + stackTrace);
addMrReportErrorLog(reportDownDto); addMrReportErrorLog(reportDownDto);
e.printStackTrace(); e.printStackTrace();
} }
}); }
} }
}*/ }
/** /**
* *
* *
* @param startDate * @param startDate
* @param endDate * @param endDate
*/ */
private void collectByDates(String startDate, String endDate) { // private void collectByDates(String startDate, String endDate) {
//页码 // //页码
int current; // int current;
//每页10条数据 // //每页10条数据
int size; // int size;
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); // String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
String assortid = String.valueOf(FileUtils.getJsonByName("assortid")); // String assortid = String.valueOf(FileUtils.getJsonByName("assortid"));
int filesource = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource"))); // int filesource = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource")));
int filestoragetype = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype"))); // int filestoragetype = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filestoragetype")));
Map<String, Object> headMap = new HashMap<>(); // Map<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json"); // headMap.put("Content-Type", "application/json");
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0); // SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
String indexFlag = String.valueOf(FileUtils.getJsonByName("indexFlag")); // String indexFlag = String.valueOf(FileUtils.getJsonByName("indexFlag"));
String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum")); // String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum"));
//String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle")); // //String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle"));
String downurl = String.valueOf(FileUtils.getJsonByName("downurl")); // String downurl = String.valueOf(FileUtils.getJsonByName("downurl"));
List<String> fieldArr=new ArrayList<>(); // List<String> fieldArr=new ArrayList<>();
fieldArr.add(indexFlag); // fieldArr.add(indexFlag);
fieldArr.add(serialnum); // fieldArr.add(serialnum);
// if(StringUtils.isNotBlank(filetitle)){ //// if(StringUtils.isNotBlank(filetitle)){
// fieldArr.add(filetitle); //// fieldArr.add(filetitle);
//// }
// fieldArr.add(downurl);
// String namespace = String.valueOf(FileUtils.getJsonByName("namespace"));
// String tableName = String.valueOf(FileUtils.getJsonByName("tableName"));
// String collectTimeName = String.valueOf(FileUtils.getJsonByName("collectTimeName"));
// List<Map> maps;
// //2.获取第一页10条数据开始采集
// logger.info("开始时间-----"+startDate+"结束时间-----"+"\n"+endDate);
// for (current = 1; ; current++) {
// size = 10 * current;
// maps = vDocumentPdfMapper.listCollectPage(size-10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
// logger.info("处理采集数据:"+maps);
// if (null == maps || maps.size() <= 0) {
// break;
// }
// maps.stream().forEach(map -> {
// ReportDownDto reportDownDto = new ReportDownDto();
// reportDownDto.setCollectorid(collectorid);
// reportDownDto.setAssortid(assortid);
//
// ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
// reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
// reportDownDto.setPatient(reportDownPatientDto);
//
// List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>();
// ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
// reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
// reportDownScanFileDto.setFilestoragetype(filestoragetype);
// reportDownScanFileDto.setFilesource(filesource);
// //reportDownScanFileDto.setFiletitle(map.get(filetitle)==null?"重症"+(System.currentTimeMillis()):String.valueOf(map.get(filetitle)));
// reportDownScanFileDto.setFiletitle(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
// reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
// reportDownScanFileDtos.add(reportDownScanFileDto);
// reportDownDto.setScanfiles(reportDownScanFileDtos);
// String post;
// try {
// afCollectTaskService.insert(reportDownDto);
// //String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
// post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
// Map resMap = JSON.parseObject(post, Map.class);
// logger.info(reportDownDto);
// if (String.valueOf(resMap.get("code")).equals("500")) {
// throw new RuntimeException(String.valueOf(resMap.get("msg")));
// }
// } catch (Exception e) {
// //打印错误日志
// logger.info("采集出错:"+reportDownDto);
// logger.info(e);
// String stackTrace = ExceptionUtils.getStackTrace(e);
// logger.info("错误信息----------"+stackTrace);
// addMrReportErrorLog(reportDownDto);
// e.printStackTrace();
// }
// });
// } // }
fieldArr.add(downurl); // }
String namespace = String.valueOf(FileUtils.getJsonByName("namespace"));
String tableName = String.valueOf(FileUtils.getJsonByName("tableName"));
String collectTimeName = String.valueOf(FileUtils.getJsonByName("collectTimeName"));
List<Map> maps;
//2.获取第一页10条数据开始采集
logger.info("开始时间-----"+startDate+"结束时间-----"+"\n"+endDate);
for (current = 1; ; current++) {
size = 10 * current;
maps = vDocumentPdfMapper.listCollectPage(size-10, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
logger.info("处理采集数据:"+maps);
if (null == maps || maps.size() <= 0) {
break;
}
maps.stream().forEach(map -> {
ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setCollectorid(collectorid);
reportDownDto.setAssortid(assortid);
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
reportDownDto.setPatient(reportDownPatientDto);
List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>();
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
reportDownScanFileDto.setFilestoragetype(filestoragetype);
reportDownScanFileDto.setFilesource(filesource);
//reportDownScanFileDto.setFiletitle(map.get(filetitle)==null?"重症"+(System.currentTimeMillis()):String.valueOf(map.get(filetitle)));
reportDownScanFileDto.setFiletitle(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
reportDownScanFileDtos.add(reportDownScanFileDto);
reportDownDto.setScanfiles(reportDownScanFileDtos);
String post;
try {
afCollectTaskService.insert(reportDownDto);
//String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
Map resMap = JSON.parseObject(post, Map.class);
logger.info(reportDownDto);
if (String.valueOf(resMap.get("code")).equals("500")) {
throw new RuntimeException(String.valueOf(resMap.get("msg")));
}
} catch (Exception e) {
//打印错误日志
logger.info("采集出错:"+reportDownDto);
logger.info(e);
String stackTrace = ExceptionUtils.getStackTrace(e);
logger.info("错误信息----------"+stackTrace);
addMrReportErrorLog(reportDownDto);
e.printStackTrace();
}
});
}
}
@Override @Override
public void timerCollect() { public void timerCollect() {
logger.info("------采集器开始采集---------"); logger.info("------采集器开始采集---------");
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
//1.获取上次采集时间 //1.获取上次采集时间
Date time = afCollectAddMapper.getTimeByAdd(); Date time;
if (collectorid.equals("5")) {
time = afCollectAddMapper.getTimeByAdd(5);
}else {
time = afCollectAddMapper.getTimeByAdd(15);
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startDate = simpleDateFormat.format(time); String startDate = simpleDateFormat.format(time);
//当前日期 //当前日期
@ -294,7 +311,7 @@ public class BgtsServiceImpl implements IBgtsService {
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
AfCollectAdd afCollectAdd = new AfCollectAdd(); AfCollectAdd afCollectAdd = new AfCollectAdd();
afCollectAdd.setBeginStageDate(date); afCollectAdd.setBeginStageDate(date);
afCollectAddMapper.update(afCollectAdd,new QueryWrapper<AfCollectAdd>().eq("classify",collectorid)); afCollectAddMapper.update(afCollectAdd, new QueryWrapper<AfCollectAdd>().eq("classify", collectorid));
} }
/** /**
@ -317,7 +334,7 @@ public class BgtsServiceImpl implements IBgtsService {
* @param exams * @param exams
* @param empId * @param empId
*/ */
private void collectExams(List<String[]> exams, String empId,ReportDownDto reportDownDto) throws Exception { private void collectExams(List<String[]> exams, String empId, ReportDownDto reportDownDto) throws Exception {
//调用上传接口 //调用上传接口
Map<String, Object> headMap = new HashMap<>(); Map<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json"); headMap.put("Content-Type", "application/json");
@ -369,16 +386,16 @@ public class BgtsServiceImpl implements IBgtsService {
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setSerialnum(exam[0]); reportDownScanFileDto.setSerialnum(exam[0]);
reportDownScanFileDto.setFiletitle(exam[1]); reportDownScanFileDto.setFiletitle(exam[1]);
XmlUtils reqXmlUtils=new XmlUtils(FileUtils.getXmlDetailsPath()); XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlDetailsPath());
Element esbEntry = reqXmlUtils.getMsgElement(); Element esbEntry = reqXmlUtils.getMsgElement();
esbEntry.element("EXAM_NO").setText(exam[0]); esbEntry.element("EXAM_NO").setText(exam[0]);
String resXml = invokeWs(reqXmlUtils.getDocument().asXML()); String resXml = invokeWs(reqXmlUtils.getDocument().asXML());
logger.info("明细入参------------"+reqXmlUtils.getDocument().asXML()); logger.info("明细入参------------" + reqXmlUtils.getDocument().asXML());
//解析XML //解析XML
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8"))); XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8")));
String success = xmlUtils.isSuccess(); String success = xmlUtils.isSuccess();
if(!success.equals("ok")){ if (!success.equals("ok")) {
logger.info("发送错误:"+success); logger.info("发送错误:" + success);
throw new RuntimeException(success); throw new RuntimeException(success);
} }
List<String> dis = (List<String>) FileUtils.getJsonByName("bgtsDetailRespon"); List<String> dis = (List<String>) FileUtils.getJsonByName("bgtsDetailRespon");
@ -397,7 +414,7 @@ public class BgtsServiceImpl implements IBgtsService {
private List<String[]> getExamNo(String empId) throws Exception { private List<String[]> getExamNo(String empId) throws Exception {
List<String[]> exams = new ArrayList<>(); List<String[]> exams = new ArrayList<>();
XmlUtils reqXmlUtils=new XmlUtils(FileUtils.getXmlPath()); XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlPath());
Element reqElement = reqXmlUtils.getMsgElement(); Element reqElement = reqXmlUtils.getMsgElement();
reqElement.element("INHOSP_NO").setText(empId); reqElement.element("INHOSP_NO").setText(empId);
logger.info("-------根据患者主索引号查询多个报告单号,地址:" + wsUrl + ",方法:" + wsLocalMethod + "---------"); logger.info("-------根据患者主索引号查询多个报告单号,地址:" + wsUrl + ",方法:" + wsLocalMethod + "---------");
@ -412,8 +429,8 @@ public class BgtsServiceImpl implements IBgtsService {
//解析XML //解析XML
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8"))); XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8")));
String success = xmlUtils.isSuccess(); String success = xmlUtils.isSuccess();
if(!success.equals("ok")){ if (!success.equals("ok")) {
logger.info("发送错误:"+success); logger.info("发送错误:" + success);
throw new RuntimeException(success); throw new RuntimeException(success);
} }
List<String> dis = (List<String>) FileUtils.getJsonByName("bgtsRespon"); List<String> dis = (List<String>) FileUtils.getJsonByName("bgtsRespon");
@ -440,19 +457,20 @@ public class BgtsServiceImpl implements IBgtsService {
/** /**
* *
* @param startDate *
* @param endDate * @param startDate
* @param collectorId * @param endDate
* @param collectorId
*/ */
public void collectByDate(String startDate,String endDate,String collectorId){ public void collectByDate(String startDate, String endDate, String collectorId) {
//通过日期查询patientId集合 //通过日期查询patientId集合
List<String> patientIds = afCollectTaskService.getjzhByDate(startDate,endDate); List<String> patientIds = afCollectTaskService.getjzhByDate(startDate, endDate);
//通过patientId集合与采集器编号查询报告单号 //通过patientId集合与采集器编号查询报告单号
//List<String> c1s = afCollectTaskService.getC1ByPatientId(patientIds, collectorId); //List<String> c1s = afCollectTaskService.getC1ByPatientId(patientIds, collectorId);
//通过唯一报告单号查询patient_id //通过唯一报告单号查询patient_id
//List<String> patientIdByC1 = afCollectTaskService.getPatientIdByC1(c1s); //List<String> patientIdByC1 = afCollectTaskService.getPatientIdByC1(c1s);
//通过patientId集合查询jzh //通过patientId集合查询jzh
List<String> jzhs = afCollectTaskService.getJzhByPatientId(patientIds); //List<String> jzhs = afCollectTaskService.getJzhByPatientId(patientIds);
//int i = -1; //int i = -1;
//循环jzh与报告单号c1调用按需采集 //循环jzh与报告单号c1调用按需采集
// for (String c1 : c1s) { // for (String c1 : c1s) {
@ -470,10 +488,19 @@ public class BgtsServiceImpl implements IBgtsService {
// } // }
// } // }
try { try {
for (String jzh : jzhs) { for (String patientId : patientIds) {
collect(jzh); if (patientId!=null){
logger.info("按需采集------患者"+patientId);
collect(patientId);
}
} }
}catch (Exception e){ // for (String jzh : jzhs) {
// if (jzh!=null) {
// logger.info("按需采集------患者"+jzh);
// collect(jzh);
// }
// }
} catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

@ -44,7 +44,7 @@
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 --> <!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
<!-- com.liyan为根包也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG --> <!-- com.liyan为根包也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
<!-- 级别依次为【从高到低】FATAL > ERROR > WARN > INFO > DEBUG > TRACE --> <!-- 级别依次为【从高到低】FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
<!--<logger name="com.docus.bgts" level="debug"> <logger name="com.docus.bgts" level="INFO">
<appender-ref ref="demolog" /> <appender-ref ref="demolog" />
</logger>--> </logger>
</configuration> </configuration>

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.dbmysql.AfCollectAddMapper"> <mapper namespace="com.docus.bgts.mapper.dbmysql.AfCollectAddMapper">
<select id="getTimeByAdd" resultType="date"> <select id="getTimeByAdd" resultType="date">
select begin_stage_date from af_collect_add where classify=5 limit 0,1 select begin_stage_date from af_collect_add where classify=#{classIfy} limit 0,1
</select> </select>
<select id="listJzh" resultType="string"> <select id="listJzh" resultType="string">

@ -9,7 +9,7 @@
where jzh = #{jzh} where jzh = #{jzh}
</select> </select>
<select id="getjzhByDate" resultType="string"> <select id="getjzhByDate" resultType="string">
select patient_id select jzh
from docus_medicalrecord.t_basic from docus_medicalrecord.t_basic
where dis_date between #{startDate} and #{endDate} where dis_date between #{startDate} and #{endDate}
</select> </select>

Loading…
Cancel
Save