优化打印预览备份(未完成)

master
zengwh 6 years ago
parent c3ea22c7e2
commit 398ac2fda2

@ -12,16 +12,22 @@
<result column="text_color" property="textColor" jdbcType="NVARCHAR" />
<result column="text_size" property="textSize" jdbcType="INTEGER" />
<result column="text_rotation" property="textRotation" jdbcType="INTEGER" />
<result column="is_img" property="isImg" jdbcType="SMALLINT" />
<result column="img_file" property="imgFile" jdbcType="NVARCHAR" />
<result column="img_width" property="imgWidth" jdbcType="INTEGER" />
<result column="img_height" property="imgHeight" jdbcType="INTEGER" />
<result column="img_x" property="imgX" jdbcType="INTEGER" />
<result column="img_y" property="imgY" jdbcType="INTEGER" />
<result column="unique_id" property="uniqueId" jdbcType="NVARCHAR" />
<result column="download_effective" property="downloadEffective" jdbcType="SMALLINT" />
<result column="download_is_img" property="downloadIsImg" jdbcType="SMALLINT" />
<result column="print_effective" property="printEffective" jdbcType="SMALLINT" />
<result column="print_is_img" property="printIsImg" jdbcType="SMALLINT" />
</resultMap>
<sql id="Base_Column_List" >
id, effective, up_or_under, transparent, text, text_x, text_y, text_color, text_size,
text_rotation, img_file, img_width, img_height, img_x, img_y, unique_id
text_rotation, is_img, img_file, img_width, img_height, img_x, img_y, unique_id,
download_effective, download_is_img, print_effective, print_is_img
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
@ -37,15 +43,19 @@
insert into emr_pdf_water_set (id, effective, up_or_under,
transparent, text, text_x,
text_y, text_color, text_size,
text_rotation, img_file, img_width,
img_height, img_x, img_y,
unique_id)
text_rotation, is_img, img_file,
img_width, img_height, img_x,
img_y, unique_id, download_effective,
download_is_img, print_effective, print_is_img
)
values (#{id,jdbcType=INTEGER}, #{effective,jdbcType=SMALLINT}, #{upOrUnder,jdbcType=SMALLINT},
#{transparent,jdbcType=REAL}, #{text,jdbcType=NVARCHAR}, #{textX,jdbcType=INTEGER},
#{textY,jdbcType=INTEGER}, #{textColor,jdbcType=NVARCHAR}, #{textSize,jdbcType=INTEGER},
#{textRotation,jdbcType=INTEGER}, #{imgFile,jdbcType=NVARCHAR}, #{imgWidth,jdbcType=INTEGER},
#{imgHeight,jdbcType=INTEGER}, #{imgX,jdbcType=INTEGER}, #{imgY,jdbcType=INTEGER},
#{uniqueId,jdbcType=NVARCHAR})
#{textRotation,jdbcType=INTEGER}, #{isImg,jdbcType=SMALLINT}, #{imgFile,jdbcType=NVARCHAR},
#{imgWidth,jdbcType=INTEGER}, #{imgHeight,jdbcType=INTEGER}, #{imgX,jdbcType=INTEGER},
#{imgY,jdbcType=INTEGER}, #{uniqueId,jdbcType=NVARCHAR}, #{downloadEffective,jdbcType=SMALLINT},
#{downloadIsImg,jdbcType=SMALLINT}, #{printEffective,jdbcType=SMALLINT}, #{printIsImg,jdbcType=SMALLINT}
)
</insert>
<insert id="insertSelective" parameterType="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
insert into emr_pdf_water_set
@ -80,6 +90,9 @@
<if test="textRotation != null" >
text_rotation,
</if>
<if test="isImg != null" >
is_img,
</if>
<if test="imgFile != null" >
img_file,
</if>
@ -98,6 +111,18 @@
<if test="uniqueId != null" >
unique_id,
</if>
<if test="downloadEffective != null" >
download_effective,
</if>
<if test="downloadIsImg != null" >
download_is_img,
</if>
<if test="printEffective != null" >
print_effective,
</if>
<if test="printIsImg != null" >
print_is_img,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
@ -130,6 +155,9 @@
<if test="textRotation != null" >
#{textRotation,jdbcType=INTEGER},
</if>
<if test="isImg != null" >
#{isImg,jdbcType=SMALLINT},
</if>
<if test="imgFile != null" >
#{imgFile,jdbcType=NVARCHAR},
</if>
@ -148,6 +176,18 @@
<if test="uniqueId != null" >
#{uniqueId,jdbcType=NVARCHAR},
</if>
<if test="downloadEffective != null" >
#{downloadEffective,jdbcType=SMALLINT},
</if>
<if test="downloadIsImg != null" >
#{downloadIsImg,jdbcType=SMALLINT},
</if>
<if test="printEffective != null" >
#{printEffective,jdbcType=SMALLINT},
</if>
<if test="printIsImg != null" >
#{printIsImg,jdbcType=SMALLINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
@ -180,6 +220,9 @@
<if test="textRotation != null" >
text_rotation = #{textRotation,jdbcType=INTEGER},
</if>
<if test="isImg != null" >
is_img = #{isImg,jdbcType=SMALLINT},
</if>
<if test="imgFile != null" >
img_file = #{imgFile,jdbcType=NVARCHAR},
</if>
@ -198,6 +241,18 @@
<if test="uniqueId != null" >
unique_id = #{uniqueId,jdbcType=NVARCHAR},
</if>
<if test="downloadEffective != null" >
download_effective = #{downloadEffective,jdbcType=SMALLINT},
</if>
<if test="downloadIsImg != null" >
download_is_img = #{downloadIsImg,jdbcType=SMALLINT},
</if>
<if test="printEffective != null" >
print_effective = #{printEffective,jdbcType=SMALLINT},
</if>
<if test="printIsImg != null" >
print_is_img = #{printIsImg,jdbcType=SMALLINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@ -212,12 +267,17 @@
text_color = #{textColor,jdbcType=NVARCHAR},
text_size = #{textSize,jdbcType=INTEGER},
text_rotation = #{textRotation,jdbcType=INTEGER},
is_img = #{isImg,jdbcType=SMALLINT},
img_file = #{imgFile,jdbcType=NVARCHAR},
img_width = #{imgWidth,jdbcType=INTEGER},
img_height = #{imgHeight,jdbcType=INTEGER},
img_x = #{imgX,jdbcType=INTEGER},
img_y = #{imgY,jdbcType=INTEGER},
unique_id = #{uniqueId,jdbcType=NVARCHAR}
unique_id = #{uniqueId,jdbcType=NVARCHAR},
download_effective = #{downloadEffective,jdbcType=SMALLINT},
download_is_img = #{downloadIsImg,jdbcType=SMALLINT},
print_effective = #{printEffective,jdbcType=SMALLINT},
print_is_img = #{printIsImg,jdbcType=SMALLINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -1,45 +0,0 @@
package com.emr.entity;
/**
* @Author:hjl
* @Date:Creatid in 15:44 2019/4/6
* @Description:
*/
public class Paper {
private long paperId;
private String paperName;
private int paperNum;
private String paperDetail;
public long getPaperId() {
return paperId;
}
public void setPaperId(long paperId) {
this.paperId = paperId;
}
public String getPaperName() {
return paperName;
}
public void setPaperName(String paperName) {
this.paperName = paperName;
}
public int getPaperNum() {
return paperNum;
}
public void setPaperNum(int paperNum) {
this.paperNum = paperNum;
}
public String getPaperDetail() {
return paperDetail;
}
public void setPaperDetail(String paperDetail) {
this.paperDetail = paperDetail;
}
}

@ -7,8 +7,6 @@ public class EmrPdfWaterSet implements Serializable {
private Short effective;
private Short downloadEffective;
private Short upOrUnder;
private Float transparent;
@ -27,8 +25,6 @@ public class EmrPdfWaterSet implements Serializable {
private Short isImg;
private Short downloadIsImg;
private String imgFile;
private Integer imgWidth;
@ -41,6 +37,14 @@ public class EmrPdfWaterSet implements Serializable {
private String uniqueId;
private Short downloadEffective;
private Short downloadIsImg;
private Short printEffective;
private Short printIsImg;
private static final long serialVersionUID = 1L;
public Integer getId() {
@ -59,14 +63,6 @@ public class EmrPdfWaterSet implements Serializable {
this.effective = effective;
}
public Short getDownloadEffective() {
return downloadEffective;
}
public void setDownloadEffective(Short downloadEffective) {
this.downloadEffective = downloadEffective;
}
public Short getUpOrUnder() {
return upOrUnder;
}
@ -139,14 +135,6 @@ public class EmrPdfWaterSet implements Serializable {
this.isImg = isImg;
}
public Short getDownloadIsImg() {
return downloadIsImg;
}
public void setDownloadIsImg(Short downloadIsImg) {
this.downloadIsImg = downloadIsImg;
}
public String getImgFile() {
return imgFile;
}
@ -195,6 +183,38 @@ public class EmrPdfWaterSet implements Serializable {
this.uniqueId = uniqueId == null ? null : uniqueId.trim();
}
public Short getDownloadEffective() {
return downloadEffective;
}
public void setDownloadEffective(Short downloadEffective) {
this.downloadEffective = downloadEffective;
}
public Short getDownloadIsImg() {
return downloadIsImg;
}
public void setDownloadIsImg(Short downloadIsImg) {
this.downloadIsImg = downloadIsImg;
}
public Short getPrintEffective() {
return printEffective;
}
public void setPrintEffective(Short printEffective) {
this.printEffective = printEffective;
}
public Short getPrintIsImg() {
return printIsImg;
}
public void setPrintIsImg(Short printIsImg) {
this.printIsImg = printIsImg;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -203,7 +223,6 @@ public class EmrPdfWaterSet implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", effective=").append(effective);
sb.append(", downloadEffective=").append(downloadEffective);
sb.append(", upOrUnder=").append(upOrUnder);
sb.append(", transparent=").append(transparent);
sb.append(", text=").append(text);
@ -213,13 +232,16 @@ public class EmrPdfWaterSet implements Serializable {
sb.append(", textSize=").append(textSize);
sb.append(", textRotation=").append(textRotation);
sb.append(", isImg=").append(isImg);
sb.append(", downloadIsImg=").append(downloadIsImg);
sb.append(", imgFile=").append(imgFile);
sb.append(", imgWidth=").append(imgWidth);
sb.append(", imgHeight=").append(imgHeight);
sb.append(", imgX=").append(imgX);
sb.append(", imgY=").append(imgY);
sb.append(", uniqueId=").append(uniqueId);
sb.append(", downloadEffective=").append(downloadEffective);
sb.append(", downloadIsImg=").append(downloadIsImg);
sb.append(", printEffective=").append(printEffective);
sb.append(", printIsImg=").append(printIsImg);
sb.append("]");
return sb.toString();
}

@ -28,6 +28,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@ -54,6 +56,10 @@ import java.util.*;
public class CommomService {
@Value("${POWER_URLHEAD}")
private String POWER_URLHEAD;
@Value("${waterPicPath}")
private String WATERPICPATH;
@Value("${EMR_RECORD_JSP}")
private String EMRRECORDJSP;
@Autowired
private CommomMapper commomMapper;
@Autowired
@ -362,4 +368,102 @@ public class CommomService {
commomVo.setIsOper("-1");
commomMapper.updateRecordReMark(commomVo);
}
/**
*
* @param patientId
* @param rootPaths
* @param names
* @param sources
* @return
*/
public List<String> selectPrintPic(String patientId, String rootPaths, String names, String sources) {
List<String> outs = new LinkedList<>();
if(StringUtils.isNotBlank(names)){
String[] rootPathList = rootPaths.split(",");
String[] nameList = names.split(",");
String[] sourceList = sources.split(",");
//获取水印设置
EmrPdfWaterSet emrPdfWaterSet = pdfWaterSetMapper.selectByPrimaryKey(1);
//获取是否打印文本水印
Short printEffective = emrPdfWaterSet.getPrintEffective();
//获取是否打印图片水印
Short printIsImg = emrPdfWaterSet.getPrintIsImg();
for (int i = 0;i < nameList.length;i++) {
//定义图片根目录地址
String rootPath = "";
//组织原图片地址
if("1".equals(sourceList[i])){
//扫描图片地址位于rootPathList第一个
rootPath = rootPathList[0];
}else{
rootPath = rootPathList[1];
}
//原图片地址
String srcPath = rootPath + "\\" + nameList[i];
//定义输出地址
String outSrc = "";
//获取项目上下文地址
if((printEffective != null && printEffective == 1) ||
(printIsImg != null && printIsImg == 1)){
//需要水印
//组织加水印后图片存放目录
String waterPicRoot = WATERPICPATH + patientId +"\\" + sourceList[i] + "\\";
//目录不存在则创建
if(!new File(waterPicRoot).isDirectory()){
new File(waterPicRoot).mkdirs();
}
//组织加水印后图片存放地址
String waterPicPath = waterPicRoot + nameList[i];
if(!new File(waterPicPath).exists()) {
img2PdfUtil.addWatermarkPic1(new File(srcPath), emrPdfWaterSet, waterPicPath);
}
//组织输出地址
outSrc = EMRRECORDJSP + "\\reload\\" + patientId +"\\" + sourceList[i] + "\\" + nameList[i];
}else{
//不需要水印
//将原图片地址转换成映射地址
//获取盘符并转换映射地址的头部地址
String root = selectRootByNotWater(srcPath);
//获取盘符后面的地址
String str1 = srcPath.substring(0, srcPath.indexOf("\\"));
String picPath = srcPath.substring(str1.length()+1, srcPath.length());
outSrc = EMRRECORDJSP + "\\" + root + picPath;
}
outs.add(outSrc);
}
}
return outs;
}
/**
*
* @param srcPath
* @return
*/
private String selectRootByNotWater(String srcPath) {
//获取盘符
String str = srcPath.substring(0, 1).toUpperCase();
switch (str){
case "C":
return "reloadC\\";
case "D":
return "reloadD\\";
case "E":
return "reloadE\\";
case "F":
return "reloadF\\";
case "G":
return "reloadG\\";
case "H":
return "reloadH\\";
case "I":
return "reloadI\\";
case "J":
return "reloadJ\\";
case "K":
return "reloadK\\";
}
return null;
}
}

@ -14,9 +14,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
@ -86,7 +88,63 @@ public class img2PdfUtil {
pdfWaterSet.getImgHeight(), pdfWaterSet.getImgX(), pdfWaterSet.getImgY());
}
}
public static String addWatermarkPic1(File srcImgFile, EmrPdfWaterSet pdfWaterSet,String outPath) {
try {
long start = System.currentTimeMillis();
java.awt.Image srcImg = ImageIO.read(srcImgFile);//文件转化为图片
long end = System.currentTimeMillis();
//System.out.println("读取图片"+(end-start)/1000.0+"s");
int srcImgWidth = srcImg.getWidth(null);//获取图片的宽
int srcImgHeight = srcImg.getHeight(null);//获取图片的高
// 加水印
BufferedImage bufImg = new BufferedImage(srcImgWidth, srcImgHeight, BufferedImage.TYPE_INT_RGB);
Font font = new Font("STSong-Light", Font.ITALIC, pdfWaterSet.getTextSize() * 4);//水印字体,大小
Graphics2D g = bufImg.createGraphics();//得到画笔
long start1 = System.currentTimeMillis();
g.drawImage(srcImg, 0, 0, srcImgWidth, srcImgHeight, null);
long end1 = System.currentTimeMillis();
//System.out.println("画图片"+(end1-start1)/1000.0+"s");
//判断是否加水印
Short effective = pdfWaterSet.getEffective();
Short isImg = pdfWaterSet.getIsImg();
if (effective == 1 || isImg == 1) {
Color color = toColorFromString(pdfWaterSet.getTextColor());
Integer degree = 0 - pdfWaterSet.getTextRotation();//设置水印文字的旋转角度
float alpha = pdfWaterSet.getTransparent();//设置水印透明度 默认为1.0 值越小颜色越浅
g.setColor(color); //设置水印颜色
g.setFont(font); //设置字体
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha));//设置水印文字透明度
if (null != degree) {
g.rotate(Math.toRadians(degree), (double) bufImg.getWidth(), (double) bufImg.getHeight());//设置水印旋转
}
long start2 = System.currentTimeMillis();
g.drawString(pdfWaterSet.getText(), srcImg.getWidth(null) / 2 + pdfWaterSet.getTextX(), srcImg.getHeight(null) / 2 + (pdfWaterSet.getTextY() - 200));//画出水印,并设置水印位置
long end2 = System.currentTimeMillis();
//System.out.println("画文字图片"+(end2-start2)/1000.0+"s");
}
g.dispose();// 释放资源*/
long start3 = System.currentTimeMillis();
//ByteArrayInputStream fis = new ByteArrayInputStream(imageToByteArr);//创建输入流对象
if(!new File(outPath).exists()) {
ImageIO.write(bufImg, "jpg", new File(outPath));
}
/* FileOutputStream fos = new FileOutputStream("d:\\jiashi\\reload\\00004312bfd54291b31d77cc4b8e4c3b\\" + srcImgFile.getName()); //创建输出流对象
byte datas[] = new byte[1024 * 8];//创建搬运工具
int len = 0;//创建长度
while ((len = srcImgFile.read(datas)) != -1)//循环读取数据
{
fos.write(datas, 0, len);
}*/
long end3 = System.currentTimeMillis();
//System.out.println("输出时间"+(end3-start3)/1000.0+"s");
return outPath;
// 输出图片
} catch (Exception e) {
e.printStackTrace();
e.getMessage();
return null;
}
}
//图片合成pdf
private static void imgToPdf(Document document,List<String> filePaths) throws Exception{
document.open(); //打开容器

@ -39,6 +39,7 @@ http://www.springframework.org/schema/tx/spring-tx.xsd">
/images/**=anon
/css/**=anon
/js/**=anon
/reload/**=anon
/layui/**=anon
/json/**=anon
/pdfWaterSet/**=anon

@ -1,27 +1,33 @@
#power权限系统的服务器地址头
POWER_IP = localhost
POWER_URLHEAD = http://localhost:8081/power
#power\u6743\u9650\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934
POWER_IP = 192.168.1.3
POWER_URLHEAD = http://192.168.1.3:8080/power
POWER_JSPHEAD = localhost
POWER_JSP = http://localhost:8081/power
POWER_JSPHEAD = 192.168.1.3
POWER_JSP = http://192.168.1.3:8080/power
#\u672C\u8EAB\u7CFB\u7EDF\u7684\u670D\u52A1\u5668\u5730\u5740\u5934
EMR_RECORD_JSP = http://192.168.1.3:8083/emr_record
#webSocket服务器地址
#webSocket\u670D\u52A1\u5668\u5730\u5740
WEBSOCKET_URLHEAD = ${POWER_JSPHEAD}:8088
#通知字符串间隔符
#\u901A\u77E5\u5B57\u7B26\u4E32\u95F4\u9694\u7B26
STR_SPLIT = *^:|,.
#日志保留天数
#\u65E5\u5FD7\u4FDD\u7559\u5929\u6570
log.days = 180
#session过期时间
TOKEN_EXPIRE_TIME = 1200000
#session\u8FC7\u671F\u65F6\u95F4ms
TOKEN_EXPIRE_TIME = 3600000
#pdf水印
pdfWater = 广东省英德市人民医院
#pdf\u6C34\u5370
pdfWater = \u5E7F\u4E1C\u7701\u82F1\u5FB7\u5E02\u4EBA\u6C11\u533B\u9662
#icd版本
#icd\u7248\u672C
icdVersion = 10
#水印图片目录
#\u6C34\u5370\u56FE\u7247\u76EE\u5F55
picPath = static/pdfWaterSet/upload/
#\u751F\u6210\u52A0\u4E0A\u6C34\u5370\u540E\u7684\u56FE\u7247\u7684\u66F4\u76EE\u5F55
waterPicPath = D:/jiashi/reload/

@ -5,22 +5,9 @@ jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc\:sqlserver\://localhost:1433;databaseName=qf_record
jdbc.username=sa
jdbc.password=12345612345654
jdbc.password=docus702
#dataSource2
jdbc.url2=jdbc\:sqlserver\://localhost:1433;databaseName=blgd_java
jdbc.username2=sa
jdbc.password2=docus702
#hibernate config
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.hbm2ddl.auto=update
#hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
hibernate.current_session_context_class=thread
hibernate.jdbc.batch_size=50
hibernate.enable_lazy_load_no_trans=true

@ -1,21 +0,0 @@
record.jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
#jdbc.url=jdbc\:sqlserver\://120.27.212.36:1433;databaseName=emr_record
#jdbc.username=sa
#jdbc.password=docus@702
record.jdbc.url=jdbc\:sqlserver\://localhost:1433;databaseName=blgd_java
record.jdbc.username=sa
record.jdbc.password=docus702
#hibernate config
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.hbm2ddl.auto=update
#hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
hibernate.current_session_context_class=thread
hibernate.jdbc.batch_size=50
hibernate.enable_lazy_load_no_trans=true

@ -329,10 +329,12 @@
dbo.commomtable.main_dis_thing,
dbo.commomtable.dis_dept,
<if test="flag != null and flag != ''">
dbo.commomtable.memo,
commomtable.home_addr,
commomtable.file_path,
commomtable.new_path,
<if test="flag == 'home_addr'">
dbo.commomtable.memo,
</if>
</if>
dbo.commomtable.dis_date,
t_scan_assort.count delCount

@ -4,7 +4,6 @@
<resultMap id="BaseResultMap" type="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="effective" property="effective" jdbcType="SMALLINT" />
<result column="download_effective" property="downloadEffective" jdbcType="SMALLINT" />
<result column="up_or_under" property="upOrUnder" jdbcType="SMALLINT" />
<result column="transparent" property="transparent" jdbcType="REAL" />
<result column="text" property="text" jdbcType="NVARCHAR" />
@ -14,18 +13,21 @@
<result column="text_size" property="textSize" jdbcType="INTEGER" />
<result column="text_rotation" property="textRotation" jdbcType="INTEGER" />
<result column="is_img" property="isImg" jdbcType="SMALLINT" />
<result column="download_is_img" property="downloadIsImg" jdbcType="SMALLINT" />
<result column="img_file" property="imgFile" jdbcType="NVARCHAR" />
<result column="img_width" property="imgWidth" jdbcType="INTEGER" />
<result column="img_height" property="imgHeight" jdbcType="INTEGER" />
<result column="img_x" property="imgX" jdbcType="INTEGER" />
<result column="img_y" property="imgY" jdbcType="INTEGER" />
<result column="unique_id" property="uniqueId" jdbcType="NVARCHAR" />
<result column="download_effective" property="downloadEffective" jdbcType="SMALLINT" />
<result column="download_is_img" property="downloadIsImg" jdbcType="SMALLINT" />
<result column="print_effective" property="printEffective" jdbcType="SMALLINT" />
<result column="print_is_img" property="printIsImg" jdbcType="SMALLINT" />
</resultMap>
<sql id="Base_Column_List" >
id, effective, download_effective, up_or_under, transparent, text, text_x, text_y,
text_color, text_size, text_rotation, is_img, download_is_img, img_file, img_width,
img_height, img_x, img_y, unique_id
id, effective, up_or_under, transparent, text, text_x, text_y, text_color, text_size,
text_rotation, is_img, img_file, img_width, img_height, img_x, img_y, unique_id,
download_effective, download_is_img, print_effective, print_is_img
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
@ -38,20 +40,22 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
insert into emr_pdf_water_set (id, effective, download_effective,
up_or_under, transparent, text,
text_x, text_y, text_color,
text_size, text_rotation, is_img,
download_is_img, img_file, img_width,
img_height, img_x, img_y,
unique_id)
values (#{id,jdbcType=INTEGER}, #{effective,jdbcType=SMALLINT}, #{downloadEffective,jdbcType=SMALLINT},
#{upOrUnder,jdbcType=SMALLINT}, #{transparent,jdbcType=REAL}, #{text,jdbcType=NVARCHAR},
#{textX,jdbcType=INTEGER}, #{textY,jdbcType=INTEGER}, #{textColor,jdbcType=NVARCHAR},
#{textSize,jdbcType=INTEGER}, #{textRotation,jdbcType=INTEGER}, #{isImg,jdbcType=SMALLINT},
#{downloadIsImg,jdbcType=SMALLINT}, #{imgFile,jdbcType=NVARCHAR}, #{imgWidth,jdbcType=INTEGER},
#{imgHeight,jdbcType=INTEGER}, #{imgX,jdbcType=INTEGER}, #{imgY,jdbcType=INTEGER},
#{uniqueId,jdbcType=NVARCHAR})
insert into emr_pdf_water_set (id, effective, up_or_under,
transparent, text, text_x,
text_y, text_color, text_size,
text_rotation, is_img, img_file,
img_width, img_height, img_x,
img_y, unique_id, download_effective,
download_is_img, print_effective, print_is_img
)
values (#{id,jdbcType=INTEGER}, #{effective,jdbcType=SMALLINT}, #{upOrUnder,jdbcType=SMALLINT},
#{transparent,jdbcType=REAL}, #{text,jdbcType=NVARCHAR}, #{textX,jdbcType=INTEGER},
#{textY,jdbcType=INTEGER}, #{textColor,jdbcType=NVARCHAR}, #{textSize,jdbcType=INTEGER},
#{textRotation,jdbcType=INTEGER}, #{isImg,jdbcType=SMALLINT}, #{imgFile,jdbcType=NVARCHAR},
#{imgWidth,jdbcType=INTEGER}, #{imgHeight,jdbcType=INTEGER}, #{imgX,jdbcType=INTEGER},
#{imgY,jdbcType=INTEGER}, #{uniqueId,jdbcType=NVARCHAR}, #{downloadEffective,jdbcType=SMALLINT},
#{downloadIsImg,jdbcType=SMALLINT}, #{printEffective,jdbcType=SMALLINT}, #{printIsImg,jdbcType=SMALLINT}
)
</insert>
<insert id="insertSelective" parameterType="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
insert into emr_pdf_water_set
@ -62,9 +66,6 @@
<if test="effective != null" >
effective,
</if>
<if test="downloadEffective != null" >
download_effective,
</if>
<if test="upOrUnder != null" >
up_or_under,
</if>
@ -92,9 +93,6 @@
<if test="isImg != null" >
is_img,
</if>
<if test="downloadIsImg != null" >
download_is_img,
</if>
<if test="imgFile != null" >
img_file,
</if>
@ -113,6 +111,18 @@
<if test="uniqueId != null" >
unique_id,
</if>
<if test="downloadEffective != null" >
download_effective,
</if>
<if test="downloadIsImg != null" >
download_is_img,
</if>
<if test="printEffective != null" >
print_effective,
</if>
<if test="printIsImg != null" >
print_is_img,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
@ -121,9 +131,6 @@
<if test="effective != null" >
#{effective,jdbcType=SMALLINT},
</if>
<if test="downloadEffective != null" >
#{downloadEffective,jdbcType=SMALLINT},
</if>
<if test="upOrUnder != null" >
#{upOrUnder,jdbcType=SMALLINT},
</if>
@ -151,9 +158,6 @@
<if test="isImg != null" >
#{isImg,jdbcType=SMALLINT},
</if>
<if test="downloadIsImg != null" >
#{downloadIsImg,jdbcType=SMALLINT},
</if>
<if test="imgFile != null" >
#{imgFile,jdbcType=NVARCHAR},
</if>
@ -172,6 +176,18 @@
<if test="uniqueId != null" >
#{uniqueId,jdbcType=NVARCHAR},
</if>
<if test="downloadEffective != null" >
#{downloadEffective,jdbcType=SMALLINT},
</if>
<if test="downloadIsImg != null" >
#{downloadIsImg,jdbcType=SMALLINT},
</if>
<if test="printEffective != null" >
#{printEffective,jdbcType=SMALLINT},
</if>
<if test="printIsImg != null" >
#{printIsImg,jdbcType=SMALLINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
@ -180,9 +196,6 @@
<if test="effective != null" >
effective = #{effective,jdbcType=SMALLINT},
</if>
<if test="downloadEffective != null" >
download_effective = #{downloadEffective,jdbcType=SMALLINT},
</if>
<if test="upOrUnder != null" >
up_or_under = #{upOrUnder,jdbcType=SMALLINT},
</if>
@ -210,9 +223,6 @@
<if test="isImg != null" >
is_img = #{isImg,jdbcType=SMALLINT},
</if>
<if test="downloadIsImg != null" >
download_is_img = #{downloadIsImg,jdbcType=SMALLINT},
</if>
<if test="imgFile != null" >
img_file = #{imgFile,jdbcType=NVARCHAR},
</if>
@ -231,13 +241,24 @@
<if test="uniqueId != null" >
unique_id = #{uniqueId,jdbcType=NVARCHAR},
</if>
<if test="downloadEffective != null" >
download_effective = #{downloadEffective,jdbcType=SMALLINT},
</if>
<if test="downloadIsImg != null" >
download_is_img = #{downloadIsImg,jdbcType=SMALLINT},
</if>
<if test="printEffective != null" >
print_effective = #{printEffective,jdbcType=SMALLINT},
</if>
<if test="printIsImg != null" >
print_is_img = #{printIsImg,jdbcType=SMALLINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.emr.entity.emrPdfWaterSet.EmrPdfWaterSet" >
update emr_pdf_water_set
set effective = #{effective,jdbcType=SMALLINT},
download_effective = #{downloadEffective,jdbcType=SMALLINT},
up_or_under = #{upOrUnder,jdbcType=SMALLINT},
transparent = #{transparent,jdbcType=REAL},
text = #{text,jdbcType=NVARCHAR},
@ -247,13 +268,16 @@
text_size = #{textSize,jdbcType=INTEGER},
text_rotation = #{textRotation,jdbcType=INTEGER},
is_img = #{isImg,jdbcType=SMALLINT},
download_is_img = #{downloadIsImg,jdbcType=SMALLINT},
img_file = #{imgFile,jdbcType=NVARCHAR},
img_width = #{imgWidth,jdbcType=INTEGER},
img_height = #{imgHeight,jdbcType=INTEGER},
img_x = #{imgX,jdbcType=INTEGER},
img_y = #{imgY,jdbcType=INTEGER},
unique_id = #{uniqueId,jdbcType=NVARCHAR}
unique_id = #{uniqueId,jdbcType=NVARCHAR},
download_effective = #{downloadEffective,jdbcType=SMALLINT},
download_is_img = #{downloadIsImg,jdbcType=SMALLINT},
print_effective = #{printEffective,jdbcType=SMALLINT},
print_is_img = #{printIsImg,jdbcType=SMALLINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -46,6 +46,16 @@
</mvc:annotation-driven>
<!-- 静态资源映射 -->
<mvc:resources mapping="/static/**" location="/static/" />
<mvc:resources mapping="/reload/**" location="file:D:/jiashi/reload/" />
<mvc:resources mapping="/reloadC/**" location="file:C:/" />
<mvc:resources mapping="/reloadD/**" location="file:D:/" />
<mvc:resources mapping="/reloadE/**" location="file:E:/" />
<mvc:resources mapping="/reloadF/**" location="file:F:/" />
<mvc:resources mapping="/reloadG/**" location="file:G:/" />
<mvc:resources mapping="/reloadH/**" location="file:D:/" />
<mvc:resources mapping="/reloadI/**" location="file:I:/" />
<mvc:resources mapping="/reloadJ/**" location="file:J:/" />
<mvc:resources mapping="/reloadK/**" location="file:K:/" />
<!-- 当上面要访问的静态资源不包括在上面的配置中时,则根据此配置来访问 -->
<!--配置视图解析器,方便页面返回 -->
<bean id="jspViewResolver"

@ -100,28 +100,29 @@
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>文本内容</label>
<label>打印启用文本水印</label>
</div>
<div class="col-md-7">
<input type="text" id="text" class="form-control input-sm" value="${pdfWaterSet.text}"
name="text" maxlength="50">
<select class="form-control input-sm" name="printEffective">
<option value="1" <c:if test="${pdfWaterSet.printEffective == 1}">selected</c:if>>是</option>
<option value="0" <c:if test="${pdfWaterSet.printEffective == 0}">selected</c:if>>否</option>
</select>
</div>
</div>
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>文本颜色</label>
<label>文本内容</label>
</div>
<div class="col-md-7">
<input type="text" id="color" class="form-control input-sm" style="background-color: ${pdfWaterSet.textColor}">
<input type="hidden" class="form-control input-sm" value="${pdfWaterSet.textColor}"
id="textColor" name="textColor" maxlength="12">
<input type="text" id="text" class="form-control input-sm" value="${pdfWaterSet.text}"
name="text" maxlength="50">
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>文本偏(px)</label>
<label>文本偏(px)</label>
</div>
<div class="col-md-7">
<input type="number" min="0" id="textX" class="form-control input-sm" value="${pdfWaterSet.textX}"
@ -130,7 +131,7 @@
</div>
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>文本偏(px)</label>
<label>文本偏(px)</label>
</div>
<div class="col-md-7">
<input type="number" min="0" id="textY" class="form-control input-sm" value="${pdfWaterSet.textY}"
@ -158,6 +159,18 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>文本颜色:</label>
</div>
<div class="col-md-7">
<input type="text" id="color" class="form-control input-sm" style="background-color: ${pdfWaterSet.textColor}">
<input type="hidden" class="form-control input-sm" value="${pdfWaterSet.textColor}"
id="textColor" name="textColor" maxlength="12">
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-5">
@ -183,6 +196,31 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>打印启用水印图片:</label>
</div>
<div class="col-md-7">
<select class="form-control input-sm" name="printIsImg">
<option <c:if test="${pdfWaterSet.printIsImg == 1}">selected</c:if> value="1">是</option>
<option <c:if test="${pdfWaterSet.printIsImg == 0}">selected</c:if> value="0">否</option>
</select>
</div>
</div>
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>选择图片:</label>
</div>
<div class="col-md-7">
<input type="file" id="file" accept="image/jpg,image/jpeg,image/png,image/bmp">
<input type="hidden" id="imgFile" name="imgFile" value="${pdfWaterSet.imgFile}">
<a href="${path}/static/pdfWaterSet/upload/${pdfWaterSet.imgFile}" target="_blank" id="aDiv">
<img width="100" height="100" src="${path}/static/pdfWaterSet/upload/${pdfWaterSet.imgFile}" id="imgDiv"/>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
@ -206,7 +244,7 @@
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>图片偏(px)</label>
<label>图片偏(px)</label>
</div>
<div class="col-md-7">
<input type="number" min="0" class="form-control input-sm" value="${pdfWaterSet.imgX}"
@ -215,7 +253,7 @@
</div>
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>图片偏(px)</label>
<label>图片偏(px)</label>
</div>
<div class="col-md-7">
<input type="number" min="0" class="form-control input-sm" value="${pdfWaterSet.imgY}"
@ -223,20 +261,6 @@
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="col-md-5 labelDiv">
<label>选择图片:</label>
</div>
<div class="col-md-7">
<input type="file" id="file" accept="image/jpg,image/jpeg,image/png,image/bmp">
<input type="hidden" id="imgFile" name="imgFile" value="${pdfWaterSet.imgFile}">
<a href="${path}/static/pdfWaterSet/upload/${pdfWaterSet.imgFile}" target="_blank" id="aDiv">
<img width="100" height="100" src="${path}/static/pdfWaterSet/upload/${pdfWaterSet.imgFile}" id="imgDiv"/>
</a>
</div>
</div>
</div>
<div class="btnsDiv">
<shiro:hasPermission name="/pdfWaterSet/update">
<button type="button" class="btn btn-sm btn-primary btns" onclick="save()">保存</button>

@ -155,8 +155,11 @@
</style>
</head>
<body style="scroll:auto" onkeydown="disabledPrint()">
<input type="hidden" id="patientId" value="${patientId}">
<input type="hidden" id="flag" value="file_path">
<input hidden id="patientId" value="${patientId}">
<!--174、祈福医院扫描图片存放根目录的字段-->
<input hidden id="flag" value="file_path">
<!--存放扫描图片和新上传图片根目录的集合-->
<input type="hidden" id="rootPaths">
<div class="main">
<div class="headDiv">
<div class="headSpanDiv">
@ -243,6 +246,11 @@
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#myModal3" onclick="addPic()">新增扫描图片</button>
</div>
</shiro:hasPermission>
<shiro:hasPermission name="/commom/recoverPic">
<div class="btn" id="recoverPic" style="display: none">
<button type="button" class="btn btn-sm btn-warning" data-toggle="modal" data-target="#myModal5" onclick="recoverPic()">恢复扫描图片</button>
</div>
</shiro:hasPermission>
<shiro:hasPermission name="/collect/addCollect">
<div class="col-sm-4">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#myModal2" onclick="collect()">&nbsp;&nbsp;&nbsp;&nbsp;收藏&nbsp;&nbsp;&nbsp;&nbsp;</button>
@ -875,5 +883,6 @@
</div>
</div>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecord174.js?t=2019-12-20"></script>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js"></script>
</body>
</html>

@ -135,7 +135,10 @@
</head>
<body style="scroll:auto" onkeydown="disabledPrint()">
<input type="hidden" id="patientId" value="${patientId}">
<!--脐血库扫描图片存放根目录的字段-->
<input type="hidden" id="flag" value="home_addr">
<!--存放扫描图片和新上传图片根目录的集合-->
<input type="hidden" id="rootPaths">
<div class="main">
<div class="headDiv">
<div class="headSpanDiv">
@ -447,4 +450,5 @@
</script>--%>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecordBlood.js?t=2019-12-20"></script>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js"></script>
</html>

@ -43,8 +43,10 @@
</style>
</head>
<body style="scroll:auto" onkeydown="disabledPrint()">
<input type="hidden" id="patientId" value="${patientId}">
<input type="hidden" id="assortIds">
<input hidden id="patientId" value="${patientId}">
<input hidden id="assortIds">
<!--定义打印预览的图片加载完成标识-->
<input type="hidden" id="printPicLoaded">
<div class="content-left">
<div class="form-group">
<div class="col-sm-7">
@ -76,7 +78,7 @@
&lt;%&ndash;<button type="button" class="btn btn-warning" style="float:right;margin-right: 1%" onclick="">笔记</button>&ndash;%&gt;
</div>
</shiro:hasPermission>--%>
<iframe width="100%" height="100%" src="" id="iframe1" frameborder="0" scrolling="yes"></iframe>
<iframe width="100%" height="100%" src="" id="iframe1" name="iframe1" frameborder="0" scrolling="yes"></iframe>
</div>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecordIframe.js?t=2020-04-27"></script>
</body>

@ -52,6 +52,10 @@
<input type="hidden" id="print" value="${printFlag}">
<!--文件路径-->
<input type="hidden" id="filePath">
<!--定义iframe1加载完成标识-->
<input type="hidden" id="iframeLoad">
<!--定义打印预览的图片加载完成标识-->
<input type="hidden" id="printPicLoaded">
<div class="content-left">
<div class="form-group">
<div class="col-sm-5" style="padding-right: 0">
@ -95,5 +99,6 @@
<iframe width="100%" height="100%" src="" id="iframe1" frameborder="0" scrolling="yes"></iframe>
</div>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecordIframeBlood.js"></script>
<script type="text/javascript" src="${path}/static/js/recordManage/commomSearch/showRecordIframeBloodCommom.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 670 KiB

@ -1,21 +1,3 @@
//屏蔽鼠标右键
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;
}
}
//初始化函数
$(function(){
//加载其他诊断名称鼠标滑过显示全部文本
@ -49,7 +31,7 @@ function loadRecord(){
$.ajax({
type:'get',
url:path+'/commom/getRecord',
data:{patientId:$("#patientId").val()},
data:{patientId:$("#patientId").val(),flag:$("#flag").val()},
async:false,
dataType:'json',
success:function (data) {
@ -63,6 +45,26 @@ function loadRecord(){
$("#disDate").val(data.disDate);
$("#disDeptName").val(data.disDept);
$("#diagName").val(data.mainDiagName);
var delCount = data.delCount;
//不为空,有已删除的图片,显示恢复图片按钮
if(delCount != null){
$("#recoverPic").show();
}
//判断哪家医院赋值扫描图片和新上传图片的根目录集合
var flag = $("#flag").val();
var rootPaths = "";
if(flag != '' && flag == 'home_addr'){
//脐血库
rootPaths = data.homeAddr + ",";
}else if(flag != '' && flag == 'file_path'){
//祈福医院
rootPaths = data.filePath + ",";
}
//拼接新上传图片根目录
if(data.newFile != null && data.newFile != ''){
rootPaths += data.newFile;
}
$("#rootPaths").val(rootPaths);
//$("#otherDiagName").val(data.otherDiagName);
}
}

@ -1,21 +1,3 @@
//屏蔽鼠标右键
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;
}
}
//初始化函数
$(function(){
//加载病案信息
@ -57,6 +39,21 @@ function loadRecord(){
if(delCount != null){
$("#recoverPic").show();
}
//判断哪家医院赋值扫描图片和新上传图片的根目录集合
var flag = $("#flag").val();
var rootPaths = "";
if(flag != '' && flag == 'home_addr'){
//脐血库
rootPaths = data.homeAddr + ",";
}else if(flag != '' && flag == 'file_path'){
//祈福医院
rootPaths = data.filePath + ",";
}
//拼接新上传图片根目录
if(data.newFile != null && data.newFile != ''){
rootPaths += data.newFile;
}
$("#rootPaths").val(rootPaths);
}
}
})

@ -110,6 +110,11 @@ $("#typeId").change(function(){
})
//加载pdf按钮功能
function onloadPdf(){
$("#iframeLoad").val("");
$("#printPicLoaded").val("");
if($("#iframeLoad").val() == 1) {
window.frames['iframe1'].contentDocument.getElementById("printContainer1").innerHTML = '';
}
var patientId = $("#patientId").val();
//图片集合
var scanPages = $("#assortIds").val();
@ -119,6 +124,65 @@ function onloadPdf(){
var flag = parent.$("#flag").val();
var str= path+"/commom/showRecordContentBlood?patientId="+patientId+"&scanPages="+scanPages+"&sources="+sources+"&flag="+flag;
$("#iframe1").attr("src",path+"/static/pdfjs/web/viewer1.html?file="+encodeURIComponent(str));
var rootPaths = parent.$("#rootPaths").val();
//获取加水印后的图片
if(scanPages != ''){
selectPrintPic(patientId,rootPaths,scanPages,sources);
}
}
/**
* 加载打印预览所需图片
*/
function selectPrintPic(patientId,rootPaths,scanPages,sources){
$.ajax({
type:'post',
url:path+"/commom/selectPrintPic",
data:{
patientId:patientId,
rootPaths:rootPaths,
names:scanPages,
sources:sources
},
datType:'json',
success:function(data){
if(data.code == 0){
var resultList = data.data;
if(null != resultList){
var img = '';
for (var i = 0; i < resultList.length; i++) {
img += "<img src='"+resultList[i]+"' width='850' height='1190'>";
}
setInterval(function () {
if($("#iframeLoad").val() == 1 && $("#printPicLoaded").val() != 1) {
window.frames['iframe1'].contentDocument.getElementById("printContainer1").innerHTML = img;
$("#printPicLoaded").val(1);
}
},1*1000);
}
}
}
})
}
var iframe = window.frames['iframe1'];
if(iframe.attachEvent){
iframe.attachEvent("onreadystatechange", function() {
//此事件在内容没有被载入时候也会被触发,所以我们要判断状态
//有时候会比较怪异 readyState状态会跳过 complete 所以我们loaded状态也要判断
if (iframe.readyState === "complete" || iframe.readyState == "loaded") {
//代码能执行到这里说明已经载入成功完毕了
//要清除掉事件
iframe.detachEvent("onreadystatechange", arguments.callee);
//这里是回调函数
}
});
}else{
iframe.addEventListener("load", function() {
$("#iframeLoad").val(1);
//代码能执行到这里说明已经载入成功完毕了
this.removeEventListener("load", arguments.call, false);
}, false);
}
//下载pdf按钮功能
function onloadJpgForPdf(){
@ -232,21 +296,3 @@ function printInfoBlood(){
}
})
}
//屏蔽鼠标右键
// 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;
}
}

@ -16,195 +16,3 @@ function disabledPrint(){
return false;
}
}
//树操作
var menu = {
setting: {
view:{
fontCss : {"font-family": "微软雅黑","color":"blue"}
},
data:{
key:{
name:"assortName"
},
simpleData: {
chkStyle: "checkbox",
enable: true,
idKey: "id",
pIdKey: "parentId",
},
},
check:{
enable:true
},
callback: { //回调函数
onCheck: onCheck }
},
loadMenuTree:function(){
$.ajax({
type: "post",
url:path+"/commom/getRecordTree",
data:{patientId:$("#patientId").val(),typeId:$("#typeId").val()},
dataType:"json",
success:function(data){
$("#assortIds").val("");
if(data != null){
var assortIds = '';
for (var i = 0; i < data.length; i++) {
if(data[i].parentId != null && data[i].parentId != 1 && data[i].checked == 'true'){
assortIds += data[i].assortName+",";
}
}
if(assortIds != ''){
assortIds = assortIds.substring(0,assortIds.length-1);
$("#assortIds").val(assortIds);
}
$.fn.zTree.init($("#ztree"), menu.setting, data);
zTree = $.fn.zTree.getZTreeObj("ztree");
var nodes = zTree.getNodes();
for (var i = 0; i < nodes.length; i++) { //设置节点展开
zTree.expandNode(nodes[i], true, false, true);
}
//加载pdf
onloadPdf();
}
}
})
}
};
//加载树
$().ready(function(data){
menu.loadMenuTree();
//loadFilePath();
});
//树选中事件
function onCheck(e, treeId, treeNode) {
var treeObj=$.fn.zTree.getZTreeObj("ztree");
nodes=treeObj.getCheckedNodes(true);
var assortIds = '';
for (var i = 0; i < nodes.length; i++) {
if(nodes[i].level == 2){
if(i == 0){
assortIds = nodes[i].assortName+",";
}else{
if(i != (nodes.length-1)){
assortIds += nodes[i].assortName+",";
}else{
assortIds += nodes[i].assortName;
}
}
}
}
$("#assortIds").val(assortIds);
};
//打印分类变更事件
$("#typeId").change(function(){
menu.loadMenuTree();
})
//记录打印记录
function printInfoBlood(){
var patientId = "'"+$("#patientId").val()+"'";
var assortIds = $("#assortIds").val();
var typeId = $("#typeId").val();
post(path+'/template/printInfoBlood',{"patientIds":patientId,"assortIds":assortIds,"typeId":typeId});
}
//确定按钮功能
function sure(){
Common.confirm({
title: "提示",
message: "确认将左侧树选中的图片是否重新归页?",
operate: function (reselt) {
if (reselt) {
//pdf页数
var newAssortId = $("#newAssortId").val();
if (newAssortId != '') {
var patientId = $("#patientId").val();
var assortIds = $("#assortIds").val();
if(assortIds != ''){
$.ajax({
type: 'post',
url: path + '/commom/updateScanAssortByBlood',
data: {patientId: patientId, assortIds: assortIds,newAssortId: newAssortId},
dataType: 'json',
success: function (data) {
if (data.code == 0) {
toastr.success("重新归页成功!");
}
//重新加载
menu.loadMenuTree();
}
})
}else{
toastr.warning("左侧树至少选中一张图片!")
}
} else {
toastr.warning("要重新分页,需选中其中下拉框其中一项!")
}
}
}
})
}
function delPic(){
Common.confirm({
title: "提示",
message: "确认将左侧树选中的图片删除,删除就不可恢复?",
operate: function (reselt) {
if (reselt) {
var patientId = $("#patientId").val();
var assortIds = $("#assortIds").val();
if(assortIds != '') {
$.ajax({
type: 'post',
url: path + '/commom/delScanAssortByBlood',
data: {patientId: patientId, assortIds: assortIds},
dataType: 'json',
success: function (data) {
if (data.code == 0) {
toastr.success("删除成功!");
}
//重新加载
menu.loadMenuTree();
}
})
}
}
}
})
}
/*
//确定按钮功能
function sure(){
Common.confirm({
title: "提示",
message: "确认是否重新归页?",
operate: function (reselt) {
if (reselt) {
//pdf页数
var index = $("#iframe1").contents().find("#pageNumber").val();
var newAssortId = $("#newAssortId").val();
if (newAssortId != '') {
if (index != '' && index != null) {
var patientId = $("#patientId").val();
var assortIds = $("#assortIds").val();
$.ajax({
type: 'post',
url: path + '/commom/updateScanAssort',
data: {patientId: patientId, assortIds: assortIds, index: index, newAssortId: newAssortId},
dataType: 'json',
success: function (data) {
if (data.code == 0) {
toastr.success("重新归页成功!");
}
//重新加载
menu.loadMenuTree();
}
})
}
} else {
toastr.warning("要重新分页,需选中其中下拉框其中一项!")
}
}
}
})
}*/

@ -0,0 +1,124 @@
/* @Print.js
* DH (http://denghao.me)
* 2017-7-14
*/
(function (window, document) {
var Print = function (dom, options) {
if (!(this instanceof Print)) return new Print(dom, options);
this.options = this.extend({
noPrint: '.no-print',
onStart: function () { },
onEnd: function () { }
}, options);
if ((typeof dom) === "string") {
this.dom = document.querySelector(dom);
} else {
this.dom = dom;
}
this.init();
};
Print.prototype = {
init: function () {
var content = this.getStyle() + this.getHtml();
this.writeIframe(content);
},
extend: function (obj, obj2) {
for (var k in obj2) {
obj[k] = obj2[k];
}
return obj;
},
getStyle: function () {
var str = "",
styles = document.querySelectorAll('style,link');
for (var i = 0; i < styles.length; i++) {
str += styles[i].outerHTML;
}
str += "<style>" + (this.options.noPrint ? this.options.noPrint : '.no-print') + "{display:none;}</style>";
return str;
},
getHtml: function () {
var inputs = document.querySelectorAll('input');
var textareas = document.querySelectorAll('textarea');
var selects = document.querySelectorAll('select');
for (var k in inputs) {
if (inputs[k].type == "checkbox" || inputs[k].type == "radio") {
if (inputs[k].checked == true) {
inputs[k].setAttribute('checked', "checked")
} else {
inputs[k].removeAttribute('checked')
}
} else if (inputs[k].type == "text") {
inputs[k].setAttribute('value', inputs[k].value)
}
}
for (var k2 in textareas) {
if (textareas[k2].type == 'textarea') {
textareas[k2].innerHTML = textareas[k2].value
}
}
for (var k3 in selects) {
if (selects[k3].type == 'select-one') {
var child = selects[k3].children;
for (var i in child) {
if (child[i].tagName == 'OPTION') {
if (child[i].selected == true) {
child[i].setAttribute('selected', "selected")
} else {
child[i].removeAttribute('selected')
}
}
}
}
}
return this.dom.outerHTML;
},
writeIframe: function (content) {
var w, doc, iframe = document.createElement('iframe'),
f = document.body.appendChild(iframe);
iframe.id = "myIframe";
iframe.style = "position:absolute;width:0;height:0;top:-10px;left:-10px;";
w = f.contentWindow || f.contentDocument;
doc = f.contentDocument || f.contentWindow.document;
doc.open();
doc.write(content);
doc.close();
this.toPrint(w, function () {
document.body.removeChild(iframe)
});
},
toPrint: function (w, cb) {
var _this = this;
w.onload = function () {
try {
setTimeout(function () {
w.focus();
typeof _this.options.onStart === 'function' && _this.options.onStart();
if (!w.document.execCommand('print', false, null)) {
w.print();
}
typeof _this.options.onEnd === 'function' && _this.options.onEnd();
w.close();
cb && cb()
});
} catch (err) {
console.log('err', err);
}
}
}
};
window.Print = Print;
}(window, document));

@ -13,13 +13,13 @@ function loadPdf() {
}
}
//屏蔽鼠标右键
document.oncontextmenu = function(e) {
/*document.oncontextmenu = function(e) {
var e = e || window.event;
e.returnValue = false;
return false;
}
}*/
//禁止快捷键打印
function disabledPrint(){
/*function disabledPrint(){
if(event.keyCode==80 && event.ctrlKey){
event.keyCode=0;
event.returnValue=false;
@ -29,7 +29,7 @@ function disabledPrint(){
event.returnValue = false;
return false;
}
}
}*/
document.onkeydown = function(e) {
//快捷键ctrl+上图片放大
if (38 == e.keyCode && e.ctrlKey) {

@ -45,6 +45,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
<script src="debugger.js"></script>
<script src="viewer1.js"></script>
<script src="../build/pdf.js"></script>
<script src="../Print.js"></script>
<style>
.loading {
@ -389,6 +390,8 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div> <!-- outerContainer -->
<div id="printContainer"></div>
<div id="printContainer1">
</div>
<div id="mozPrintCallback-shim" hidden>
<style>
@media print {
@ -457,8 +460,7 @@ http://sourceforge.net/adobe/cmap/wiki/License/
}
</style>
<div class="mozPrintCallback-dialog-box">
&lt;!&ndash; TODO: Localise the following strings &ndash;&gt;
Preparing document for printing...
打印加载中...
<div class="progress-row">
<progress value="0" max="100"></progress>
<span class="relative-progress">0%</span>
@ -470,12 +472,23 @@ http://sourceforge.net/adobe/cmap/wiki/License/
</div>
</body>
<script>
function getContextPath() {
var pathName = document.location.pathname;
var index = pathName.substr(1).indexOf("/");
var result = pathName.substr(0, index + 1);
return result;
}
var path;
$(function(){
//获取父页面打印权限显示打印按钮
var print = parent.$("#print").val();
if(print == 1){
$("#print").show();
}
/*for (var i = 0; i < 147; i++) {
var html = "<img src=\"http://localhost:8083/emr_record/reload/000239.jpg\" width=\"890\" height=\"1180\">";
$("#printContainer1").append(html);
}*/
})
</script>
</html>

@ -1883,7 +1883,22 @@ var SecondaryToolbar = {
},
printClick: function secondaryToolbarPrintClick(evt) {
window.print();
//window.print();
//是否打印预览图片加载完成标识
var printPicLoaded = parent.$("#printPicLoaded").val();
if(printPicLoaded == 1){
Print('#printContainer1', {
onStart: function () {
console.log('onStart', new Date())
},
onEnd: function () {
console.log('onEnd', new Date())
$("#printContainer1").hide();
}
})
}else{
alert("预览图片未加载完,请稍后再试");
}
this.close();
},

Loading…
Cancel
Save