|
|
|
@ -6,6 +6,8 @@ import cn.hutool.http.HttpUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.docus.infrastructure.web.api.CommonResult;
|
|
|
|
|
import com.docus.infrastructure.web.api.ResultCode;
|
|
|
|
|
import com.docus.server.collection.entity.TBasic;
|
|
|
|
|
import com.docus.server.collection.service.ITBasicService;
|
|
|
|
|
import com.docus.server.report.api.DownPlatformService;
|
|
|
|
|
import com.docus.server.report.api.dto.ReportDownDto;
|
|
|
|
|
import com.docus.server.report.api.dto.ReportDownPatientDto;
|
|
|
|
@ -24,10 +26,7 @@ import sun.misc.BASE64Encoder;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 上报下载监听
|
|
|
|
@ -43,12 +42,31 @@ public class ReportDownListener {
|
|
|
|
|
@Resource
|
|
|
|
|
private AfReportRecordMapper afReportRecordMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ITBasicService itBasicService;
|
|
|
|
|
|
|
|
|
|
@EventListener
|
|
|
|
|
@Async("threadPoolExecutor")
|
|
|
|
|
public void threePartyPushReportDown(ThreePartyPushReportDownEvent threePartyPushReportDownEvent) {
|
|
|
|
|
// 根据任务id获取上报记录信息
|
|
|
|
|
AfReportRecord afReportRecord = afReportRecordMapper.getReportRecordInfoByTaskId(threePartyPushReportDownEvent.getTaskId());
|
|
|
|
|
|
|
|
|
|
// 病案是否是婴儿
|
|
|
|
|
boolean isBaby = itBasicService.getIsBabyBasic(afReportRecord.getPatientId());
|
|
|
|
|
if (isBaby) {
|
|
|
|
|
// 如果是婴儿查找母亲的信息
|
|
|
|
|
TBasic parentPatientInfo = itBasicService.getSdRyParentPatientInfo(afReportRecord.getPatientId());
|
|
|
|
|
if (Objects.isNull(parentPatientInfo)) {
|
|
|
|
|
log.warn("住院号:{},住院次数:{},病案主键:{} 是婴儿病案,未关联查询到母亲信息,不进行下载!", afReportRecord.getInpatientNo(), afReportRecord.getAdmissTimes(), afReportRecord.getPatientId());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 婴儿的报告要推给母亲,修改为母亲信息
|
|
|
|
|
afReportRecord.setPatientId(parentPatientInfo.getPatientId());
|
|
|
|
|
afReportRecord.setInpatientNo(parentPatientInfo.getInpatientNo());
|
|
|
|
|
afReportRecord.setAdmissTimes(parentPatientInfo.getAdmissTimes());
|
|
|
|
|
afReportRecord.setJzh(parentPatientInfo.getJzh());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 组织基础信息数据
|
|
|
|
|
ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(afReportRecord);
|
|
|
|
|
|
|
|
|
@ -75,7 +93,6 @@ public class ReportDownListener {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventListener
|
|
|
|
|
@Async("threadPoolExecutor")
|
|
|
|
|
public void taskConsumptionReporDown(TaskConsumptionReportDownEvent taskConsumptionReportDownEvent) {
|
|
|
|
@ -102,17 +119,16 @@ public class ReportDownListener {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
|
BASE64Encoder encoder = new BASE64Encoder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String url="http://192.168.161.102:9291/api/downplatform/scansionReportBatch";
|
|
|
|
|
String url = "http://192.168.161.102:9291/api/downplatform/scansionReportBatch";
|
|
|
|
|
// String url="http://127.0.0.1:9291/api/downplatform/scansionReportBatch";
|
|
|
|
|
Map<String, Object> bodyMap=new HashMap<>();
|
|
|
|
|
Map<String, Object> patientMap=new HashMap<>();
|
|
|
|
|
patientMap.put("patientid","8099350542");
|
|
|
|
|
List<Map<String, Object>> scanfiles=new ArrayList<>();
|
|
|
|
|
Map<String, Object> bodyMap = new HashMap<>();
|
|
|
|
|
Map<String, Object> patientMap = new HashMap<>();
|
|
|
|
|
patientMap.put("patientid", "8099350542");
|
|
|
|
|
List<Map<String, Object>> scanfiles = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FileInputStream inputStream = new FileInputStream("d://wyb.png");
|
|
|
|
@ -130,31 +146,30 @@ public class ReportDownListener {
|
|
|
|
|
// scanfile1Map.put("serialnum","嘉时测试图片1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileInputStream inputStream2 = new FileInputStream("d://jianli_02.jpg");
|
|
|
|
|
System.out.println(inputStream2.available());
|
|
|
|
|
byte[] bytes2 = new byte[inputStream2.available()];
|
|
|
|
|
inputStream2.read(bytes2,0,inputStream2.available());
|
|
|
|
|
inputStream2.read(bytes2, 0, inputStream2.available());
|
|
|
|
|
inputStream2.close();
|
|
|
|
|
String base642 = encoder.encode(bytes2);
|
|
|
|
|
Map<String, Object> scanfile2Map=new HashMap<>();
|
|
|
|
|
scanfile2Map.put("assortid","docustestAssortID");
|
|
|
|
|
scanfile2Map.put("downurl",base642);
|
|
|
|
|
scanfile2Map.put("filestoragetype",1);
|
|
|
|
|
scanfile2Map.put("filetitle","嘉时测试图片2");
|
|
|
|
|
scanfile2Map.put("filetype","2");
|
|
|
|
|
scanfile2Map.put("serialnum","嘉时测试图片2");
|
|
|
|
|
Map<String, Object> scanfile2Map = new HashMap<>();
|
|
|
|
|
scanfile2Map.put("assortid", "docustestAssortID");
|
|
|
|
|
scanfile2Map.put("downurl", base642);
|
|
|
|
|
scanfile2Map.put("filestoragetype", 1);
|
|
|
|
|
scanfile2Map.put("filetitle", "嘉时测试图片2");
|
|
|
|
|
scanfile2Map.put("filetype", "2");
|
|
|
|
|
scanfile2Map.put("serialnum", "嘉时测试图片2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// scanfiles.add(scanfile1Map);
|
|
|
|
|
scanfiles.add(scanfile2Map);
|
|
|
|
|
bodyMap.put("patient",patientMap);
|
|
|
|
|
bodyMap.put("ip","wybtest");
|
|
|
|
|
bodyMap.put("collectorid","docus测试扫描");
|
|
|
|
|
bodyMap.put("scanfiles",scanfiles);
|
|
|
|
|
bodyMap.put("scanusercode","docus测试");
|
|
|
|
|
bodyMap.put("scanusername","docus测试");
|
|
|
|
|
bodyMap.put("patient", patientMap);
|
|
|
|
|
bodyMap.put("ip", "wybtest");
|
|
|
|
|
bodyMap.put("collectorid", "docus测试扫描");
|
|
|
|
|
bodyMap.put("scanfiles", scanfiles);
|
|
|
|
|
bodyMap.put("scanusercode", "docus测试");
|
|
|
|
|
bodyMap.put("scanusername", "docus测试");
|
|
|
|
|
HttpRequest post = HttpUtil.createPost(url);
|
|
|
|
|
post.timeout(5 * 1000);
|
|
|
|
|
post.header("Content-Type", "application/json; charset=utf-8");
|
|
|
|
|