手麻重症采集器

docus-active-query-service_1.3
lzy 4 years ago
parent 6ed606a579
commit 2c79ddae80

@ -2,13 +2,13 @@
//,
"directory":["Msg","ReportInfo"],
//
"indexFlag":"jzh",
"indexFlag":"就诊号",
//
"serialnum":"SAMPLE_NO",
"serialnum":"手术申请单号",
//
"filetitle":"TEST_ITEM_NAME",
"filetitle":"文书名",
//
"downurl":"IMAGE_URL",
"downurl":"WEB_ADDRESS",
//id
"assortid":"15E7FE7803F545CB81390BC88E725240",
//id
@ -40,6 +40,12 @@
//
"startCollectTime":"2016-04-11",
// 1: 0 :
"isStartCollect":"1"
"isStartCollect":"1",
//oracle
"namespace":"DOCUS",
//oracle
"tableName":"V_DOCUMENT_PDF",
//oracle
"collectTimeName":"ARCHIVE_DATE_TIME"
}

@ -26,7 +26,7 @@ public class AfCollectTask implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id 雪花算法")
@TableId(value = "id", type = IdType.ID_WORKER_STR)
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
@ApiModelProperty(value = "病案主键")

@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface VDocumentPdfMapper {
/**
@ -16,8 +17,12 @@ public interface VDocumentPdfMapper {
* @param date
* @return
*/
List<VDocumentPdf> listCollectPage(@Param("current") int current,
@Param("size") int size,
@Param("startTime") String startCollectTime,
@Param("endTime") String date);
List<Map> listCollectPage(@Param("current") int current,
@Param("size") int size,
@Param("startTime") String startCollectTime,
@Param("endTime") String date,
@Param("namespace") String namespace,
@Param("tableName") String tableName,
@Param("fieldArr") List<String> fieldArr,
@Param("collectTimeName") String collectTimeName);
}

@ -25,7 +25,6 @@ import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -78,7 +77,7 @@ public class BgtsServiceImpl implements IBgtsService {
}
@Override
public void collectAll() {
public void collectAll() {
logger.info("----------全量采集开始-----------");
//1.获取最早采集日期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -106,7 +105,6 @@ public class BgtsServiceImpl implements IBgtsService {
int current;
//每页10条数据
int size;
List<VDocumentPdf> vDocumentPdfs;
String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid"));
String assortid = String.valueOf(FileUtils.getJsonByName("assortid"));
int filesource = Integer.parseInt(String.valueOf(FileUtils.getJsonByName("filesource")));
@ -114,42 +112,55 @@ public class BgtsServiceImpl implements IBgtsService {
Map<String, Object> headMap = new HashMap<>();
headMap.put("Content-Type", "application/json");
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(0, 0);
String indexFlag = String.valueOf(FileUtils.getJsonByName("indexFlag"));
String serialnum = String.valueOf(FileUtils.getJsonByName("serialnum"));
String filetitle = String.valueOf(FileUtils.getJsonByName("filetitle"));
String downurl = String.valueOf(FileUtils.getJsonByName("downurl"));
List<String> fieldArr=new ArrayList<>();
fieldArr.add(indexFlag);
fieldArr.add(serialnum);
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条数据开始采集
for (current = 1; ; current++) {
size = 10 * current;
vDocumentPdfs = vDocumentPdfMapper.listCollectPage(current, size, startDate, endDate);
logger.info("处理采集数据:"+vDocumentPdfs);
if (null == vDocumentPdfs || vDocumentPdfs.size() <= 0) {
maps = vDocumentPdfMapper.listCollectPage(current, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
logger.info("处理采集数据:"+maps);
if (null == maps || maps.size() <= 0) {
break;
}
vDocumentPdfs.stream().forEach(vDocumentPdf -> {
maps.stream().forEach(map -> {
ReportDownDto reportDownDto = new ReportDownDto();
reportDownDto.setCollectorid(collectorid);
reportDownDto.setAssortid(assortid);
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto();
reportDownPatientDto.setJzh(vDocumentPdf.getPATIENT_ID());
reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
reportDownDto.setPatient(reportDownPatientDto);
List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>();
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setDownurl(vDocumentPdf.getWEB_ADDRESS());
reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
reportDownScanFileDto.setFilestoragetype(filestoragetype);
reportDownScanFileDto.setFilesource(filesource);
reportDownScanFileDto.setFiletitle(vDocumentPdf.get());
reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(vDocumentPdf.get())?vDocumentPdf.get():String.valueOf(idWorker.nextId()));
reportDownScanFileDto.setFiletitle(String.valueOf(map.get(filetitle)));
reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(String.valueOf(map.get(serialnum)))?String.valueOf(map.get(serialnum)):String.valueOf(idWorker.nextId()));
reportDownScanFileDtos.add(reportDownScanFileDto);
reportDownDto.setScanfiles(reportDownScanFileDtos);
afCollectTaskService.insert(reportDownDto);
String post = null;
String post;
try {
afCollectTaskService.insert(reportDownDto);
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);
if (String.valueOf(resMap.get("code")).equals("500")) {
throw new RuntimeException(String.valueOf(resMap.get("msg")));
}
} catch (Exception e) {
logger.info("手麻采集出错:"+reportDownDto);
logger.info("采集出错:"+reportDownDto);
addMrReportErrorLog(reportDownDto);
e.printStackTrace();
}
@ -159,7 +170,7 @@ public class BgtsServiceImpl implements IBgtsService {
@Override
public void timerCollect() {
logger.info("------手麻采集器开始采集---------");
logger.info("------采集器开始采集---------");
//1.获取上次采集时间
Date time = afCollectAddMapper.getTimeByAdd();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -170,7 +181,7 @@ public class BgtsServiceImpl implements IBgtsService {
collectByDates(startDate, endDate);
//更新采集时间
addAfCollectAdd(date);
logger.info("--------手麻采集器结束采集------");
logger.info("--------采集器结束采集------");
}
/**

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.bgts.mapper.dboracle.VDocumentPdfMapper">
<select id="listCollectPage" resultType="com.docus.bgts.entity.VDocumentPdf">
<select id="listCollectPage" resultType="map">
SELECT
*
FROM
@ -14,15 +14,13 @@
FROM
(
SELECT
"DOCUS"."V_DOCUMENT_PDF"."手术申请单号",
"DOCUS"."V_DOCUMENT_PDF"."文书名",
"DOCUS"."V_DOCUMENT_PDF"."WEB_ADDRESS",
"DOCUS"."V_DOCUMENT_PDF"."PATIENT_ID",
"DOCUS"."V_DOCUMENT_PDF"."ARCHIVE_DATE_TIME"
<foreach collection="fieldArr" item="field" separator=",">
"${namespace}"."${tableName}"."${field}"
</foreach>
FROM
"DOCUS"."V_DOCUMENT_PDF"
"${namespace}"."${tableName}"
WHERE
"ARCHIVE_DATE_TIME" BETWEEN TO_DATE ( #{startTime}, 'YYYY-MM-DD HH24:MI:SS' )
"${collectTimeName}" BETWEEN TO_DATE ( #{startTime}, 'YYYY-MM-DD HH24:MI:SS' )
AND TO_DATE ( #{endTime}, 'YYYY-MM-DD HH24:MI:SS' )
) "NAVICAT_TABLE"
WHERE

Loading…
Cancel
Save