新增对外浏览病案接口页面

master
bigbananass 4 years ago
parent 35b4e1c5d5
commit eb9bc60a0a

@ -0,0 +1,356 @@
package com.emr.controller;
import com.alibaba.fastjson.JSON;
import com.emr.dao.Emr_DictionaryMapper;
import com.emr.entity.*;
import com.emr.service.Archive_DetailService;
import com.emr.service.Archive_MasterService;
import com.emr.service.Zd_AssortService;
import com.emr.util.ExceptionPrintUtil;
import com.emr.util.Msg;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
/**
* @author zwh
* */
@Controller
@RequestMapping("font/")
public class FontController {
@Value("${pdfWater}")
private String pdfWater;
@Value("${allAddortIds}")
private String allAddortIds;
@Value("${POWER_URLHEAD}")
private String powerUrlHead;
@Autowired
private Archive_DetailService archiveDetailService;
@Autowired
private Archive_MasterService archiveMasterService;
@Autowired
private Emr_DictionaryMapper dictionaryMapper;
@Autowired
private Zd_AssortService assortService;
/***************************提供第三方按多个分段id和记账号查询病历pdf***********************************/
/**
* idpdf
* */
@RequestMapping("showRecordByPatientId")
public String showRecordByPatientId(String assortIds, String patientId, Model model){
if(StringUtils.isBlank(assortIds)){
return retrunErrorPage(model,"病案分类Id不能为空!");
}
if(StringUtils.isBlank(patientId)){
return retrunErrorPage(model,"记账号不能为空!");
}
List<Archive_Master> list = new ArrayList<>();
//判断工号是否存在
try {
/* String checkUserName = checkUserName(userName);
if(StringUtils.isNotBlank(checkUserName)){
return retrunErrorPage(model,checkUserName);
}*/
//判断分类id是否存在,协商assortIds = "00000000"为查询全部
if(!allAddortIds.equals(assortIds)) {
String checkAssortIds = checkAssortIds(assortIds);
if (StringUtils.isNotBlank(checkAssortIds)) {
return retrunErrorPage(model, checkAssortIds);
}
}
//判断记账号是否存在
Archive_Master master = new Archive_Master();
master.setPatientId(patientId);
list = archiveMasterService.selectByObject(master);
if(null == list || list.isEmpty()){
return retrunErrorPage(model,"记账号不存在!");
}
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
}
model.addAttribute("patientId",list.get(0).getId());
model.addAttribute("accountNumber",list.get(0).getPatientId());
model.addAttribute("assortIds",assortIds);
return "font/showRecord";
}
/**
*
* */
private String retrunErrorPage(Model model,String errorMsg){
model.addAttribute("errorMsg",errorMsg);
return "font/error";
}
/**
* id
* */
private String checkAssortIds(String assortIds){
Zd_Assort assort = new Zd_Assort();
assort.setPrintFlag("0");
List<Zd_Assort> assortList = null;
try {
assortList = assortService.selectAll(assort);
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
}
if(null != assortList && !assortList.isEmpty()){
String[] split = assortIds.split(",");
for (String s : split) {
//定义分类存在
boolean exist = false;
if (StringUtils.isNotBlank(s)) {
for (Zd_Assort assort1 : assortList) {
if (s.equals(assort1.getAssortId())) {
exist = true;
break;
}
}
}
if (!exist) {
return "病案分类Id有误!";
}
}
}else{
return "病案分类Id有误!";
}
return null;
}
/**
*
* @param masterId
* @return
*/
@ResponseBody
@RequestMapping(value = "/getRecord")
public String getPdfToPdf(String masterId){
try {
Archive_Master archiveMaster = archiveMasterService.selectById(masterId);
//转换科室数据字典
if(StringUtils.isNotBlank(archiveMaster.getDeptName())){
Emr_Dictionary dictionary = new Emr_Dictionary();
dictionary.setCode(archiveMaster.getDeptName());
dictionary.setTypecode("dept_code");
List<Emr_Dictionary> dictionaries = dictionaryMapper.dicByTypeCode(dictionary);
if(null != dictionaries && !dictionaries.isEmpty()){
archiveMaster.setDeptName(dictionaries.get(0).getName());
}
//判断出院日期
String dischargeDateTime = archiveMaster.getDischargeDateTime();
if(StringUtils.isNotBlank(dischargeDateTime)){
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
String time = fmt.format(fmt.parse(dischargeDateTime));
if("1801-02-03".equals(time)){
archiveMaster.setDischargeDateTime(null);
}
}
}
return JSON.toJSONString(archiveMaster);
} catch (ParseException e) {
ExceptionPrintUtil.printException(e);
//e.printStackTrace();
return null;
}
}
/**
* showRecordIframe
* */
@RequestMapping("showRecordIframe")
public String showRecordIframe(){
return "font/showRecordIframe";
}
/**
* masterid
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/getRecordTypeTree")
public String getRecordTypeTree(String patientId,String assortIds){
List<AssortTypeTree> treeList = new ArrayList<>();
if(StringUtils.isNotBlank(patientId) && StringUtils.isNotBlank(assortIds)){
List<Archive_Detail> list = new ArrayList<>();
//assortIds等于协商的全查的分类id全查
try {
if(allAddortIds.equals(assortIds)){
list = archiveDetailService.selectTypeTreeByPatientIdAndAssortIds(patientId, null);
}else{
//否则按条件查
//分类id分别以单引号隔开
StringBuilder assortIdStr = new StringBuilder();
String[] split = assortIds.split(",");
for (String s : split) {
assortIdStr.append("'").append(s).append("',");
}
//去掉最后一个逗号
assortIdStr = new StringBuilder(assortIdStr.substring(0, assortIdStr.length() - 1));
list = archiveDetailService.selectTypeTreeByPatientIdAndAssortIds(patientId, assortIdStr.toString());
}
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
}
if(null != list && !list.isEmpty()){
Set<String> assortList = new LinkedHashSet<>();
//抽取首次病程记录
String strTemp = "首次病程";
String assortId = "AFB9FBE656D7492C80AEDE6E685A851A";
//定义护理记录里的首次护理记录排前头
String nurseTemp = "首次护理";
String nurseAssortId = "C70E8C427A3648B79BE80798C08F4D12";
Archive_Detail detailTemp = new Archive_Detail();
Archive_Detail nurseDetailVoTemp = new Archive_Detail();
//分类去重
for(Archive_Detail detail : list){
assortList.add(detail.getSubassort());
//获取title
String title = detail.getTitle();
if(StringUtils.isNotBlank(title) && detail.getTitle().contains(strTemp)){
detailTemp = detail;
}
if(StringUtils.isNotBlank(title) && detail.getTitle().contains(nurseTemp)){
nurseDetailVoTemp = detail;
}
}
//组织树
int id = 1;
//定义第一层的id为第二层父id
int oneParentId = 0;
//定义第二层的id为第三层父id
int twoParentId = 0;
AssortTypeTree tree = new AssortTypeTree();
//第一层,根目录全部影像资料
tree.setId(id);
tree.setParentId(0);
tree.setName("全部影像资料");
tree.setChecked("true");
treeList.add(tree);
oneParentId = id;
id++;
for(String assortName : assortList){
AssortTypeTree tree1 = new AssortTypeTree();
//第二层,分类名称
tree1.setId(id);
tree1.setParentId(oneParentId);
twoParentId = id;
id++;
//定义该类的数量
int count = 0;
//定义是否添加了首次病程
boolean flag = false;
boolean nurseflag = false;
for(Archive_Detail detail : list){
if(StringUtils.isNotBlank(detail.getSubassort()) && assortName.equals(detail.getSubassort())){
String assortid = detail.getAssortid();
if(StringUtils.isNotBlank(assortid) && assortid.equals(assortId)){
//是病程记录
if(!flag && StringUtils.isNotBlank(detailTemp.getTitle())){
AssortTypeTree tree2 = new AssortTypeTree();
//第三层,资料名称
count++;
tree2.setId(id);
tree2.setParentId(twoParentId);
tree2.setName(detailTemp.getTitle());
tree2.setSelfId(detailTemp.getId());
tree2.setChecked("true");
treeList.add(tree2);
id++;
flag = true;
}
}
if(StringUtils.isNotBlank(assortid) && assortid.equals(nurseAssortId)){
//是护理记录
if(!nurseflag && StringUtils.isNotBlank(nurseDetailVoTemp.getTitle())){
AssortTypeTree tree2 = new AssortTypeTree();
//第三层,资料名称
count++;
tree2.setId(id);
tree2.setParentId(twoParentId);
tree2.setName(nurseDetailVoTemp.getTitle());
tree2.setSelfId(nurseDetailVoTemp.getId());
tree2.setChecked("true");
treeList.add(tree2);
id++;
nurseflag = true;
}
}
if(!detail.equals(detailTemp) && !detail.equals(nurseDetailVoTemp)) {
AssortTypeTree tree2 = new AssortTypeTree();
//第三层,资料名称
count++;
tree2.setId(id);
tree2.setParentId(twoParentId);
tree2.setName(detail.getTitle());
tree2.setSelfId(detail.getId());
tree2.setChecked("true");
treeList.add(tree2);
id++;
}
}
}
tree1.setName(assortName + "("+count+")");
tree1.setChecked("true");
treeList.add(tree1);
}
}
}
return JSON.toJSONString(treeList);
}
/**
* idPDFpdf
* @param response
* @param detailIds
* @return
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "/getPdfToPdf",method = RequestMethod.POST)
public Msg getPdfToPdf(HttpServletResponse response, String detailIds, HttpSession session){
try {
Archive_Detail detail = new Archive_Detail();
if(StringUtils.isNotBlank(detailIds)){
detail.setTitle(detailIds);
archiveDetailService.selectByIdStrFont(response,session,detail);
}else{
//存至session
session.setAttribute("showRecord",null);
}
return Msg.success();
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
return Msg.fail("查看出错了,请联系系统管理员");
//e.printStackTrace();
}
}
@ResponseBody
@RequestMapping(value = "showPdf")
public void showPdf(HttpServletResponse response,HttpSession session){
try {
archiveDetailService.showPdf(response,session,pdfWater);
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
}
}
}

@ -2,6 +2,7 @@ package com.emr.dao;
import com.emr.entity.Archive_Detail;
import com.emr.entity.Archive_Detail_Vo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -32,4 +33,5 @@ public interface Archive_DetailMapper {
List<Archive_Detail> selectByCol2(Archive_Detail record);
List<Archive_Detail> selectTypeTreeByPatientIdAndAssortIds(@Param("patientId")String patientId, @Param("assortIds")String assortIds);
}

@ -49,4 +49,9 @@ public interface Archive_MasterMapper {
//封存日志
List<Archive_Master_Vo> selectByFollowinglog(Archive_Master_Vo record);
/**
*
* */
List<Archive_Master> selectByObject(Archive_Master master);
}

@ -1,6 +1,7 @@
package com.emr.dao;
import com.emr.entity.Zd_Assort;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -10,4 +11,9 @@ public interface Zd_AssortMapper {
int insertSelective(Zd_Assort record);
List<Zd_Assort> selectByColm(Zd_Assort record);
/**
*
* */
List<Zd_Assort> selectAll(@Param("record") Zd_Assort record);
}

@ -0,0 +1,65 @@
package com.emr.entity;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2020/4/22 17:40
* @UpdateUser:
* @UpdateDate: 2020/4/22 17:40
* @UpdateRemark:
* @Version: 1.0
*/
public class AssortTypeTree {
private Integer id;
private Integer parentId;
private String name;
private String selfId;
private String checked;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSelfId() {
return selfId;
}
public void setSelfId(String selfId) {
this.selfId = selfId;
}
public String getChecked() {
return checked;
}
public void setChecked(String checked) {
this.checked = checked;
}
}

@ -9,7 +9,10 @@ package com.emr.service;
import com.emr.entity.Archive_Detail;
import com.emr.entity.Archive_Detail_Vo;
import com.emr.entity.OffsetLimitPage;
import org.apache.ibatis.annotations.Param;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
public interface Archive_DetailService {
@ -84,6 +87,14 @@ public interface Archive_DetailService {
List<Archive_Detail> selectByIdStr(Archive_Detail record);
List<Archive_Detail> selectByCol2(Archive_Detail record);
List<Archive_Detail> selectTypeTreeByPatientIdAndAssortIds(@Param("patientId")String patientId, @Param("assortIds")String assortIds);
void selectByIdStrFont(HttpServletResponse response, HttpSession session, Archive_Detail detail);
List<String> mulFile2OneById(HttpServletResponse response,List<Archive_Detail> arList);
void showPdf(HttpServletResponse response, HttpSession session, String pdfWater);
}

@ -198,6 +198,11 @@ public interface Archive_MasterService {
//封存日志
OffsetLimitPage selectByFollowinglog(Archive_Master_Vo record, Integer offset, Integer limit);
/**
*
* */
List<Archive_Master> selectByObject(Archive_Master master);
}

@ -4,9 +4,15 @@ import com.emr.entity.Emr_Log;
import com.emr.entity.Emr_Log_Vo;
import com.emr.entity.OffsetLimitPage;
import com.emr.entity.Zd_Assort;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface Zd_AssortService {
List<Zd_Assort> selectByColm(Zd_Assort record);
/**
*
* */
List<Zd_Assort> selectAll(@Param("record") Zd_Assort record);
}

@ -12,11 +12,17 @@ import com.emr.entity.Archive_Detail_Vo;
import com.emr.entity.Emr_Fault_Vo;
import com.emr.entity.OffsetLimitPage;
import com.emr.service.Archive_DetailService;
import com.emr.util.Jpg2PdfUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
@Service
@ -83,7 +89,81 @@ public class Archive_DetailServiceImpl implements Archive_DetailService {
return archiveDetailMapper.selectByCol2(record);
}
@Override
public List<Archive_Detail> selectTypeTreeByPatientIdAndAssortIds(String patientId, String assortIds) {
return archiveDetailMapper.selectTypeTreeByPatientIdAndAssortIds(patientId,assortIds);
}
@Override
public void selectByIdStrFont(HttpServletResponse response, HttpSession session, Archive_Detail detail) {
List<Archive_Detail> arList = archiveDetailMapper.selectByIdStr(detail);
List<String> pdfList = mulFile2OneById(response, arList);
//存至session
session.setAttribute("showRecord",pdfList);
}
/**
* pdf
* @param response
* @param arList
*/
@Override
public List<String> mulFile2OneById(HttpServletResponse response,List<Archive_Detail> arList) {
List<String> pdfList = new ArrayList<>();
if (arList != null && !arList.isEmpty()) {
//TODO 抽取首次病程记录
String strTemp = "首次病程";
String assortId = "AFB9FBE656D7492C80AEDE6E685A851A";
//定义护理记录里的首次护理记录排前头
String nurseTemp = "首次护理";
String nurseAssortId = "C70E8C427A3648B79BE80798C08F4D12";
if(!CollectionUtils.isEmpty(arList)) {
String strPath = "";
String nursePath = "";
for (int i = 0; i < arList.size(); i++) {
String assortid = arList.get(i).getAssortid();
if(StringUtils.isNotBlank(assortid) && assortid.equals(assortId) && arList.get(i).getTitle().contains(strTemp)){
strPath = arList.get(i).getPdfPath();
}
if(StringUtils.isNotBlank(assortid) && assortid.equals(nurseAssortId) && arList.get(i).getTitle().contains(nurseTemp)){
nursePath = arList.get(i).getPdfPath();
}
}
//定义是否添加首次病程
boolean flag = false;
boolean nurseFlag = false;
for (Archive_Detail detail : arList) {
String str = detail.getPdfPath();
if (StringUtils.isNoneBlank(str)) {
//病程分类先添加首次病程
if (detail.getAssortid().equals(assortId) && !flag && StringUtils.isNotBlank(strPath)) {
pdfList.add(strPath);
flag = true;
}
//护理记录单先添加首次护理
if (detail.getAssortid().equals(nurseAssortId) && !nurseFlag && StringUtils.isNotBlank(nursePath)) {
pdfList.add(nursePath);
nurseFlag = true;
}
if(!detail.getPdfPath().equals(strPath) && !detail.getPdfPath().equals(nursePath)){
pdfList.add(str);
}
}
}
}
}
return pdfList;
}
@Override
public void showPdf(HttpServletResponse response, HttpSession session, String pdfWater) {
List<String> pdfList = (List<String>)session.getAttribute("showRecord");
if(!CollectionUtils.isEmpty(pdfList)) {
Jpg2PdfUtil jpg2PdfUtil = Jpg2PdfUtil.getInstance();
jpg2PdfUtil.mulFile2One(response, pdfList, pdfWater);
}
//删除缓存` ` `
session.removeAttribute("showRecord");
}
}

@ -357,6 +357,11 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
return new OffsetLimitPage((Page) list);
}
@Override
public List<Archive_Master> selectByObject(Archive_Master master) {
return archiveMasterMapper.selectByObject(master);
}
}

@ -32,6 +32,11 @@ public class Zd_AssortServiceImpl implements Zd_AssortService {
public List<Zd_Assort> selectByColm(Zd_Assort record) {
return zdAssortMapper.selectByColm(record);
}
@Override
public List<Zd_Assort> selectAll(Zd_Assort record) {
return zdAssortMapper.selectAll(record);
}
}

@ -0,0 +1,36 @@
package com.emr.util;
import org.apache.log4j.Logger;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2020/8/4 14:18
* @UpdateUser:
* @UpdateDate: 2020/8/4 14:18
* @UpdateRemark:
* @Version: 1.0
*/
public class ExceptionPrintUtil {
private static Logger log = Logger.getLogger("errorMsg");
public static void printException(Exception e){
//方法名
ByteArrayOutputStream baos = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(baos));
String exception = baos.toString();
log.error(exception);
try {
baos.flush();
baos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}

@ -0,0 +1,187 @@
package com.emr.util;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.pdf.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.util.CollectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2019/6/6 9:07
* @UpdateUser:
* @UpdateDate: 2019/6/6 9:07
* @UpdateRemark:
* @Version: 1.0
*/
public class Jpg2PdfUtil {
private static Logger log = Logger.getLogger("myMsg");
/**
* itextpdf
*/
private PdfReader check(String file) {
if(StringUtils.isNotBlank(file)) {
PdfReader pdfReader = null;
try {
pdfReader = new PdfReader(file);
if (pdfReader.getNumberOfPages() != 0) {
return pdfReader;
}
} catch (Exception e) {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String logStr = "'"+ file + "'"+"文件损坏或不存在";
log.info(logStr);
System.out.println(fmt.format(new Date()) + ":" + logStr);
} finally {
if (null != pdfReader) {
pdfReader.close();
}
}
}
return null;
}
private Jpg2PdfUtil(){};
public static Jpg2PdfUtil getInstance(){
return ContainerHolder.HOLDER.jpg2PdfUtil;
}
private enum ContainerHolder{
HOLDER;
private Jpg2PdfUtil jpg2PdfUtil;
ContainerHolder(){
jpg2PdfUtil = new Jpg2PdfUtil();
}
}
public void mulFile2One(HttpServletResponse response, List<String> files, String waterMarkName) {
List<PdfReader> list = new ArrayList<>();
//遍历删除,除去损坏,文件不存在,抛异常就是空白页
Iterator<String> iterator = files.iterator();
while (iterator.hasNext()) {
PdfReader check = check(iterator.next());
if(null != check){
list.add(check);
}
}
if (!CollectionUtils.isEmpty(list)) {
// pdf合并工具类
Document document = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PdfCopy copy = null;
try {
response.reset();
document = new Document(list.get(0).getPageSize(1));
copy = new PdfCopy(document, response.getOutputStream());
document.open();
for (PdfReader reader : list) {
bos.flush();
//判断是否加水印
if (StringUtils.isNotBlank(waterMarkName)) {
setWatermark(bos, reader, waterMarkName, null);
reader = new PdfReader(bos.toByteArray());
}
int n = reader.getNumberOfPages();
for (int j = 1; j <= n; j++) {
document.newPage();
PdfImportedPage page = null;
if (StringUtils.isNotBlank(waterMarkName)) {
page = copy.getImportedPage(reader, j);
} else {
page = copy.getImportedPage(reader, j);
}
copy.addPage(page);
}
reader.close();
}
} catch (Exception e) {
//e.printStackTrace();
} finally {
if (null != copy) {
copy.close();
}
try {
bos.flush();
bos.close();
} catch (Exception e) {
//e.printStackTrace();
}
if (null != document) {
document.close();
}
}
}
}
//加水印
private void setWatermark(ByteArrayOutputStream bos, PdfReader reader, String waterMarkName, String imgPath) {
PdfStamper stamper = null;
try {
stamper = new PdfStamper(reader, bos);
//stamper.setEncryption(null, null, ~(PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_PRINTING), PdfWriter.STANDARD_ENCRYPTION_128);
int total = reader.getNumberOfPages() + 1;
PdfContentByte content;
BaseFont base = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED);
PdfGState gs = new PdfGState();
for (int i = 1; i < total; i++) {
content = stamper.getOverContent(i);// 在内容上方加水印
//加文字水印
if (StringUtils.isNotBlank(waterMarkName)) {
gs.setFillOpacity(0.3f);
gs.setStrokeOpacity(0.3f);
content.setGState(gs);
content.beginText();
content.setColorFill(Color.LIGHT_GRAY);
content.setFontAndSize(base, 50);
content.setTextMatrix(70, 200);
//v:距左 v1:距下 v2:
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 300, 600, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 300, 200, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 800, 600, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 800, 200, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 300, 1100, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 300, 1500, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 800, 1100, 40);
content.showTextAligned(Element.ALIGN_CENTER, waterMarkName, 800, 1500, 40);
content.endText();
}
if (StringUtils.isNotBlank(imgPath)) {
Image image = Image.getInstance(imgPath);
image.setAbsolutePosition(200, 206); // set the first background
image.scaleToFit(200, 200);
content.addImage(image);
}
content.setColorFill(Color.BLACK);
content.setFontAndSize(base, 8);
}
} catch (IOException | DocumentException e) {
e.printStackTrace();
} finally {
try {
assert stamper != null;
stamper.close();
} catch (DocumentException | IOException e) {
e.printStackTrace();
}
}
}
}

@ -0,0 +1,75 @@
/**
*
*/
package com.emr.util;
import java.util.HashMap;
import java.util.Map;
/**
* <p>Title:Msg </p>
* <p>Description:common return class </p>
* <p>Company: </p>
* @author hu
* @date
*/
public class Msg {
//state:100-success 200-fail
private int code;
//提示信息
private String msg;
//用户要返回给浏览器的数据
private Map<String,Object> extend=new HashMap<String,Object>();
public static Msg success(){
Msg result=new Msg();
result.setCode(100);
result.setMsg("success");
return result;
}
public static Msg fail(){
Msg result=new Msg();
result.setCode(200);
result.setMsg("fail");
return result;
}
public static Msg fail(String msg){
Msg result=new Msg();
result.setCode(200);
result.setMsg(msg);
return result;
}
public Msg add(String key, Object value){
this.getExtend().put(key, value);
return this;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Map<String, Object> getExtend() {
return extend;
}
public void setExtend(Map<String, Object> extend) {
this.extend = extend;
}
}

@ -5,10 +5,11 @@
#jdbc.mysql.password=root
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc\:sqlserver\://127.0.0.1:1433;databaseName=emr_recode_test
jdbc.url=jdbc\:sqlserver\://127.0.0.1:1433;databaseName=emr_record_zj
#jdbc.url=jdbc\:sqlserver\://10.6.1.127:1433;databaseName=DB_PrivilegeManagement_GYFY
jdbc.username=sa
jdbc.password=123456
#jdbc.password=123456
jdbc.password=xjgs+docus911
#hibernate config
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
@ -32,18 +33,21 @@ expired=7
#死亡超期天数
deathExpired=7
powerUrl=http://127.0.0.1:8080/power/font/getMenusByUserIdAndSysFlag
POWER_URLHEAD=http://127.0.0.1:8080/power
POWER_JSP=http://127.0.0.1:8080/power
powerUrl=http://127.0.0.1:8081/power/font/getMenusByUserIdAndSysFlag
POWER_URLHEAD=http://127.0.0.1:8081/power
POWER_JSP=http://127.0.0.1:8081/power
recallReason=医院需要这份文档
#HomepageDictionary=http://120.27.212.36:9999/WholeCheckInterface/services/HomepageDictionary?wsdl
#HomepageDictionary=http://10.6.1.127:9999/WholeCheckInterface/services/HomepageDictionary?wsdl
HomepageDictionary=http://127.0.0.1:8080/WholeCheckInterface/services/HomepageDictionary?wsdl
HomepageDictionary=http://127.0.0.1:8081/WholeCheckInterface/services/HomepageDictionary?wsdl
HomepageMethod=CheckData
powerGetUserList=http://127.0.0.1:8080/power/font/getUserList?userName=admin
powerGetUserList=http://127.0.0.1:8081/power/font/getUserList?userName=admin
allAddortIds = 00000000
#pdf\u6C34\u5370
pdfWater = \u4F5B\u5C71\u5E02\u9AD8\u660E\u4EBA\u6C11\u533B\u9662
#菜单接口http://120.27.212.36:8888/power/font/getMenusByUserIdAndSysFlag
#powerUrl=http://120.27.212.36:8888/power/font/getMenusByUserIdAndSysFlag

@ -342,4 +342,25 @@
page_number=#{pageNumber,jdbcType=INTEGER}
where id = #{id,jdbcType=NVARCHAR}
</update>
<!--以master表的记账号或分类id集合组织分类树-->
<select id="selectTypeTreeByPatientIdAndAssortIds" resultMap="BaseResultMap">
SELECT
archive_detail.id,
zd_assort.assort_name subassort,
archive_detail.AssortID,
archive_detail.Title
FROM
archive_detail
LEFT JOIN zd_assort ON archive_detail.AssortID = zd_assort.assort_id
WHERE
archive_detail.flag != '1'
<if test="patientId != null and patientId != ''">
AND archive_detail.MasterID = #{patientId}
</if>
<if test="assortIds != null and assortIds != ''">
AND archive_detail.AssortID in (${assortIds})
</if>
ORDER BY zd_assort.assort_sort
</select>
</mapper>

@ -99,6 +99,15 @@
from archive_master
where id = #{id,jdbcType=NVARCHAR}
</select>
<!--查询病案是否存在-->
<select id="selectByObject" resultMap="BaseResultMap">
select * from archive_master
<where>
<if test="patientId != null and patientId != ''">
and patient_id = #{patientId,jdbcType=NVARCHAR}
</if>
</where>
</select>
<select id="selectByCol" parameterType="com.emr.entity.Archive_Master_Vo" resultMap="BaseResultMap">
select distinct m.id,m.patient_id,m.inp_no,m.visit_id,m.name,m.sex,f.name
dept_name,CONVERT(varchar(10),m.discharge_date_time, 120) discharge_date_time,m.ArchiveState,CONVERT(varchar(10),m.admission_date_time, 120) admission_date_time,d.name dept_admission_to

@ -58,4 +58,23 @@
</if>
</trim>
</insert>
<!--查询全部-->
<select id="selectAll" resultMap="BaseResultMap">
SELECT
*
FROM
zd_assort
<where>
print_flag = 0
<if test="record.assortName != '' and record.assortName != null">
AND assort_name = #{record.assortName}
</if>
<if test="record.printFlag != '' and record.printFlag != null">
AND print_flag = ${record.printFlag}
</if>
</where>
ORDER BY
assort_sort
</select>
</mapper>

@ -0,0 +1,45 @@
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link rel="stylesheet" href="${path}/static/js/confirm/jquery-confirm.min.css">
<script src="${path}/static/js/confirm/jquery-confirm.min.js"></script>
<input type="hidden" id="common_confirm_btn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#common_confirm_model">
<div id="common_confirm_model" class="modal" style="z-index: 99999">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> <span class="title"></span></h5>
</div>
<div class="modal-body small">
<p ><span class="message"></span></p>
</div>
<div class="modal-footer" >
<button type="button" class="btn btn-primary ok" data-dismiss="modal">确认</button>
<button type="button" class="btn btn-default cancel" data-dismiss="modal">取消</button>
</div>
</div>
</div>
</div>
<script>
var Common = {
confirm:function(params){
var model = $("#common_confirm_model");
model.find(".title").html(params.title)
model.find(".message").html(params.message)
$("#common_confirm_btn").click()
//每次都将监听先关闭,防止多次监听发生,确保只有一次监听
model.find(".cancel").off("click")
model.find(".ok").off("click")
model.find(".ok").on("click",function(){
params.operate(true)
})
model.find(".cancel").on("click",function(){
params.operate(false)
})
}
}
</script>

@ -0,0 +1,75 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/comm.jspf" %>
<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>提示页面</title>
<meta http-equiv=X-UA-Compatible IE=EmulateIE7>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="shortcut icon" href="${path}/static/favicon.ico">
<link rel="stylesheet" href="${path }/static/css/layui.css" media="all" />
<!--[if lt IE 9]>
<![endif]-->
<script>
var path = "${path}";
</script>
<style type="text/css">
body{
width:100%;
margin:0;
padding:0;
}
.main{
width:100%;
}
/*
*页头div
*/
.headDiv{
height:43px;
background-color: #1D9ED7;
}
/*
*页头标题div
*/
.headSpanDiv{
padding:10px 15px;
}
/*
*页头标题
*/
.headspan{
color: #fff;
font-size: 1.2em;
font-weight: bold;
}
h4{
color: #fff;
font-size: 1.0em;
font-weight: bold;
}
hr{
margin:0!important;
}
</style>
</head>
<body>
<div class="main">
<div class="headDiv">
<div class="headSpanDiv">
<span class="headspan">
错误提示
</span>
</div>
</div>
<div >
<blockquote class="layui-elem-quote">${errorMsg}</blockquote>
</div>
</div>
</body>
</html>

@ -0,0 +1,171 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/comm.jspf" %>
<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>病案浏览</title>
<meta http-equiv=X-UA-Compatible IE=EmulateIE7>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="shortcut icon" href="${path}/static/favicon.ico">
<!--[if lt IE 9]>
<script type="text/javascript" src="${path}/static/js/html5shiv.min.js"></script>
<script type="text/javascript" src="${path}/static/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="${path}/static/js/respond.min.js"></script>
<![endif]-->
<script>
var path = "${path}";
</script>
<style type="text/css">
body{
width:100%;
height:100%;
margin:0;
padding:0;
background-color: #F2F2F2;
}
.main{
width:100%;
background-color: #c1d7e3;
}
/*
*页头div
*/
.headDiv{
height:43px;
background-color: #1D9ED7;
}
/*
*页头标题div
*/
.headSpanDiv{
padding:10px 15px;
}
/*
*页头标题
*/
.headspan{
color: #fff;
font-size: 1.2em;
font-weight: bold;
}
.searchDiv{
width:100%;
height:13%;
background-color: #FFF;
}
.contentDiv{
width:100%;
height: calc(100vh - 13% - 43px - 1vh);
margin-top:1vh;
background-color: #FFF;
}
.labelDiv{
padding-top: 2%;
padding-right: 0;
text-align: right;
}
.rowDiv{
padding-top:0.5%;
}
.inputDiv{
padding:0!important;
margin-left: -3%!important;
}
h4{
color: #fff;
font-size: 1.0em;
font-weight: bold;
}
hr{
margin:0!important;
}
#iframe{
height: 100%;
}
</style>
</head>
<body style="scroll:auto" onkeydown="disabledPrint()">
<!--主键-->
<input type="hidden" id="patientId" value="${patientId}">
<!--记账号-->
<input type="hidden" id="accountNumber" value="${accountNumber}">
<input type="hidden" id="assortIds" value="${assortIds}">
<!--业务识别码1:护理按需采集预览-->
<input type="hidden" id="typeFlag" value="1">
<div class="main">
<div class="headDiv">
<div class="headSpanDiv">
<span class="headspan">
病案浏览
</span>
</div>
</div>
<!--病案详情-->
<div class="searchDiv">
<input type="hidden" id="admissId" value="${commom.admissId}">
<div class="row rowDiv">
<div class="col-sm-3 inputDiv">
<div class="form-group">
<label class="col-sm-5 control-label labelDiv">主管医生:</label>
<div class="col-sm-7">
<input type="text" readonly class="form-control input input-sm input" id="doctorInCharge">
</div>
</div>
</div>
<div class="col-sm-3 inputDiv">
<div class="form-group">
<label class="col-sm-5 control-label labelDiv">姓名:</label>
<div class="col-sm-7">
<input type="text" readonly class="form-control input-sm input" id="name">
</div>
</div>
</div>
<div class="col-sm-3 inputDiv">
<div class="form-group">
<label class="col-sm-5 control-label labelDiv">住院号:</label>
<div class="col-sm-7">
<input type="text" readonly class="form-control input-sm input" id="inpatientNo">
</div>
</div>
</div>
<div class="col-sm-3 inputDiv">
<div class="form-group">
<label class="col-sm-5 control-label labelDiv">住院次数:</label>
<div class="col-sm-7">
<input type="text" readonly class="form-control input-sm input" id="admissTimes">
</div>
</div>
</div>
</div>
<div class="row rowDiv">
<div class="col-sm-3 inputDiv">
<div class="form-group">
<label class="col-sm-5 control-label labelDiv">出院科室:</label>
<div class="col-sm-7">
<input type="text" readonly class="form-control input-sm input" id="disDeptName">
</div>
</div>
</div>
<div class="col-sm-3 inputDiv">
<div class="form-group">
<label class="col-sm-5 control-label labelDiv">出院日期:</label>
<div class="col-sm-7">
<input type="text" readonly class="form-control input-sm input" id="disDate">
</div>
</div>
</div>
</div>
</div>
<div class="contentDiv">
<iframe width="100%" src="" id="iframe" frameborder="0" scrolling="no"></iframe>
</div>
</div>
<script type="text/javascript" src="${path}/static/js/showRecord/showRecord.js"></script>
<script type="text/javascript" src="${path}/static/js/showRecord/showRecordIframeCommom.js"></script>
</body>
</html>

@ -0,0 +1,94 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="path" value="${pageContext.request.contextPath}"/>
<%@ include file="/WEB-INF/jspf/comm.jspf" %>
<%@ include file="/WEB-INF/jspf/ztreeCommom.jsp" %>
<%@ include file="/WEB-INF/jspf/confirmJsp.jspf" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>预览pdfIframe页面</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv=X-UA-Compatible IE=EmulateIE7>
<!--[if lt IE 9]>
<script type="text/javascript" src="${path}/static/js/html5shiv.min.js"></script>
<script type="text/javascript" src="${path}/static/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="${path}/static/js/respond.min.js"></script>
<![endif]-->
<script>
var path = "${path}";
</script>
<style type="text/css">
body{
width:100%;
margin:0;
padding:0;
background-color: #F2F2F2;
}
.content-left{
height:100%;
width:16%;
float:left;
background-color: #FFFFFF;
}
.content-right{
height:100%;
width:83%;
float:right;
background-color: #FFFFFF;
}
.loading {
width: 148px;
height: 56px;
position: absolute;
top: 28px;
right: 16px;
line-height: 56px;
color: red;
padding-left: 60px;
font-size: 7px;
background: #000;
opacity: 0.7;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
display: none;
}
</style>
</head>
<body style="scroll:auto" onkeydown="disabledPrint()">
<div id="loading" class="loading">正在采集,请稍等</div>
<!--文件路径-->
<input type="hidden" id="filePath">
<input type="hidden" id="detailIds">
<div class="content-left">
<div class="row" style="margin-top: 5px">
<div class="col-md-4">
</div>
<div class="col-md-4" style="padding:0 2px">
<button type="button" class="btn btn-xs btn-primary" onclick="onloadPdf()">加载PDF</button>
</div>
<div class="col-md-4" style="padding:0 2px;" >
<button type="button" class="btn btn-xs btn-primary" style="display: none" onclick="flashPdf()" id="freshBtnDiv">刷新</button>
<button type="button" class="btn btn-xs btn-danger" style="display: none" id="delBtnDiv">删除</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="zTreeDemo">
<ul id="ztree" class="ztree"></ul>
</div>
</div>
</div>
</div>
<div class="content-right">
<iframe width="100%" src="" id="iframe1" frameborder="0" scrolling="yes"></iframe>
</div>
<script type="text/javascript" src="${path}/static/js/showRecord/showRecordIframe.js?time=2021-02-07"></script>
<script type="text/javascript" src="${path}/static/js/showRecord/showRecordIframeCommom.js"></script>
</body>
</html>

@ -0,0 +1,29 @@
//初始化函数
$(function(){
//加载病案信息
loadRecord();
//加载iframe
$("#iframe").prop("src",path+"/font/showRecordIframe?patientId="+$("#patientId").val())+"&assortIds="+assortIds;
})
//加载病案信息
function loadRecord(){
$.ajax({
type:'get',
url:path+'/font/getRecord',
data:{masterId:$("#patientId").val()},
async:false,
dataType:'json',
success:function (data) {
if(null != data && data != ''){
$("#doctorInCharge").val(data.doctorInCharge);
$("#inpatientNo").val(data.inpNo);
$("#name").val(data.name);
$("#admissTimes").val(data.visitId);
$("#disDate").val(data.dischargeDateTime);
$("#disDeptName").val(data.deptName);
$("#archivestate").val(data.archivestate);
}
}
})
}

@ -0,0 +1,136 @@
//树操作
var menu = {
setting: {
view:{
fontCss : {"font-family": "微软雅黑","color":"blue"}
},
data:{
key:{
name:"name"
},
simpleData: {
chkStyle: "checkbox",
enable: true,
idKey: "id",
pIdKey: "parentId"
}
},
check:{
enable:true
},
callback: { //回调函数
onCheck: onCheck,
onClick:onClick}
},
loadMenuTree:function(){
var url = '';
var params = '';
//获取业务识别编码
url = path+"/font/getRecordTypeTree";
params = {patientId:parent.$("#patientId").val(),assortIds:parent.$("#assortIds").val()};
$.ajax({
type: "post",
url: url,
data: params,
dataType:"json",
async:false,
success:function(data){
$.fn.zTree.init($("#ztree"), menu.setting, data);
zTree = $.fn.zTree.getZTreeObj("ztree");
var nodes = zTree.getNodes();
zTree.expandNode(nodes[0], true, false, true);
var detailIds = '';
for (var i = 0; i < data.length; i++) {
if(data[i].selfId != null && data[i].checked == 'true'){
if(i != data.length - 1){
detailIds += "'"+data[i].selfId+"',";
}else{
detailIds += "'"+data[i].selfId+"'";
}
}
}
if(detailIds.substring(detailIds.length-1,detailIds.length) == ","){
detailIds = detailIds.substring(0,detailIds.length-1);
}
if(detailIds == ''){
toastr.warning('该患者该时间段未上传报告!');
}
$("#detailIds").val(detailIds);
}
})
//加载pdf
onloadPdf();
}
};
//加载树
$().ready(function(data){
menu.loadMenuTree();
//判断是否是护理按需采集,是显示刷新按钮
var typeFlag = parent.$("#typeFlag").val();
if(typeFlag == 1){
$("#freshBtnDiv").show();
}else if(typeFlag == 2){
var delPower = parent.$("#delPower").val();
if(delPower == 1){
$("#delBtnDiv").show();
}
}
});
//获取获取树选中节点赋值隐藏域并加载pdf
function onPdfLoadByselected() {
var treeObj = $.fn.zTree.getZTreeObj("ztree");
nodes = treeObj.getCheckedNodes(true);
var detailIds = '';
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].level == 2) {
if (i != (nodes.length - 1)) {
detailIds += "'" + nodes[i].selfId + "',";
} else {
detailIds += "'" + nodes[i].selfId + "'";
}
}
}
$("#detailIds").val(detailIds);
//加载pdf
onloadPdf();
}
//树选中事件
function onCheck(e, treeId, treeNode) {
onPdfLoadByselected();
};
//树点击事件
function onClick(e, treeId, treeNode) {
//点击后选中
zTree.checkNode(treeNode,!treeNode.checked, true);
onPdfLoadByselected();
};
//加载pdfan按钮功能
function onloadPdf(){
var url = '';
var params = '';
//获取业务识别编码
var detailIds = $("#detailIds").val();
if(detailIds != '') {
url = path + "/font/getPdfToPdf";
params = {detailIds: detailIds};
$.ajax({
type: 'post',
url: url,
data: params,
success: function (data) {
if (data.code == 100) {
var pdfUrl = path + "/static/pdfjs/web/viewer.html?file=" + path + "/font/showPdf";
$("#iframe1").attr("src", pdfUrl);
$("#iframe1").css("height", $("body")[0].offsetHeight)
} else {
toastr.error(data.msg);
}
}
})
}
/*$("#iframe1").attr("src",path+"/static/pdfjs/web/viewer.html?file="+path+"/font/getPdfToPdf/"+patientId+"/"+detailIds);*/
}

@ -0,0 +1,18 @@
//屏蔽鼠标右键
document.oncontextmenu = function(e) {
var e = e || window.event;
e.returnValue = false;
return false;
}
//禁止快捷键打印
function disabledPrint(){
if(event.keyCode==80 && event.ctrlKey){
event.keyCode=0;
event.returnValue=false;
}
if (event.ctrlKey && event.keyCode == 83) {
event.preventDefault();
event.returnValue = false;
return false;
}
}
Loading…
Cancel
Save