|
|
|
@ -17,6 +17,8 @@ import javax.xml.rpc.encoding.XMLType;
|
|
|
|
|
|
|
|
|
|
import org.apache.axis.client.Service;
|
|
|
|
|
import org.apache.axis.utils.StringUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
@ -35,7 +37,6 @@ import java.util.*;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class CollectCheckService {
|
|
|
|
|
private Map<String,String> tokenCacheMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
private String FILENAME = "fileName";
|
|
|
|
|
private String FILEBASE64 = "fileBase64";
|
|
|
|
|
@Value("${siteCode}")
|
|
|
|
@ -55,12 +56,12 @@ public class CollectCheckService {
|
|
|
|
|
@Value("${downfileUrl}")
|
|
|
|
|
private String downfileUrl;
|
|
|
|
|
|
|
|
|
|
public boolean downFileWithCheck(String masterId,String hospBarcode,String reportOdd,String fileUrl) {
|
|
|
|
|
public boolean downFileWithCheck(String masterId,String hospBarcode,String reportOdd,String fileUrl,String applyId) {
|
|
|
|
|
//登录
|
|
|
|
|
String token = getTokenByCheckKey(siteCode, customerCode, collectionLocation);
|
|
|
|
|
System.out.println("获取token:"+token);
|
|
|
|
|
log.info("获取token:"+token);
|
|
|
|
|
//下载
|
|
|
|
|
return downFileWithCheck(masterId,hospBarcode,reportOdd,fileUrl,token);
|
|
|
|
|
return downFileWithCheck(masterId,hospBarcode,reportOdd,fileUrl,token,applyId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -72,7 +73,7 @@ public class CollectCheckService {
|
|
|
|
|
* @param token
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean downFileWithCheck(String masterId,String hospBarcode,String reportOdd,String fileUrl,String token){
|
|
|
|
|
private boolean downFileWithCheck(String masterId,String hospBarcode,String reportOdd,String fileUrl,String token,String applyId){
|
|
|
|
|
//根据参数请求接口返回json数据
|
|
|
|
|
String result = reqInterfaceByParam(hospBarcode, reportOdd, fileUrl, token);
|
|
|
|
|
//解析返回json数据
|
|
|
|
@ -80,10 +81,11 @@ public class CollectCheckService {
|
|
|
|
|
//唯一文件码
|
|
|
|
|
String serialnum = hospBarcode + "_" + reportOdd;
|
|
|
|
|
//根据解析的数据调用下载
|
|
|
|
|
String reqResult = downFile(masterId,map,serialnum);
|
|
|
|
|
String reqResult = downFile(masterId,map,serialnum,applyId);
|
|
|
|
|
if(!StringUtils.isEmpty(reqResult)) {
|
|
|
|
|
String code = JsonUtils.getValueByKey(reqResult, "code");
|
|
|
|
|
if(!StringUtils.isEmpty(code) && "0".equals(code)){
|
|
|
|
|
log.info("下载成功:masterId:"+masterId);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -94,14 +96,13 @@ public class CollectCheckService {
|
|
|
|
|
* 根据解析的数据调用下载
|
|
|
|
|
* @param map
|
|
|
|
|
*/
|
|
|
|
|
private String downFile(String masterId,Map<String, String> map,String serialnum) {
|
|
|
|
|
private String downFile(String masterId,Map<String, String> map,String serialnum,String applyId) {
|
|
|
|
|
if(!CollectionUtils.isEmpty(map)){
|
|
|
|
|
//设置下载参数
|
|
|
|
|
Map rootMap = setDownReqParams(masterId, map, serialnum);
|
|
|
|
|
Map rootMap = setDownReqParams(masterId, map, serialnum,applyId);
|
|
|
|
|
//调用下载接口
|
|
|
|
|
String result = HttpClientUtils.doPost(downfileUrl,JSON.toJSONString(rootMap));
|
|
|
|
|
log.info("上传下载服务result:"+result);
|
|
|
|
|
System.out.println("上传下载服务result:"+result);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
@ -114,7 +115,7 @@ public class CollectCheckService {
|
|
|
|
|
* @param serialnum
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private Map setDownReqParams(String masterId, Map<String, String> map, String serialnum) {
|
|
|
|
|
private Map setDownReqParams(String masterId, Map<String, String> map, String serialnum,String applyId) {
|
|
|
|
|
//设置文件信息参数
|
|
|
|
|
Map<String,Object> scanfilesMap = new HashMap<>();
|
|
|
|
|
scanfilesMap.put("taskid",-1);
|
|
|
|
@ -122,8 +123,9 @@ public class CollectCheckService {
|
|
|
|
|
scanfilesMap.put("filesource",1);
|
|
|
|
|
scanfilesMap.put("filestoragetype",1);
|
|
|
|
|
scanfilesMap.put("filetype",2);
|
|
|
|
|
scanfilesMap.put("applyId",applyId);
|
|
|
|
|
scanfilesMap.put("downurl", map.get(FILEBASE64));
|
|
|
|
|
scanfilesMap.put("serialnum", serialnum +"1");
|
|
|
|
|
scanfilesMap.put("serialnum", serialnum);
|
|
|
|
|
List<Map<String,Object>> scanfilesList = new ArrayList<>();
|
|
|
|
|
scanfilesList.add(scanfilesMap);
|
|
|
|
|
//设置患者信息参数
|
|
|
|
|