优化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.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);
}
}
}

@ -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);
}

@ -1287,7 +1287,7 @@ public class CommomService {
//pdf转jpg图片生成到指定路徑
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) {
List<T_Scan_Assort> insertList = new ArrayList<>();

@ -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 ??

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

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