手麻重症采集器

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

@ -2,13 +2,13 @@
//, //,
"directory":["Msg","ReportInfo"], "directory":["Msg","ReportInfo"],
// //
"indexFlag":"jzh", "indexFlag":"就诊号",
// //
"serialnum":"SAMPLE_NO", "serialnum":"手术申请单号",
// //
"filetitle":"TEST_ITEM_NAME", "filetitle":"文书名",
// //
"downurl":"IMAGE_URL", "downurl":"WEB_ADDRESS",
//id //id
"assortid":"15E7FE7803F545CB81390BC88E725240", "assortid":"15E7FE7803F545CB81390BC88E725240",
//id //id
@ -40,6 +40,12 @@
// //
"startCollectTime":"2016-04-11", "startCollectTime":"2016-04-11",
// 1: 0 : // 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; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id 雪花算法") @ApiModelProperty(value = "id 雪花算法")
@TableId(value = "id", type = IdType.ID_WORKER_STR) @TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id; private Long id;
@ApiModelProperty(value = "病案主键") @ApiModelProperty(value = "病案主键")

@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import javax.xml.crypto.Data; import javax.xml.crypto.Data;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
public interface VDocumentPdfMapper { public interface VDocumentPdfMapper {
/** /**
@ -16,8 +17,12 @@ public interface VDocumentPdfMapper {
* @param date * @param date
* @return * @return
*/ */
List<VDocumentPdf> listCollectPage(@Param("current") int current, List<Map> listCollectPage(@Param("current") int current,
@Param("size") int size, @Param("size") int size,
@Param("startTime") String startCollectTime, @Param("startTime") String startCollectTime,
@Param("endTime") String date); @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.io.ByteArrayInputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -78,7 +77,7 @@ public class BgtsServiceImpl implements IBgtsService {
} }
@Override @Override
public void collectAll() { public void collectAll() {
logger.info("----------全量采集开始-----------"); logger.info("----------全量采集开始-----------");
//1.获取最早采集日期 //1.获取最早采集日期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -106,7 +105,6 @@ public class BgtsServiceImpl implements IBgtsService {
int current; int current;
//每页10条数据 //每页10条数据
int size; int size;
List<VDocumentPdf> vDocumentPdfs;
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")));
@ -114,42 +112,55 @@ public class BgtsServiceImpl implements IBgtsService {
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 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条数据开始采集 //2.获取第一页10条数据开始采集
for (current = 1; ; current++) { for (current = 1; ; current++) {
size = 10 * current; size = 10 * current;
vDocumentPdfs = vDocumentPdfMapper.listCollectPage(current, size, startDate, endDate); maps = vDocumentPdfMapper.listCollectPage(current, size, startDate, endDate, namespace, tableName, fieldArr, collectTimeName);
logger.info("处理采集数据:"+vDocumentPdfs); logger.info("处理采集数据:"+maps);
if (null == vDocumentPdfs || vDocumentPdfs.size() <= 0) { if (null == maps || maps.size() <= 0) {
break; break;
} }
vDocumentPdfs.stream().forEach(vDocumentPdf -> { maps.stream().forEach(map -> {
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(vDocumentPdf.getPATIENT_ID()); reportDownPatientDto.setJzh(String.valueOf(map.get(indexFlag)));
reportDownDto.setPatient(reportDownPatientDto); reportDownDto.setPatient(reportDownPatientDto);
List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>(); List<ReportDownScanFileDto> reportDownScanFileDtos = new ArrayList<>();
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setDownurl(vDocumentPdf.getWEB_ADDRESS()); reportDownScanFileDto.setDownurl(String.valueOf(map.get(downurl)));
reportDownScanFileDto.setFilestoragetype(filestoragetype); reportDownScanFileDto.setFilestoragetype(filestoragetype);
reportDownScanFileDto.setFilesource(filesource); reportDownScanFileDto.setFilesource(filesource);
reportDownScanFileDto.setFiletitle(vDocumentPdf.get()); reportDownScanFileDto.setFiletitle(String.valueOf(map.get(filetitle)));
reportDownScanFileDto.setSerialnum(StringUtils.isNotBlank(vDocumentPdf.get())?vDocumentPdf.get():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);
afCollectTaskService.insert(reportDownDto); String post;
String post = null;
try { try {
afCollectTaskService.insert(reportDownDto);
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);
if (String.valueOf(resMap.get("code")).equals("500")) { if (String.valueOf(resMap.get("code")).equals("500")) {
throw new RuntimeException(String.valueOf(resMap.get("msg"))); throw new RuntimeException(String.valueOf(resMap.get("msg")));
} }
} catch (Exception e) { } catch (Exception e) {
logger.info("手麻采集出错:"+reportDownDto); logger.info("采集出错:"+reportDownDto);
addMrReportErrorLog(reportDownDto); addMrReportErrorLog(reportDownDto);
e.printStackTrace(); e.printStackTrace();
} }
@ -159,7 +170,7 @@ public class BgtsServiceImpl implements IBgtsService {
@Override @Override
public void timerCollect() { public void timerCollect() {
logger.info("------手麻采集器开始采集---------"); logger.info("------采集器开始采集---------");
//1.获取上次采集时间 //1.获取上次采集时间
Date time = afCollectAddMapper.getTimeByAdd(); Date time = afCollectAddMapper.getTimeByAdd();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -170,7 +181,7 @@ public class BgtsServiceImpl implements IBgtsService {
collectByDates(startDate, endDate); collectByDates(startDate, endDate);
//更新采集时间 //更新采集时间
addAfCollectAdd(date); addAfCollectAdd(date);
logger.info("--------手麻采集器结束采集------"); logger.info("--------采集器结束采集------");
} }
/** /**

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

Loading…
Cancel
Save