潮州人医快速借阅、快速归还

master
linjj 2 years ago
parent dcbcf482b8
commit 2c327b1720

@ -1,11 +1,16 @@
package com.emr.controller; package com.emr.controller;
import com.emr.dao.Archive_DetailMapper;
import com.emr.dao.Archive_MasterMapper;
import com.emr.dao.CommomMapper; import com.emr.dao.CommomMapper;
import com.emr.dao.approve.Emr_Apply_ApproveMapper; import com.emr.dao.approve.Emr_Apply_ApproveMapper;
import com.emr.dao.commomSearch.ScanPathMapper;
import com.emr.dao.emrPdfWaterSet.EmrPdfWaterSetMapper;
import com.emr.dao.recordLock.Emr_LockMapper; import com.emr.dao.recordLock.Emr_LockMapper;
import com.emr.dao.tScanAssort.T_Scan_AssortMapper; import com.emr.dao.tScanAssort.T_Scan_AssortMapper;
import com.emr.entity.Power_User; import com.emr.entity.Power_User;
import com.emr.entity.Zd_Assort; import com.emr.entity.Zd_Assort;
import com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet;
import com.emr.entity.recordType.Emr_Type; import com.emr.entity.recordType.Emr_Type;
import com.emr.service.FontService; import com.emr.service.FontService;
import com.emr.service.Zd_AssortServiceImpl; import com.emr.service.Zd_AssortServiceImpl;
@ -14,11 +19,14 @@ import com.emr.service.recordType.EmrTypeService;
import com.emr.service.tScanAssort.T_Scan_AssortService; import com.emr.service.tScanAssort.T_Scan_AssortService;
import com.emr.util.ExceptionPrintUtil; import com.emr.util.ExceptionPrintUtil;
import com.emr.util.Jpg2PdfUtil; import com.emr.util.Jpg2PdfUtil;
import com.emr.vo.ArchiveMasterVo;
import com.emr.vo.FontVo.*; import com.emr.vo.FontVo.*;
import com.emr.vo.Msg; import com.emr.vo.Msg;
import com.emr.vo.PushRcvBasicDTO; import com.emr.vo.PushRcvBasicDTO;
import com.emr.vo.ZhFyImageVo; import com.emr.vo.ZhFyImageVo;
import com.emr.vo.commomSearch.CommomTree;
import com.emr.vo.commomSearch.CommomVo; import com.emr.vo.commomSearch.CommomVo;
import com.emr.vo.commomSearch.ScanPathVo;
import com.lowagie.text.Document; import com.lowagie.text.Document;
import com.lowagie.text.Image; import com.lowagie.text.Image;
import com.lowagie.text.Utilities; import com.lowagie.text.Utilities;
@ -77,9 +85,16 @@ public class FontController {
@Autowired @Autowired
private PushRcvBasicService pushRcvBasicService; private PushRcvBasicService pushRcvBasicService;
@Autowired
private Archive_MasterMapper archiveMasterMapper;
@Autowired
private Archive_DetailMapper archiveDetailMapper;
@Autowired
private EmrPdfWaterSetMapper pdfWaterSetMapper;
/** /**
* 2.1 * 2.1
*
* @MethodName getLockList * @MethodName getLockList
* @Description: * @Description:
* @Param lockVo.patientId, admissTimes, admissId * @Param lockVo.patientId, admissTimes, admissId
@ -91,9 +106,9 @@ public class FontController {
* @UpdateRemark: * @UpdateRemark:
* @Version: 1.0 * @Version: 1.0
*/ */
@RequestMapping(value= "getLockList",method = RequestMethod.GET) @RequestMapping(value = "getLockList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public Msg getLockList(LockVo lock) throws Exception{ public Msg getLockList(LockVo lock) throws Exception {
FontCommom commom = new FontCommom(); FontCommom commom = new FontCommom();
BeanUtils.copyProperties(lock, commom); BeanUtils.copyProperties(lock, commom);
List<FontCommom> list = commomMapper.isExistInpatient(commom); List<FontCommom> list = commomMapper.isExistInpatient(commom);
@ -110,6 +125,7 @@ public class FontController {
/** /**
* 2.2 * 2.2
*
* @MethodName getInpatientList * @MethodName getInpatientList
* @Description: * @Description:
* @Param lockVo.patientId, admissTimes, admissId * @Param lockVo.patientId, admissTimes, admissId
@ -123,8 +139,8 @@ public class FontController {
*/ */
@RequestMapping("getInpatientList") @RequestMapping("getInpatientList")
@ResponseBody @ResponseBody
public Msg getInpatientList(FontCommom commom) throws Exception{ public Msg getInpatientList(FontCommom commom) throws Exception {
Msg msg = getScanAssortVoList(commom,0); Msg msg = getScanAssortVoList(commom, 0);
if (msg.getCode() == 200) { if (msg.getCode() == 200) {
return msg; return msg;
} }
@ -141,9 +157,9 @@ public class FontController {
/** /**
* *
*/ */
private Msg getScanAssortVoList(FontCommom commom,int flag) throws Exception{ private Msg getScanAssortVoList(FontCommom commom, int flag) throws Exception {
//判断参数是否不为全空 //判断参数是否不为全空
if (StringUtils.isNotBlank(commom.getPatientId()) && StringUtils.isBlank(commom.getInpatientNo()) && StringUtils.isBlank(commom.getAdmissId()) &&StringUtils.isNotBlank(commom.getName()) if (StringUtils.isNotBlank(commom.getPatientId()) && StringUtils.isBlank(commom.getInpatientNo()) && StringUtils.isBlank(commom.getAdmissId()) && StringUtils.isNotBlank(commom.getName())
&& null == commom.getAdmissTimes() && StringUtils.isBlank(commom.getDisDate()) && StringUtils.isBlank(commom.getIdCard())) { && null == commom.getAdmissTimes() && StringUtils.isBlank(commom.getDisDate()) && StringUtils.isBlank(commom.getIdCard())) {
return Msg.fail("由于数据太大,参数不能全为空!"); return Msg.fail("由于数据太大,参数不能全为空!");
} }
@ -153,7 +169,7 @@ public class FontController {
return Msg.fail("由于数据太大,参数不能只带住院次数!"); return Msg.fail("由于数据太大,参数不能只带住院次数!");
} }
//判断住院记录是否存在 //判断住院记录是否存在
if(flag == 1){ if (flag == 1) {
//是否需要判断 //是否需要判断
List<FontCommom> list = commomMapper.isExistInpatient(commom); List<FontCommom> list = commomMapper.isExistInpatient(commom);
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
@ -165,6 +181,7 @@ public class FontController {
/** /**
* 2.3 * 2.3
*
* @MethodName getScanAssortPathList * @MethodName getScanAssortPathList
* @Description: PDF(PDF) * @Description: PDF(PDF)
* @Param lockVo.patientId, admissTimes, admissId * @Param lockVo.patientId, admissTimes, admissId
@ -176,10 +193,10 @@ public class FontController {
* @UpdateRemark: * @UpdateRemark:
* @Version: 1.0 * @Version: 1.0
*/ */
@RequestMapping(value="getScanAssortPathList",method = RequestMethod.GET) @RequestMapping(value = "getScanAssortPathList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public Msg getScanAssortPathList(FontCommom commom) throws Exception{ public Msg getScanAssortPathList(FontCommom commom) throws Exception {
Msg msg = getScanAssortVoList(commom,1); Msg msg = getScanAssortVoList(commom, 1);
if (msg.getCode() == 200) { if (msg.getCode() == 200) {
return msg; return msg;
} }
@ -280,8 +297,45 @@ public class FontController {
return Msg.success().add("list", scanAssortVos1); return Msg.success().add("list", scanAssortVos1);
} }
/**
* @description: 23
* @author linjj
* @date: 2024/3/25 15:25
*/
@RequestMapping(value = "downloadPdfBlood", method = RequestMethod.GET)
@ResponseBody
public void downloadPdf(HttpServletResponse response) {
//查询需要下载患者
List<ArchiveMasterVo> list = archiveMasterMapper.getMasterID();
for (ArchiveMasterVo archiveMaster : list) {
String masterId = archiveMaster.getId();
List<String> pdfPaths = archiveDetailMapper.selectPDFRATH2(masterId, "7A9C621E3F4F4C9CA95292141C5E15E8");
if (pdfPaths!=null||pdfPaths.isEmpty()){
String newPath = "D:\\jiashi\\copy" + File.separator + archiveMaster.getName() + "-" + archiveMaster.getInpNo()+"-知情同意书";
if (!new File(newPath).isDirectory()) {
new File(newPath).mkdirs();
}
for (String pdfPath:pdfPaths){
String newSrc = newPath + File.separator + new File(pdfPath).getName();
try (InputStream inputStream = new FileInputStream(pdfPath);
OutputStream outputStream = new FileOutputStream(newSrc)) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
System.out.println("文件拷贝完成");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
/** /**
* 2.4 * 2.4
*
* @MethodName getScanAssortFilePathList * @MethodName getScanAssortFilePathList
* @Description: PDF * @Description: PDF
* @Param lockVo.patientId, admissTimes, admissId * @Param lockVo.patientId, admissTimes, admissId
@ -293,10 +347,10 @@ public class FontController {
* @UpdateRemark: * @UpdateRemark:
* @Version: 1.0 * @Version: 1.0
*/ */
@RequestMapping(value = "getScanAssortFilePathList",method = RequestMethod.GET) @RequestMapping(value = "getScanAssortFilePathList", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public Msg getScanAssortFilePathList(FontCommom commom, HttpServletResponse response) throws Exception{ public Msg getScanAssortFilePathList(FontCommom commom, HttpServletResponse response) throws Exception {
Msg msg = getScanAssortVoList(commom,1); Msg msg = getScanAssortVoList(commom, 1);
if (msg.getCode() == 200) { if (msg.getCode() == 200) {
return msg; return msg;
} }
@ -398,13 +452,13 @@ public class FontController {
byte[] bytes = baos.toByteArray(); byte[] bytes = baos.toByteArray();
String filePath1 = Base64Utils.encodeToString(bytes); String filePath1 = Base64Utils.encodeToString(bytes);
scanAssortVo.setFilePath(filePath1); scanAssortVo.setFilePath(filePath1);
} else { } else {
scanAssortVo.setFilePath(""); scanAssortVo.setFilePath("");
}
ScanAssortVo1 vo1 = new ScanAssortVo1();
BeanUtils.copyProperties(scanAssortVo, vo1);
scanAssortVos1.add(vo1);
} }
ScanAssortVo1 vo1 = new ScanAssortVo1();
BeanUtils.copyProperties(scanAssortVo, vo1);
scanAssortVos1.add(vo1);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
@ -422,6 +476,7 @@ public class FontController {
/** /**
* 2.8 * 2.8
*
* @MethodName updateTableCommom * @MethodName updateTableCommom
* @Description: commomtablecommomtable1 * @Description: commomtablecommomtable1
* @Param * @Param
@ -435,15 +490,15 @@ public class FontController {
*/ */
@RequestMapping(value = "updateTableCommom", method = RequestMethod.POST) @RequestMapping(value = "updateTableCommom", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Msg updateTableCommom(CommomVo commom) throws Exception{ public Msg updateTableCommom(CommomVo commom) throws Exception {
return fontService.updateTableCommom(commom); return fontService.updateTableCommom(commom);
} }
/** /**
* @description: * @description:
* @params: patientId * @params: patientId
* @params: flag * @params: flag
* @author linjj * @author linjj
* @date: 2023/5/18 15:45 * @date: 2023/5/18 15:45
*/ */
@ -477,6 +532,7 @@ public class FontController {
model.addAttribute("flag", flag); model.addAttribute("flag", flag);
return "recordManage/commomSearch/showRecordIframeBlood"; return "recordManage/commomSearch/showRecordIframeBlood";
} }
/** /**
* @description: * @description:
* @params: inpatientNo * @params: inpatientNo
@ -486,16 +542,16 @@ public class FontController {
*/ */
@RequestMapping(value = "getPathListByInpatientNo", method = RequestMethod.POST) @RequestMapping(value = "getPathListByInpatientNo", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Msg getPathListByInpatientNo(String inpatientNo,String admissTimes){ public Msg getPathListByInpatientNo(String inpatientNo, String admissTimes) {
if (StringUtils.isBlank(inpatientNo)){ if (StringUtils.isBlank(inpatientNo)) {
return Msg.fail("inpatientNo住院号不得为空"); return Msg.fail("inpatientNo住院号不得为空");
} }
if (StringUtils.isBlank(admissTimes)){ if (StringUtils.isBlank(admissTimes)) {
return Msg.fail("admissTimes住院次数不得为空"); return Msg.fail("admissTimes住院次数不得为空");
} }
List<ZhFyImageVo> list = tScanAssortService.getPathListByInpatientNo(inpatientNo, admissTimes); List<ZhFyImageVo> list = tScanAssortService.getPathListByInpatientNo(inpatientNo, admissTimes);
return Msg.successData(list); return Msg.successData(list);
} }
/** /**
@ -507,16 +563,17 @@ public class FontController {
*/ */
@RequestMapping(value = "getPathListByDisDate", method = RequestMethod.POST) @RequestMapping(value = "getPathListByDisDate", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Msg getPathListByDisDate(String startTime,String endTime){ public Msg getPathListByDisDate(String startTime, String endTime) {
if (StringUtils.isBlank(startTime)){ if (StringUtils.isBlank(startTime)) {
return Msg.fail("startTime开始时间范围不得为空"); return Msg.fail("startTime开始时间范围不得为空");
} }
if (StringUtils.isBlank(endTime)){ if (StringUtils.isBlank(endTime)) {
return Msg.fail("endTime结束时间范围不得为空"); return Msg.fail("endTime结束时间范围不得为空");
} }
List<ZhFyImageVo> list = tScanAssortService.getPathListByDisDate(startTime,endTime); List<ZhFyImageVo> list = tScanAssortService.getPathListByDisDate(startTime, endTime);
return Msg.successData(list); return Msg.successData(list);
} }
/** /**
* @description: * @description:
* @author linjj * @author linjj
@ -524,10 +581,10 @@ public class FontController {
*/ */
@RequestMapping(value = "addRcvBasic", method = RequestMethod.POST) @RequestMapping(value = "addRcvBasic", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public Msg addRcvBasic(@RequestBody List<PushRcvBasicDTO> list){ public Msg addRcvBasic(@RequestBody List<PushRcvBasicDTO> list) {
int i = pushRcvBasicService.addRcvBasic(list); int i = pushRcvBasicService.addRcvBasic(list);
if (i==1){ if (i == 1) {
return Msg.success(); return Msg.success();
} }
return Msg.fail(); return Msg.fail();
} }

@ -521,6 +521,21 @@ public class ApproveController {
emrApplyApprove.setDisTime(fmt.format(disDate)); emrApplyApprove.setDisTime(fmt.format(disDate));
} }
} }
List<User> userList = commomService.getUserList(user.getUserName(), request);
//查询条件用户名转姓名
for (Emr_Apply_Approve obj : approve){
//转换用户名
//获取申请者工号
String applyer = obj.getApplyer();
if(!CollectionUtils.isEmpty(userList)){
for(User user1 : userList){
String name = user1.getName();
if(StringUtils.isNotBlank(applyer) && user1.getUserName().equals(applyer)){
obj.setApplyer(name);
}
}
}
}
return JSON.toJSONString(emrApplyApprove); return JSON.toJSONString(emrApplyApprove);
}catch (Exception e){ }catch (Exception e){
ExceptionPrintUtil.printException(e); ExceptionPrintUtil.printException(e);

@ -1483,7 +1483,7 @@ public class TemplateSearchController {
} }
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1); EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
//下载文件名 //下载文件名
String filename = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date()); String filename = vo.getInpatientNo().trim() + "-" + vo.getName().trim() + "-" + disDate.trim() + "_" + fmt.format(new Date());
Jpg2PdfUtil.mulFile2One3(response,filePaths,filename,emrPdfWaterSet); Jpg2PdfUtil.mulFile2One3(response,filePaths,filename,emrPdfWaterSet);
} }
} catch (Exception e) { } catch (Exception e) {

@ -16,6 +16,9 @@ public interface Archive_DetailMapper {
List<CommomTree> selectPdfPathByPatient2(@Param("patientId")String patientId); List<CommomTree> selectPdfPathByPatient2(@Param("patientId")String patientId);
List<String> selectPDFRATH(@Param("patientId")String patientId); List<String> selectPDFRATH(@Param("patientId")String patientId);
List<String> selectPDFRATH2(@Param("masterId")String masterId,@Param("assortId")String assortId);
List<String> getPDFRATH(@Param("patientId")String patientId,@Param("scanPages")String scanPages); List<String> getPDFRATH(@Param("patientId")String patientId,@Param("scanPages")String scanPages);

@ -1,5 +1,6 @@
package com.emr.dao; package com.emr.dao;
import com.emr.vo.ArchiveMasterVo;
import com.emr.vo.UpdateReturnVo; import com.emr.vo.UpdateReturnVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -24,4 +25,6 @@ public interface Archive_MasterMapper {
* @date: 2023/12/27 17:11 * @date: 2023/12/27 17:11
*/ */
List<UpdateReturnVo> getInpNoAndVisitIdByBarCode(@Param("barCode") String barCode); List<UpdateReturnVo> getInpNoAndVisitIdByBarCode(@Param("barCode") String barCode);
List<ArchiveMasterVo> getMasterID();
} }

@ -32,8 +32,9 @@ import java.util.List;
* @Version: 1.0 * @Version: 1.0
*/ */
public class Jpg2PdfUtil { public class Jpg2PdfUtil {
static Logger logger = LoggerFactory.getLogger(Jpg2PdfUtil.class); static Logger logger = LoggerFactory.getLogger(Jpg2PdfUtil.class);
public static void imageToPdf(HttpServletResponse response, List<String> filePaths, String pdfName) throws Exception{
public static void imageToPdf(HttpServletResponse response, List<String> filePaths, String pdfName) throws Exception {
// 实例化图牿 // 实例化图牿
Image image = null; Image image = null;
pdfName = java.net.URLEncoder.encode(pdfName, "UTF-8"); pdfName = java.net.URLEncoder.encode(pdfName, "UTF-8");
@ -41,14 +42,14 @@ public class Jpg2PdfUtil {
response.reset(); response.reset();
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setContentType("application/pdf"); // word格式 response.setContentType("application/pdf"); // word格式
response.setHeader("Content-Disposition", "attachment; filename=" + pdfName+ "("+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) +").pdf"); response.setHeader("Content-Disposition", "attachment; filename=" + pdfName + "(" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + ").pdf");
PdfWriter writer = PdfWriter.getInstance(doc, response.getOutputStream()); PdfWriter writer = PdfWriter.getInstance(doc, response.getOutputStream());
// 开启文桿 // 开启文桿
doc.open(); doc.open();
try { try {
for (String filePath : filePaths) { for (String filePath : filePaths) {
File file1 = new File(filePath); File file1 = new File(filePath);
if(file1.exists()){ if (file1.exists()) {
if (file1.getName().endsWith(".tif") || file1.getName().endsWith(".tiff")) { if (file1.getName().endsWith(".tif") || file1.getName().endsWith(".tiff")) {
Object localObject1 = null; Object localObject1 = null;
Object localObject2 = null; Object localObject2 = null;
@ -81,7 +82,7 @@ public class Jpg2PdfUtil {
((RandomAccessFileOrArray) localObject1).close(); ((RandomAccessFileOrArray) localObject1).close();
} }
} }
}else if (file1.getName().endsWith(".png") } else if (file1.getName().endsWith(".png")
|| file1.getName().endsWith(".jpg") || file1.getName().endsWith(".jpg")
|| file1.getName().endsWith(".gif") || file1.getName().endsWith(".gif")
|| file1.getName().endsWith(".jpeg") || file1.getName().endsWith(".jpeg")
@ -101,21 +102,21 @@ public class Jpg2PdfUtil {
//image.scaleAbsolute(500, 400); //image.scaleAbsolute(500, 400);
// 按百分比显示图片的比便 // 按百分比显示图片的比便
if (width > 1024 || heigth > 786) { if (width > 1024 || heigth > 786) {
image.scalePercent(percent+5); image.scalePercent(percent + 5);
} }
PdfContentByte canvas = writer.getDirectContent(); PdfContentByte canvas = writer.getDirectContent();
//pdf文档中中文字体的设置注意一定要添加iTextAsian.jar包 //pdf文档中中文字体的设置注意一定要添加iTextAsian.jar包
BaseFont bfChinese = BaseFont.createFont("STSong-Light", BaseFont bfChinese = BaseFont.createFont("STSong-Light",
"UniGB-UCS2-H",BaseFont.NOT_EMBEDDED); "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
Font fontChinese = new Font(bfChinese, 50, Font.NORMAL,Color.blue); Font fontChinese = new Font(bfChinese, 50, Font.NORMAL, Color.blue);
Phrase phrase = new Phrase("老客户看黑科技好客户客户客户客户客户客户看黑科技",fontChinese); Phrase phrase = new Phrase("老客户看黑科技好客户客户客户客户客户客户看黑科技", fontChinese);
ColumnText.showTextAligned( ColumnText.showTextAligned(
canvas, Element.ALIGN_UNDEFINED, phrase, 200, 200, 50); canvas, Element.ALIGN_UNDEFINED, phrase, 200, 200, 50);
Image image1 = null; Image image1 = null;
image1 = Image.getInstance("D:\\出差准备文档\\pdf\\9d17f073c61adfaf79438401bc6ffb7.jpg"); image1 = Image.getInstance("D:\\出差准备文档\\pdf\\9d17f073c61adfaf79438401bc6ffb7.jpg");
//位置 //位置
image1.setAbsolutePosition(200, 200); image1.setAbsolutePosition(200, 200);
// 设置图片的显示大小 // 设置图片的显示大小
image1.scaleToFit(200, 200); image1.scaleToFit(200, 200);
canvas.addImage(image1); canvas.addImage(image1);
doc.add(image); doc.add(image);
@ -132,19 +133,20 @@ public class Jpg2PdfUtil {
writer.close(); writer.close();
} }
} }
public static boolean check(String file) { public static boolean check(String file) {
PdfReader pdfReader = null; PdfReader pdfReader = null;
try { try {
File f = new File(file); File f = new File(file);
if(f.isFile()){ if (f.isFile()) {
pdfReader = new PdfReader(file); pdfReader = new PdfReader(file);
if (pdfReader.getNumberOfPages() != 0) { if (pdfReader.getNumberOfPages() != 0) {
return true; return true;
} }
} }
} catch (Exception e) { } catch (Exception e) {
}finally { } finally {
if(null != pdfReader){ if (null != pdfReader) {
pdfReader.close(); pdfReader.close();
} }
} }
@ -152,31 +154,31 @@ public class Jpg2PdfUtil {
} }
public static void mulFile2One(HttpServletResponse response,List<String> filePaths,String waterMarkName) { public static void mulFile2One(HttpServletResponse response, List<String> filePaths, String waterMarkName) {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//遍历删除,除去损坏,文件不存在,抛异常就是空白页 //遍历删除,除去损坏,文件不存在,抛异常就是空白页
Iterator<String> iterator = filePaths.iterator(); Iterator<String> iterator = filePaths.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String fileStr = iterator.next(); String fileStr = iterator.next();
File file = new File(fileStr); File file = new File(fileStr);
if(file.isFile()){ if (file.isFile()) {
boolean flag = check(fileStr); boolean flag = check(fileStr);
if(!flag){ if (!flag) {
iterator.remove(); iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件损坏"); System.out.println(fmt.format(new Date()) + ":" + file + "文件损坏");
} }
}else{ } else {
iterator.remove(); iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件不存在"); System.out.println(fmt.format(new Date()) + ":" + file + "文件不存在");
} }
} }
if(!filePaths.isEmpty()){ if (!filePaths.isEmpty()) {
// pdf合并工具类 // pdf合并工具类
Document document = null; Document document = null;
PdfCopy copy = null; PdfCopy copy = null;
try { try {
document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1)); document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream()); copy = new PdfCopy(document, response.getOutputStream());
document.open(); document.open();
for (String file : filePaths) { for (String file : filePaths) {
PdfReader reader = new PdfReader(file); PdfReader reader = new PdfReader(file);
@ -198,21 +200,21 @@ public class Jpg2PdfUtil {
} }
copy.addPage(page); copy.addPage(page);
} }
if(null != pdfReader){ if (null != pdfReader) {
pdfReader.close(); pdfReader.close();
} }
reader.close(); reader.close();
try { try {
bos.flush(); bos.flush();
bos.close(); bos.close();
}catch (Exception e){ } catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
} }
} }
}catch (Exception e){ } catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
}finally { } finally {
if(null != document){ if (null != document) {
document.close(); document.close();
} }
} }
@ -220,7 +222,7 @@ public class Jpg2PdfUtil {
} }
} }
public static void setWatermark(ByteArrayOutputStream bos, PdfReader reader, String waterMarkName, String imgPath){ public static void setWatermark(ByteArrayOutputStream bos, PdfReader reader, String waterMarkName, String imgPath) {
PdfStamper stamper = null; PdfStamper stamper = null;
try { try {
stamper = new PdfStamper(reader, bos); stamper = new PdfStamper(reader, bos);
@ -231,7 +233,7 @@ public class Jpg2PdfUtil {
for (int i = 1; i < total; i++) { for (int i = 1; i < total; i++) {
content = stamper.getOverContent(i);// 在内容上方加水印 content = stamper.getOverContent(i);// 在内容上方加水印
//加文字水印 //加文字水印
if(StringUtils.isNotBlank(waterMarkName)) { if (StringUtils.isNotBlank(waterMarkName)) {
gs.setFillOpacity(0.3f); gs.setFillOpacity(0.3f);
gs.setStrokeOpacity(0.3f); gs.setStrokeOpacity(0.3f);
content.setGState(gs); content.setGState(gs);
@ -249,7 +251,7 @@ public class Jpg2PdfUtil {
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 1500, 40); content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 250, 1500, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1100, 40); content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1100, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1500, 40);*/ content.showTextAligned(Element.ALIGN_CENTER, waterMarks[0], 800, 1500, 40);*/
if(waterMarks.length > 1){ if (waterMarks.length > 1) {
//v:距左 v1:距下 v2: //v:距左 v1:距下 v2:
content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 400, 40); content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 400, 40);
/* content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 150, 40);*/ /* content.showTextAligned(Element.ALIGN_CENTER, waterMarks[1], 310, 150, 40);*/
@ -262,7 +264,7 @@ public class Jpg2PdfUtil {
} }
content.endText(); content.endText();
} }
if(StringUtils.isNotBlank(imgPath)){ if (StringUtils.isNotBlank(imgPath)) {
Image image = Image.getInstance(imgPath); Image image = Image.getInstance(imgPath);
image.setAbsolutePosition(200, 206); // set the first background image.setAbsolutePosition(200, 206); // set the first background
image.scaleToFit(200, 200); image.scaleToFit(200, 200);
@ -283,26 +285,26 @@ public class Jpg2PdfUtil {
} }
} }
public static void mulFile2One3(HttpServletResponse response,List<String> filePaths,String filename,EmrPdfWaterSet emrPdfWaterSet) { public static void mulFile2One3(HttpServletResponse response, List<String> filePaths, String filename, EmrPdfWaterSet emrPdfWaterSet) {
String waterMarkName=""; String waterMarkName = "";
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat fmt= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//遍历删除,除去损坏,文件不存在,抛异常就是空白页 //遍历删除,除去损坏,文件不存在,抛异常就是空白页
Iterator<String> iterator = filePaths.iterator(); Iterator<String> iterator = filePaths.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String fileStr = iterator.next(); String fileStr = iterator.next();
File file = new File(fileStr); File file = new File(fileStr);
if(file.isFile()){ if (file.isFile()) {
boolean flag = check(fileStr); boolean flag = check(fileStr);
if(!flag){ if (!flag) {
iterator.remove(); iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件损坏"); System.out.println(fmt.format(new Date()) + ":" + file + "文件损坏");
} }
}else{ } else {
iterator.remove(); iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件不存在"); System.out.println(fmt.format(new Date()) + ":" + file + "文件不存在");
} }
} }
if(!filePaths.isEmpty()){ if (!filePaths.isEmpty()) {
// pdf合并工具类 // pdf合并工具类
Document document = null; Document document = null;
PdfCopy copy = null; PdfCopy copy = null;
@ -313,14 +315,14 @@ public class Jpg2PdfUtil {
response.setContentType("application/pdf"); response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf"); response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf");
document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1)); document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream()); copy = new PdfCopy(document, response.getOutputStream());
document.open(); document.open();
for (String file : filePaths) { for (String file : filePaths) {
PdfReader reader = new PdfReader(file); PdfReader reader = new PdfReader(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfReader pdfReader = null; PdfReader pdfReader = null;
//判断是否加水印 //判断是否加水印
if (emrPdfWaterSet.getDownloadEffective()==1) { if (emrPdfWaterSet.getDownloadEffective() == 1) {
setWatermark(bos, reader, emrPdfWaterSet.getText(), null); setWatermark(bos, reader, emrPdfWaterSet.getText(), null);
pdfReader = new PdfReader(bos.toByteArray()); pdfReader = new PdfReader(bos.toByteArray());
} }
@ -328,28 +330,28 @@ public class Jpg2PdfUtil {
for (int j = 1; j <= n; j++) { for (int j = 1; j <= n; j++) {
document.newPage(); document.newPage();
PdfImportedPage page = null; PdfImportedPage page = null;
if (emrPdfWaterSet.getDownloadEffective()==1) { if (emrPdfWaterSet.getDownloadEffective() == 1) {
page = copy.getImportedPage(pdfReader, j); page = copy.getImportedPage(pdfReader, j);
} else { } else {
page = copy.getImportedPage(reader, j); page = copy.getImportedPage(reader, j);
} }
copy.addPage(page); copy.addPage(page);
} }
if(null != pdfReader){ if (null != pdfReader) {
pdfReader.close(); pdfReader.close();
} }
reader.close(); reader.close();
try { try {
bos.flush(); bos.flush();
bos.close(); bos.close();
}catch (Exception e){ } catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
} }
} }
}catch (Exception e){ } catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
}finally { } finally {
if(null != document){ if (null != document) {
document.close(); document.close();
} }
} }
@ -357,6 +359,54 @@ public class Jpg2PdfUtil {
} }
} }
public static void mulFile2One4(HttpServletResponse response, List<String> filePath, String filename) {
// pdf合并工具类
Document document = null;
PdfCopy copy = null;
try {
filename = java.net.URLEncoder.encode(filename, "UTF-8");
response.reset();
response.setCharacterEncoding("utf-8");
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf");
document = new Document(new PdfReader(filePath.get(0)).getPageSize(1));
copy = new PdfCopy(document, response.getOutputStream());
document.open();
for (String file : filePath) {
PdfReader reader = new PdfReader(file);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfReader pdfReader = null;
//判断是否加水印
int n = reader.getNumberOfPages();
for (int j = 1; j <= n; j++) {
document.newPage();
PdfImportedPage page = null;
page = copy.getImportedPage(reader, j);
copy.addPage(page);
}
if (null != pdfReader) {
pdfReader.close();
}
reader.close();
try {
bos.flush();
bos.close();
} catch (Exception e) {
//e.printStackTrace();
}
}
} catch (Exception e) {
//e.printStackTrace();
} finally {
if (null != document) {
document.close();
}
}
}
public static void mulFile2One2(HttpServletResponse response, List<String> filePaths, String filename, EmrPdfWaterSet emrPdfWaterSet) { public static void mulFile2One2(HttpServletResponse response, List<String> filePaths, String filename, EmrPdfWaterSet emrPdfWaterSet) {
//是否启用水印 //是否启用水印
Short effective = emrPdfWaterSet.getEffective(); Short effective = emrPdfWaterSet.getEffective();
@ -367,18 +417,18 @@ public class Jpg2PdfUtil {
while (iterator.hasNext()) { while (iterator.hasNext()) {
String fileStr = iterator.next(); String fileStr = iterator.next();
File file = new File(fileStr); File file = new File(fileStr);
if(file.isFile()){ if (file.isFile()) {
boolean flag = check(fileStr); boolean flag = check(fileStr);
if(!flag){ if (!flag) {
iterator.remove(); iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件损坏"); System.out.println(fmt.format(new Date()) + ":" + file + "文件损坏");
} }
}else{ } else {
iterator.remove(); iterator.remove();
System.out.println(fmt.format(new Date())+":"+file+"文件不存在"); System.out.println(fmt.format(new Date()) + ":" + file + "文件不存在");
} }
} }
if(!filePaths.isEmpty()){ if (!filePaths.isEmpty()) {
// pdf合并工具类 // pdf合并工具类
Document document = null; Document document = null;
PdfCopy copy = null; PdfCopy copy = null;
@ -388,7 +438,7 @@ public class Jpg2PdfUtil {
response.setContentType("application/pdf"); response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf"); response.setHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf");
document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1)); document = new Document(new PdfReader(filePaths.get(0)).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream()); copy = new PdfCopy(document, response.getOutputStream());
document.open(); document.open();
for (String file : filePaths) { for (String file : filePaths) {
PdfReader reader = new PdfReader(file); PdfReader reader = new PdfReader(file);
@ -410,21 +460,21 @@ public class Jpg2PdfUtil {
} }
copy.addPage(page); copy.addPage(page);
} }
if(null != pdfReader){ if (null != pdfReader) {
pdfReader.close(); pdfReader.close();
} }
reader.close(); reader.close();
try { try {
bos.flush(); bos.flush();
bos.close(); bos.close();
}catch (Exception e){ } catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
} }
} }
}catch (Exception e){ } catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
}finally { } finally {
if(null != document){ if (null != document) {
document.close(); document.close();
} }
} }
@ -435,6 +485,7 @@ public class Jpg2PdfUtil {
/** /**
* h>whw>hw=h * h>whw>hw=h
*
* @param h * @param h
* @param w * @param w
* @return * @return
@ -452,48 +503,48 @@ public class Jpg2PdfUtil {
} }
public static void mulFile2OneOne(HttpServletResponse response,String filePaths,String waterMarkName) { public static void mulFile2OneOne(HttpServletResponse response, String filePaths, String waterMarkName) {
if(!filePaths.isEmpty()){ if (!filePaths.isEmpty()) {
// pdf合并工具类 // pdf合并工具类
Document document = null; Document document = null;
PdfCopy copy = null; PdfCopy copy = null;
try { try {
document = new Document(new PdfReader(filePaths).getPageSize(1)); document = new Document(new PdfReader(filePaths).getPageSize(1));
copy = new PdfCopy(document,response.getOutputStream()); copy = new PdfCopy(document, response.getOutputStream());
document.open(); document.open();
PdfReader reader = new PdfReader(filePaths); PdfReader reader = new PdfReader(filePaths);
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfReader pdfReader = null; PdfReader pdfReader = null;
//判断是否加水印 //判断是否加水印
if (StringUtils.isNotBlank(waterMarkName)) {
setWatermark(bos, reader, waterMarkName, null);
pdfReader = new PdfReader(bos.toByteArray());
}
int n = reader.getNumberOfPages();
for (int j = 1; j <= n; j++) {
document.newPage();
PdfImportedPage page = null;
if (StringUtils.isNotBlank(waterMarkName)) { if (StringUtils.isNotBlank(waterMarkName)) {
setWatermark(bos, reader, waterMarkName, null); page = copy.getImportedPage(pdfReader, j);
pdfReader = new PdfReader(bos.toByteArray()); } else {
} page = copy.getImportedPage(reader, j);
int n = reader.getNumberOfPages();
for (int j = 1; j <= n; j++) {
document.newPage();
PdfImportedPage page = null;
if (StringUtils.isNotBlank(waterMarkName)) {
page = copy.getImportedPage(pdfReader, j);
} else {
page = copy.getImportedPage(reader, j);
}
copy.addPage(page);
} }
if(null != pdfReader){ copy.addPage(page);
pdfReader.close(); }
} if (null != pdfReader) {
reader.close(); pdfReader.close();
try { }
bos.flush(); reader.close();
bos.close(); try {
}catch (Exception e){ bos.flush();
//e.printStackTrace(); bos.close();
} } catch (Exception e) {
}catch (Exception e){ //e.printStackTrace();
}
} catch (Exception e) {
//e.printStackTrace(); //e.printStackTrace();
}finally { } finally {
if(null != document){ if (null != document) {
document.close(); document.close();
} }
} }

@ -0,0 +1,19 @@
package com.emr.vo;
import lombok.Data;
/**
* @ClassName ArchiveMasterVO
* @Author linjj
* @Date 2024/3/25 15:42
* @Version 1.0
*/
@Data
public class ArchiveMasterVo {
private String id;
private String inpNo;
private String visitId;
private String name;
}

@ -1,12 +1,12 @@
#power\u6743\u9650\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934 #power\u6743\u9650\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934
POWER_IP =localhost POWER_IP =172.16.11.90
POWER_URLHEAD = http://localhost:8081/power POWER_URLHEAD = http://172.16.11.90:8081/power
POWER_JSPHEAD = localhost POWER_JSPHEAD = 172.16.11.90
POWER_JSP = http://localhost:8081/power POWER_JSP = http://172.16.11.90:8081/power
#\u672C\u8EAB\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934 #\u672C\u8EAB\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934
EMR_RECORD_JSP = http://localhost:8081/emr_record EMR_RECORD_JSP = http://172.16.11.90:8081/emr_record
#webSocket\u670D\u52A1\u5668\u5730\u5740 #webSocket\u670D\u52A1\u5668\u5730\u5740
@ -53,4 +53,5 @@ fullTextSearchMethod = SearchFulltext
fullTextDays = 90 fullTextDays = 90
NEW_EMR_RECORD_JSP : http://localhost:8081/emr_record NEW_EMR_RECORD_JSP : http://localhost:8081/emr_record

@ -3,9 +3,9 @@ jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
#jdbc.username=sa #jdbc.username=sa
#jdbc.password=docus@702 #jdbc.password=docus@702
jdbc.url=jdbc\:sqlserver\://localhost:1433;databaseName=qf_record jdbc.url=jdbc\:sqlserver\://localhost:1433;databaseName=emr_record
jdbc.username=sa jdbc.username=sa
jdbc.password=admin123 jdbc.password=docus@702
#dataSource2 #dataSource2
jdbc.url2=jdbc\:sqlserver\://localhost:1433;databaseName=blgd_java jdbc.url2=jdbc\:sqlserver\://localhost:1433;databaseName=blgd_java

@ -160,6 +160,21 @@
<select id="selectPDFRATH2" resultType="java.lang.String">
SELECT
archive_detail.PDF_PATH
FROM
archive_detail
LEFT JOIN zd_assort
ON archive_detail.AssortID = zd_assort.assort_id
WHERE
MasterID = #{masterId} and zd_assort.assort_id=#{assortId}
ORDER BY zd_assort.assort_sort,UpLoadDateTime
</select>
<select id="getPDFRATH" resultType="java.lang.String"> <select id="getPDFRATH" resultType="java.lang.String">
SELECT SELECT
archive_detail.PDF_PATH archive_detail.PDF_PATH

@ -6,4 +6,8 @@
<select id="getInpNoAndVisitIdByBarCode" resultType="com.emr.vo.UpdateReturnVo"> <select id="getInpNoAndVisitIdByBarCode" resultType="com.emr.vo.UpdateReturnVo">
select inp_no,visit_id,discharge_date_time,name from archive_master where bar_code=#{barCode} select inp_no,visit_id,discharge_date_time,name from archive_master where bar_code=#{barCode}
</select> </select>
<select id="getMasterID" resultType="com.emr.vo.ArchiveMasterVo">
select * from archive_master where discharge_date_time between'2024-02-01 00:00:00' and '2024-03-31 23:59:59'
</select>
</mapper> </mapper>

@ -1158,7 +1158,7 @@
commomtable commomtable
<where> <where>
<if test="inpatientNo != null and inpatientNo != ''"> <if test="inpatientNo != null and inpatientNo != ''">
AND inpatient_no like '%${inpatientNo}%' AND admiss_id =#{inpatientNo}
</if> </if>
<if test="admissId != null and admissId != ''"> <if test="admissId != null and admissId != ''">
AND admiss_id = #{admissId} AND admiss_id = #{admissId}
@ -1239,7 +1239,7 @@
from commomtable from commomtable
<where> 1=1 <where> 1=1
<if test="inpatientNo != null and inpatientNo != ''"> <if test="inpatientNo != null and inpatientNo != ''">
AND inpatient_no like '%${inpatientNo}%' AND admiss_id =#{inpatientNo}
</if> </if>
<if test="idCard != null and idCard != ''"> <if test="idCard != null and idCard != ''">
AND id_card = #{idCard} AND id_card = #{idCard}

Loading…
Cancel
Save