验证码

master
ALW 3 years ago
parent 2350a95c90
commit 95767bebd6

@ -0,0 +1,48 @@
package com.emr.controller;
import com.emr.util.DrawCheckcode;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
@Controller
public class CheckcodeController {
@RequestMapping("/check")
@ResponseBody
public String checkcodeCheck(String codeClient, HttpServletRequest request){
String codeServer = (String)request.getSession().getAttribute("CHECKCODE");
if (codeClient.equals(codeServer)){
return "验证码正确";
}else{
return "验证码错误";
}
}
@RequestMapping("/checkcode")
public void checkcodeMake(HttpServletResponse response, HttpServletRequest request) throws IOException {
//画验证码
DrawCheckcode drawCheckcode = new DrawCheckcode();
BufferedImage image = drawCheckcode.doDraw();
//设置响应头,防止缓存
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
response.setHeader("Expires","0");
//将验证码的值保存在session中以便校验
request.getSession().setAttribute("CHECKCODE",drawCheckcode.getCheckCode());
ServletOutputStream outputStream = response.getOutputStream();
ImageIO.write(image,"jpeg",outputStream);
outputStream.flush(); //清空缓冲区数据
outputStream.close(); //关闭流
}
}

@ -1,6 +1,7 @@
package com.emr.controller;
import com.emr.entity.Archive_Master_Vo;
import com.emr.entity.CollectorStatus;
import com.emr.entity.OffsetLimitPage;
import com.emr.service.ipml.StatisticsService;
import com.emr.util.ExceptionPrintUtil;
@ -305,6 +306,28 @@ public class StatisticsController {
}
}
//采集器状态
@RequestMapping("getCollectorStatus")
@ResponseBody
public OffsetLimitPage getCollectorStatus(Integer offset, Integer limit,CollectorStatusVo collectorStatusVo){
if(null != offset && null != limit){
PageHelper.offsetPage(offset, limit);
}
try {
List<CollectorStatusVo> list = statisticsService.getCollectorStatus(collectorStatusVo);
return new OffsetLimitPage((Page)list);
} catch (Exception e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
return null;
}
}
//扫描记录明细
@RequestMapping("getScanInfo")
@ResponseBody

@ -0,0 +1,11 @@
package com.emr.dao;
import com.emr.entity.CollectorStatus;
import com.emr.vo.CollectorStatusVo;
import java.util.List;
public interface CollectorStatusMapper {
List<CollectorStatusVo> getCollectorStatus(CollectorStatus collectorStatus);
}

@ -0,0 +1,28 @@
package com.emr.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class CollectorStatus implements Serializable {
private int id;
//虚拟机ip
private String fictitiousIp;
//采集器名称
private String collectorName;
//采集器标识
private String collectorKey;
//更新时间
private String updateTime;
//备用字段
private String c1;
//备用字段
private String c2;
}

@ -1,10 +1,8 @@
package com.emr.service.ipml;
import com.emr.dao.RecordStatisticsMapper;
import com.emr.dao.StatisticsMapper;
import com.emr.dao.TUuInfoMapper;
import com.emr.dao.TUuPrintMapper;
import com.emr.dao.*;
import com.emr.entity.Archive_Master_Vo;
import com.emr.entity.CollectorStatus;
import com.emr.entity.OffsetLimitPage;
import com.emr.vo.*;
import com.github.pagehelper.Page;
@ -43,6 +41,8 @@ public class StatisticsService {
private RecordStatisticsMapper recordStatisticsMapper;
@Autowired
private CommomService commomService;
@Autowired
private CollectorStatusMapper collectorStatusMapper;
//终审按天统计
public List<FinalAndFirstStatistics> getFinalStatistics(Integer offset, Integer limit, String startDate, String endDate,String sql) throws Exception{
if(null != offset && null != limit){
@ -174,6 +174,33 @@ public class StatisticsService {
}
return countlist;
}
//采集器状态
public List<CollectorStatusVo> getCollectorStatus(CollectorStatus collectorStatus){
List<CollectorStatusVo> list = collectorStatusMapper.getCollectorStatus(collectorStatus);
//获取系统当前时间
Long time = System.currentTimeMillis();
//时间格式转换
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
time -=20*1000*60;//在当前系统时间的基础上减去20分钟
String currentTime = format.format(time);
if (list!=null){
for (CollectorStatusVo StatusList:list){
String updateTime = StatusList.getUpdateTime();
if(updateTime.compareTo(currentTime)>0){
StatusList.setCollectorStatus("正在运行");
}else {
StatusList.setCollectorStatus("停止运行");
}
String c1 = StatusList.getC1();
if(StringUtils.isNotBlank(c1)){
StatusList.setC1("采集任务已完成");
}else {
StatusList.setC1("采集任务未完成");
}
}
}
return list;
}
private String setSearchName(TUuPrintSearch search, List<User> userList) {
String name = "";

@ -0,0 +1,74 @@
package com.emr.util;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Random;
public class DrawCheckcode {
private String checkCode;
public String getCheckCode() {
return checkCode;
}
public void setCheckCode(String checkCode) {
this.checkCode = checkCode;
}
//随机产生颜色
public Color getColor(){
Random random = new Random();
//获取0-255随机值
int r = random.nextInt(256);
int g = random.nextInt(256);
int b = random.nextInt(256);
return new Color(r,g,b);
}
//产生验证码值
public String getNum(){
//原来是0-8999+1000后变成1000-9999
int ran = (int)(Math.random()*9000)+1000;
return String.valueOf(ran);
}
public BufferedImage doDraw(){
//绘制验证码
//参数:长,宽,图片类型
BufferedImage image = new BufferedImage(80, 30, BufferedImage.TYPE_INT_RGB);
//画笔
Graphics graphics = image.getGraphics();
//画长方形坐标从0,0,到8030
graphics.fillRect(0,0,80,30);
//绘制50条干扰条
for(int i=0;i<50;i++){
Random random = new Random();
int xBegin = random.nextInt(80);
int yBegin = random.nextInt(30);
int xEnd = random.nextInt(xBegin +10);
int yEnd = random.nextInt(yBegin +10);
//画笔颜色,随机
graphics.setColor(getColor());
//绘制线条
graphics.drawLine(xBegin,yBegin,xEnd,yEnd);
}
//绘制验证码
//字体加粗,变大
graphics.setFont(new Font("seif",Font.BOLD,20));
//画笔颜色
graphics.setColor(Color.BLACK);
//得到随机取得的数字
String checode = getNum();
checkCode = checode;
//在数字中间加上空格分开
StringBuffer buffer = new StringBuffer();
for(int i=0;i<checode.length();i++){
buffer.append(checode.charAt(i)+" ");
}
//在长方形里绘制验证码15,20是起始坐标
graphics.drawString(buffer.toString(),15,20);
return image;
}
}

@ -0,0 +1,27 @@
package com.emr.vo;
import com.emr.entity.CollectorStatus;
import lombok.Data;
import java.util.Date;
@Data
public class CollectorStatusVo extends CollectorStatus {
private int id;
//虚拟机ip
private String fictitiousIp;
//采集器名称
private String collectorName;
//采集器标识
private String collectorKey;
//更新时间
private String updateTime;
//备用字段
private String c1;
//备用字段
private String c2;
//采集器状态
private String collectorStatus;
}

@ -1,7 +1,7 @@
#\u6570\u636E\u5E93IP
dataBaseIp=localhost
#\u6570\u636E\u5E93\u540D\u79F0
dataBaseName=gm_record
dataBaseName=fs_record
#\u6570\u636E\u5E93\u5BC6\u7801
dataBasePassword=admin123

@ -0,0 +1,13 @@
<?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.CollectorStatusMapper" >
<select id="getCollectorStatus" resultType="com.emr.vo.CollectorStatusVo"
parameterType="com.emr.entity.CollectorStatus">
select * from collector_status
<where>
<if test="collectorKey != null and collectorKey !='' " >
collector_key=#{collectorKey}
</if>
</where>
</select>
</mapper>

@ -846,7 +846,7 @@
</div>
<!--数据表格-->
<div class="col-sm-12" style="margin-top: 5px">
<table id="table5" class="table text-nowrap table-striped"></table>
<table id="table5" class="table text-nowrap table-striped" style="max-width: 60px; white-space: nowrap;text-overflow: ellipsis;overflow: hidden;"></table>
</div>
</div>
</div>

@ -3,7 +3,7 @@
<c:set value="${pageContext.request.contextPath}" var="path" scope="page"/>
<html>
<head>
<title>扫描上传记录报表</title>
<title>采集器状态</title>
<meta charset="utf-8">
<!-- 解决部分兼容性问题如果安装了GCF则使用GCF来渲染页面如果未安装GCF则使用最高版本的IE内核进行渲染。 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@ -38,7 +38,7 @@
<div class="headDiv">
<div class="headSpanDiv">
<span class="headspan">
扫描上传记录报表
采集器状态
</span>
</div>
</div>
@ -46,79 +46,84 @@
<!--搜索-->
<form>
<div class="form-inline" style="margin-left:5px;margin-top:5px;margin-bottom: 0!important;">
<div class="form-group divCss8">
<div class="input-group">
<select class="form-control" id="dateFlag">
<option value="1">按日查询</option>
<option value="2">按月查询</option>
<option value="3">按年查询</option>
</select>
</div>
</div>
<div class="form-group divCss8" id="day">
<label>出院日查询:</label>
<div class="input-group">
<input type="text" class="input-sm form-control" id="startTime1" style="text-align: center"
maxlength="10" autocomplete="off" value="${startDate}"/>
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" id="endTime1" style="text-align: center"
maxlength="10" autocomplete="off" value="${endDate}"/>
</div>
</div>
<div class="form-group divCss8" id="month" style="display: none">
<label>出院月查询:</label>
<div class="input-group">
<input type="text" class="input-sm form-control" id="startTime3" style="text-align: center"
maxlength="10" autocomplete="off"/>
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" id="endTime3" style="text-align: center"
maxlength="10" autocomplete="off"/>
</div>
</div>
<div class="form-group divCss8" id="year" style="display: none">
<label>出院年查询:</label>
<div class="input-group">
<input type="text" class="input-sm form-control" id="startTime4" style="text-align: center"
maxlength="10" autocomplete="off"/>
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" id="endTime4" style="text-align: center"
maxlength="10" autocomplete="off"/>
</div>
</div>
<div class="form-group divCss" id="dateRange">
<label>扫描时段:</label>
<select class="form-control input-sm" id="timeInterval"
onchange="loadTableByTime(this.options[this.options.selectedIndex].value,'startTime1','endTime1','table')">
<div class="form-group divCss">
<label>业务系统:</label>
<select class="form-control input-sm" id="collectorKey">
<option value="">全部</option>
<option value="15">电子病历系统采集服务-嘉禾美康</option>
<option value="06">LIS系统采集服务</option>
<option value="3">PACS系统采集服务</option>
<option value="12">心理测量报告采集器服务</option>
<option value="01">移动护理系统采集服务</option>
<option value="08">电子病历系统采集服务-长临医嘱</option>
<option value="04">电生理系统采集服务</option>
<option value="03">pacs</option>
</select>
</div>
<div class="form-group divCss8">
<label>扫描人:</label>
<input type="text" class="form-control input-sm" id="name" maxlength="8">
</div>
<%--<div class="form-group divCss8" id="day">--%>
<%--<label>出院日查询:</label>--%>
<%--<div class="input-group">--%>
<%--<input type="text" class="input-sm form-control" id="startTime1" style="text-align: center"--%>
<%--maxlength="10" autocomplete="off" value="${startDate}"/>--%>
<%--<span class="input-group-addon">-</span>--%>
<%--<input type="text" class="input-sm form-control" id="endTime1" style="text-align: center"--%>
<%--maxlength="10" autocomplete="off" value="${endDate}"/>--%>
<%--</div>--%>
<%--</div>--%>
<%--<div class="form-group divCss8" id="month" style="display: none">--%>
<%--<label>出院月查询:</label>--%>
<%--<div class="input-group">--%>
<%--<input type="text" class="input-sm form-control" id="startTime3" style="text-align: center"--%>
<%--maxlength="10" autocomplete="off"/>--%>
<%--<span class="input-group-addon">-</span>--%>
<%--<input type="text" class="input-sm form-control" id="endTime3" style="text-align: center"--%>
<%--maxlength="10" autocomplete="off"/>--%>
<%--</div>--%>
<%--</div>--%>
<%--<div class="form-group divCss8" id="year" style="display: none">--%>
<%--<label>出院年查询:</label>--%>
<%--<div class="input-group">--%>
<%--<input type="text" class="input-sm form-control" id="startTime4" style="text-align: center"--%>
<%--maxlength="10" autocomplete="off"/>--%>
<%--<span class="input-group-addon">-</span>--%>
<%--<input type="text" class="input-sm form-control" id="endTime4" style="text-align: center"--%>
<%--maxlength="10" autocomplete="off"/>--%>
<%--</div>--%>
<%--</div>--%>
<%--<div class="form-group divCss" id="dateRange">--%>
<%--<label>扫描时段:</label>--%>
<%--<select class="form-control input-sm" id="timeInterval"--%>
<%--onchange="loadTableByTime(this.options[this.options.selectedIndex].value,'startTime1','endTime1','table')">--%>
<%--</select>--%>
<%--</div>--%>
<%--<div class="form-group divCss8">--%>
<%--<label>扫描人:</label>--%>
<%--<input type="text" class="form-control input-sm" id="name" maxlength="8">--%>
<%--</div>--%>
<button type="button" class="btn btn-primary btn-sm divCss" id="searchBtn">查询</button>
<button type="button" class="btn btn-info btn-sm divCss" id="excelBtn">条件导出</button>
<%--<button type="button" class="btn btn-info btn-sm divCss" id="excelBtn">条件导出</button>--%>
</div>
</form>
<!--数据表格-->
<table id="table" class="table table-striped"></table>
<div id="toolbar" class="btn-group pull-right" style="margin-right: 20px;">
<div class="columns columns-right btn-group pull-right">
<div class="btn-group btn-info">
<select id="sel_exportoption" class="form-control">                
<option value="">导出当前页面数据</option>
               
<option value="all">导出全部数据</option>
             
<option value="selected">导出选中数据</option>
</select>
</div>
<button class=" btn btn-success" style="height: 34px" type="button" id="refreshBtn" name="refresh"
aria-label="Refresh"
title="Refresh">
<i class="glyphicon glyphicon-refresh icon-refresh"></i>
</button>
</div>
</div>
<%--<div id="toolbar" class="btn-group pull-right" style="margin-right: 20px;">--%>
<%--<div class="columns columns-right btn-group pull-right">--%>
<%--<div class="btn-group btn-info">--%>
<%--<select id="sel_exportoption" class="form-control">                --%>
<%--<option value="">导出当前页面数据</option>--%>
<%--               --%>
<%--<option value="all">导出全部数据</option>--%>
<%--             --%>
<%--<option value="selected">导出选中数据</option>--%>
<%--</select>--%>
<%--</div>--%>
<%--<button class=" btn btn-success" style="height: 34px" type="button" id="refreshBtn" name="refresh"--%>
<%--aria-label="Refresh"--%>
<%--title="Refresh">--%>
<%--<i class="glyphicon glyphicon-refresh icon-refresh"></i>--%>
<%--</button>--%>
<%--</div>--%>
<%--</div>--%>
</div>
</div>
</div>

@ -651,12 +651,15 @@ function initTable2() {
valign: 'middle',
visible: false
},
{
title: '标题',
field: 'title',
align: 'left',
valign: 'middle'
valign: 'middle',
width: 1,
cellStyle: {
css: {"max-width":"450px","white-space":"nowrap","text-overflow":"ellipsis","overflow":"hidden"}
}
},
{
title: '采集完成时间',

@ -22,7 +22,7 @@ $("#dateFlag").change(function(){
function initTable() {
if(tipLoad == 1){
$("#table").bootstrapTable({ // 对应table标签的id
url: path+"/statistics/getScanCount", // 获取表格数据的url
url: path+"/statistics/getCollectorStatus", // 获取表格数据的url
contentType: "application/x-www-form-urlencoded",//一种编码。好像在post请求的时候需要用到。这里用的get请求注释掉这句话也能拿到数据
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
@ -74,11 +74,7 @@ function initTable() {
var temp = {
limit: limit, //页面大小
offset: offset, //页码
startDate: startDate,
endDate: endDate,
name:$("#name").val(),
isSearch:$("#isSearch").val(),
dateFlag:$("#dateFlag").val()
collectorKey:$("#collectorKey").val(),
};
return temp;
},
@ -91,29 +87,60 @@ function initTable() {
valign: 'middle'
},
{
title: '扫描人',
field: 'uuname',
title: '虚拟机ip',
field: 'fictitiousIp',
align: 'center',
valign: 'middle'
},
{
title: '扫描日期',
field: 'uploaddatetime',
title: '采集器名称',
field: 'collectorName',
align: 'center',
valign: 'middle'
},
{
title: '扫描次数',
field: 'scanCount',
title: '采集器标识',
field: 'collectorKey',
align: 'center',
valign: 'middle'
},
{
title: '扫描份数',
field: 'scanNums',
title: '最后更新时间',
field: 'updateTime',
align: 'center',
valign: 'middle'
},
{
title: '采集器状态',
field: 'collectorStatus',
align: 'center',
valign: 'middle',
formatter: function (value, row, index) {
if(value != null){
var color = '';
if(row.collectorStatus=="正在运行"){
color = 'green';
}else{
color = 'red';
}
return '<span style="color: ' + color + '">' + value + '</span>';
}
}
},
{
title: '是否完成任务',
field: 'c1',
align: 'center',
valign: 'middle',
// formatter: function (value, row, index) {
// if(value != null ||value != ""){
// value='采集任务已完成'
// }else {
// value='采集任务未完成'
// }
// return value;
// }
},
],
onLoadSuccess: function (result) { //加载成功时执行
$(".page-list").show();
@ -126,45 +153,45 @@ function initTable() {
});
}
}
//导出excel功能
$("#excelBtn").click(function () {
//获取选中数据记录
var idlist = $('#table').bootstrapTable('getAllSelections');
var dateFlag = $("#dateFlag").val();
var sql = '';//AND ((uuName = '何素芳' and convert(date, UpLoadDateTime, 8) = '2019-12-26') or (uuName = '何素芳' and convert(date, UpLoadDateTime, 8) = '2019-12-26'))
if(idlist.length > 0){
var dateWhereSql = '';
if(dateFlag == 1){
dateWhereSql = 'CONVERT (VARCHAR(10), t1.UpLoadDateTime, 120)';
}else if(dateFlag == 2){
dateWhereSql = 'CONVERT (VARCHAR(7), t1.UpLoadDateTime, 120)';
}else if(dateFlag == 3){
dateWhereSql = 'CONVERT (VARCHAR(4), t1.UpLoadDateTime, 120)';
}
for (var i = 0; i < idlist.length; i++) {
if(idlist.length == 1){
sql += "AND (powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"')";
}else{
if(i == 0){
sql += "AND ((powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"') or ";
}else if(i != idlist.length - 1){
sql += "(powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"') or ";
}else if(i == idlist.length - 1){
sql += "(powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"'))";
}
}
}
}
var url = path+"/statistics/exportExcelScanCount";
var startDate = getStartOrEndDate(dateFlag,"startTime");
var endDate = getStartOrEndDate(dateFlag,"endTime");
post(url, {
"startDate": startDate,
"endDate": endDate,
"name":$("#name").val(),
"isSearch":$("#isSearch").val(),
"sql":sql,
"dateFlag":dateFlag
});
});
//
// //导出excel功能
// $("#excelBtn").click(function () {
// //获取选中数据记录
// var idlist = $('#table').bootstrapTable('getAllSelections');
// var dateFlag = $("#dateFlag").val();
// var sql = '';//AND ((uuName = '何素芳' and convert(date, UpLoadDateTime, 8) = '2019-12-26') or (uuName = '何素芳' and convert(date, UpLoadDateTime, 8) = '2019-12-26'))
// if(idlist.length > 0){
// var dateWhereSql = '';
// if(dateFlag == 1){
// dateWhereSql = 'CONVERT (VARCHAR(10), t1.UpLoadDateTime, 120)';
// }else if(dateFlag == 2){
// dateWhereSql = 'CONVERT (VARCHAR(7), t1.UpLoadDateTime, 120)';
// }else if(dateFlag == 3){
// dateWhereSql = 'CONVERT (VARCHAR(4), t1.UpLoadDateTime, 120)';
// }
// for (var i = 0; i < idlist.length; i++) {
// if(idlist.length == 1){
// sql += "AND (powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"')";
// }else{
// if(i == 0){
// sql += "AND ((powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"') or ";
// }else if(i != idlist.length - 1){
// sql += "(powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"') or ";
// }else if(i == idlist.length - 1){
// sql += "(powerusers.name = '"+idlist[i].uuname+"' and "+dateWhereSql+" = '"+idlist[i].uploaddatetime+"'))";
// }
// }
// }
// }
// var url = path+"/statistics/exportExcelScanCount";
// var startDate = getStartOrEndDate(dateFlag,"startTime");
// var endDate = getStartOrEndDate(dateFlag,"endTime");
// post(url, {
// "startDate": startDate,
// "endDate": endDate,
// "name":$("#name").val(),
// "isSearch":$("#isSearch").val(),
// "sql":sql,
// "dateFlag":dateFlag
// });
// });

Loading…
Cancel
Save