优化2.0标准版代码

master
Godblessyou 9 months ago
parent 51b49d5410
commit 0b22c9cf5e

@ -49,8 +49,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.Base64;
@Controller @Controller
@RequestMapping("font/") @RequestMapping("font/")
@ -1100,53 +1103,96 @@ public class FontShowRecordController {
@RequestMapping("sendFileManage") @RequestMapping("sendFileManage")
public String sendFileManage() { public String sendFileManage() {
List<Map<String,Object>> list = commomService.queryFileManage();
//创建连接工厂 //创建连接工厂
JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance(); JAXDynamicClientFactory dcf = JAXDynamicClientFactory.newInstance();
//创建客户端 //创建客户端
Client client = null; Client client = null;
try { String base64 = "";
//http://172.16.60.202:9083/HtMongoDBWebServiceInterface/services/Manage?wsdl List<Map<String,Object>> list = commomService.queryFileManage();
client = dcf.createClient("http://172.16.60.202:9083/HtMongoDBWebServiceInterface/services/Manage?wsdl"); int total = list.size();
// 在循环外定义前一个文件名和排序码
String prevFileName = null;
int reportOrdinal = 1;
// 构造 XML 参数字符串 for(Map<String,Object> map : list){
String xmlParam = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + String patientId = (String) map.get("patient_id");
"<DOCINFO>\n" + String proNo = (String) map.get("pro_no");
" <reportTypeCode>Js</reportTypeCode>\n" + String fileName = (String) map.get("file_name");
" <reportTypeName>嘉时采集资料</reportTypeName>\n" + String scanPage = (String) map.get("scan_page");
" <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>";
// 调用 WebService 方法,并传递 XML 参数 // 判断是否与上一个文件名相同
Object[] response = client.invoke("reportFileManage", xmlParam); if (fileName != null && fileName.equals(prevFileName)) {
// 处理返回结果 reportOrdinal++;
System.out.println("Response: " + response[0]); } else {
reportOrdinal = 1; // 不同则重置为 1
}
// 更新 prevFileName 为当前文件名
prevFileName = fileName;
} catch (Exception e) { // 获取文件路径
e.printStackTrace(); String filePath = (String) map.get("file_path");
} finally { if (filePath == null || filePath.isEmpty()) {
if (null != client) { continue; // 跳过空路径
client.destroy(); }
// 尝试读取文件并转换为 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; 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);
}
}
} }

@ -44,8 +44,8 @@ public interface Zd_AssortMapper {
/** /**
* *
* @param patientId * @param assortName
* @return * @return
*/ */
Zd_Assort getZdAssortByName(@Param("patientId") String patientId); Zd_Assort getZdAssortByName(@Param("assortName") String assortName);
} }

@ -1287,7 +1287,7 @@ public class CommomService {
//pdf转jpg图片生成到指定路徑 //pdf转jpg图片生成到指定路徑
List<String> picNameList = Pdf2ImgUtil.pdfToPic(saveFileName, pdfName, "jpg", commomVo.getFilePath()); List<String> 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) { if (picNameList != null && picNameList.size() > 0) {
List<T_Scan_Assort> insertList = new ArrayList<>(); List<T_Scan_Assort> insertList = new ArrayList<>();

@ -45,7 +45,7 @@ applyApproveFlag =0
#//????? #//?????
initialization =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\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 ?? #\u5e7f\u4e1c\u7701\u005f\u5e7f\u5dde\u5e02\u5929\u6cb3\u533a\u4eba\u6c11\u533b\u9662 ??

@ -1613,12 +1613,12 @@
</select> </select>
<select id="queryFileManage" parameterType="map" resultType="map"> <select id="queryFileManage" parameterType="map" resultType="map">
select select top 1
a.patient_id patientId, a.patient_id,
a.inpatient_no inpatientNo, a.pro_no,
a.file_path + '\' + b.scan_page filePath, a.file_path + '\' + b.scan_page file_path,
c.assort_name fileName, a.file_type file_name,
b.scan_page scanPage b.scan_page scan_page
from commomtable a join t_scan_assort b on a.patient_id = b.patient_id join zd_assort c on b.assort_id = c.assort_id from commomtable a join t_scan_assort b on a.patient_id = b.patient_id where a.patient_id = '1ee10f4084964bb7ba90461a92879c99'
</select> </select>
</mapper> </mapper>

@ -157,9 +157,6 @@
select * from emr_type select * from emr_type
</select> </select>
<select id="getZdAssortByName" resultType="com.emr.entity.Zd_Assort"> <select id="getZdAssortByName" resultType="com.emr.entity.Zd_Assort">
select top 1 b.* from t_scan_assort a join select * from zd_assort t where t.assort_name like '%${assortName}%'
(
select * from zd_assort where assort_name like '%费用%'
) b on a.assort_id = b.assort_id where a.patient_id = #{patientId}
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save