diff --git a/src/main/java/com/emr/controller/FontShowRecordController.java b/src/main/java/com/emr/controller/FontShowRecordController.java index 3308659..8d18c1a 100644 --- a/src/main/java/com/emr/controller/FontShowRecordController.java +++ b/src/main/java/com/emr/controller/FontShowRecordController.java @@ -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> 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> list = commomService.queryFileManage(); + int total = list.size(); + // 在循环外定义前一个文件名和排序码 + String prevFileName = null; + int reportOrdinal = 1; - // 构造 XML 参数字符串 - String xmlParam = "\n" + - "\n" + - " Js\n" + - " 嘉时采集资料\n" + - " 17.1\n" + - " 费用结算清单\n" + - " 患者EMPI\n" + - " 患者PID\n" + - " 患者ID\n" + - " 患者住院号、门诊号\n" + - " 报告来源\n" + - " 文档流水号(唯一)\n" + - " 报告名称、文档名称(唯一)\n" + - " 报告PDF转base64\n" + - " 报告处理类型(CRUD)\n" + - " 应传报告数\n" + - " 实传报告数\n" + - " 关联申请单号\n" + - " 报告时间(不是上传时间、当前时间)\n" + - "排序码\n" + - "< relOutRecSn>\n" + - ""; + for(Map 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 = "\n" + + "\n" + + " Js\n" + + " 嘉时采集资料\n" + + " 17.1\n" + + " 费用结算清单\n" + + " "+ patientId +"\n" + + " "+ patientId +"\n" + + " "+ patientId +"\n" + + " "+ proNo +"\n" + + " I\n" + + " " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n" + + " "+ fileName + "(" + scanPage + ")\n" + + " "+ base64 +"\n" + + " C\n" + + " "+ total +"\n" + + " "+ total +"\n" + + " " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n" + + " " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n" + + ""+ reportOrdinal +"\n" + + "< relOutRecSn>\n" + + ""; + + // 调用 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); + } + } } diff --git a/src/main/java/com/emr/dao/Zd_AssortMapper.java b/src/main/java/com/emr/dao/Zd_AssortMapper.java index 48ce8cb..c976abe 100644 --- a/src/main/java/com/emr/dao/Zd_AssortMapper.java +++ b/src/main/java/com/emr/dao/Zd_AssortMapper.java @@ -44,8 +44,8 @@ public interface Zd_AssortMapper { /** * 根据分类名称查询分类对象 - * @param patientId + * @param assortName * @return */ - Zd_Assort getZdAssortByName(@Param("patientId") String patientId); + Zd_Assort getZdAssortByName(@Param("assortName") String assortName); } \ No newline at end of file diff --git a/src/main/java/com/emr/service/CommomService.java b/src/main/java/com/emr/service/CommomService.java index c75ee64..ce53991 100644 --- a/src/main/java/com/emr/service/CommomService.java +++ b/src/main/java/com/emr/service/CommomService.java @@ -1287,7 +1287,7 @@ public class CommomService { //pdf转jpg图片生成到指定路徑 List picNameList = Pdf2ImgUtil.pdfToPic(saveFileName, pdfName, "jpg", commomVo.getFilePath()); - Zd_Assort zd_assort = zd_assortMapper.getZdAssortByName(commomVo.getPatientId()); + Zd_Assort zd_assort = zd_assortMapper.getZdAssortByName("费用"); if (picNameList != null && picNameList.size() > 0) { List insertList = new ArrayList<>(); diff --git a/src/main/resources/config/config.properties b/src/main/resources/config/config.properties index bda5c8a..d37133d 100644 --- a/src/main/resources/config/config.properties +++ b/src/main/resources/config/config.properties @@ -45,7 +45,7 @@ applyApproveFlag =0 #//????? initialization =0 -export_pdf_hospital_info = \u5e7f\u4e1c\u7701\u005f\u5e7f\u5dde\u5e02\u5929\u6cb3\u533a\u4eba\u6c11\u533b\u9662 +export_pdf_hospital_info = \u5e7f\u4e1c\u7701\u005f\u6e5b\u6c5f\u5e02\u005f\u9042\u6eaa\u53bf\u4eba\u6c11\u533b\u9662 #\u5e7f\u4e1c\u7701\u005f\u6e5b\u6c5f\u5e02\u005f\u9042\u6eaa\u53bf\u4eba\u6c11\u533b\u9662 ?? #\u5e7f\u4e1c\u7701\u005f\u5e7f\u5dde\u5e02\u5929\u6cb3\u533a\u4eba\u6c11\u533b\u9662 ?? diff --git a/src/main/resources/mapper/CommomMapper.xml b/src/main/resources/mapper/CommomMapper.xml index 52dd704..6cd4e73 100644 --- a/src/main/resources/mapper/CommomMapper.xml +++ b/src/main/resources/mapper/CommomMapper.xml @@ -1613,12 +1613,12 @@ \ No newline at end of file diff --git a/src/main/resources/mapper/Zd_AssortMapper.xml b/src/main/resources/mapper/Zd_AssortMapper.xml index 5dc435c..4b29432 100644 --- a/src/main/resources/mapper/Zd_AssortMapper.xml +++ b/src/main/resources/mapper/Zd_AssortMapper.xml @@ -157,9 +157,6 @@ select * from emr_type \ No newline at end of file