优化打印下载查询

master
zengwh 6 years ago
parent eb86ab3d3d
commit 159d95c40b

@ -431,10 +431,8 @@ public class ApproveController {
if(null != page && null != limit){ if(null != page && null != limit){
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
} }
long start = System.currentTimeMillis();
List<Emr_Apply_Approve> approves = applyApproveService.selectAllApproveByCreater(approve, List<Emr_Apply_Approve> approves = applyApproveService.selectAllApproveByCreater(approve,
startTime1, endTime1,null,null,request); startTime1, endTime1,null,null,request);
long end = System.currentTimeMillis();
//匹配权限 //匹配权限
Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER"); Power_User user = (Power_User) request.getSession().getAttribute("CURRENT_USER");
if(null != approves && !approves.isEmpty()){ if(null != approves && !approves.isEmpty()){

@ -6,6 +6,7 @@ import com.emr.entity.ResultUtil;
import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService; import com.emr.service.emrPrintOrDownLoadInfo.PrintOrDownLoadInfoService;
import com.emr.util.ExportExcelUtil; import com.emr.util.ExportExcelUtil;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo; import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -64,25 +65,15 @@ public class PrintOrDownLoadInfoController {
@RequiresPermissions("/printInfoList/select") @RequiresPermissions("/printInfoList/select")
@RequestMapping("printInfoList/getPrintInfoList") @RequestMapping("printInfoList/getPrintInfoList")
@ResponseBody @ResponseBody
public String getPrintInfoList(Integer page, Integer limit, EmrPrintOrDownLoadInfoVo emrPrintOrDownLoadInfoVo,String flag){ public PageInfo getPrintInfoList(Integer page, Integer limit, EmrPrintOrDownLoadInfoVo emrPrintOrDownLoadInfoVo){
try{ try{
//查询 if(null != page && null != limit){
List<EmrPrintOrDownLoadInfoVo> list = printOrDownLoadInfoService.selectAll(emrPrintOrDownLoadInfoVo,flag); PageHelper.startPage(page, limit);
Long size = (long) list.size();
List<EmrPrintOrDownLoadInfoVo> updateList = new ArrayList<>();
if (size > 0) {
int pageCount = (int) ((size / limit) + ((size % limit > 0) ? 1 : 0));
int start = (page - 1) * limit;
int end = (int) (page == pageCount ? size : page * limit);
if (end < size) {
updateList = list.subList(start, end);
} else {
updateList = list.subList(start, size.intValue());
}
} }
PageInfo pageInfo = new PageInfo<>(updateList); //查询
pageInfo.setTotal(size); List<EmrPrintOrDownLoadInfoVo> list = printOrDownLoadInfoService.selectAll(emrPrintOrDownLoadInfoVo);
return JSON.toJSONString(pageInfo); PageInfo pageInfo = new PageInfo<>(list);
return pageInfo;
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
return null; return null;
@ -186,7 +177,7 @@ public class PrintOrDownLoadInfoController {
list = printOrDownLoadInfoService.selectAllByIds(checks,flag); list = printOrDownLoadInfoService.selectAllByIds(checks,flag);
}else{ }else{
//查询 //查询
list = printOrDownLoadInfoService.selectAll(printOrDownLoadInfoVo,flag); list = printOrDownLoadInfoService.selectAll(printOrDownLoadInfoVo);
} }
//文件名 //文件名
String fileName = "打印记录列表导出数据(" + new SimpleDateFormat("yyyy-MM-dd HH_mm_ss").format(new Date()) + ").xls"; String fileName = "打印记录列表导出数据(" + new SimpleDateFormat("yyyy-MM-dd HH_mm_ss").format(new Date()) + ").xls";
@ -208,7 +199,7 @@ public class PrintOrDownLoadInfoController {
list = printOrDownLoadInfoService.selectAllByIds(checks,flag); list = printOrDownLoadInfoService.selectAllByIds(checks,flag);
}else{ }else{
//查询 //查询
list = printOrDownLoadInfoService.selectAll(printOrDownLoadInfoVo,flag); list = printOrDownLoadInfoService.selectAll(printOrDownLoadInfoVo);
} }
String fileName = ""; String fileName = "";
if(operType == 1){ if(operType == 1){

@ -1366,10 +1366,10 @@ public class TemplateSearchController {
assortIds += "'" + assortIdStr[i] + "'"; assortIds += "'" + assortIdStr[i] + "'";
} }
} }
List<ScanPathVo> scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds,assortIds,flag);
//批量添加打印记录
printOrDownLoadInfoService.SimpleInsert(scanPathVos,typeId,Short.valueOf("1"));
} }
List<ScanPathVo> scanPathVos = scanPathMapper.selectScanFileByBloodPatientIds(patientIds,assortIds,flag);
//批量添加打印记录
printOrDownLoadInfoService.SimpleInsert(scanPathVos,typeId,Short.valueOf("1"));
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
} }

@ -13,8 +13,7 @@ public interface EmrPrintDownloadInfoMapper {
int SimpleInsert(List<EmrPrintDownloadInfo> list); int SimpleInsert(List<EmrPrintDownloadInfo> list);
List<EmrPrintOrDownLoadInfoVo> selectAll(@Param("record") EmrPrintOrDownLoadInfoVo record, List<EmrPrintOrDownLoadInfoVo> selectAll(@Param("record") EmrPrintOrDownLoadInfoVo record);
@Param("flag")String flag);
List<EmrPrintOrDownLoadInfoVo> selectAllByIds(@Param("ids")String ids,@Param("flag")String flag); List<EmrPrintOrDownLoadInfoVo> selectAllByIds(@Param("ids")String ids,@Param("flag")String flag);

@ -7,8 +7,6 @@ public class EmrPrintDownloadInfo implements Serializable {
private String patientId; private String patientId;
private String assortId;
private String scanPage; private String scanPage;
private Integer typeId; private Integer typeId;
@ -39,14 +37,6 @@ public class EmrPrintDownloadInfo implements Serializable {
this.patientId = patientId == null ? null : patientId.trim(); this.patientId = patientId == null ? null : patientId.trim();
} }
public String getAssortId() {
return assortId;
}
public void setAssortId(String assortId) {
this.assortId = assortId == null ? null : assortId.trim();
}
public String getScanPage() { public String getScanPage() {
return scanPage; return scanPage;
} }
@ -103,7 +93,6 @@ public class EmrPrintDownloadInfo implements Serializable {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", patientId=").append(patientId); sb.append(", patientId=").append(patientId);
sb.append(", assortId=").append(assortId);
sb.append(", scanPage=").append(scanPage); sb.append(", scanPage=").append(scanPage);
sb.append(", typeId=").append(typeId); sb.append(", typeId=").append(typeId);
sb.append(", operType=").append(operType); sb.append(", operType=").append(operType);

@ -1,11 +1,16 @@
package com.emr.service.emrPrintOrDownLoadInfo; package com.emr.service.emrPrintOrDownLoadInfo;
import com.alibaba.fastjson.JSON;
import com.emr.dao.CommomMapper; import com.emr.dao.CommomMapper;
import com.emr.dao.Zd_AssortMapper;
import com.emr.dao.emrPrintAndDownLoad.EmrPrintDownloadInfoMapper; import com.emr.dao.emrPrintAndDownLoad.EmrPrintDownloadInfoMapper;
import com.emr.entity.Power_User; import com.emr.entity.Power_User;
import com.emr.entity.Zd_Assort;
import com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo; import com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo;
import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo; import com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo;
import com.emr.vo.commomSearch.ScanPathVo; import com.emr.vo.commomSearch.ScanPathVo;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.util.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -25,38 +30,63 @@ public class PrintOrDownLoadInfoService {
@Autowired @Autowired
private EmrPrintDownloadInfoMapper printDownloadInfoMapper; private EmrPrintDownloadInfoMapper printDownloadInfoMapper;
@Autowired @Autowired
private CommomMapper commomMapper; private Zd_AssortMapper assortMapper;
/** /**
* *
* */ * */
public void SimpleInsert(List<ScanPathVo> scanPathVos, Integer typeId, Short operType){ public void SimpleInsert(List<ScanPathVo> scanPathVos, Integer typeId, Short operType){
if(null != scanPathVos && !scanPathVos.isEmpty()){ if(null != scanPathVos && !scanPathVos.isEmpty()){
//定义不重复的主键集合
Set<String> patientIdList = new HashSet<>();
for (ScanPathVo scanPathVo : scanPathVos) {
if(StringUtils.isNotBlank(scanPathVo.getPatientId())) {
patientIdList.add(scanPathVo.getPatientId());
}
}
//组织批量插入集合
List<EmrPrintDownloadInfo> batchInsertList = new ArrayList<>();
//获取登录者用户名
Power_User user = (Power_User)((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession().getAttribute("CURRENT_USER"); Power_User user = (Power_User)((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession().getAttribute("CURRENT_USER");
//获取格式化日期
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//查询表列数 //遍历主键组织批量插入集合
int colCount = commomMapper.selectColByTableName("emr_print_download_info"); for(String patientId : patientIdList){
int simpleInsertCount = 2100/colCount; //定义不重复的分类id集合
//定义批量添加下载记录 Set<String> assortList = new LinkedHashSet<>();
List<EmrPrintDownloadInfo> list = new ArrayList<>(); for (ScanPathVo scanPathVo : scanPathVos) {
for (int i = 0; i < scanPathVos.size(); i++) { if(StringUtils.isNotBlank(scanPathVo.getAssortId()) && patientId.equals(scanPathVo.getPatientId())) {
//处理批量添加sql太长问题设定个数为180 assortList.add(scanPathVo.getAssortId());
if(null != list && i > 0 && list.size()%simpleInsertCount == 0){ }
list.clear(); }
//遍历组织Map
//定义分类-图片Map
Map<String,List<String>> map = new LinkedHashMap<>();
//分patientId
for(String assortId : assortList){
List<String> scanPageList = new ArrayList<>();
for (ScanPathVo scanPathVo : scanPathVos) {
//获取分类id
String assortIdTemp = scanPathVo.getAssortId();
//匹配图片分类
if(StringUtils.isNotBlank(assortIdTemp) && assortId.equals(assortIdTemp) && patientId.equals(scanPathVo.getPatientId())){
scanPageList.add(scanPathVo.getScanPage());
}
}
map.put(assortId,scanPageList);
} }
//添加下载记录对象 //添加下载记录对象
EmrPrintDownloadInfo obj = new EmrPrintDownloadInfo(); EmrPrintDownloadInfo obj = new EmrPrintDownloadInfo();
BeanUtils.copyProperties(scanPathVos.get(i),obj);
obj.setTypeId(typeId); obj.setTypeId(typeId);
obj.setOperType(operType); obj.setOperType(operType);
obj.setCreater(user.getUserName()); obj.setCreater(user.getUserName());
obj.setCreateTime(fmt.format(new Date())); obj.setCreateTime(fmt.format(new Date()));
obj.setIp(getOperIp()); obj.setIp(getOperIp());
list.add(obj); obj.setScanPage(JSON.toJSONString(map));
//是180的倍数或最后一个 obj.setPatientId(patientId);
if(null != list && (list.size()%simpleInsertCount == 0 || i == scanPathVos.size() - 1)) { batchInsertList.add(obj);
printDownloadInfoMapper.SimpleInsert(list);
}
} }
//批量插入
printDownloadInfoMapper.SimpleInsert(batchInsertList);
} }
} }
@ -96,55 +126,64 @@ public class PrintOrDownLoadInfoService {
/** /**
* *
* */ * */
public List<EmrPrintOrDownLoadInfoVo> selectAll(EmrPrintOrDownLoadInfoVo emrPrintOrDownLoadInfoVo,String flag){ public List<EmrPrintOrDownLoadInfoVo> selectAll(EmrPrintOrDownLoadInfoVo emrPrintOrDownLoadInfoVo){
long start = System.currentTimeMillis(); List<EmrPrintOrDownLoadInfoVo> list = printDownloadInfoMapper.selectAll(emrPrintOrDownLoadInfoVo);
List<EmrPrintOrDownLoadInfoVo> list = printDownloadInfoMapper.selectAll(emrPrintOrDownLoadInfoVo,flag);
long end = System.currentTimeMillis();
System.out.println("查询用时:"+(end-start)/1000.0+"s");
return getReturnList(list); return getReturnList(list);
} }
//组织数据 //组织数据
private List<EmrPrintOrDownLoadInfoVo> getReturnList(List<EmrPrintOrDownLoadInfoVo> list){ private List<EmrPrintOrDownLoadInfoVo> getReturnList(List<EmrPrintOrDownLoadInfoVo> list){
long start = System.currentTimeMillis();
List<EmrPrintOrDownLoadInfoVo> returnList = new ArrayList<>();
if(null != list && !list.isEmpty()){ if(null != list && !list.isEmpty()){
Map<String,EmrPrintOrDownLoadInfoVo> map = new LinkedHashMap<>(); //查询分类集合
List<Zd_Assort> assortList = assortMapper.selectAll(new Zd_Assort());
for(EmrPrintOrDownLoadInfoVo vo : list){ for(EmrPrintOrDownLoadInfoVo vo : list){
String key = vo.getPatientId() + "," + vo.getCreateTime() + "," + vo.getCreateTime(); //获取图片数据
map.put(key,vo); String scanPage = vo.getScanPage();
} //json数据转对象
for(Map.Entry<String,EmrPrintOrDownLoadInfoVo> obj : map.entrySet()){ Map<String,List> map = JSON.parseObject(scanPage, LinkedHashMap.class);
String ids = ""; //定义图片分类字符串
String assortNames = ""; String assortNames = "";
//定义图片名称字符串
String scanPages = ""; String scanPages = "";
int printCount = 0; //定义页数
Set<String> assortNameSet = new LinkedHashSet<>(); Integer printCount = 0;
for(EmrPrintOrDownLoadInfoVo vo : list){ //遍历map
String key = vo.getPatientId() + "," + vo.getCreateTime() + "," + vo.getCreateTime(); for(Map.Entry<String,List> m : map.entrySet()){
if(key.equals(obj.getKey())){ //获取图片分类
ids += vo.getId() + ","; String assortId = m.getKey();
scanPages += vo.getScanPage() + ","; //转换分类名称
assortNameSet.add(vo.getAssortName()); if(!CollectionUtils.isEmpty(assortList)){
for(Zd_Assort assort : assortList){
if(StringUtils.isNotBlank(assort.getAssortId()) &&
assortId.equals(assort.getAssortId())){
if(StringUtils.isNotBlank(assort.getAssortName())){
assortNames += assort.getAssortName() + ",";
}
break;
}
}
}
//获取图片名称
List<String> scanPageList = m.getValue();
//遍历图片名称
for (String scanPageTemp : scanPageList){
scanPages += scanPageTemp + ",";
printCount++; printCount++;
} }
} }
for(String assortName : assortNameSet){ //去掉尾部逗号
assortNames += assortName + ","; if(StringUtils.isNotBlank(assortNames)){
assortNames = assortNames.substring(0,assortNames.length()-1);
vo.setAssortName(assortNames);
} }
ids = ids.substring(0,ids.length() - 1); //去掉尾部逗号
assortNames = assortNames.substring(0,assortNames.length() - 1); if(StringUtils.isNotBlank(scanPages)){
scanPages = scanPages.substring(0,scanPages.length() - 1); scanPages = scanPages.substring(0,scanPages.length()-1);
EmrPrintOrDownLoadInfoVo emrPrintOrDownLoadInfoVo = obj.getValue(); vo.setScanPage(scanPages);
emrPrintOrDownLoadInfoVo.setIds(ids); }
emrPrintOrDownLoadInfoVo.setAssortName(assortNames); vo.setPrintCount(printCount);
emrPrintOrDownLoadInfoVo.setScanPage(scanPages);
emrPrintOrDownLoadInfoVo.setPrintCount(printCount);
returnList.add(emrPrintOrDownLoadInfoVo);
} }
} }
long end = System.currentTimeMillis(); return list;
System.out.println("组织用时:"+(end-start)/1000.0+"s");
return returnList;
} }
/** /**
* *

@ -15,6 +15,8 @@ public class EmrPrintOrDownLoadInfoVo extends EmrPrintDownloadInfo {
private String typeName; private String typeName;
private String assortId;
private String assortName; private String assortName;
private String startTime; private String startTime;

@ -4,8 +4,7 @@
<resultMap id="BaseResultMap" type="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" > <resultMap id="BaseResultMap" type="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" >
<result column="id" property="id" jdbcType="INTEGER" /> <result column="id" property="id" jdbcType="INTEGER" />
<result column="patient_id" property="patientId" jdbcType="NVARCHAR" /> <result column="patient_id" property="patientId" jdbcType="NVARCHAR" />
<result column="assort_id" property="assortId" jdbcType="VARCHAR" /> <result column="scan_page" property="scanPage" jdbcType="VARCHAR" />
<result column="scan_page" property="scanPage" jdbcType="NVARCHAR" />
<result column="type_id" property="typeId" jdbcType="INTEGER" /> <result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="oper_type" property="operType" jdbcType="SMALLINT" /> <result column="oper_type" property="operType" jdbcType="SMALLINT" />
<result column="create_time" property="createTime" jdbcType="NVARCHAR" /> <result column="create_time" property="createTime" jdbcType="NVARCHAR" />
@ -15,7 +14,6 @@
<resultMap id="BaseResultMapVo" type="com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo" > <resultMap id="BaseResultMapVo" type="com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo" >
<result column="id" property="id" jdbcType="INTEGER" /> <result column="id" property="id" jdbcType="INTEGER" />
<result column="patient_id" property="patientId" jdbcType="NVARCHAR" /> <result column="patient_id" property="patientId" jdbcType="NVARCHAR" />
<result column="assort_id" property="assortId" jdbcType="VARCHAR" />
<result column="scan_page" property="scanPage" jdbcType="NVARCHAR" /> <result column="scan_page" property="scanPage" jdbcType="NVARCHAR" />
<result column="type_id" property="typeId" jdbcType="INTEGER" /> <result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="oper_type" property="operType" jdbcType="SMALLINT" /> <result column="oper_type" property="operType" jdbcType="SMALLINT" />
@ -28,13 +26,26 @@
<result column="assort_name" property="assortName" jdbcType="NVARCHAR" /> <result column="assort_name" property="assortName" jdbcType="NVARCHAR" />
<result column="ip" property="ip" jdbcType="NVARCHAR" /> <result column="ip" property="ip" jdbcType="NVARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" >
id, patient_id, scan_page, type_id, oper_type, create_time, creater, ip
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from emr_print_download_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from emr_print_download_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" > <insert id="insert" parameterType="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" >
insert into emr_print_download_info (id, patient_id, assort_id, insert into emr_print_download_info (id, patient_id, scan_page,
scan_page, type_id, oper_type, type_id, oper_type, create_time,
create_time, creater) creater, ip)
values (#{id,jdbcType=INTEGER}, #{patientId,jdbcType=NVARCHAR}, #{assortId,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{patientId,jdbcType=NVARCHAR}, #{scanPage,jdbcType=VARCHAR},
#{scanPage,jdbcType=NVARCHAR}, #{typeId,jdbcType=INTEGER}, #{operType,jdbcType=SMALLINT}, #{typeId,jdbcType=INTEGER}, #{operType,jdbcType=SMALLINT}, #{createTime,jdbcType=NVARCHAR},
#{createTime,jdbcType=NVARCHAR}, #{creater,jdbcType=NVARCHAR}) #{creater,jdbcType=NVARCHAR}, #{ip,jdbcType=NVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" > <insert id="insertSelective" parameterType="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" >
insert into emr_print_download_info insert into emr_print_download_info
@ -45,9 +56,6 @@
<if test="patientId != null" > <if test="patientId != null" >
patient_id, patient_id,
</if> </if>
<if test="assortId != null" >
assort_id,
</if>
<if test="scanPage != null" > <if test="scanPage != null" >
scan_page, scan_page,
</if> </if>
@ -63,6 +71,9 @@
<if test="creater != null" > <if test="creater != null" >
creater, creater,
</if> </if>
<if test="ip != null" >
ip,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" > <if test="id != null" >
@ -71,11 +82,8 @@
<if test="patientId != null" > <if test="patientId != null" >
#{patientId,jdbcType=NVARCHAR}, #{patientId,jdbcType=NVARCHAR},
</if> </if>
<if test="assortId != null" >
#{assortId,jdbcType=VARCHAR},
</if>
<if test="scanPage != null" > <if test="scanPage != null" >
#{scanPage,jdbcType=NVARCHAR}, #{scanPage,jdbcType=VARCHAR},
</if> </if>
<if test="typeId != null" > <if test="typeId != null" >
#{typeId,jdbcType=INTEGER}, #{typeId,jdbcType=INTEGER},
@ -89,19 +97,49 @@
<if test="creater != null" > <if test="creater != null" >
#{creater,jdbcType=NVARCHAR}, #{creater,jdbcType=NVARCHAR},
</if> </if>
<if test="ip != null" >
#{ip,jdbcType=NVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<!--批量添加下载记录--> <update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" >
<insert id="SimpleInsert" parameterType="java.util.List"> update emr_print_download_info
insert into emr_print_download_info (patient_id, scan_page,assort_id, <set >
type_id, oper_type, create_time, <if test="patientId != null" >
creater,ip) patient_id = #{patientId,jdbcType=NVARCHAR},
<foreach collection="list" item="items" separator="union"> </if>
select #{items.patientId,jdbcType=NVARCHAR}, #{items.scanPage,jdbcType=NVARCHAR},#{items.assortId,jdbcType=VARCHAR}, <if test="scanPage != null" >
#{items.typeId,jdbcType=INTEGER}, #{items.operType,jdbcType=SMALLINT}, #{items.createTime,jdbcType=NVARCHAR}, scan_page = #{scanPage,jdbcType=VARCHAR},
#{items.creater,jdbcType=NVARCHAR}, #{items.ip,jdbcType=NVARCHAR} </if>
</foreach> <if test="typeId != null" >
</insert> type_id = #{typeId,jdbcType=INTEGER},
</if>
<if test="operType != null" >
oper_type = #{operType,jdbcType=SMALLINT},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=NVARCHAR},
</if>
<if test="creater != null" >
creater = #{creater,jdbcType=NVARCHAR},
</if>
<if test="ip != null" >
ip = #{ip,jdbcType=NVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.emr.entity.emrPrintAndDownLoad.EmrPrintDownloadInfo" >
update emr_print_download_info
set patient_id = #{patientId,jdbcType=NVARCHAR},
scan_page = #{scanPage,jdbcType=VARCHAR},
type_id = #{typeId,jdbcType=INTEGER},
oper_type = #{operType,jdbcType=SMALLINT},
create_time = #{createTime,jdbcType=NVARCHAR},
creater = #{creater,jdbcType=NVARCHAR},
ip = #{ip,jdbcType=NVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<!--查询列表--> <!--查询列表-->
<select id="selectAll" resultMap="BaseResultMapVo" parameterType="com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo"> <select id="selectAll" resultMap="BaseResultMapVo" parameterType="com.emr.vo.EmrPrintOrDownLoadInfo.EmrPrintOrDownLoadInfoVo">
@ -110,16 +148,12 @@
emr_print_download_info.create_time, emr_print_download_info.create_time,
emr_print_download_info.patient_id, emr_print_download_info.patient_id,
emr_print_download_info.scan_page, emr_print_download_info.scan_page,
(
commomtable.${flag} + '/' + emr_print_download_info.scan_page
) scanAddr,
emr_print_download_info.creater, emr_print_download_info.creater,
emr_print_download_info.ip, emr_print_download_info.ip,
commomtable.name, commomtable.name,
commomtable.admiss_times, commomtable.admiss_times,
commomtable.inpatient_no, commomtable.inpatient_no,
emr_type.type_name, emr_type.type_name
zd_assort.assort_name
FROM FROM
emr_print_download_info emr_print_download_info
INNER JOIN commomtable ON emr_print_download_info.patient_id = commomtable.patient_id INNER JOIN commomtable ON emr_print_download_info.patient_id = commomtable.patient_id
@ -130,11 +164,13 @@
AND commomtable.inpatient_no LIKE '%${record.inpatientNo}%' AND commomtable.inpatient_no LIKE '%${record.inpatientNo}%'
</if> </if>
LEFT JOIN emr_type ON emr_print_download_info.type_id = emr_type.id LEFT JOIN emr_type ON emr_print_download_info.type_id = emr_type.id
INNER JOIN zd_assort ON emr_print_download_info.assort_id = zd_assort.assort_id
WHERE WHERE
emr_print_download_info.oper_type = #{record.operType} emr_print_download_info.oper_type = #{record.operType}
<if test="record.assortId != null and record.assortId != ''"> <if test="record.assortId != null and record.assortId != ''">
AND emr_print_download_info.assort_id = #{record.assortId} AND emr_print_download_info.scan_page like '%${record.assortId}%'
</if>
<if test="record.typeName != null and record.typeName != ''">
AND emr_type.type_name like '%${record.typeName}%'
</if> </if>
<if test="record.creater != null and record.creater != ''"> <if test="record.creater != null and record.creater != ''">
AND emr_print_download_info.creater LIKE '%${record.creater}%' AND emr_print_download_info.creater LIKE '%${record.creater}%'
@ -154,20 +190,16 @@
emr_print_download_info.create_time, emr_print_download_info.create_time,
emr_print_download_info.patient_id, emr_print_download_info.patient_id,
emr_print_download_info.scan_page, emr_print_download_info.scan_page,
(
commomtable.${flag} + '/' + emr_print_download_info.scan_page
) scanAddr,
emr_print_download_info.creater, emr_print_download_info.creater,
emr_print_download_info.ip,
commomtable.name, commomtable.name,
commomtable.inpatient_no, commomtable.inpatient_no,
commomtable.admiss_times, commomtable.admiss_times,
emr_type.type_name, emr_type.type_name
zd_assort.assort_name
FROM FROM
emr_print_download_info emr_print_download_info
INNER JOIN commomtable ON emr_print_download_info.patient_id = commomtable.patient_id INNER JOIN commomtable ON emr_print_download_info.patient_id = commomtable.patient_id
LEFT JOIN emr_type ON emr_print_download_info.type_id = emr_type.id LEFT JOIN emr_type ON emr_print_download_info.type_id = emr_type.id
INNER JOIN zd_assort ON emr_print_download_info.assort_id = zd_assort.assort_id
where emr_print_download_info.id in (${ids}) where emr_print_download_info.id in (${ids})
</select> </select>
@ -211,4 +243,18 @@
emr_print_download_info.oper_type = 2 emr_print_download_info.oper_type = 2
GROUP BY emr_print_download_info.create_time,emr_print_download_info.creater GROUP BY emr_print_download_info.create_time,emr_print_download_info.creater
</select> </select>
<!--批量插入-->
<insert id="SimpleInsert" parameterType="java.util.List">
insert into emr_print_download_info
(patient_id, scan_page,
type_id, oper_type, create_time,
creater, ip)
values
<foreach collection="list" item="record" separator=",">
(#{record.patientId,jdbcType=NVARCHAR}, #{record.scanPage,jdbcType=VARCHAR},
#{record.typeId,jdbcType=INTEGER}, #{record.operType,jdbcType=SMALLINT}, #{record.createTime,jdbcType=NVARCHAR},
#{record.creater,jdbcType=NVARCHAR}, #{record.ip,jdbcType=NVARCHAR})
</foreach>
</insert>
</mapper> </mapper>

@ -33,7 +33,7 @@
} }
.dateSearchInput{ .dateSearchInput{
width:30%; width:30%;
margin-left:2%; margin-left:2px;
} }
.dateLabelDiv{ .dateLabelDiv{
width: 30%; width: 30%;
@ -129,15 +129,23 @@
</div> </div>
</div> </div>
<div class="searchDiv" style="margin-top: 0.4%"> <div class="searchDiv" style="margin-top: 0.4%">
<div class="searchInput left">
<div class="searchElement left">
<label class="labelDiv">用途:</label>
</div>
<div class="searchInputElement left">
<input class="form-control input-sm" id="typeName" maxlength="16"/>
</div>
</div>
<div class="dateSearchDiv left"> <div class="dateSearchDiv left">
<div class="dateLabelDiv left"> <div class="dateLabelDiv left">
<label class="labelDiv">操作时间:</label> <label class="labelDiv">操作时间:</label>
</div> </div>
<div class="dateSearchInput left"> <div class="dateSearchInput left">
<input type="text" class="form-control input-sm" id="startTime1" placeholder="开始时间"> <input type="text" class="form-control input-sm" id="startTime1" placeholder="开始时间" autocomplete="off">
</div> </div>
<div class="dateSearchInput left"> <div class="dateSearchInput left">
<input type="text" class="form-control input-sm" id="endTime1" placeholder="结束时间"> <input type="text" class="form-control input-sm" id="endTime1" placeholder="结束时间" autocomplete="off">
</div> </div>
</div> </div>
<div class="left"> <div class="left">

@ -33,7 +33,7 @@
} }
.dateSearchInput{ .dateSearchInput{
width:30%; width:30%;
margin-left:2%; margin-left:2px;
} }
.dateLabelDiv{ .dateLabelDiv{
width: 30%; width: 30%;
@ -129,15 +129,23 @@
</div> </div>
</div> </div>
<div class="searchDiv" style="margin-top: 0.4%"> <div class="searchDiv" style="margin-top: 0.4%">
<div class="searchInput left">
<div class="searchElement left">
<label class="labelDiv">用途:</label>
</div>
<div class="searchInputElement left">
<input class="form-control input-sm" id="typeName" maxlength="16"/>
</div>
</div>
<div class="dateSearchDiv left"> <div class="dateSearchDiv left">
<div class="dateLabelDiv left"> <div class="dateLabelDiv left">
<label class="labelDiv">操作时间:</label> <label class="labelDiv">操作时间:</label>
</div> </div>
<div class="dateSearchInput left"> <div class="dateSearchInput left">
<input type="text" class="form-control input-sm" id="startTime1" placeholder="开始时间"> <input type="text" class="form-control input-sm" id="startTime1" placeholder="开始时间" autocomplete="off">
</div> </div>
<div class="dateSearchInput left"> <div class="dateSearchInput left">
<input type="text" class="form-control input-sm" id="endTime1" placeholder="结束时间"> <input type="text" class="form-control input-sm" id="endTime1" placeholder="结束时间" autocomplete="off">
</div> </div>
</div> </div>
<div class="left"> <div class="left">

@ -128,18 +128,19 @@ $('#mytab').bootstrapTable({
inpatientNo:$("#inpatientNo").val(), inpatientNo:$("#inpatientNo").val(),
operType:$("#operType").val(), operType:$("#operType").val(),
assortId:$("#assortId").val(), assortId:$("#assortId").val(),
typeName:$("#typeName").val(),
flag:$("#flag").val() flag:$("#flag").val()
} }
}, },
//选中单个复选框 //选中单个复选框
onCheck:function(row){ onCheck:function(row){
var checks = $("#checks").val(); var checks = $("#checks").val();
$("#checks").val(checks+=row.ids + ","); $("#checks").val(checks+=row.id + ",");
}, },
//取消单个复选框 //取消单个复选框
onUncheck:function(row){ onUncheck:function(row){
var checks = $("#checks").val(); var checks = $("#checks").val();
checks = checks.replace(row.ids + ","); checks = checks.replace(row.id + ",");
$("#checks").val(checks); $("#checks").val(checks);
}, },
//全选 //全选
@ -148,7 +149,7 @@ $('#mytab').bootstrapTable({
var checks = ''; var checks = '';
for(var i=0;i<rows.length;i++) for(var i=0;i<rows.length;i++)
{ {
checks += rows[i].ids + "," checks += rows[i].id + ","
} }
$("#checks").val(checks); $("#checks").val(checks);
}, },
@ -190,7 +191,7 @@ function exportExcelCommom(reqUrl){
var operType = $("#operType").val(); var operType = $("#operType").val();
if(checks != '') { if(checks != '') {
checks = checks.substring(0, checks.length - 1); checks = checks.substring(0, checks.length - 1);
var url = path+reqUrl+"?checks="+checks+"&flag="+$("#flag").val()+"&operType="+operType; var url = path+reqUrl+"?checks="+checks+"&flag="+$("#flag").val()+"&operType="+$("#operType").val();
window.location.href = url; window.location.href = url;
}else{ }else{
Common.confirm({ Common.confirm({
@ -201,7 +202,7 @@ function exportExcelCommom(reqUrl){
var url = path+reqUrl+"?startTime="+$("#startTime1").val()+"&endTime="+$("#endTime1").val() var url = path+reqUrl+"?startTime="+$("#startTime1").val()+"&endTime="+$("#endTime1").val()
+"&creater="+$("#creater").val()+"&name="+$("#name").val() +"&creater="+$("#creater").val()+"&name="+$("#name").val()
+"&operType="+$("#operType").val()+"&assortId="+$("#assortId").val() +"&operType="+$("#operType").val()+"&assortId="+$("#assortId").val()
+"&inpatientNo="+$("#inpatientNo").val()+"&flag="+$("#flag").val()+"&operType="+operType; +"&inpatientNo="+$("#inpatientNo").val()+"&flag="+$("#flag").val()+"&operType="+operType+"&typeName="+$("#typeName").val();
window.open(url); window.open(url);
} }
} }

Loading…
Cancel
Save