复印记录(统计+明细)、扫描上传(统计和明细)
parent
9a01fce576
commit
c871980a65
@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Copyright (C), 2015-2019
|
||||
* Author: HJL
|
||||
* Date: 2019/7/19 14:39
|
||||
* Description:病案召回
|
||||
*/
|
||||
package com.emr.controller;
|
||||
|
||||
import com.emr.entity.Archive_Master_Vo;
|
||||
import com.emr.entity.OffsetLimitPage;
|
||||
import com.emr.service.Archive_MasterService;
|
||||
import com.emr.util.DatelUtils;
|
||||
import com.emr.util.ThreadExcelUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.emr.util.DatelUtils.addDayFun;
|
||||
import static com.emr.util.DatelUtils.compareDate;
|
||||
|
||||
|
||||
//@PropertySource(value = "classpath:config/jdbc.properties", encoding = "UTF-8")
|
||||
@Controller
|
||||
@RequestMapping("/copyInfo")
|
||||
public class CopyListController {
|
||||
|
||||
@Autowired
|
||||
private Archive_MasterService archiveMasterService;
|
||||
|
||||
@RequestMapping(value = "/copyDetailList")
|
||||
public String faults(Model model) {
|
||||
return "copyDir/copyDetailList";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/copyDetailPage")
|
||||
public OffsetLimitPage copyDetailPage(HttpServletRequest request, HttpServletResponse response,Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) throws Exception {
|
||||
//判断复制时段类型
|
||||
archiveMasterVo=DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
OffsetLimitPage result = (OffsetLimitPage) archiveMasterService.copyDetailList(archiveMasterVo, offset, limit);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/exportExcel")
|
||||
public void exportExcel(HttpServletResponse response, Archive_Master_Vo archiveMasterVo) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
String[] header = {"记帐号","住院号","住院次数","患者姓名","性别","入院日期","出院日期","出院科室","主管医生","复印内容","复印日期"};
|
||||
String[] fileNames = {"patientId","inpNo","visitId","name","sex","admissionDateTime","dischargeDateTime","deptName","doctorInCharge","content","createTime"};
|
||||
//文件名
|
||||
String fileName = "复印记录明细" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xls";
|
||||
//构造excel的数据beHospList
|
||||
archiveMasterVo= DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
List<Archive_Master_Vo> list = archiveMasterService.copyDetailList(archiveMasterVo);
|
||||
ThreadExcelUtils utils = new ThreadExcelUtils(fileName, "", header, fileNames);
|
||||
String result=utils.exportExcelToFilePath(response,utils.listConvert(list));
|
||||
}
|
||||
|
||||
/*
|
||||
* 复印记录统计
|
||||
* */
|
||||
@RequestMapping(value = "/copyCountList")
|
||||
public String faultsLog(Model model) {
|
||||
return "copyDir/copyCountList";
|
||||
}
|
||||
|
||||
/*
|
||||
* 复印记录统计分页
|
||||
* */
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/copyCountPage")
|
||||
public OffsetLimitPage copyCountPage(HttpServletRequest request, HttpServletResponse response, Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit)throws Exception {
|
||||
archiveMasterVo=DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
OffsetLimitPage result = archiveMasterService.copyCountList(archiveMasterVo, offset, limit);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/exportCountExcel")
|
||||
public void exportCountExcel(HttpServletResponse response,Archive_Master_Vo archiveMasterVo) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
String[] header = {"记帐号","住院号","住院次数","患者姓名","复印日期","复印次数"};
|
||||
String[] fileNames = {"patientId","inpNo","visitId","name","createTime","numb"};
|
||||
//文件名
|
||||
String fileName = "复印记录统计" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xls";
|
||||
//构造excel的数据beHospList
|
||||
archiveMasterVo=DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
List<Archive_Master_Vo> list = archiveMasterService.copyCountList(archiveMasterVo);
|
||||
ThreadExcelUtils utils = new ThreadExcelUtils(fileName, "", header, fileNames);
|
||||
String result=utils.exportExcelToFilePath(response,utils.listConvert(list));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,99 @@
|
||||
package com.emr.controller;
|
||||
|
||||
import com.emr.entity.Archive_Master_Vo;
|
||||
import com.emr.entity.OffsetLimitPage;
|
||||
import com.emr.entity.Zd_Assort;
|
||||
import com.emr.service.ScanInfoService;
|
||||
import com.emr.util.DatelUtils;
|
||||
import com.emr.util.ThreadExcelUtils;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/scanInfo")
|
||||
public class ScanListController {
|
||||
@Autowired
|
||||
private ScanInfoService scanInfoService;
|
||||
|
||||
/*
|
||||
* 扫描上传记录统计
|
||||
* */
|
||||
@RequestMapping(value = "/scanCount")
|
||||
public String scanCount(Model model) {
|
||||
return "scanDir/scanCountList";
|
||||
}
|
||||
|
||||
/*
|
||||
* 复印记录统计分页
|
||||
* */
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/scanCountPage")
|
||||
public OffsetLimitPage scanCountPage(HttpServletRequest request, HttpServletResponse response, Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit)throws Exception {
|
||||
archiveMasterVo= DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
OffsetLimitPage result = (OffsetLimitPage) scanInfoService.scanCountPage(archiveMasterVo, offset, limit);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/exportCountExcel")
|
||||
public void exportCountExcel(HttpServletResponse response, Archive_Master_Vo archiveMasterVo) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
String[] header = {"扫描人","扫描日期","扫描次数","扫描份数"};
|
||||
String[] fileNames = {"creater","createTime","numb","content"};
|
||||
//文件名
|
||||
String fileName = "扫描上传记录统计" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xls";
|
||||
//构造excel的数据beHospList
|
||||
archiveMasterVo=DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
List<Archive_Master_Vo> list = scanInfoService.scanCountList(archiveMasterVo);
|
||||
ThreadExcelUtils utils = new ThreadExcelUtils(fileName, "", header, fileNames);
|
||||
String result=utils.exportExcelToFilePath(response,utils.listConvert(list));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 扫描上传记录明细
|
||||
* */
|
||||
@RequestMapping(value = "/scanDetailList")
|
||||
public String scanDetailList(Model model) {
|
||||
return "scanDir/scanDetailList";
|
||||
}
|
||||
|
||||
/*
|
||||
* 复印记录统计明细
|
||||
* */
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/scanDetailPage")
|
||||
public OffsetLimitPage scanDetailPage(HttpServletRequest request, HttpServletResponse response, Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit)throws Exception {
|
||||
archiveMasterVo= DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
OffsetLimitPage result = (OffsetLimitPage) scanInfoService.scanDetailPage(archiveMasterVo, offset, limit);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/exportExcel")
|
||||
public void exportExcel(HttpServletResponse response, Archive_Master_Vo archiveMasterVo) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||
/* String[] header = {"记帐号","住院号","住院次数","患者姓名","性别","入院日期","出院日期","出院科室","主管医生","扫描人","文件名","扫描日期"};
|
||||
String[] fileNames = {"patientId","inpNo","visitId","name","sex","admissionDateTime","dischargeDateTime","deptName","doctorInCharge","creater","content","createTime"};*/
|
||||
String[] header = {"记帐号","住院号","住院次数","患者姓名","出院日期","扫描人","文件名","扫描日期"};
|
||||
String[] fileNames = {"patientId","inpNo","visitId","name","dischargeDateTime","creater","content","createTime"};
|
||||
//文件名
|
||||
String fileName = "扫描上传记录明细" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xls";
|
||||
//构造excel的数据beHospList
|
||||
archiveMasterVo=DatelUtils.setMaterVoFun(archiveMasterVo);
|
||||
List<Archive_Master_Vo> list = scanInfoService.scanDetailList(archiveMasterVo);
|
||||
ThreadExcelUtils utils = new ThreadExcelUtils(fileName, "", header, fileNames);
|
||||
String result=utils.exportExcelToFilePath(response,utils.listConvert(list));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.emr.service;
|
||||
|
||||
import com.emr.entity.Archive_Master;
|
||||
import com.emr.entity.Archive_Master_Vo;
|
||||
import com.emr.entity.OffsetLimitPage;
|
||||
import com.emr.entity.Zd_Assort;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ScanInfoService {
|
||||
OffsetLimitPage scanCountPage(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit);
|
||||
|
||||
List<Archive_Master_Vo> scanCountList(Archive_Master_Vo archiveMasterVo);
|
||||
|
||||
OffsetLimitPage scanDetailPage(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit);
|
||||
|
||||
List<Archive_Master_Vo> scanDetailList(Archive_Master_Vo archiveMasterVo);
|
||||
}
|
@ -0,0 +1,490 @@
|
||||
package com.emr.service.ipml;
|
||||
|
||||
import com.emr.entity.Archive_Master_Vo;
|
||||
import com.emr.entity.OffsetLimitPage;
|
||||
import com.emr.entity.Zd_Assort;
|
||||
import com.emr.service.ScanInfoService;
|
||||
import com.emr.util.JdbcUtil;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ScanInfoServiceImpl implements ScanInfoService {
|
||||
|
||||
@Override
|
||||
public OffsetLimitPage scanCountPage(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) {
|
||||
PageHelper.offsetPage(offset, limit);
|
||||
//开始和结束行数
|
||||
Integer stratRow=(offset/10)*limit;
|
||||
Integer endRow=(offset/10)*limit+limit;
|
||||
Connection con = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int rowTotal=0;
|
||||
List<Archive_Master_Vo> list=new ArrayList<>();
|
||||
int a=0,b=0,c=0,d=0;
|
||||
try {
|
||||
con = JdbcUtil.getConnection();
|
||||
String sql = "";//"select * from [zd_Assort] where print_flag=?";
|
||||
/*select c.patient_id,c.numb,a.assort_name,a.assort_date,content from(
|
||||
select patient_id,assort_id,COUNT(*) numb from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id,assort_id
|
||||
)c
|
||||
LEFT JOIN(
|
||||
select patient_id,assort_name,convert(varchar(10), assort_date,23) assort_date from t_gdh_index where patient_id is not null and patient_id!=''
|
||||
)a
|
||||
on c.patient_id=a.patient_id
|
||||
LEFT JOIN(
|
||||
select patient_id,COUNT(*) content from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id
|
||||
)b
|
||||
on a.patient_id=b.patient_id*/
|
||||
//查询总记录数
|
||||
sql = "select count(*) from( " +
|
||||
" select c.patient_id,c.numb,a.assort_name creater,a.create_time,content from( " +
|
||||
" select patient_id,assort_id,COUNT(*) numb from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id,assort_id " +
|
||||
" )c " +
|
||||
" LEFT JOIN( " +
|
||||
" select patient_id,assort_name,convert(varchar(10), assort_date,23) create_time from t_gdh_index where patient_id is not null and patient_id!='' " +
|
||||
" )a " +
|
||||
" on c.patient_id=a.patient_id " +
|
||||
" LEFT JOIN( " +
|
||||
" select patient_id,COUNT(*) content from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id " +
|
||||
" )b " +
|
||||
" on a.patient_id=b.patient_id " +
|
||||
" )m group by creater,create_time having 1=1 ";
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getCreater())){
|
||||
sql+=" and creater like '%'+?+'%'" ;
|
||||
b=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23) between ? and ? " ;
|
||||
c=1;d=1;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate())){
|
||||
c=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23)>=?" ;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
d=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23)>=?" ;
|
||||
}
|
||||
stmt = con.prepareStatement(sql);
|
||||
if(a==1){
|
||||
stmt.setString(a, archiveMasterVo.getInpNo());
|
||||
}
|
||||
if(b==1) {
|
||||
stmt.setString(a+b, archiveMasterVo.getCreater());
|
||||
}
|
||||
if(c==1) {
|
||||
stmt.setString(a+b+c, archiveMasterVo.getStartDate());
|
||||
}
|
||||
if(d==1) {
|
||||
stmt.setString(a+b+c+d, archiveMasterVo.getEndDate());
|
||||
}
|
||||
rs = stmt.executeQuery();
|
||||
rs.next();
|
||||
rowTotal=rs.getInt(1);
|
||||
sql="select * from(" +
|
||||
"select ROW_NUMBER() over(order by creater desc) RowNum,creater,create_time,sum(numb) numb ,sum(content) content from( " +
|
||||
" select c.patient_id,c.numb,a.assort_name creater,a.create_time,content from( " +
|
||||
" select patient_id,assort_id,COUNT(*) numb from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id,assort_id " +
|
||||
" )c " +
|
||||
" LEFT JOIN( " +
|
||||
" select patient_id,assort_name,convert(varchar(10), assort_date,23) create_time from t_gdh_index where patient_id is not null and patient_id!='' " +
|
||||
" )a " +
|
||||
" on c.patient_id=a.patient_id " +
|
||||
" LEFT JOIN( " +
|
||||
" select patient_id,COUNT(*) content from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id " +
|
||||
" )b " +
|
||||
" on a.patient_id=b.patient_id " +
|
||||
" )m group by creater,create_time having 1=1 ";
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getCreater())){
|
||||
sql+=" and creater like '%'+?+'%'" ;
|
||||
b=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23) between ? and ? " ;
|
||||
c=1;d=1;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate())){
|
||||
c=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23)>=?" ;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
d=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23)>=?" ;
|
||||
}
|
||||
sql+= " ) as t1 " +
|
||||
" where 1=1 and RowNum>"+stratRow+" and RowNum<="+endRow ;
|
||||
stmt = con.prepareStatement(sql);
|
||||
if(a==1){
|
||||
stmt.setString(a, archiveMasterVo.getInpNo());
|
||||
}
|
||||
if(b==1) {
|
||||
stmt.setString(a+b, archiveMasterVo.getCreater());
|
||||
}
|
||||
if(c==1) {
|
||||
stmt.setString(a+b+c, archiveMasterVo.getStartDate());
|
||||
}
|
||||
if(d==1) {
|
||||
stmt.setString(a+b+c+d, archiveMasterVo.getEndDate());
|
||||
}
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
Archive_Master_Vo archiveMasterVo1=new Archive_Master_Vo();
|
||||
while(rs.next())
|
||||
{
|
||||
archiveMasterVo1=new Archive_Master_Vo();
|
||||
String creater = rs.getString("creater");//扫描人
|
||||
String createTime = rs.getString("create_time");//扫描时间
|
||||
int numb=Integer.parseInt(rs.getString("numb"));//扫描次数
|
||||
String content=rs.getString("content");//扫描份数
|
||||
archiveMasterVo1.setCreater(creater);
|
||||
archiveMasterVo1.setCreateTime(createTime);
|
||||
archiveMasterVo1.setNumb(numb);
|
||||
archiveMasterVo1.setContent(content);
|
||||
list.add(archiveMasterVo1);
|
||||
}
|
||||
} catch (Exception w) {
|
||||
w.printStackTrace();
|
||||
}finally{
|
||||
JdbcUtil.close(rs, stmt, con);
|
||||
}
|
||||
OffsetLimitPage offsetLimitPage=new OffsetLimitPage();
|
||||
offsetLimitPage.setTotal((long) rowTotal);
|
||||
offsetLimitPage.setRows(list);
|
||||
return offsetLimitPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Archive_Master_Vo> scanCountList(Archive_Master_Vo archiveMasterVo) {
|
||||
Connection con = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Archive_Master_Vo> list=new ArrayList<>();
|
||||
int a=0,b=0,c=0,d=0;
|
||||
try {
|
||||
con = JdbcUtil.getConnection();
|
||||
String sql = "";
|
||||
sql = "select creater,create_time,sum(numb) numb ,sum(content) content from( " +
|
||||
" select c.patient_id,c.numb,a.assort_name creater,a.create_time,content from( " +
|
||||
" select patient_id,assort_id,COUNT(*) numb from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id,assort_id " +
|
||||
" )c " +
|
||||
" LEFT JOIN( " +
|
||||
" select patient_id,assort_name,convert(varchar(10), assort_date,23) create_time from t_gdh_index where patient_id is not null and patient_id!='' " +
|
||||
" )a " +
|
||||
" on c.patient_id=a.patient_id " +
|
||||
" LEFT JOIN( " +
|
||||
" select patient_id,COUNT(*) content from t_scan_assort where patient_id is not null and patient_id!='' group by patient_id " +
|
||||
" )b " +
|
||||
" on a.patient_id=b.patient_id " +
|
||||
" )m group by creater,create_time having 1=1 ";
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getCreater())){
|
||||
sql+=" and creater like '%'+?+'%'" ;
|
||||
b=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23) between ? and ? " ;
|
||||
c=1;d=1;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate())){
|
||||
c=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23)>=?" ;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
d=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), create_time, 23)>=?" ;
|
||||
}
|
||||
stmt = con.prepareStatement(sql);
|
||||
if(a==1){
|
||||
stmt.setString(a, archiveMasterVo.getInpNo());
|
||||
}
|
||||
if(b==1) {
|
||||
stmt.setString(a+b, archiveMasterVo.getCreater());
|
||||
}
|
||||
if(c==1) {
|
||||
stmt.setString(a+b+c, archiveMasterVo.getStartDate());
|
||||
}
|
||||
if(d==1) {
|
||||
stmt.setString(a+b+c+d, archiveMasterVo.getEndDate());
|
||||
}
|
||||
rs = stmt.executeQuery();
|
||||
Archive_Master_Vo archiveMasterVo1=new Archive_Master_Vo();
|
||||
while(rs.next())
|
||||
{
|
||||
archiveMasterVo1=new Archive_Master_Vo();
|
||||
String creater = rs.getString("creater");//扫描人
|
||||
String createTime = rs.getString("create_time");//扫描时间
|
||||
int numb=Integer.parseInt(rs.getString("numb"));//扫描次数
|
||||
String content=rs.getString("content");//扫描份数
|
||||
archiveMasterVo1.setCreater(creater);
|
||||
archiveMasterVo1.setCreateTime(createTime);
|
||||
archiveMasterVo1.setNumb(numb);
|
||||
archiveMasterVo1.setContent(content);
|
||||
list.add(archiveMasterVo1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
JdbcUtil.close(rs, stmt, con);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OffsetLimitPage scanDetailPage(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) {
|
||||
PageHelper.offsetPage(offset, limit);
|
||||
//开始和结束行数
|
||||
Integer stratRow=(offset/10)*limit;
|
||||
Integer endRow=(offset/10)*limit+limit;
|
||||
Connection con = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int rowTotal=0;
|
||||
int a=0,b=0,c=0,d=0;
|
||||
List<Archive_Master_Vo> list=new ArrayList<>();;
|
||||
try {
|
||||
con = JdbcUtil.getConnection();
|
||||
String sql = "";//"select * from [zd_Assort] where print_flag=?";
|
||||
//查询总记录数
|
||||
sql = "select count(*) from(" +
|
||||
" select patient_id patient_id2,assort_id,scan_page from t_scan_assort where patient_id is not null and patient_id!=''" +
|
||||
" )a" +
|
||||
" left join (" +
|
||||
" select patient_id,inpatient_no inp_no,admiss_times visit_id,name,convert(varchar(19), dis_date,120) discharge_date_time,assort_name creater,convert(varchar(10), assort_date,23) create_time " +
|
||||
" from t_gdh_index where patient_id is not null and patient_id!=''" +
|
||||
" )b" +
|
||||
" on a.patient_id2=b.patient_id" +
|
||||
" where 1=1";
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getCreater())){
|
||||
sql+=" and creater like '%'+?+'%'" ;
|
||||
b=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23) between ? and ? " ;
|
||||
c=1;d=1;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate())){
|
||||
c=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23)>=?" ;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
d=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23)>=?" ;
|
||||
}
|
||||
stmt = con.prepareStatement(sql);
|
||||
if(a==1){
|
||||
stmt.setString(a, archiveMasterVo.getInpNo());
|
||||
}
|
||||
if(b==1) {
|
||||
stmt.setString(a+b, archiveMasterVo.getCreater());
|
||||
}
|
||||
if(c==1) {
|
||||
stmt.setString(a+b+c, archiveMasterVo.getStartDate());
|
||||
}
|
||||
if(d==1) {
|
||||
stmt.setString(a+b+c+d, archiveMasterVo.getEndDate());
|
||||
}
|
||||
rs = stmt.executeQuery();
|
||||
rs.next();
|
||||
rowTotal=rs.getInt(1);
|
||||
|
||||
sql="select * from (" +
|
||||
"select ROW_NUMBER() over(order by assort_id desc) RowNum ,b.*,a.scan_page content from(" +
|
||||
" select patient_id patient_id2,assort_id,scan_page from t_scan_assort where patient_id is not null and patient_id!=''" +
|
||||
" )a" +
|
||||
" left join (" +
|
||||
" select patient_id,inpatient_no inp_no,admiss_times visit_id,name,convert(varchar(19), dis_date,120) discharge_date_time,assort_name creater,convert(varchar(10), assort_date,23) create_time " +
|
||||
" from t_gdh_index where patient_id is not null and patient_id!=''" +
|
||||
" )b" +
|
||||
" on a.patient_id2=b.patient_id" +
|
||||
" where 1=1 ";
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getCreater())){
|
||||
sql+=" and creater like '%'+?+'%'" ;
|
||||
b=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23) between ? and ? " ;
|
||||
c=1;d=1;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate())){
|
||||
c=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23)>=?" ;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
d=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23)>=?" ;
|
||||
}
|
||||
sql+=" ) as t1 "
|
||||
+ " where 1=1 and RowNum>"+stratRow+" and RowNum<="+endRow ;
|
||||
stmt = con.prepareStatement(sql);
|
||||
if(a==1){
|
||||
stmt.setString(a, archiveMasterVo.getInpNo());
|
||||
}
|
||||
if(b==1) {
|
||||
stmt.setString(a+b, archiveMasterVo.getCreater());
|
||||
}
|
||||
if(c==1) {
|
||||
stmt.setString(a+b+c, archiveMasterVo.getStartDate());
|
||||
}
|
||||
if(d==1) {
|
||||
stmt.setString(a+b+c+d, archiveMasterVo.getEndDate());
|
||||
}
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
Archive_Master_Vo archiveMasterVo1=new Archive_Master_Vo();
|
||||
while(rs.next())
|
||||
{
|
||||
archiveMasterVo1=new Archive_Master_Vo();
|
||||
String patientId = rs.getString("patient_id");
|
||||
String inpNo = rs.getString("inp_no");
|
||||
String visitId = rs.getString("visit_id");
|
||||
String name = rs.getString("name");
|
||||
// String sex = rs.getString("sex");
|
||||
//String admissionDateTime = rs.getString("admission_date_time");
|
||||
String dischargeDateTime = rs.getString("discharge_date_time");
|
||||
// String deptName = rs.getString("dept_name");
|
||||
// String doctorInCharge = rs.getString("doctor_in_charge");
|
||||
String creater = rs.getString("creater");//扫描人
|
||||
String content = rs.getString("content");//文件名
|
||||
String createTime = rs.getString("create_time");//扫描时间
|
||||
|
||||
archiveMasterVo1.setPatientId(patientId);
|
||||
archiveMasterVo1.setInpNo(inpNo);
|
||||
archiveMasterVo1.setVisitId(visitId);
|
||||
archiveMasterVo1.setName(name);
|
||||
//archiveMasterVo1.setSex(sex);
|
||||
//archiveMasterVo1.setAdmissionDateTime(admissionDateTime);
|
||||
archiveMasterVo1.setDischargeDateTime(dischargeDateTime);
|
||||
// archiveMasterVo1.setDeptName(deptName);
|
||||
// archiveMasterVo1.setDoctorInCharge(doctorInCharge);
|
||||
archiveMasterVo1.setCreater(creater);
|
||||
archiveMasterVo1.setContent(content);
|
||||
archiveMasterVo1.setCreateTime(createTime);
|
||||
list.add(archiveMasterVo1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
JdbcUtil.close(rs, stmt, con);
|
||||
}
|
||||
OffsetLimitPage offsetLimitPage=new OffsetLimitPage();
|
||||
offsetLimitPage.setTotal((long) rowTotal);
|
||||
offsetLimitPage.setRows(list);
|
||||
return offsetLimitPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Archive_Master_Vo> scanDetailList(Archive_Master_Vo archiveMasterVo) {
|
||||
Connection con = null;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Archive_Master_Vo> list=new ArrayList<>();;
|
||||
try {
|
||||
con = JdbcUtil.getConnection();
|
||||
int a=0,b=0,c=0,d=0;
|
||||
String sql = "select b.*,a.scan_page content from(" +
|
||||
" select patient_id patient_id2,assort_id,scan_page from t_scan_assort where patient_id is not null and patient_id!=''" +
|
||||
" )a" +
|
||||
" left join (" +
|
||||
" select patient_id,inpatient_no inp_no,admiss_times visit_id,name,convert(varchar(19), dis_date,120) discharge_date_time,assort_name creater,convert(varchar(10), assort_date,23) create_time " +
|
||||
" from t_gdh_index where patient_id is not null and patient_id!=''" +
|
||||
" )b" +
|
||||
" on a.patient_id2=b.patient_id" +
|
||||
" where 1=1";
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getInpNo())){
|
||||
sql+=" and inp_no like '%'+?+'%'" ;
|
||||
a=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getCreater())){
|
||||
sql+=" and creater like '%'+?+'%'" ;
|
||||
b=1;
|
||||
}
|
||||
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23) between ? and ? " ;
|
||||
c=1;d=1;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate())){
|
||||
c=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23)>=?" ;
|
||||
}else if(StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
d=1;
|
||||
sql+=" and CONVERT (VARCHAR(10), b.create_time, 23)>=?" ;
|
||||
}
|
||||
stmt = con.prepareStatement(sql);
|
||||
if(a==1){
|
||||
stmt.setString(a, archiveMasterVo.getInpNo());
|
||||
}
|
||||
if(b==1) {
|
||||
stmt.setString(a+b, archiveMasterVo.getCreater());
|
||||
}
|
||||
if(c==1) {
|
||||
stmt.setString(a+b+c, archiveMasterVo.getStartDate());
|
||||
}
|
||||
if(d==1) {
|
||||
stmt.setString(a+b+c+d, archiveMasterVo.getEndDate());
|
||||
}
|
||||
rs = stmt.executeQuery();
|
||||
Archive_Master_Vo archiveMasterVo1=new Archive_Master_Vo();
|
||||
while(rs.next())
|
||||
{
|
||||
archiveMasterVo1=new Archive_Master_Vo();
|
||||
String patientId = rs.getString("patient_id");
|
||||
String inpNo = rs.getString("inp_no");
|
||||
String visitId = rs.getString("visit_id");
|
||||
String name = rs.getString("name");
|
||||
// String sex = rs.getString("sex");
|
||||
// String admissionDateTime = rs.getString("admission_date_time");
|
||||
String dischargeDateTime = rs.getString("discharge_date_time");
|
||||
// String deptName = rs.getString("dept_name");
|
||||
// String doctorInCharge = rs.getString("doctor_in_charge");
|
||||
String creater = rs.getString("creater");//扫描人
|
||||
String content = rs.getString("content");//文件名
|
||||
String createTime = rs.getString("create_time");//扫描时间
|
||||
|
||||
archiveMasterVo1.setPatientId(patientId);
|
||||
archiveMasterVo1.setInpNo(inpNo);
|
||||
archiveMasterVo1.setVisitId(visitId);
|
||||
archiveMasterVo1.setName(name);
|
||||
//archiveMasterVo1.setSex(sex);
|
||||
//archiveMasterVo1.setAdmissionDateTime(admissionDateTime);
|
||||
archiveMasterVo1.setDischargeDateTime(dischargeDateTime);
|
||||
//archiveMasterVo1.setDeptName(deptName);
|
||||
// archiveMasterVo1.setDoctorInCharge(doctorInCharge);
|
||||
archiveMasterVo1.setCreater(creater);
|
||||
archiveMasterVo1.setContent(content);
|
||||
archiveMasterVo1.setCreateTime(createTime);
|
||||
list.add(archiveMasterVo1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
JdbcUtil.close(rs, stmt, con);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package com.emr.util;
|
||||
|
||||
import com.emr.entity.Archive_Master_Vo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 多线程多sheet导出数据
|
||||
*/
|
||||
public class DatelUtils {
|
||||
/**
|
||||
* 比较两个日期的大小
|
||||
* @param time1
|
||||
* @param time2
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static boolean compareDate(String time1,String time2) throws ParseException{
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date a=sdf.parse(time1);
|
||||
Date b=sdf.parse(time2);
|
||||
//a早于b返回true
|
||||
if(a.before(b)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 日期增加年月日
|
||||
* @param dayStr 日期str
|
||||
* @return 加上几天后的日期
|
||||
*/
|
||||
public static String addDayFun(String dayStr, String dayType, int i) {
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date dt=null;
|
||||
if(StringUtils.isBlank(dayStr)){
|
||||
//系统时间
|
||||
dt=sdf.parse(sdf.format(new Date()));
|
||||
}else{
|
||||
dt=sdf.parse(dayStr);
|
||||
}
|
||||
Calendar rightNow=Calendar.getInstance();
|
||||
rightNow.setTime(dt);
|
||||
if(dayType=="year") {
|
||||
rightNow.add(Calendar.YEAR, i);//-1 日期减1年
|
||||
}else if(dayType=="month") {
|
||||
rightNow.add(Calendar.MONTH, i);//3 日期加三个月
|
||||
}else if(dayType=="day") {
|
||||
rightNow.add(Calendar.DAY_OF_YEAR, i);//15 日期加15天
|
||||
}
|
||||
Date dt1=rightNow.getTime();
|
||||
String reStr=sdf.format(dt1);
|
||||
//System.out.println(reStr);
|
||||
return reStr;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static Archive_Master_Vo setMaterVoFun(Archive_Master_Vo archiveMasterVo) throws Exception {
|
||||
//判断复制时段类型
|
||||
String endDateStr="";
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getLockinfo())){
|
||||
//day_7 month_day_15 month_1 month_3
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getEndDate())){
|
||||
//复印时间的截至日期,不得超过
|
||||
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),archiveMasterVo.getStartDate(),"A",0);
|
||||
archiveMasterVo.setEndDate(endDateStr);
|
||||
}else if(org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),archiveMasterVo.getStartDate(),"A",0);
|
||||
if(!compareDate(archiveMasterVo.getStartDate(),endDateStr)){
|
||||
archiveMasterVo.setEndDate(endDateStr);
|
||||
}
|
||||
}else if(org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
|
||||
//反向扣除s
|
||||
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),archiveMasterVo.getEndDate(),"B",0);
|
||||
archiveMasterVo.setStartDate(endDateStr);
|
||||
}else if(org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getEndDate())){
|
||||
//系统时间
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String nowDate= String.valueOf(sdf.format(new Date()));
|
||||
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),nowDate,"B",0);
|
||||
archiveMasterVo.setStartDate(endDateStr);
|
||||
archiveMasterVo.setEndDate(nowDate);
|
||||
}
|
||||
}
|
||||
archiveMasterVo.setLockinfo(null);
|
||||
return archiveMasterVo;
|
||||
}
|
||||
public static String getDateFun(String dayType,String currDate,String dayFlag,int numb){
|
||||
String endDateStr="";
|
||||
if(dayFlag.equals("A")) { //加
|
||||
if (dayType.equals("day_7")) {
|
||||
endDateStr = addDayFun(currDate, "day", 7);
|
||||
} else if (dayType.equals("month_day_15")) {
|
||||
endDateStr = addDayFun(currDate, "day", 15);
|
||||
} else if (dayType.equals("month_1")) {
|
||||
endDateStr = addDayFun(currDate, "month", 1);
|
||||
} else if (dayType.equals("month_3")) {
|
||||
endDateStr = addDayFun(currDate, "month", 3);
|
||||
} else if (dayType.equals("day")) {
|
||||
endDateStr = addDayFun(currDate, "day", numb);
|
||||
} else if (dayType.equals("month")) {
|
||||
endDateStr = addDayFun(currDate, "month", numb);
|
||||
}
|
||||
}else if(dayFlag.equals("B")) { //减
|
||||
if (dayType.equals("day_7")) {
|
||||
endDateStr = addDayFun(currDate, "day", -7);
|
||||
} else if (dayType.equals("month_day_15")) {
|
||||
endDateStr = addDayFun(currDate, "day", -15);
|
||||
} else if (dayType.equals("month_1")) {
|
||||
endDateStr = addDayFun(currDate, "month", -1);
|
||||
} else if (dayType.equals("month_3")) {
|
||||
endDateStr = addDayFun(currDate, "month", -3);
|
||||
}else if (dayType.equals("day")) {
|
||||
endDateStr = addDayFun(currDate, "day", -1*numb);
|
||||
} else if (dayType.equals("month")) {
|
||||
endDateStr = addDayFun(currDate, "month", -1*numb);
|
||||
}
|
||||
}
|
||||
return endDateStr;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
System.out.println(addDayFun( "2021-12-21", "day", -15));
|
||||
}
|
||||
}
|
@ -1,6 +1,15 @@
|
||||
#留观推送第三方接口地址
|
||||
#\u7559\u89C2\u63A8\u9001\u7B2C\u4E09\u65B9\u63A5\u53E3\u5730\u5740
|
||||
observationRecordRequestUrl = http://10.162.0.51:8091/sanshuyun-ems-function/file/away/updateStatus
|
||||
#模块打回第三方接口地址
|
||||
#\u6A21\u5757\u6253\u56DE\u7B2C\u4E09\u65B9\u63A5\u53E3\u5730\u5740
|
||||
returnUrl = http://10.6.1.152:8085/SignWebService.asmx/PartrePair
|
||||
#模块打回第三方接口参数
|
||||
returnParam = strJson
|
||||
#\u6A21\u5757\u6253\u56DE\u7B2C\u4E09\u65B9\u63A5\u53E3\u53C2\u6570
|
||||
returnParam = strJson
|
||||
|
||||
#\u6A21\u5757\u626B\u63CF\u4E0A\u4F20\u62A5\u8868
|
||||
sqlServerClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
sqlServerUrl=jdbc:sqlserver://10.3.6.94:1433;DatabaseName=headpage_gyfs_1
|
||||
sqlServerUserName=sa
|
||||
sqlServerPassword=xjgs+docus911
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue