|
|
|
|
@ -49,8 +49,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.Base64;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping("font/")
|
|
|
|
|
@ -1100,53 +1103,96 @@ public class FontShowRecordController {
|
|
|
|
|
|
|
|
|
|
@RequestMapping("sendFileManage")
|
|
|
|
|
public String sendFileManage() {
|
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> list = commomService.queryFileManage();
|
|
|
|
|
|
|
|
|
|
//创建连接工厂
|
|
|
|
|
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
|
|
|
|
|
//创建客户端
|
|
|
|
|
Client client = null;
|
|
|
|
|
try {
|
|
|
|
|
//http://172.16.60.202:9083/HtMongoDBWebServiceInterface/services/Manage?wsdl
|
|
|
|
|
client = dcf.createClient("http://172.16.60.202:9083/HtMongoDBWebServiceInterface/services/Manage?wsdl");
|
|
|
|
|
String base64 = "";
|
|
|
|
|
List<Map<String,Object>> list = commomService.queryFileManage();
|
|
|
|
|
int total = list.size();
|
|
|
|
|
// 在循环外定义前一个文件名和排序码
|
|
|
|
|
String prevFileName = null;
|
|
|
|
|
int reportOrdinal = 1;
|
|
|
|
|
|
|
|
|
|
// 构造 XML 参数字符串
|
|
|
|
|
String xmlParam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
|
|
|
|
"<DOCINFO>\n" +
|
|
|
|
|
" <reportTypeCode>Js</reportTypeCode>\n" +
|
|
|
|
|
" <reportTypeName>嘉时采集资料</reportTypeName>\n" +
|
|
|
|
|
" <reportTypeSubCode>17.1</reportTypeSubCode>\n" +
|
|
|
|
|
" <reportTypeSubName>费用结算清单</reportTypeSubName>\n" +
|
|
|
|
|
" <empi>患者EMPI</empi>\n" +
|
|
|
|
|
" <pid>患者PID</pid>\n" +
|
|
|
|
|
" <ipid>患者ID</ipid>\n" +
|
|
|
|
|
" <pno>患者住院号、门诊号</pno>\n" +
|
|
|
|
|
" <reportSource>报告来源</reportSource>\n" +
|
|
|
|
|
" <fileSn>文档流水号(唯一)</fileSn>\n" +
|
|
|
|
|
" <fileName>报告名称、文档名称(唯一)</fileName>\n" +
|
|
|
|
|
" <reportContent>报告PDF转base64</reportContent>\n" +
|
|
|
|
|
" <reportManageType>报告处理类型(CRUD)</reportManageType>\n" +
|
|
|
|
|
" <needCount>应传报告数</needCount>\n" +
|
|
|
|
|
" <realCount>实传报告数</realCount>\n" +
|
|
|
|
|
" <applySns>关联申请单号</applySns>\n" +
|
|
|
|
|
" <reportTime>报告时间(不是上传时间、当前时间)</reportTime>\n" +
|
|
|
|
|
"<reportOrdinal>排序码<//reportOrdinal>\n" +
|
|
|
|
|
"< relOutRecSn></ relOutRecSn>\n" +
|
|
|
|
|
"</DOCINFO>";
|
|
|
|
|
for(Map<String,Object> map : list){
|
|
|
|
|
String patientId = (String) map.get("patient_id");
|
|
|
|
|
String proNo = (String) map.get("pro_no");
|
|
|
|
|
String fileName = (String) map.get("file_name");
|
|
|
|
|
String scanPage = (String) map.get("scan_page");
|
|
|
|
|
|
|
|
|
|
// 调用 WebService 方法,并传递 XML 参数
|
|
|
|
|
Object[] response = client.invoke("reportFileManage", xmlParam);
|
|
|
|
|
// 处理返回结果
|
|
|
|
|
System.out.println("Response: " + response[0]);
|
|
|
|
|
// 判断是否与上一个文件名相同
|
|
|
|
|
if (fileName != null && fileName.equals(prevFileName)) {
|
|
|
|
|
reportOrdinal++;
|
|
|
|
|
} else {
|
|
|
|
|
reportOrdinal = 1; // 不同则重置为 1
|
|
|
|
|
}
|
|
|
|
|
// 更新 prevFileName 为当前文件名
|
|
|
|
|
prevFileName = fileName;
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
if (null != client) {
|
|
|
|
|
client.destroy();
|
|
|
|
|
// 获取文件路径
|
|
|
|
|
String filePath = (String) map.get("file_path");
|
|
|
|
|
if (filePath == null || filePath.isEmpty()) {
|
|
|
|
|
continue; // 跳过空路径
|
|
|
|
|
}
|
|
|
|
|
// 尝试读取文件并转换为 Base64
|
|
|
|
|
try {
|
|
|
|
|
base64 = convertImageToBase64(filePath);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
System.err.println("无法读取文件: " + filePath);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
//http://172.16.60.202:9083/HtMongoDBWebServiceInterface/services/Manage?wsdl
|
|
|
|
|
client = dcf.createClient("http://172.16.60.202:9083/HtMongoDBWebServiceInterface/services/Manage?wsdl");
|
|
|
|
|
|
|
|
|
|
// 构造 XML 参数字符串
|
|
|
|
|
String xmlParam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
|
|
|
|
"<DOCINFO>\n" +
|
|
|
|
|
" <reportTypeCode>Js</reportTypeCode>\n" +
|
|
|
|
|
" <reportTypeName>嘉时采集资料</reportTypeName>\n" +
|
|
|
|
|
" <reportTypeSubCode>17.1</reportTypeSubCode>\n" +
|
|
|
|
|
" <reportTypeSubName>费用结算清单</reportTypeSubName>\n" +
|
|
|
|
|
" <empi>"+ patientId +"</empi>\n" +
|
|
|
|
|
" <pid>"+ patientId +"</pid>\n" +
|
|
|
|
|
" <ipid>"+ patientId +"</ipid>\n" +
|
|
|
|
|
" <pno>"+ proNo +"</pno>\n" +
|
|
|
|
|
" <reportSource>I</reportSource>\n" +
|
|
|
|
|
" <fileSn>" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "</fileSn>\n" +
|
|
|
|
|
" <fileName>"+ fileName + "(" + scanPage + ")</fileName>\n" +
|
|
|
|
|
" <reportContent>"+ base64 +"</reportContent>\n" +
|
|
|
|
|
" <reportManageType>C</reportManageType>\n" +
|
|
|
|
|
" <needCount>"+ total +"</needCount>\n" +
|
|
|
|
|
" <realCount>"+ total +"</realCount>\n" +
|
|
|
|
|
" <applySns>" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "</applySns>\n" +
|
|
|
|
|
" <reportTime>" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "</reportTime>\n" +
|
|
|
|
|
"<reportOrdinal>"+ reportOrdinal +"</reportOrdinal>\n" +
|
|
|
|
|
"< relOutRecSn></ relOutRecSn>\n" +
|
|
|
|
|
"</DOCINFO>";
|
|
|
|
|
|
|
|
|
|
// 调用 WebService 方法,并传递 XML 参数
|
|
|
|
|
Object[] response = client.invoke("reportFileManage", xmlParam);
|
|
|
|
|
// 处理返回结果
|
|
|
|
|
System.out.println("Response: " + response[0]);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
if (null != client) {
|
|
|
|
|
client.destroy();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 图像文件转 Base64
|
|
|
|
|
public static String convertImageToBase64(String filePath) throws IOException {
|
|
|
|
|
File file = new File(filePath);
|
|
|
|
|
try (FileInputStream imageInFile = new FileInputStream(file)) {
|
|
|
|
|
byte[] imageData = new byte[(int) file.length()];
|
|
|
|
|
imageInFile.read(imageData);
|
|
|
|
|
return Base64.getEncoder().encodeToString(imageData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|