diff --git a/src/main/java/com/docus/bgts/rpc/impl/DownloadPlatformRpcImpl.java b/src/main/java/com/docus/bgts/rpc/impl/DownloadPlatformRpcImpl.java index bef9dd1..ef1a15a 100644 --- a/src/main/java/com/docus/bgts/rpc/impl/DownloadPlatformRpcImpl.java +++ b/src/main/java/com/docus/bgts/rpc/impl/DownloadPlatformRpcImpl.java @@ -5,10 +5,15 @@ import com.alibaba.fastjson.JSON; import com.docus.bgts.entity.CommonResult; import com.docus.bgts.rpc.DownloadPlatformRpc; import com.docus.bgts.rpc.dto.ReportDownDto; +import com.docus.bgts.rpc.dto.ReportDownPatientDto; +import com.docus.bgts.rpc.dto.ReportDownScanFileDto; import lombok.extern.slf4j.Slf4j; +import org.apache.http.entity.ContentType; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.Collections; +import java.util.List; import java.util.UUID; /** @@ -31,7 +36,10 @@ public class DownloadPlatformRpcImpl implements DownloadPlatformRpc { String bodyParam = JSON.toJSONString(resources); log.info("[{}] 上报病案文件到下载平台,地址:{} ,参数:{}", contextId, url, bodyParam); try { - String resp = HttpUtil.post(url, bodyParam); + String resp = HttpUtil.createPost(url) + .body(bodyParam, ContentType.APPLICATION_JSON.getMimeType()) + .execute() + .body(); log.info("[{}] 上报病案文件到下载平台,返回内容:{}", contextId, resp); return JSON.parseObject(resp, CommonResult.class); } catch (Exception ex) { @@ -47,7 +55,11 @@ public class DownloadPlatformRpcImpl implements DownloadPlatformRpc { String bodyParam = JSON.toJSONString(resources); log.info("[{}] 上报封存病案文件到下载平台,地址:{} ,参数:{}", contextId, url, bodyParam); try { - String resp = HttpUtil.post(url, bodyParam); + + String resp = HttpUtil.createPost(url) + .body(bodyParam, ContentType.APPLICATION_JSON.getMimeType()) + .execute() + .body(); log.info("[{}] 上报封存病案文件到下载平台,返回内容:{}", contextId, resp); return JSON.parseObject(resp, CommonResult.class); } catch (Exception ex) { @@ -55,4 +67,31 @@ public class DownloadPlatformRpcImpl implements DownloadPlatformRpc { throw ex; } } + + public static void main(String[] args) { + + + DownloadPlatformRpcImpl platformRpc = new DownloadPlatformRpcImpl(); + platformRpc.downloadPlatformAddress="http://127.0.0.1:9291"; + + ReportDownPatientDto reportDownPatientDto = new ReportDownPatientDto(); + reportDownPatientDto.setPatientid("123"); + + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setDownurl("666http"); + reportDownScanFileDto.setFilestoragetype(1); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFiletitle("dm"); + reportDownScanFileDto.setSerialnum("fileid"); + List reportDownScanFileDtos = Collections.singletonList(reportDownScanFileDto); + + ReportDownDto reportDownDto = new ReportDownDto(); + reportDownDto.setCollectorid("test"); + reportDownDto.setAssortid("assortid"); + reportDownDto.setPatient(reportDownPatientDto); + reportDownDto.setScanfiles(reportDownScanFileDtos); + + CommonResult commonResult = platformRpc.sealReport(reportDownDto); + System.out.println(JSON.toJSONString(commonResult)); + } }