版本2 http采集器

docus-active-query-service_1.3
lzy 4 years ago
parent 9ad4a9eb07
commit 9ea5dcccfe

@ -0,0 +1,38 @@
<ESBEntry>
<AccessControl>
<SysFlag>1</SysFlag>
<UserName>WZHBAGL</UserName>
<Password>WZHBAGL_1127</Password>
<Fid>BS07002</Fid>
<OrderNo>BS07002S51001</OrderNo>
<SUBOR_HOSPITAL_DISTRICT>GZ</SUBOR_HOSPITAL_DISTRICT>
</AccessControl>
<MessageHeader>
<Fid>BS07002</Fid>
<OrderNo>BS07002S51001</OrderNo>
<SourceSysCode>S51</SourceSysCode>
<TargetSysCode>S00</TargetSysCode>
<MsgDate>2021-12-23 09:34:31</MsgDate>
</MessageHeader>
<RequestOption>
<triggerData>0</triggerData>
<dataAmount>500</dataAmount>
</RequestOption>
<MsgInfo flag="1">
<Msg/>
<distinct value="0"/>
<query item="WS_INPUT" compy=" = " value=" 1 " splice="AND"/>
<query_ws action="Q_WS_JCBGLBCX">
<content>
<Request>
<Msg>
<EXAM_NO></EXAM_NO>
</Msg>
</Request>
</content>
</query_ws>
</MsgInfo>
<GroupInfo flag="0">
<AS ID="" linkField=""/>
</GroupInfo>
</ESBEntry>

@ -12,7 +12,7 @@
//id
"assortid":"15E7FE7803F545CB81390BC88E725240",
//id
"collectorid":"5",
"collectorid":"14",
//( 1:2)
"filesource":1,
//(1:2ftp3)
@ -40,7 +40,7 @@
//
"startCollectTime":"2016-04-11",
// 1: 0 :
"isStartCollect":"1",
"isStartCollect":"0",
//oracle
"namespace":"DOCUS",
//oracle

@ -35,6 +35,13 @@ public class BgtsController {
@Autowired
IAfCollectTaskService afCollectTaskService;
@GetMapping("/test")
public String test(@RequestParam("empId") String empId,
@RequestParam("collectSubId") String collectSubId){
return bgtsService.test(collectSubId)+"---"+empId;
}
@ApiOperation("采集接口")
@ApiImplicitParams({
@ -42,10 +49,12 @@ public class BgtsController {
@ApiImplicitParam(name = "collectSubId",value = "af_interface_collect_sub表id",required = true)
})
@GetMapping("/collect")
public CommonResult<String> collect(@RequestParam("empId") String empId, @Param("collectSubId") String collectSubId) {
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) {
@ -53,6 +62,7 @@ public class BgtsController {
try {
afCollectTaskService.updateInterfaceCollect(collectSubId, 0);
}catch (Exception e1) {
logger.info(e1.getMessage());
return CommonResult.failed(e1.getMessage());
}
return CommonResult.failed(e.getMessage());

@ -1,5 +1,7 @@
package com.docus.bgts.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -9,6 +11,7 @@ import java.io.Serializable;
@Data
@ApiModel("文件库中的省中医病案采集-子任务表")
public class AfInterfaceCollectSub implements Serializable {
@TableId(value = "id",type = IdType.ASSIGN_ID)
private Long id;
@ApiModelProperty(value = "af_interface_collect表id")
private Long afInterfaceCollectId;

@ -30,6 +30,8 @@ public enum Codes {
ZZCODE ("15","重症代码"),
//xml地址
REQUEST_XML("0","\\dataConfig\\RequestParams.xml"),
//xml地址
REQUEST_details_XML("0","\\dataConfig\\RequestDetailsParams.xml"),
//患者主索引号
EMP_ID("0","indexFlag"),
//错误日志编号

@ -22,4 +22,6 @@ public interface IBgtsService {
*
*/
void timerCollect();
String test(String collectSubId);
}

@ -73,7 +73,10 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
save = afCollectTaskMapper.insert(afCollectTask);
if (save <= 0) {
throw new RuntimeException("插入病案任务表数据出错");
}else {
log.warn("插入病案成功");
}
} else {
//存在就修改
afCollectTask.setPatientId(patientId);
@ -83,6 +86,7 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
afCollectTask.setC1(scanfile.getSerialnum());
afCollectTask.setC2(scanfile.getFiletitle());
save = afCollectTaskMapper.updateById(afCollectTask);
log.warn("修改病案成功");
}
scanfile.setTaskid(afCollectTask.getId());
}
@ -91,7 +95,9 @@ public class AfCollectTaskServiceImpl extends ServiceImpl<AfCollectTaskMapper, A
@Override
public void updateInterfaceCollect(String collectSubId, int state) {
log.warn("开始记录采集");
AfInterfaceCollectSub afInterfaceCollectSub = afInterfaceCollectSubMapper.selectById(collectSubId);
log.warn("操作记录:"+afInterfaceCollectSub);
if (afInterfaceCollectSub == null) {
throw new RuntimeException("afInterfaceCollectSub表数据为空");
}

@ -9,6 +9,7 @@ import com.docus.bgts.enums.Codes;
import com.docus.bgts.facade.IAfCollectTaskService;
import com.docus.bgts.facade.IBgtsService;
import com.docus.bgts.mapper.dbmysql.AfCollectAddMapper;
import com.docus.bgts.mapper.dbmysql.AfInterfaceCollectSubMapper;
import com.docus.bgts.mapper.dbmysql.MrReportErrorMapper;
import com.docus.bgts.mapper.dboracle.VDocumentPdfMapper;
import com.docus.bgts.utils.*;
@ -43,6 +44,9 @@ public class BgtsServiceImpl implements IBgtsService {
@Autowired
VDocumentPdfMapper vDocumentPdfMapper;
@Autowired
AfInterfaceCollectSubMapper afInterfaceCollectSubMapper;
@Autowired
MrReportErrorMapper mrReportErrorMapper;
@ -186,6 +190,13 @@ public class BgtsServiceImpl implements IBgtsService {
logger.info("--------采集器结束采集------");
}
@Override
public String test(String collectSubId) {
AfInterfaceCollectSub x = afInterfaceCollectSubMapper.selectById(collectSubId);
System.out.println(x);
return x.toString();
}
/**
*
*/
@ -268,12 +279,17 @@ public class BgtsServiceImpl implements IBgtsService {
ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setSerialnum(exam[0]);
reportDownScanFileDto.setFiletitle(exam[1]);
XmlUtils reqXmlUtils=new XmlUtils(FileUtils.getXmlPath());
XmlUtils reqXmlUtils=new XmlUtils(FileUtils.getXmlDetailsPath());
Element esbEntry = reqXmlUtils.getMsgElement();
esbEntry.element("EXAM_NO").setText(exam[0]);
String resXml = invokeWs(reqXmlUtils.getDocument().asXML());
//解析XML
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8")));
String success = xmlUtils.isSuccess();
if(!success.equals("ok")){
logger.info("发送错误:"+success);
throw new RuntimeException(success);
}
List<String> dis = (List<String>) FileUtils.getJsonByName("bgtsDetailRespon");
//数据所在节点
Element element = xmlUtils.getElement(dis);
@ -304,6 +320,11 @@ public class BgtsServiceImpl implements IBgtsService {
logger.info("-----------------------------");
//解析XML
XmlUtils xmlUtils = new XmlUtils(new ByteArrayInputStream(resXml.getBytes("UTF-8")));
String success = xmlUtils.isSuccess();
if(!success.equals("ok")){
logger.info("发送错误:"+success);
throw new RuntimeException(success);
}
List<String> dis = (List<String>) FileUtils.getJsonByName("bgtsRespon");
//数据所在节点
Element element = xmlUtils.getElement(dis);

@ -34,6 +34,16 @@ public class FileUtils {
String path = FileUtils.currentPath();
return path + Codes.REQUEST_XML.getMessage();
}
/**
* xml
*
* @return
*/
public static String getXmlDetailsPath() {
//获取目录结构
String path = FileUtils.currentPath();
return path + Codes.REQUEST_details_XML.getMessage();
}
/**
*

@ -47,6 +47,23 @@ public class XmlUtils {
}
}
/**
* OK
* @return
*/
public String isSuccess(){
//获取根节点
Element root = document.getRootElement();
Element retInfo = root.element("RetInfo");
Element retCode = retInfo.element("RetCode");
String code = retCode.getText();
if(code.equals("0")){
return "ok";
}else {
return retInfo.element("RetCon").getText();
}
}
/**
*
* @return

@ -25,6 +25,7 @@ public class MyFilter implements Filter {
}else if(collectorid.equals(Codes.ZZCODE.getCode())){
logger.info("-----当前请求已被拦截...------");
}else {
logger.info("----已放行----");
filterChain.doFilter(servletRequest,servletResponse);
}
}

Loading…
Cancel
Save