easyUI一览页面查询、导出功能

<%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<title>病毒复核检测结果一览</title>
<link href="<%= request.getContextPath() %>/css/reset.css" rel="stylesheet" type="text/css" />
<link href="<%= request.getContextPath() %>/css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/page.css"/>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/themes/default/easyui.css" media="all">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/themes/icon.css" media="all">
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.easyui.min.js" ></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/easyloader.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/message.js"></script>
<script type="text/javascript">

    $(function(){
        window.onresize=function(){
            try{
                var w=document.body.clientWidth;
                $('#filterDiv').panel('resize',{w-8});
                $('#grid').datagrid('getPanel').panel('resize',{w-8});
            }catch(e){
                
            }
        };
    });

    //初始化easyui datagrid控件
    $(function(){
        //设置grid宽度
        $('#grid').datagrid({
            title:'检索结果',//&nbsp;&nbsp;&nbsp;<a href="#" onclick="javascript:add();">新增</a>
            pageNumber:1,
            pageList:[10,20,50],
            nowrap: true,
            striped: true,
            collapsible:true,
            method:'get',
            height:325,
            fitColumns:false,
            remoteSort:false,
            idField:"id",
            animate:true,
            singleSelect:true,
            loadMsg:"Loading...",
            onLoadSuccess:function(){
                $("#grid").datagrid("clearSelections");
            },
            frozenColumns:[[//固定列
                    {field:"no",title:"&nbsp;No.","30",align:"center",
                        formatter:function(value,rec,rowIndex){
                        var pageSize=$("#grid").datagrid("options").pageSize;
                        var pageNumber=$("#grid").datagrid("options").pageNumber;
                        return (pageNumber-1)*pageSize+rowIndex+1;
                            }
                    },
                    {field:"id",hidden:true},
                    {field:"blbh",title:"病例编号","100",align:"center"},
                    {field:"xm",title:"姓名","50",align:"center"},
                    {field:"xb",title:"性别","50",align:"center"},
                    {field:"zjhm",title:"证件号码","120",align:"center"},
                    {field:"lrrq",title:"录入日期","100",align:"center"},
                    {field:"lrz",title:"录入者","80",align:"center"}
                    
                ]],
            columns:[[
                    {field:"jcjg",title:"病毒检测结果","240",align:"center"}
                ]],
                pagination:true,
                onDblClickRow:function(rowIndex,rowData) {                    
                    $("#grid").datagrid("selectRow",rowIndex); //获取双击选中行的病例编号单元格数据
                    var blbh = $("#grid").datagrid("getSelected").blbh;    
                    
                       var url = "../fxb/redirect.action?result=fxbUpdateFhbd&blbh="+blbh; //详情修改页面(同区录入)
                      var params = "dialogWidth:800px;dialogHeight:400px;center:yes;status:no;help:no;scrollbars:auto";  
                      showModalDialog(url,window,params);
                      $("#grid").datagrid("reload");
                  }
        }); 
        
        $(".pagination-info").text("显示1到0,共0记录");
        $("#grid").datagrid("loaded");
        
        //阳性病例是否不可编辑
        $("#bdjcjg").combobox({
            onChange:function(v){                
                if(v=='02'){
                    $('#yxbl').combobox('enable');
                }else{
                    $('#yxbl').combobox('setValue','');
                    $('#yxbl').combobox('disable');
                }
            }
        });
    });
    
    //查询
    function doSearch() {
        var param = new Object();
        var xm = $("#xm")[0].value;
        var xb = $('#xb').combobox("getValue");
    
        var zjhm = $('#zjhm')[0].value;
        var blbh = $("#blbh")[0].value;
        var startDate = $("#startDate").val();
        var endDate = $("#endDate").val();
        if(startDate==null||startDate==""){
            }else
            if(endDate==null||endDate==""){
            }else
            if(startDate > endDate){
                $.messager.alert('警告', getMessage(MSG_C012,"录入日期(结束)","录入日期(开始)"));
                return false;
        }
        var bdjcjg = $("#bdjcjg").combobox("getValue");
        var yxbl = $("#yxbl").combobox("getValue"); 
        if(xm) {
            param.xm = xm;
        }
        if(xb) {
            param.xb = xb;
        }
        if(zjhm) {
            param.zjhm = zjhm;
        }
        if(blbh) {
            param.blbh = blbh;
        }
        if(startDate) {
            param.startDate = startDate;
        }        
        if(endDate) {
            param.endDate = endDate;
        }
        if(bdjcjg) {
            param.bdjcjg = bdjcjg;
        }        
        if(yxbl) {
            param.yxbl = yxbl;
        }
        $("#grid").datagrid("options").url="<%= request.getContextPath() %>/fxb/fxbListFhbdQuery.action";
        $("#grid").datagrid("load",param);
    }
    
    //重置查询条件
    function resetForm() {
        //$("#queryForm").form("clear");
        $("#xm").val("");
        $("#zjhm").val("");
        $("#blbh").val("");
        $("#startDate").val("");
        $("#endDate").val("");
        $("#xb").combobox("setValue","");
        $("#bdjcjg").combobox("setValue","");
        $("#yxbl").combobox("setValue","");
    }
    
    //导出功能
    function exportExcel() {
        var rows = $("#grid").datagrid("getData").rows;
        var maxCount = rows.length;
        if (maxCount < 10000 && maxCount >= 1) {
            var str = $.param($("#grid").datagrid("options").queryParams); //查询参数
            var form = document.getElementById("excelForm");
            if(str == "") {
                form.action = "<%= request.getContextPath() %>/fxb/exportExcelQuery.action";
            }else {
                form.action = "<%= request.getContextPath() %>/fxb/exportExcelQuery.action?"+str;
            }
            form.submit(); 
        }
        else if (maxCount < 1) {
            $.messager.alert("警告", getMessage(MSG_C017));
        }else {
            $.messager.alert("警告", getMessage(MSG_C005)); 
        }     
    }
    
</script>
</head>
<body class="main_bg">
<div class="cfbk">
<h3><span>病毒复核检测结果一览</span></h3></div>
<form id="excelForm"  method="POST"></form>
<table width="99%" border="0" cellpadding="0" cellspacing="0" >
    <tr>
    <td width="100%"> <br/>
    <div id="filterDiv" class="easyui-panel" style="padding:2px;" title="检索条件" collapsible="true">
    <form id="queryForm"  method="POST">
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="commonTable">
        <tr>
            <th>姓名</th>
            <td><input id="xm" name="xm" class="easyui-validatebox" style="100px;" ></td>
            <th>性别</th>
            <td><input id="xb" name="xb" class="easyui-combobox" valueField="code" textField="text" method="get" editable="false"
                  url="<%= request.getContextPath() %>/pt/codeQuery!getComboboxInfoForJquery.action?key=gb&code=xb&showPlease=true" 
                  style="100px;" panelHeight="auto" panelWidth="auto"/>
            </td>
            <th>证件号码</th>
            <td ><input id="zjhm" name="zjhm" class="easyui-validatebox" ></td>
        </tr>
        <tr>
            <th>病例编号</th>
            <td><input id="blbh" name="blbh" class="easyui-validatebox" ></td>
            <th>录入日期</th>
            <td><input id="startDate" name="startDate" style="70px;" onClick="WdatePicker()"><input id="endDate" name="endDate" style="70px;" onClick="WdatePicker()">
            </td>
            <td></td><td></td>
        </tr>
        <tr>
            <th align="right">病毒检测结果</th>
            <td><input id="bdjcjg" name="bdjcjg" class="easyui-combobox" style="100px;" editable="false" 
                  url="<%= request.getContextPath() %>/pt/codeQuery!getComboboxInfoForJquery.action?key=fxb&code=bd_jcjg&showPlease=true" 
                  valueField="code" textField="text" method="get" panelHeight="auto" panelWidth="auto"/>
            </td>
            <th>阳性病例</th>
            <td colspan="4"><input id="yxbl" name="yxbl" class="easyui-combobox" style="100px;" editable="false" disabled="disabled"
                   url="<%= request.getContextPath() %>/pt/codeQuery!getComboboxInfoForJquery.action?key=fxb&code=bd_yxbl&showPlease=true" 
                  valueField="code" textField="text" method="get" panelHeight="auto" panelWidth="auto"/>
            </td>
        </tr>
               
        <tr>
            <td colspan="6" align="center">
                <input class="submit_01" type="button" onClick="doSearch();" value="搜索" />
                <input class="submit_01" type="button" onclick="resetForm();" value="重置" />
                <input class="submit_01" type="button" onclick="exportExcel();" value="导出" />
            </td>
        </tr>
        </table>
    </form></div><br/>
    
    <table id="grid" width="99%"></table>
    </td>
    
    <td width="1%" rowspan="6"></td>
    </tr>    
        
</table>
</body>
</html>
FxbListFhbd.jsp
    /**
     * 病毒复核检测信息分页查询
     * @return
     * @throws Exception 
     */
    public String query() throws Exception {            
        String pageNo = this.servletRequest.getParameter("page"); 
        String pageSize = this.servletRequest.getParameter("rows");        
        vo.setPage(Integer.parseInt(pageNo));
        vo.setRows(Integer.parseInt(pageSize));
        
        Page page = fxbListFhbdService.queryByPage(vo, vo.getPage(), vo.getRows(),"1");
        BaseJqueryGridVo gridVo = new BaseJqueryGridVo();
        gridVo.setRows(page.getResult());
        gridVo.setTotal(page.getTotalSize());
        String json = VOUtils.getJsonData(gridVo);
        createJSonData(json);
        return "ajax";            
    }
分页查询
    /**
     * 病毒复核检测信息分页查询
     * @param pageNo
     * @param pageSize
     * @param bz
     * @return
     */
    @SuppressWarnings("unchecked")
    public Page queryByPage(FxbListFhbdVo vo, int pageNo, int pageSize,String bz) {        
        Page page = this.fxbListFhbdDao.queryByPage(vo, pageNo, pageSize,bz);
        
        List<FxbListFhbdVo> list = page.getResult();
        if (list != null && list.size() > 0) {
            FxbListFhbdVo bo = null;
            FxbListFhbdVo voResult = null;
            List<FxbListFhbdVo> volist=new ArrayList<FxbListFhbdVo>();
            for (int i = 0; i < list.size(); i++)  {
                bo=list.get(i);
                voResult = new FxbListFhbdVo();
                if(bo.getXb()!=null){
                    voResult.setXb(codeService.getNameByValue("gb", "xb", bo.getXb()));
                }
                if("99".equals(bo.getJcjg()) || "01".equals(bo.getJcjg()) ) {
                    voResult.setJcjg(codeService.getNameByValue("fxb", "bd_bdjcjg", bo.getJcjg()));
                }
                else {
                    voResult.setJcjg(codeService.getNamesByValueJcjg("fxb", "bd_bdjcjg", bo.getJcjg()));
                }
                voResult.setXm(bo.getXm());
                voResult.setBlbh(bo.getBlbh());
                voResult.setZjhm(bo.getZjhm());
                voResult.setLrz(bo.getLrz());
                //SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
                //vo1.setLrrq(sdf.format(bo.getLrrq()));
                voResult.setLrrq(bo.getLrrq());                
                volist.add(voResult);
            }            
            page.setResult(volist);
        }
        return page;
    }
serviceImpl
package com.wonders.cutecdc.fxb.dao.impl;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;

import com.wonders.cutecdc.common.StringUtils;
import com.wonders.cutecdc.fxb.dao.FxbListFhbdDao;
import com.wonders.cutecdc.fxb.entity.bo.TC7Fxjcbdjcjg;
import com.wonders.cutecdc.fxb.entity.vo.FxbListFhbdVo;
import com.wondersgroup.framework.core.bo.Page;
import com.wondersgroup.framework.core5.dao.impl.AbstractHibernateDaoImpl;

public class FxbListFhbdDaoImpl extends AbstractHibernateDaoImpl<TC7Fxjcbdjcjg> implements FxbListFhbdDao {

    /**
     * 病毒复核检测信息分页查询
     * @param  pageNo
     * @return pageSize
     * @param  bz
     * @return
     */
    @SuppressWarnings("unchecked")
    public Page queryByPage(FxbListFhbdVo vo, int pageNo, int pageSize,String bz) {
        int startCount = pageSize *(pageNo-1);
        int endCount = pageSize * (pageNo); 
        
        StringBuilder hql = new StringBuilder("select tb.* ");
        StringBuilder countHql = new StringBuilder(" select count(*) ");
        String sqlFromStr="FROM (SELECT ROWNUM RN,"+
            " GA.XM, GA.XB, GA.ZJHM, T.BLBH, T.CJSJ, T.CJZ, T.JCJG "+
            " FROM T_C7_FXJCBDJCJG T "+
            " LEFT JOIN T_C7_FXJCGA GA ON GA.BLBH = T.BLBH AND GA.YXBZ = '1' "+
            " WHERE T.YXBZ = '1' AND T.JCLX = '1' ";
      
        hql.append(sqlFromStr); 
        countHql.append(sqlFromStr);
        
        //姓名
        if (!StringUtils.isEmpty(vo.getXm())) {
            hql.append(" and ga.xm like '%"+vo.getXm()+"%' ");
            countHql.append(" and ga.xm like '%"+vo.getXm()+"%' "); 
        }
        //性别
        if (!StringUtils.isEmpty(vo.getXb())) {
            hql.append(" and ga.xb ='"+vo.getXb()+"'") ;
            countHql.append(" and ga.xb ='"+vo.getXb()+"' "); 
        }
        //证件号码
        if (!StringUtils.isEmpty(vo.getZjhm())) {
            hql.append(" and ga.zjhm like '%"+vo.getZjhm()+"%' ");
            countHql.append(" and ga.zjhm like '%"+vo.getZjhm()+"%' "); 
        }
        //病例编号
        if (!StringUtils.isEmpty(vo.getBlbh())) {
            hql.append(" and ga.blbh like '%"+vo.getBlbh()+"%' ");
            countHql.append(" and ga.blbh like '%"+vo.getBlbh()+"%' "); 
        }
        //录入日期
        if(vo.getStartDate() != null){
            hql.append(" and to_char(t.cjsj,'yyyy-mm-dd') >= '"+vo.getStartDate()+"' ");
            countHql.append(" and to_char(t.cjsj,'yyyy-mm-dd') >= '"+vo.getStartDate()+"' ");
        }
        if(vo.getEndDate() != null){
            hql.append(" and to_char(t.cjsj,'yyyy-mm-dd') <= '"+vo.getEndDate()+"' ");
            countHql.append(" and to_char(t.cjsj,'yyyy-mm-dd') <= '"+vo.getEndDate()+"' ");
        }
        //病毒检测结果
        if (!StringUtils.isEmpty(vo.getBdjcjg())) {
            
            if("01".equals(vo.getBdjcjg()) || "99".equals(vo.getBdjcjg())) {
                hql.append(" and t.jcjg ='"+vo.getBdjcjg()+"' ") ;
                countHql.append(" and t.jcjg ='"+vo.getBdjcjg()+"' "); 
            }
                
            if("02".equals(vo.getBdjcjg())) { //阳性病例
                if (!StringUtils.isEmpty(vo.getYxbl())) {
                    hql.append(" and t.jcjg like '%"+vo.getYxbl()+"%' ");
                    countHql.append(" and t.jcjg like '%"+vo.getYxbl()+"%' "); 
                }
                else {
                    hql.append(" and (t.jcjg not like '%01%' and t.jcjg not like '%99%') ");
                    countHql.append(" and (t.jcjg not like '%01%' and t.jcjg not like '%99%') ");
                }
            }            
        }
    
        if("1".equals(bz)){ //查询
        hql.append(" ) tb where tb.rn > "+startCount+" and tb.rn <= "+endCount);
        countHql.append(" ) tb ");
        }
        else{ //导出
                hql.append( " ) tb ");    
                countHql.append(" ) tb ");
        }
    
        Query query = this.getSession().createSQLQuery(hql.toString()); 
        List<Object[]> list = query.list();
        List<FxbListFhbdVo> voList=new ArrayList<FxbListFhbdVo>();
        int j=0;
        if(list != null && list.size()>0){
            for(int i=0; i<list.size(); i++){
                j = 1;
                Object[] po = list.get(i) ;
                FxbListFhbdVo result=new FxbListFhbdVo();
                result.setXm(StringUtils.ObjectToString(po[j++]));
                result.setXb(StringUtils.ObjectToString(po[j++]));
                result.setZjhm(StringUtils.ObjectToString(po[j++]));
                result.setBlbh(StringUtils.ObjectToString(po[j++]));
                result.setLrrq(StringUtils.ObjectToString(po[j++]));
                result.setLrz(StringUtils.ObjectToString(po[j++]));
                result.setJcjg(StringUtils.ObjectToString(po[j++]));
                voList.add(result); 
            }            
        }
        
        Query countQuery = this.getSession().createSQLQuery(countHql.toString());
        //Object obj  = countQuery.uniqueResult();
        //int count = Integer.valueOf(obj == null?0:Integer.valueOf(obj+""));
        Integer count = Integer.parseInt(countQuery.list().get(0)+"");
        
        Page page = new Page();
        page.setCurrentPageNo(pageNo);
        page.setCurrentPageSize(pageSize);
        page.setResult(voList);
        page.setTotalSize(count);
        return page;
    }
    
    /**
     * 通过病例编号和检测类型获取id
     * @param blbh
     * @param jclx
     * @return
     */
    @SuppressWarnings("unchecked")
    public Long queryId(String blbh, String jclx) {
        
        StringBuilder sql = new StringBuilder("select t.id from T_C7_FXJCBDJCJG t where t.blbh= :blbh and t.jclx= :jclx ");        
        
        Query query = this.getSession().createSQLQuery(sql.toString()); 
        query.setString("blbh", blbh);
        query.setString("jclx", jclx);
        List <BigDecimal>list = query.list();
        Long ids=0l;
        if(list!=null&&list.size()>0) {            
             ids = (list.get(0)).longValue();        
        }
        return ids;        
    }
    
}
DaoImpl
    /**
     * 病毒复核检测信息导出
     * @return
     */
    @SuppressWarnings("unchecked")
    public void exportExcelQuery() {
        String realPath = PublicUtil.getRealPath(this.servletRequest);
        String filepath=realPath+"\excel\FxbListFhbdReport.xls";                                           
        try {
                HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(new File(filepath)));
                List<FxbListFhbdVo> list = null; 
                
                Page page = fxbListFhbdService.queryByPage(vo, vo.getPage(), vo.getRows(),"2");
                list = page.getResult();
                HSSFSheet sheet = wb.getSheetAt(0);        
                ExportExcelUtil exportExce = new ExportExcelUtil(wb, sheet);  
                String[] fields = { "blbh", "xm", "xb", "zjhm", "lrrq", "lrz", "jcjg" };
                if(list != null){
                    exportExce.cteateTableByList(list, fields, 2); 
            }
            exportExce.outputExcel("病毒复核检测结果");             
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }        
    }  
导出

双击一览页面跳转到详情页面从后台获取数据并显示的完整代码:RedirectAction

package com.wonders.cutecdc.fxb.action;

import com.wonders.cutecdc.fxb.entity.vo.FxbListFhbdVo;
import com.wonders.cutecdc.fxb.entity.vo.FxbTaskYmbzgzglVo;
import com.wonders.cutecdc.fxb.service.FxbListFhbdService;
import com.wonders.cutecdc.fxb.service.FxbTaskYmbzgzglService;
import com.wondersgroup.framework.core.web.struts2.action.BaseAction;



public class RedirectAction extends BaseAction {
    private static final long serialVersionUID = 6333873045441654724L;
    private FxbListFhbdVo fhbdQxVo;//区县
    private FxbListFhbdVo fhbdVo;//市平台

    private FxbListFhbdService fxbListFhbdService;    
    
    public FxbListFhbdService getFxbListFhbdService() {
        return fxbListFhbdService;
    }

    public void setFxbListFhbdService(FxbListFhbdService fxbListFhbdService) {
        this.fxbListFhbdService = fxbListFhbdService;
    }

    public FxbListFhbdVo getFhbdQxVo() {
        return fhbdQxVo;
    }

    public void setFhbdQxVo(FxbListFhbdVo fhbdQxVo) {
        this.fhbdQxVo = fhbdQxVo;
    }

    public FxbListFhbdVo getFhbdVo() {
        return fhbdVo;
    }

    public void setFhbdVo(FxbListFhbdVo fhbdVo) {
        this.fhbdVo = fhbdVo;
    }



    protected String operate() {
        String result = super.getServletRequest().getParameter("result");
        String blbh = super.getServletRequest().getParameter("blbh");
        if("fxbUpdateFhbd".equals(result)) {
            Long id = fxbListFhbdService.queryId(blbh,"1");    //1=复核检测样本
            if(id != null && id != 0l) {
                fhbdVo = fxbListFhbdService.loadByFhbdId(id);    
            }else {
                fhbdVo = new FxbListFhbdVo();
                fhbdVo.setBlbh(blbh);
            }
            Long qxid = fxbListFhbdService.queryId(blbh,"3"); //3=区县检测样本
            if(qxid != null && qxid != 0l) {
                fhbdQxVo = fxbListFhbdService.loadByFhbdId(qxid);
            }                    
        } 
}
View Code
<!DOCTYPE struts PUBLIC    
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"    
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
	<package name="fxb" namespace = "/fxb" extends="gwcdc-default">
		<!--腹泻病 -->
		<action name="redirect" class="fxbRedirectAction" method="execute">
    /**
     * 通过病例编号和检测类型获取id
     * @param blbh
     * @param jclx
     * @return
     */
    @SuppressWarnings("unchecked")
    public Long queryId(String blbh, String jclx) {
        
        StringBuilder sql = new StringBuilder("select t.id from T_C7_FXJCBDJCJG t where t.blbh= :blbh and t.jclx= :jclx ");        
        
        Query query = this.getSession().createSQLQuery(sql.toString()); 
        query.setString("blbh", blbh);
        query.setString("jclx", jclx);
        List <BigDecimal>list = query.list();
        Long id = 0l;
        if(list!=null&&list.size()>0) {            
             id = (list.get(0)).longValue();        
        }
        return id;        
    }
View Code
<%@ page language="java" contentType="text/html; charset=utf-8"    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<title>病毒检测结果修改</title>
<link rel="stylesheet" href="<%= request.getContextPath() %>/css/main.css" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/page.css"/>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/themes/default/easyui.css" media="all">
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/themes/icon.css" media="all">
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.easyui.min.js" ></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/even.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.grid.scrollbar.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/message.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.autocomplete.min.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/common.js"></script>
<%
    String blbh = request.getParameter("blbh");
%>
<script type="text/javascript">

    //限制只能输入数字和字母
    $.fn.onlyNumAlpha = function () {
        $(this).keypress(function (event) {
            var eventObj = event || e;
            var keyCode = eventObj.keyCode || eventObj.which;
            if ((keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122))
                return true;
            else
                return false;
        }).focus(function () {
                this.style.imeMode = 'disabled';
            }).bind("paste", function () {
            var clipboard = window.clipboardData.getData("Text");
            if (/^(d|[a-zA-Z])+$/.test(clipboard))
                return true;
            else
                return false;
        });
    };

    //初始化
    $(function() {
        // 限制使用了onlyNumAlpha类样式的控件只能输入数字和字母
        $(".onlyNumAlpha").onlyNumAlpha();

        initCheckboxCommon("qxbdjcjg",'<s:property value="fhbdQxVo.jcjg"/>');
        initCheckboxCommon("bdjcjg",'<s:property value="fhbdVo.jcjg"/>');
        showOrHide();
    });
    
    function doSave() {
        var bdjcjg = $("input[name='bdjcjg']:checked").map(function() { 
            return $(this).val(); 
            }).get().join(',');
        $("#bdjcjg").val(bdjcjg);        
        //var id='<s:property value="fhbdVo.id"/>';//后台已经获取id    
        var azlzbdjyfx = $("input[name='fx2']").val();
        var filter  = /^G[0-9]{1,2}P[0-9]{1,2}$/;
        if(azlzbdjyfx !="" && filter.test(azlzbdjyfx)==false){
            alert("[A组轮状病毒基因分型]格式不正确,正确格式为:“G”+“1到2位的<br>不固定的数字”+固定大写字母“P”+“1到2位的不固定的数<br>字”,如G1P2,G23P3,G2P33,G22P35"); 
            return ;
        } 
        if(bdjcjg == "" ||bdjcjg == null) {
            $.messager.alert("提示!", getMessage(MSG_C001,"病毒检测录入结果"));
            return ;
        }
        $.messager.confirm("提示", "是否确认保存?", function(r) {                    
            if(r){
            $.ajax({
                type:"get",
                url:'../fxb/bdjcjgInputSave.action?bdjcjg='+bdjcjg,
                data:$("#inputForm").serialize(),
                dataType:"text",
                async:false,
                global:false,
                success:function(data){
                if(data=="1"){            
                    $.messager.confirm("提示", getMessage(MSG_T009),function(r) {                    
                        if(r){
                            window.close();    }});
                }else{ 
                    $.messager.alert("提示!", getMessage(MSG_T027));
                }}
            });
            }
        });
    }

    //病毒检测结果click
    function bdClick(obj){
        if(obj.value == '01') {
            checkSfyx('1','bdjcjg');
        }
        else if(obj.value == '99') {
            checkSfyx('2','bdjcjg');
        }
        else {
            checkSfyx('3','bdjcjg');
        }
    }
    //判断勾选内容是否阳性
    function checkSfyx(tel,checkName) {
        var obj = document.getElementsByName(checkName);
        if(tel == 1) {//阴性
            for(var i = 1; i < obj.length; i++) {
                obj[i].checked = false;
            }
        }else if(tel==2) {//未检测
            for(var i = 0; i < obj.length-1; i++) {
                obj[i].checked = false;
            }
        }else if(tel==3) {//阳性
            $("[name='"+checkName+"']")[0].checked = false;
            $("[name='"+checkName+"']")[obj.length-1].checked = false;
        }
        for(var i = 0; i < obj.length; i++) {
            obj[i].nextSibling.style.color=(obj[i].checked)?"#CC33CC":"black";
        }
        showOrHide();
    }
    
    //基因测序(基因分型)显示或隐藏
    function showOrHide() {
        
        var bdjcjg2=document.getElementById("bdjcjg2"); 
        var bdjcjg3=document.getElementById("bdjcjg3");
        var bdjcjg4=document.getElementById("bdjcjg4"); 
        var bdjcjg5=document.getElementById("bdjcjg5"); 
        var bdjcjg6=document.getElementById("bdjcjg6"); 
        var bdjcjg7=document.getElementById("bdjcjg7");
        var bdjcjg8=document.getElementById("bdjcjg8");
        var bdjcjg9=document.getElementById("bdjcjg9"); 
        
        if(bdjcjg2.checked==true){
            $('#cx2').show();
        }else{
            $('#cx2').hide();
        }            
        if(bdjcjg3.checked==true){
            $('#cx3').show();
        }else{
            $('#cx3').hide();
        }            
        if(bdjcjg4.checked==true){
            $('#cx4').show();
        }else{
            $('#cx4').hide();
        }            
        if(bdjcjg5.checked==true){
            $('#fx1').show();
            $('#fx2').show();
            $('#cx5').show();
        }else{
            $('#fx1').hide();
            $('#fx2').hide();                
            $('#cx5').hide();
        }            
        if(bdjcjg6.checked==true){
            $('#cx6').show();
        }else{
            $('#cx6').hide();
        }            
        if(bdjcjg7.checked==true){
            $('#cx7').show();
        }else{
            $('#cx7').hide();
        }            
        if(bdjcjg8.checked==true){
            $('#cx8').show();
        }else{
            $('#cx8').hide();
        }            
        if(bdjcjg9.checked==true){
            $('#cx9').show();
        }else{
            $('#cx9').hide();
        }
    }
    
    //阳性勾选改变颜色
    function chgColor() {    
        var obj=event.srcElement;
        obj.nextSibling.style.color=(obj.checked)?"#CC33CC":"black";
    }
                        
</script>
</head>
  
<body class="main_bg">
<div class="cfbk">
    <form name="inputForm" id="inputForm" method="post">
    <input type="hidden" id ="id" name="id" value="<s:property value="fhbdVo.id"/>"/>
    <input type="hidden" id ="blbh" name="blbh" value="<s:property value="fhbdVo.blbh"/>"/>
    <div class="easyui-panel" border="0" title="病毒检测结果修改(同区录入)" closable="false" style="border-bottom: 0px">
        <table border="0"  width="100%" cellpadding="0" cellspacing="0"  class="commonTable">
            <tr>
                <th width="10%">病例编号</th>
                <td align="left" width="30%"><s:property value="fhbdVo.blbh"/></td>                
                <td align="left" width="60%"></td>
            </tr>
            <tr><td style="color:red; text-align:left; font-weight:bold;" colspan="3">检测信息</td></tr>
            <tr>
                <th rowspan="3">病毒检测结果<font color="red"></font></th>
                   <td colspan="2">
                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="commonTable2" id="resultTable">
                    <th width="30%" align="left"><b>区县结果</b> </th>
                     <th width="60%"><b>录入结果</b></th>
                   </table>
                </td>
            </tr>
            <tr>
            <td>
                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="commonTable">
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="01" disabled="disabled"/><font>阴性</font></td></tr>
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="02" disabled="disabled"/><font>星状病毒</font></td></tr>        
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="03" disabled="disabled"/><font>肠道腺病毒</font></td></tr>              
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="04" disabled="disabled"/><font>札如病毒</font></td></tr>        
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg"  value="05" disabled="disabled"/>
                        <font>轮状病毒A组</font>
                        <font color="#239AD7">基因分型 <input value="<s:property value="fhbdQxVo.azlzbdjyfx"/>" disabled="disabled" style="80px;"/></span></font></td></tr>
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="06" disabled="disabled"/><font>轮状病毒B组</font></td></tr>
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="07" disabled="disabled"/><font>轮状病毒C组</font></td></tr>
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="08" disabled="disabled"/><font>诺如病毒GI型</font></td></tr>
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="09" disabled="disabled"/><font>诺如病毒GII型</font></td></tr>
                    <tr>
                        <td align="left" height="20px">
                        <input type="checkbox" name="qxbdjcjg" value="99" disabled="disabled"/><font>未检测</font></td></tr>
                   </table>
            </td>
               <td>
                <table id="eytab" border="1" width="100%" cellpadding="0" cellspacing="0" class="commonTable">
                    <tr>
                        <td align="left" width="25%" height="20px">                
                            <input type="checkbox" name="bdjcjg" value="01" id="bdjcjg1" onclick="bdClick(this)"/><font>阴性</font></td>        
                        <td align="left" width="65%" ></td></tr>
                    <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="02" id="bdjcjg2" onclick="bdClick(this)"/><font>星状病毒</font></td>        
                        <td align="left" height="20px"><span id="cx2" style="display:none">基因测序
                            <input id="cx2Input" name="cx2" value="<s:property value="fhbdVo.jycy_xz"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                    <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="03" id="bdjcjg3" onclick="bdClick(this)"/><font>肠道腺病毒</font></td>        
                        <td align="left" height="20px"><span id="cx3" style="display:none">基因测序
                            <input id="cx3Input" name="cx3" value="<s:property value="fhbdVo.jycy_cdx"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                    <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="04" id="bdjcjg4" onclick="bdClick(this)"/><font>札如病毒</font></td>        
                        <td align="left" height="20px"><span id="cx4" style="display:none">基因测序
                            <input name="cx4" value="<s:property value="fhbdVo.jycy_zr"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                    <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="05" id="bdjcjg5" onclick="bdClick(this)"/><font>轮状病毒A组</font></td>        
                           <td align="left" height="20px"><span id="cx5" style="display:none">基因测序
                             <input name="cx5" value="<s:property value="fhbdVo.jycy_lza"/>" class="onlyNumAlpha" style="100px;"/></span>                            
                                <span id="fx1" style="display:none"><font color="#239AD7">基因分型</font></span>
                                <span id="fx2" style="display:none">
                                <input name="fx2" value="<s:property value="fhbdVo.azlzbdjyfx"/>" class="easyui-combobox" style="100px;height:20px;"
                                    url="<%= request.getContextPath() %>/pt/codeQuery!getComboboxInfoForJquery.action?key=fxb&code=fxb_jyfx"
                                    valueField="code" textField="text" method="get" editable="true" panelHeight="100px"/></span>
                            </td></tr>
                      <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="06" id="bdjcjg6" onclick="bdClick(this)"/><font>轮状病毒B组</font></td>        
                        <td align="left" height="20px"><span id="cx6" style="display:none">基因测序
                            <input name="cx6" value="<s:property value="fhbdVo.jycy_lzb"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                       <tr>
                           <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="07" id="bdjcjg7" onclick="bdClick(this)"/><font>轮状病毒C组</font></td>        
                        <td align="left" height="20px"><span id="cx7" style="display:none">基因测序
                            <input name="cx7" value="<s:property value="fhbdVo.jycy_lzc"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                    <tr>
                           <td align="left" height="20px" >
                            <input type="checkbox" name="bdjcjg" value="08" id="bdjcjg8" onclick="bdClick(this)"/><font>诺如病毒GI型</font></td>        
                        <td align="left" height="20px"><span id="cx8" style="display:none">基因测序
                            <input name="cx8" value="<s:property value="fhbdVo.jycy_nryx"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                    <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="09" id="bdjcjg9" onclick="bdClick(this)"/><font>诺如病毒GII型</font></td>        
                        <td align="left" height="20px"><span id="cx9" style="display:none">基因测序
                            <input name="cx9" value="<s:property value="fhbdVo.jycy_nrex"/>" class="onlyNumAlpha" style="100px;"/></span>
                            </td></tr>
                    <tr>
                        <td align="left" height="20px">
                            <input type="checkbox" name="bdjcjg" value="99" id="bdjcjg99" onclick="bdClick(this)"/><font>未检测</font></td>        
                        <td align="left" height="20px">
                            </td></tr>
              </table>  
            </td>
            </tr>        
        </table>
    </div>
    </form>
</div>

    <table align="center" height="40">
    <tr align="center" height="30">
        <td align="center">
            <input class="submit_01" type="button" value="保存" onClick="doSave()">
            <input class="submit_01" type="button" value="关闭" onClick="window.close();">
        </td>
    </tr>
    </table>
    
</body>
</html>
fxbUpdataFhbd.jsp
    /**
     * 保存病毒检测详情修改录入结果
     * @return
     */
    public String inputSave() {
        SecurityUser userVo = Login.getLoginUser(servletRequest);
        String jcjg = this.servletRequest.getParameter("bdjcjg");
        vo.setJcjg(jcjg);        
        fxbListFhbdService.saveBdjcjg(vo, userVo);
        
        String json = "1";
        createJSonData(json);
        //createJSonData((new StringBuilder()).append("{"success":true,"result":[").append(json.toString()).append("]}").toString());
        return "ajax";        
    }
保存修改结果
    /**
     * 通过id查询病毒检测结果
     * @param id
     * @return
     */
    public FxbListFhbdVo loadByFhbdId (Long id) {        
        FxbListFhbdVo vo=new FxbListFhbdVo();
        TC7Fxjcbdjcjg bo = fxbListFhbdDao.load(id);
        if (bo != null) {
            vo.setId(id);
            vo.setBlbh(bo.getBlbh());
            vo.setJcjg(bo.getJcjg());
            vo.setAzlzbdjyfx(bo.getAzlzbdjyfx());
            vo.setJycy_xz(bo.getJycy_xz());
            vo.setJycy_cdx(bo.getJycy_cdx());
            vo.setJycy_zr(bo.getJycy_zr());
            vo.setJycy_lza(bo.getJycy_lza());
            vo.setJycy_lzb(bo.getJycy_lzb());
            vo.setJycy_lzc(bo.getJycy_lzc());
            vo.setJycy_nryx(bo.getJycy_nryx());
            vo.setJycy_nrex(bo.getJycy_nrex());    
        }
        return vo;
    }

    /**
     * 保存病毒检测录入结果
     * @param vo
     * @return
     */
    public void saveBdjcjg(FxbListFhbdVo vo, SecurityUser userVo) {    
        Long id = fxbListFhbdDao.queryId(vo.getBlbh(),"1");
        TC7Fxjcbdjcjg bo = null;
        if(id == 0l) {
            bo = new TC7Fxjcbdjcjg();
            bo.setBlbh(vo.getBlbh());
            bo.setJcjg(vo.getJcjg());
            bo.setAzlzbdjyfx(vo.getAzlzbdjyfx());
            bo.setJycy_xz(vo.getJycy_xz());
            bo.setJycy_cdx(vo.getJycy_cdx());
            bo.setJycy_zr(vo.getJycy_zr());
            bo.setJycy_lza(vo.getJycy_lza());
            bo.setJycy_lzb(vo.getJycy_lzb());
            bo.setJycy_lzc(vo.getJycy_lzc());
            bo.setJycy_nryx(vo.getJycy_nryx());
            bo.setJycy_nrex(vo.getJycy_nrex());
            bo.setZzjgxdrq(new Date()); //最终结果修订日期
            bo.setYxbz(ConstantsUtils.YXBZ_YX); //有效标志
            bo.setYljgdm(ConstantsUtils.QX_SHSJK); //医疗机构代码(市疾控)
            bo.setJclx(ConstantsUtils.FXB_JCLX_FHJCYB); //检测类型(复核检测)
            bo.setXgbz(ConstantsUtils.XGBZ_XZ); //修改标志(新增)
            bo.setRksj(new Date()); //入库时间
            bo.setIsxf(ConstantsUtils.ISXF_WXF); //下发标志(未下发)
            bo.setCjsj(new Date()); //创建时间
            bo.setCjz(userVo.getName()); //创建者
            bo.setCjjg(ConstantsUtils.QX_SHSJK); //创建机构(上海市疾控中心)
            this.fxbListFhbdDao.save(bo);
        }else {
            bo = fxbListFhbdDao.load(id);
            bo.setJcjg(vo.getJcjg());
            bo.setAzlzbdjyfx(vo.getAzlzbdjyfx());
            bo.setJycy_xz(vo.getJycy_xz());
            bo.setJycy_cdx(vo.getJycy_cdx());
            bo.setJycy_zr(vo.getJycy_zr());
            bo.setJycy_lza(vo.getJycy_lza());
            bo.setJycy_lzb(vo.getJycy_lzb());
            bo.setJycy_lzc(vo.getJycy_lzc());
            bo.setJycy_nryx(vo.getJycy_nryx());
            bo.setJycy_nrex(vo.getJycy_nrex());
            bo.setZzjgxdrq(new Date()); //最终结果修订日期
            bo.setXgbz(ConstantsUtils.XGBZ_XG);
            bo.setIsxf(ConstantsUtils.ISXF_CXXF);
            bo.setXgsj(new Date());
            bo.setXgz(userVo.getName());
            bo.setXgjg(ConstantsUtils.QX_SHSJK);
            this.fxbListFhbdDao.update(bo);
        }
    }
View Code
原文地址:https://www.cnblogs.com/fangdan/p/4974642.html