任务清单导入、导出pdf
parent
3b539ddd2b
commit
e1c4655c9a
@ -0,0 +1,128 @@
|
|||||||
|
package com.emr.controller.exportTask;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.emr.annotation.OptionalLog;
|
||||||
|
import com.emr.dao.ExportTaskDetailsMapper;
|
||||||
|
import com.emr.dao.ExportTaskMapper;
|
||||||
|
import com.emr.entity.ExportTask;
|
||||||
|
import com.emr.entity.ExportTaskDetails;
|
||||||
|
import com.emr.service.ImportExcel.ImportExcelEntity;
|
||||||
|
import com.emr.service.ImportExcel.ImportExcelUtil;
|
||||||
|
import com.emr.util.ExceptionPrintUtil;
|
||||||
|
import com.emr.vo.ExportTaskDetailsVo;
|
||||||
|
import com.emr.vo.ExportTaskVo;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务清单控制层
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("exportTask/")
|
||||||
|
public class ExportTaskController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExportTaskMapper exportTaskMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExportTaskDetailsMapper exportTaskDetailsMapper;
|
||||||
|
|
||||||
|
/*@RequiresPermissions("/exportTask/exportTaskList")*/
|
||||||
|
@OptionalLog(module = "任务清单列表", methods = "任务清单列表页面")
|
||||||
|
@RequestMapping("exportTaskList")
|
||||||
|
public String exportTaskList() {
|
||||||
|
return "recordManage/exportTask/exportTaskList";
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptionalLog(module = "任务清单列表", methods = "任务清单列表页面")
|
||||||
|
@RequestMapping("getExportTaskList")
|
||||||
|
@ResponseBody
|
||||||
|
public String getExportTaskList(Integer page, Integer limit, ExportTask exportTask,String startTime,String endTime) {
|
||||||
|
if (null != page && null != limit) {
|
||||||
|
PageHelper.startPage(page, limit);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<ExportTaskVo> list = exportTaskMapper.getExportTaskList(exportTask,startTime,endTime);
|
||||||
|
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
//根据taskid查询所有需要导出病历的住院号出院日期
|
||||||
|
List<ExportTaskDetailsVo> taskList = exportTaskDetailsMapper.selectAllByTaskId(list.get(i).getTaskId());
|
||||||
|
if (taskList != null && taskList.size() > 0) {
|
||||||
|
list.get(i).setState(0);
|
||||||
|
}else{
|
||||||
|
list.get(i).setState(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PageInfo pageInfo = new PageInfo<>(list);
|
||||||
|
return JSON.toJSONString(pageInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionPrintUtil.printException(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("/exportTask/impExcelTask")
|
||||||
|
@RequestMapping(value = "impExcelTask", method = {RequestMethod.POST})
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<String> impExcelTask(HttpServletRequest request) {
|
||||||
|
HttpHeaders responseHeaders = new HttpHeaders();
|
||||||
|
responseHeaders.setContentType(new MediaType("text", "html", Charset.forName("UTF-8")));
|
||||||
|
try {
|
||||||
|
//读取文件
|
||||||
|
MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) (request);
|
||||||
|
MultipartFile multipartFile = multiRequest.getFile("upfile");
|
||||||
|
//属性名
|
||||||
|
String[] fieldNames = {"inpno", "dischargedatetime"};
|
||||||
|
//判断集中类中的方法名
|
||||||
|
String[] judgeMethods = {"judgeInpNo", "judgeDischargeDateTime"};
|
||||||
|
ExportTaskDetails exportTaskDetails = new ExportTaskDetails();
|
||||||
|
exportTaskDetails.setState(0);
|
||||||
|
|
||||||
|
//实例化
|
||||||
|
ImportExcelUtil.newInstance("exportTaskDetailsMapper", exportTaskDetails, ExportTaskDetails.class);
|
||||||
|
//导入excel的操作
|
||||||
|
ImportExcelEntity excelEntity = ImportExcelUtil.fileImport1(multipartFile, fieldNames, judgeMethods, "");
|
||||||
|
if (excelEntity.getSuccessCount() == 0 && excelEntity.getWrongCount() == 0) {
|
||||||
|
//无数据
|
||||||
|
return new ResponseEntity<String>("无数据!", responseHeaders, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
if (excelEntity.getWrongCount() == 0) {
|
||||||
|
//成功
|
||||||
|
return new ResponseEntity<String>(null, responseHeaders, HttpStatus.OK);
|
||||||
|
} else {
|
||||||
|
//有出错数据
|
||||||
|
String msgStr = excelEntity.getWorkBookKey() + "@已成功导入" + excelEntity.getSuccessCount() + "条,失败" + excelEntity.getWrongCount() + "条,随后将导出错误记录!";
|
||||||
|
return new ResponseEntity<String>(msgStr, responseHeaders, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionPrintUtil.printException(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
//抛异常
|
||||||
|
return new ResponseEntity<String>(e.getMessage(), responseHeaders, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.emr.controller.exportTaskDetails;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.emr.annotation.OptionalLog;
|
||||||
|
import com.emr.dao.ExportTaskDetailsMapper;
|
||||||
|
import com.emr.dao.ExportTaskMapper;
|
||||||
|
import com.emr.entity.ExportTask;
|
||||||
|
import com.emr.entity.ExportTaskDetails;
|
||||||
|
import com.emr.util.ExceptionPrintUtil;
|
||||||
|
import com.emr.vo.ExportTaskDetailsVo;
|
||||||
|
import com.emr.vo.ExportTaskVo;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务清单控制层
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("exportTaskDetails/")
|
||||||
|
public class ExportTaskDetailsController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExportTaskMapper exportTaskMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExportTaskDetailsMapper exportTaskDetailsMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@OptionalLog(module = "任务清单明细查询", methods = "任务清单明细查询页面")
|
||||||
|
@RequestMapping("exportTaskDetailsList")
|
||||||
|
public String exportTaskDetailsList() {
|
||||||
|
return "recordManage/exportTaskDetails/exportTaskDetailsList";
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptionalLog(module = "任务清单明细列表", methods = "任务清单明细列表页面")
|
||||||
|
@RequestMapping("getExportTaskDetailsList")
|
||||||
|
@ResponseBody
|
||||||
|
public String getExportTaskDetailsList(Integer page, Integer limit, ExportTaskDetails exportTaskDetails,String startTime,String endTime) {
|
||||||
|
if (null != page && null != limit) {
|
||||||
|
PageHelper.startPage(page, limit);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<ExportTaskDetailsVo> list = exportTaskDetailsMapper.getExportTaskDetailsList(exportTaskDetails,startTime,endTime);
|
||||||
|
|
||||||
|
PageInfo pageInfo = new PageInfo<>(list);
|
||||||
|
return JSON.toJSONString(pageInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ExceptionPrintUtil.printException(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.emr.dao;
|
||||||
|
|
||||||
|
import com.emr.entity.ExportTask;
|
||||||
|
import com.emr.vo.ExportTaskVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExportTaskMapper {
|
||||||
|
int deleteByPrimaryKey(Integer taskId);
|
||||||
|
|
||||||
|
int insert(ExportTask record);
|
||||||
|
|
||||||
|
int insertSelective(ExportTask record);
|
||||||
|
|
||||||
|
ExportTask selectByPrimaryKey(Integer taskId);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(ExportTask record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(ExportTask record);
|
||||||
|
|
||||||
|
ExportTask getExportTaskByName(@Param("taskName") String taskName);
|
||||||
|
|
||||||
|
List<ExportTaskVo> getExportTaskList(@Param("record") ExportTask exportTask,@Param("startTime") String startTime,@Param("endTime") String endTime);
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.emr.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class ExportTask {
|
||||||
|
private Integer taskId;
|
||||||
|
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getTaskId() {
|
||||||
|
return taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskId(Integer taskId) {
|
||||||
|
this.taskId = taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskName() {
|
||||||
|
return taskName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskName(String taskName) {
|
||||||
|
this.taskName = taskName == null ? null : taskName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(Integer state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDate(Date createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package com.emr.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class ExportTaskDetails {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer taskid;
|
||||||
|
|
||||||
|
private String inpno;
|
||||||
|
|
||||||
|
private Date dischargedatetime;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTaskid() {
|
||||||
|
return taskid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskid(Integer taskid) {
|
||||||
|
this.taskid = taskid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInpno() {
|
||||||
|
return inpno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInpno(String inpno) {
|
||||||
|
this.inpno = inpno == null ? null : inpno.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDischargedatetime() {
|
||||||
|
return dischargedatetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDischargedatetime(Date dischargedatetime) {
|
||||||
|
this.dischargedatetime = dischargedatetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(Integer state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.emr.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用清单异常
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ExportInpVo {
|
||||||
|
private String inpatientNo;//病案号
|
||||||
|
|
||||||
|
private String disDate; //出院日期
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.emr.vo;
|
||||||
|
|
||||||
|
public class ExportTaskVo {
|
||||||
|
|
||||||
|
private Integer taskId;
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
private String createDate;
|
||||||
|
|
||||||
|
public Integer getTaskId() {
|
||||||
|
return taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskId(Integer taskId) {
|
||||||
|
this.taskId = taskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskName() {
|
||||||
|
return taskName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskName(String taskName) {
|
||||||
|
this.taskName = taskName == null ? null : taskName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(Integer state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDate(String createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.emr.dao.ExportTaskMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.emr.entity.ExportTask">
|
||||||
|
<id column="task_id" jdbcType="INTEGER" property="taskId" />
|
||||||
|
<result column="task_name" jdbcType="VARCHAR" property="taskName" />
|
||||||
|
<result column="state" jdbcType="INTEGER" property="state" />
|
||||||
|
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
task_id, task_name, state,create_date
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from Export_Task
|
||||||
|
where task_id = #{taskId,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
<select id="getExportTaskByName" resultType="com.emr.entity.ExportTask">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from Export_Task
|
||||||
|
where task_name = #{taskName}
|
||||||
|
|
||||||
|
</select>
|
||||||
|
<select id="getExportTaskList" resultType="com.emr.vo.ExportTaskVo">
|
||||||
|
select
|
||||||
|
task_id as taskId,
|
||||||
|
task_name as taskName,
|
||||||
|
state,
|
||||||
|
create_date as createDate
|
||||||
|
from Export_Task
|
||||||
|
where 1 =1
|
||||||
|
<if test="record.taskName != null and record.taskName != ''">
|
||||||
|
and task_name like '%${record.taskName}%'
|
||||||
|
</if>
|
||||||
|
<if test="startTime != '' and startTime != null">
|
||||||
|
AND CONVERT ( VARCHAR ( 100 ), create_date, 23 ) >= #{startTime}
|
||||||
|
<if test="endTime != '' and endTime != null">
|
||||||
|
AND CONVERT ( VARCHAR ( 100 ), create_date, 23 ) <= #{endTime}
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from Export_Task
|
||||||
|
where task_id = #{taskId,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.emr.entity.ExportTask">
|
||||||
|
insert into Export_Task (task_id, task_name, state,create_date
|
||||||
|
)
|
||||||
|
values (#{taskId,jdbcType=INTEGER}, #{taskName,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.emr.entity.ExportTask">
|
||||||
|
insert into Export_Task
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">
|
||||||
|
task_id,
|
||||||
|
</if>
|
||||||
|
<if test="taskName != null">
|
||||||
|
task_name,
|
||||||
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
state,
|
||||||
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
create_date,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="taskId != null">
|
||||||
|
#{taskId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="taskName != null">
|
||||||
|
#{taskName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
#{state,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="createDate != null">
|
||||||
|
#{createDate,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.emr.entity.ExportTask">
|
||||||
|
update Export_Task
|
||||||
|
<set>
|
||||||
|
<if test="taskName != null">
|
||||||
|
task_name = #{taskName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
state = #{state,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="state != null">
|
||||||
|
create_date = #{createDate,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where task_id = #{taskId,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.emr.entity.ExportTask">
|
||||||
|
update Export_Task
|
||||||
|
set task_name = #{taskName,jdbcType=VARCHAR},
|
||||||
|
state = #{state,jdbcType=INTEGER}
|
||||||
|
where task_id = #{taskId,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
Binary file not shown.
Loading…
Reference in New Issue