easyui模板页面 不良调查
<%@page import="com.xy.cc.util.CUtil" %>
<%@page import="com.xy.cc.bean.UserPowerBean" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
    String company_id = (String) request.getSession().getAttribute("company_id");
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link href="<%=basePath %>css/css/crud.css" rel="stylesheet" type="text/css"/>
    <script src="<%=basePath %>js/HydUtil.js" type="text/javascript"></script>
    <script src="<%=basePath %>js/ajaxfileupload.js" type="text/javascript"></script>
    <style>
#crud .crud-content-info tr td:nth-child(2n) {
            width: 24%;
        }
#crud .crud-content-info tr td {
            height: 50px;
            line-height: 50px;
        }
#crud .crud-content-info tr.btnStyle td div {
            width: 50px;
            height: 30px;
            text-align: center;
            line-height: 30px;
            border: 1px solid #000;
            float: left;
            margin-right: 20px;
            cursor: pointer;
        }
        .datagrid-header-rownumber,datagrid-cell-rownumber{
            width: 25px;
            text-align: center;
        }
        .datagrid-view1{
            width: 0px!important;
        }
        #crud div:nth-child(3) div.panel-noscroll div div div.datagrid-view div.datagrid-view2 div.datagrid-body {
            height: 400px !important;
        }
        #patient_name{
            height: 26px!important;
        }
        .button_in_table{
            margin-left: 5px!important;
        }
        #mainPanle div div div.datagrid-view{
            height: calc(100% - 140px) !important;
        }
        #head_tr>div div{
            display: inline-block;
            margin-right: 20px;
        }
    </style>
</head>
<body>
<%--查询调查管理列表条件--%>
<div id="head_tr" style="padding:5px 5px 5px 5px;font-size: 14px!important;">
    <div style="display: inline-block;margin-left: 10px;">
        <span>产品名称:</span>
        <select id="product_name" name="product_name" style="width:200px;height: 30px;">
        </select>
    </div>
    <div style="display: inline-block;margin-left: 10px;">
        <span>患者姓名:</span><input id="patient_name" name="patient_name" style="width:200px;height: 24px!important;line-height: 24px;
        vertical-align: middle;font-size: 14px">
    </div>
    <div style="display: inline-block">
        <a href="#" id="search_btn" onclick="filterBadSurvey()">查找</a>
    </div>
</div>
<%--easyui 的 tab标签栏--%>
<div id="status_tab" class="easyui-tabs">
    <div title="未处理">
        <!-- 未处理调查 -->
        <table id="untreated_investigation">
        </table>
    </div>
    <div title="有效" data-options="">
        <!-- 有效的调查 -->
        <table id="effective_investigation">
        </table>
    </div>
    <div title="无效" data-options="">
        <!-- 无效的调查 -->
        <table id="invalid_investigation">
        </table>
    </div>
</div>
<div id="detail_dialog">
    <table id="level_datagrid">
    </table>
</div>
<div id="user_dialog">
    <table id="user_datagrid">
    </table>
</div>
<!-- 不良调查信息=================================================================================================== -->
<!-- 添加不良调查Form -->
<div id="ProductBadSurveyadd">
    <form id="ProductBadSurveyaddform" class="easyui-form" method="post"
          modelAttribute="power">
        <div id="crud">
            <!-- 病例信息-->
            <div>
                <div class="crud-small-title">
                    <ul>
                        <li class="accordion left"><img class="down left"
                                                        src="<%=basePath %>css/images/crud-icon02.png" alt="">
                            <p class="left">病历信息</p></li>
                    </ul>
                </div>
                <table class="crud-content-info">
                    <tr>
                        <td align="right">医院名称:</td>
                        <td><input id="hospital_name" type="text" name="hospital_name" maxlength="30"/></td>
                        <td align="right">医院地址:</td>
                        <td><input id="hospital_address" type="text" name="hospital_address" maxlength="150"/></td>
                    </tr>
                    <tr>
                        <td align="right">病例上传:</td>
                        <td><input id="case_report_upload" type="file" onchange="upload()" name="test_file"/>
                            <input id="file_id" type="text" name="case_report_upload" style="display:none"/></td>
                        </td>
                        <td align="right">病历号/门诊号:</td>
                        <td><input id="case_report_no" type="text" name="case_report_no" maxlength="12"/></td>
                    </tr>
                    <tr>
                        <td align="right">相关信息:</td>
                        <td>
                            <select id="relevant_information" name="relevant_information" class="easyui-combotree">
                            </select>
                        </td>
                        <td align="right">过敏源:</td>
                        <td><input id="allergen" type="text" type="text" name="allergen" maxlength="20"/></td>
                    </tr>
                    <tr>
                        <td align="right">既往药品不良反应/事件:</td>
                        <td>
                            <select id="passing_bad_reaction" name="passing_bad_reaction">
                                <option value="" selected="selected">请选择</option>
                                <option value="01">有</option>
                                <option value="02">无</option>
                                <option value="03">不明</option>
                            </select>
                        </td>
                        <td align="right">反应/事件描述:</td>
                        <td>
                            <textarea cols="24" rows="3" name="reaction_expressions" maxlength="150"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">家族药品不良反应/事件:</td>
                        <td>
                            <select id="family_passing_bad_reaction" name="family_passing_bad_reaction">
                                <option value="" selected="selected">请选择</option>
                                <option value="01">有</option>
                                <option value="02">无</option>
                                <option value="03">不明</option>
                            </select>
                        </td>
                        <td align="right">家族反应/事件描述:</td>
                        <td>
                            <textarea cols="24" rows="3" name="family_reaction_expressions" maxlength="150"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- 不良调查 -->
            <div>
                <div class="crud-small-title">
                    <ul>
                        <li class="accordion left"><img class="down left"
                                                        src="<%=basePath %>css/images/crud-icon02.png" alt="">
                            <p class="left">不良调查</p></li>
                    </ul>
                </div>
                <table class="crud-content-info">
                    <tr>
                        <td align="right">不良反应/事件结果及处理:</td>
                        <td>
                            <select id="result_handling" name="result_handling" onchange="resultHandling()">
                                <option value="" selected="selected">请选择</option>
                                <option value="01">痊愈</option>
                                <option value="02">好转</option>
                                <option value="03">未好转</option>
                                <option value="04">不详</option>
                                <option value="05">有后遗症</option>
                                <option value="06">死亡</option>
                            </select>
                        </td>
                        <td align="right">表现:</td>
                        <td>
                            <textarea cols="24" rows="3" name="handling_expressions" maxlength="150"></textarea>
                        </td>
                    </tr>
                    <tr id="dethmessage">
                        <td align="right">直接死因:</td>
                        <td><input id="cause_death" type="text" name="cause_death" maxlength="30"/></td>
                        <td align="right">死亡时间:</td>
                        <td><input id="death_time" type="text" name="death_time"/></td>
                    </tr>
                    <tr>
                        <td align="right">原患疾病:</td>
                        <td><input id="original_disease" type="text" name="original_disease" maxlength="150"/></td>
                        <td align="right">对原患疾病的影响:</td>
                        <td>
                            <select id="sickness_influence" name="sickness_influence">
                                <option value="" selected="selected">请选择</option>
                                <option value="01">不明显</option>
                                <option value="02">病程延长</option>
                                <option value="03">病程加重</option>
                                <option value="04">导致后遗症</option>
                                <option value="05">导致死亡</option>
                                <option value="06">其他</option>
                            </select>
                        </td>
                    </tr>
                    <!--  <tr>
                         <td align="right">导致后遗症表现:</td>
                         <td><input id="influence_expressions" type="text" name="influence_expressions" maxlength="150"/>
                         </td>
                         <td align="right">直接死因:</td>
                         <td><input id="influence_cause_death" type="text" name="influence_cause_death" maxlength="30"/>
                         </td>
                     </tr> -->
                    <tr>
                        <td align="right">信息来源:</td>
                        <td>
                            <select id="message_source" name="message_source">
                                <option value="" selected="selected">请选择</option>
                                <option value="0">医疗机构</option>
                                <option value="1">经营企业</option>
                                <option value="2">个人</option>
                                <option value="3">文献报道</option>
                                <option value="4">上市后研究</option>
                                <option value="5">其他</option>
                            </select>
                        <td align="right">调查时间:</td>
                        <td><input id="survey_time" type="text" name="survey_time"/></td>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">备注:</td>
                        <td>
                            <textarea cols="24" rows="3" name="remarks" maxlength="150"></textarea>
                        </td>
                        <td align="right">产品名称:</td>
                        <td><input id="mProductName" type="text" name="ProductName" readonly="readonly"/></td>
</tr>
                    <tr>
                        <td align="right">停药或减量后,反应/事件是否消失或减轻:</td>
                        <td>
                            <select id="trace" name="trace">
                                <option value="" selected="selected">请选择</option>
                                <option value="1">是</option>
                                <option value="2">否</option>
                                <option value="3">不明</option>
                                <option value="4">未停药或减量</option>
                            </select>
                        </td>
                        <td align="right">再次使用后,不良反应/事件是否再次出现:</td>
                        <td>
                            <select id="reuse" name="reuse">
                                <option value="" selected="selected">请选择</option>
                                <option value="1">是</option>
                                <option value="2">否</option>
                                <option value="3">不明</option>
                                <option value="4">未再次使用</option>
                            </select>
                        </td>
</tr>
                    <tr>
                        <td align="right">患者名称:</td>
                        <td><input id="name1" type="text" name="name" maxlength="20" readonly="readonly"/></td>
                        <td align="right">患者身份证:</td>
                        <td><input id="id_card_num" type="text" name="id_card_num" maxlength="20" readonly="readonly"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">产品编号:</td>
                        <td><input id="SerialNum" type="text" name="SerialNum" maxlength="30" readonly="readonly"/></td>
                         <td align="right">监测唯一标识:</td>
                        <td><input id="sur_id" type="text" name="sur_id" maxlength="30" readonly="readonly"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">单位名称:</td>
                        <td><input id="company_nm" type="text" name="company_nm" maxlength="30" readonly="readonly"/>
                        </td>
                        <td align="right">公司id:</td>
                        <td><input id="company_id" type="text" name="company_id" readonly="readonly"/></td>
                    </tr>
</table>
            </div>
            <!-- 并用药品 -->
            <div>
                <div class="crud-small-title">
                    <ul>
                        <li class="accordion left"><img class="down left"
                                                        src="<%=basePath %>css/images/crud-icon02.png" alt="">
                            <p class="left">并用药品</p></li>
                    </ul>
                </div>
                <div style="height: 500px;">
                    <table class="crud-content-info" id="addusingprodcetheal">
</table>
                </div>
            </div>
        </div>
    </form>
</div>
<!-- 添加并用药品div====================== -->
<div id="xyccproductUsingProductadddiv">
    <form id="xyccproductUsingProductaddform" class="easyui-form" method="post"
          modelAttribute="power">
        <div id="crud">
            <!-- 并用药品信息-->
            <div>
                <div class="crud-small-title">
                    <ul>
                        <li class="accordion left"><img class="down left"
                                                        src="<%=basePath %>css/images/crud-icon02.png" alt="">
                            <p class="left">并用药信息</p></li>
                    </ul>
                </div>
                <table class="crud-content-info">
                    <tr>
                        <td align="right">添加并用药品:</td>
                        <td><input id="xuanze" type="button" onclick="selectuseing()" value="请选择并用药品"/></td>
                        <td align="right">商品名称:</td>
                        <td><input id="ProductName" type="text" name="ProductName" maxlength="30" readonly="readonly"/>
                        </td>
</tr>
                    <tr>
                        <td align="right">生产企业:</td>
                        <td><input id="UnitName" type="text" name="UnitName" maxlength="30" readonly="readonly"/></td>
                        <td align="right">批准文号:</td>
                        <td><input id="Symbol" type="text" name="Symbol" maxlength="30" readonly="readonly"/></td>
                    </tr>
                    <tr>
                        <td align="right">生产企业id:</td>
                        <td><input id="usingcompany_id" type="text" name="company_id" maxlength="30"
                                   readonly="readonly"/></td>
                        <td align="right">产品编号:</td>
                        <td><input id="usingSerialNum" type="text" name="SerialNum" maxlength="30" readonly="readonly"/>
                        </td>
                    </tr>
<tr>
                        <td align="right">用药开始时间:</td>
                        <td><input id="time_frame" type="text" name="starttime_frame"/></td>
                        <td align="right">用药结束时间:</td>
                        <td><input id="time_frame1" type="text" name="endtime_frame"/></td>
                    </tr>
                    <tr>
                        <td align="right">产品批号:</td>
                        <td><input id="lot_num" type="text" name="lot_num" maxlength="30"
                                   onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"/></td>
                        <td align="right">通用名称:</td>
                        <td><input id="common_name" type="text" name="common_name" maxlength="30"/></td>
</tr>
                    <tr>
                        <td align="right">用药原因:</td>
                        <td><input id="medical_reason" type="text" name="medical_reason" maxlength="30"/></td>
                        <td align="right">用法用量:</td>
                        <td><input id="usage" type="text" name="usage" maxlength="30"/></td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</div>
<!-- 并用药品列表 table=======================================================-->
<div id="xyccproductUsingProductdiv">
    <table id="xyccproductUsingProducttable"></table>
</div>
<!-- 不良调查列表 ====================-->
<div id="ProductBadSurveytablelistdiv">
    <table id="ProductBadSurveytable">
    </table>
</div>
<script type="text/javascript">
    $(function () {
        setSelectDefult();//下拉框设置默认项
        $('#status_tab').tabs({
            border:true,
            fit:true,
            onSelect:function(title){
}
        });
        $('#search_btn').linkbutton({
            iconCls: 'icon-search'
        });
        $('#product_name').combobox({
            editable: false,
            panelHeight:"auto",
            height:28,
            url: "<%=basePath%>xyData/badSurvey/findProductList.do",
            valueField: 'SerialNum',
            textField: 'ProductName',
            loadFilter:function(data){
                var obj={};
                obj.ProductName='所有药品';
                obj.SerialNum='';
                data.splice(0,0,obj)//在数组0位置插入obj,不删除原来的元素
                return data;
            }
        });
        $("#product_name").textbox('textbox').css("font-size", "14px");
        $("#product_name").textbox('textbox').css("height", "26px");
        $("#product_name").textbox('textbox').css("vertical-align", "middle");
    });
function filterBadSurvey() {
        $('#untreated_investigation').datagrid('options').queryParams.product_name = $('#product_name').combobox('getValue');
        $('#untreated_investigation').datagrid('options').queryParams.patient_name = $('#patient_name').val();
        $('#untreated_investigation').datagrid('reload');
        $('#effective_investigation').datagrid('options').queryParams.product_name = $('#product_name').combobox('getValue');
        $('#effective_investigation').datagrid('options').queryParams.patient_name = $('#patient_name').val();
        $('#effective_investigation').datagrid('reload');
        $('#invalid_investigation').datagrid('options').queryParams.product_name = $('#product_name').combobox('getValue');
        $('#invalid_investigation').datagrid('options').queryParams.patient_name = $('#patient_name').val();
        $('#invalid_investigation').datagrid('reload');
    }
function setSelectDefult() {//下拉框设置默认项
        document.getElementById("allergen").setAttribute("readonly",true);
        $('#relevant_information').combotree({
            valueField: "id", //Value字段
            textField: "text", //Text字段
            multiple: true,
            data: [{"id": '01', "text": "吸烟史"}, {
                "id": '02',
                "text": "饮酒史"
            }, {"id": '03', "text": "妊娠期"}, {
                "id": '04',
                "text": "肝病史"
            }, {"id": '05', "text": "肾病史"}, {
                "id": '06',
                "text": "过敏史"
            }, {"id": '07', "text": "其他"}],
            onCheck: function (node, checked) {
if(node.id=='06' && checked){
                    $('#allergen').validatebox({
                        required: true
                    });
                    $("#allergen").removeAttr("readonly");
}
                if(node.id=='06' && !checked){
                    document.getElementById("allergen").setAttribute("readonly",true);
                    $('#allergen').validatebox({
                        required: false
                    });
                }
            },
            onClick: function (node, checked) {
}
        });
    }
    function resultHandling() {//选择死亡时死亡时间必填设置
        var result_handling = $("#result_handling").val();
        if ("06" == result_handling) {
            $('#death_time').datebox({
                required: true,
                editable: false
            });
            //死亡时间只能选择今天以前的时间
            $("#death_time").datebox('calendar').calendar({
                validator: function (beginDate) {
                    var date = new Date();
                    return beginDate <= date;
                }
            });
            document.getElementById('dethmessage').style.display = "table-row";
        } else {
            document.getElementById('dethmessage').style.display = "none";
        }
    }
/**
     * 根据datagrid操作列,并弹出调查或者置为无效(改变survey_trigger表flag字段)
     * @param id 报告id
     * @param value flag值 0未处理 1有效 2无效
     * @param index 触发函数按钮所在行号
     */
    function changeTriggerFlag(id,value,index){
        if(value==2){
            $.messager.confirm('请确认!','您确定要设为'+(value=="2"?"无效":"error")+'吗?',function(r){
                if (r){
                    $.ajax({
                        url:'<%=basePath%>xyData/health/changeTrigger.do?id='+id+'&&flag='+value,
                        type: 'post',
                        dataType:"json",
                        async:false,
                        success:function(){
                            $.messager.show({
                                title: '提示',
                                msg: '设置无效成功!',
                                showType: 'show'
                            });
                        }
                    });
                }
$('#untreated_investigation').datagrid('reload');
                $('#invalid_investigation').datagrid('reload');
});
        }else{
            $('#untreated_investigation').datagrid('selectRow',index);
            var row = $('#untreated_investigation').datagrid('getSelected');
            if (row) {
                //打开弹框钱先查询这条数据是否有效
                var htmlobj=$.ajax({
                    url:"<%=basePath%>xyData/badSurvey/findSurveyTrigger.do?sur_id="+row.sur_id,
                    async:false
                });
                //object 转string htmlobj.responseText
                //string转json
                var str=JSON.parse(htmlobj.responseText)
                if(0!=str.row.flag){
                    $.messager.show({
                        title: '提示',
                        msg: '数据出错!请刷新后重试!',
                        showType: 'show'
                    });
                    return;
                }
                $('#ProductBadSurveyaddform').form('clear');
                badfindusingproduct();
                $('#ProductBadSurveyadd').dialog('open').dialog('setTitle', '添加');
                var loadmsg={
                    "company_id" : row.company_id,
                    "SerialNum":row.SerialNum,
                    "id_card_num":row.id_card_num,
                    "name":row.userInfo.name
                }
$('#ProductBadSurveyaddform').form('load', loadmsg);
//alert("row.name===="+patient_info.name+"--id_card_num==="+row.id_card_num);
                //产品名称
                var productName=row.productInfo.productName;
                $("#mProductName").val(productName);
                //获取单位名称
                var text = $('#company').find("option:selected").text();
                $("#company_nm").val(text);
                //监测唯一标识
                $('#sur_id').val(row.sur_id);
                $('#addusingprodcetheal').datagrid('loadData', {total: 0, rows: []});
                //添加不良调查必输项====================
                $('#company_id').validatebox({
                    required: true
                });
$('#hospital_name').validatebox({
                    required: true
                });
                $('#hospital_address').validatebox({
                    required: true
                });
                /* $('#case_report_upload').validatebox({
                       required: true
                }); */
                $('#case_report_no').validatebox({
                    required: true
                });
                /* $('#allergen').validatebox({
                    required: true
                }); */
                $('#original_disease').validatebox({
                    required: true
                });
                $('#survey_time').datebox({
                    required: true,
                    editable: false
                });
                $("#passing_bad_reaction").val(Array(''));
                $("#family_passing_bad_reaction").val(Array(''));
                $("#result_handling").val(Array(''));
                $("#sickness_influence").val(Array(''));
                $("#message_source").val(Array(''));
                $("#trace").val(Array(''));
                $("#reuse").val(Array(''));
            } else {
                $.messager.show({
                    title: '提示',
                    msg: '请选择一条!',
                    showType: 'show'
                });
            }
        }
    }
    //文件上传
    function upload() {
        var url = '<%=basePath%>' + 'file/upload.do';
        HydUtilUpLoad(url, "test_file", "case_report_upload", "file_id");
    }
$('#detail_dialog').dialog({
        title: '查询结果',
        width: '80%',
        height: 800,
        iconCls: 'icon-add',
        closed: true,
        closable: true,
        draggable: false,
        modal: true,
        buttons: [{
            text: '关闭',
            iconCls: 'icon-cancel',
            handler: function () {
                $('#detail_dialog').dialog('close');
            }
        }]
    });
    $('#user_dialog').dialog({
        title: '查询结果',
        width: '80%',
        height: 800,
        iconCls: 'icon-add',
        closed: true,
        closable: true,
        draggable: false,
        modal: true,
        buttons: [{
            text: '关闭',
            iconCls: 'icon-cancel',
            handler: function () {
                $('#user_dialog').dialog('close');
            }
        }]
    });
    $("#untreated_investigation").datagrid({
        width: 'auto',
        height: 'auto',
        striped: true,
        fit: true,
        pagination: true,
        scrollbarSize: 0,
        singleSelect: true,
        url: '<%=basePath%>xyData/health/getProductByCompanyId.do',
        queryParams: {
            flag:'0',
            product_name: $('#product_name').combobox('getValue'),
            patient_name: $('#patient_name').val(),
        },
        loadMsg: '数据加载中请稍后……',
        columns: [[
            {
                field: 'SerialNum',
                title: '药品id',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'company_id',
                title: '公司id',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'sur_id',
                title: '监测的唯一标识',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'name',
                title: '患者姓名',
                align: 'center',
                resizable: false,
                width: '13%',
                formatter: function (value, row) {
                    return row.userInfo.name;
                }
            },
            {
                field: 'gender',
                title: '性别',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.gender == "0" ? "男" : "女";
                }
            },
            {
                field: 'birthday',
                title: '出生年月',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.birthday;
                }
            },
            {
                field: 'productInfo',
                title: '药品名称',
                align: 'center',
                resizable: false,
                width: '20%',
                formatter: function (value, row) {
                    return value.productName;
                }
            },
            {
                field: 'contact_way',
                title: '联系方式',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.contact_way;
                }
            },
            {
                field: 'contact_num',
                title: '联系号码',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.contact_num;
                }
            }, {
                field: 'time',
                title: '上传时间',
                align: 'center',
                resizable: false,
                width: '10%'
            }, {
                field: 'flag',
                title: '操作',
                align: 'center',
                resizable: false,
                width: '15%',
                formatter: function (value, row,index) {
                    var html;
                    if(value=='0'){
                        html = "<input type='button' class='button_in_table' onclick='changeTriggerFlag(\""+ row.sur_id +"\","+1+","+index+")' value='患者调查'>" +
                            "<input type='button' class='button_in_table' onclick='changeTriggerFlag(\""+row.sur_id+"\","+2+","+index+")' value='置为无效'>"
                    }
                    return html;
                }
            }
        ]],
        method: 'post',
        toolbar: [{
            text: '查看异常指标',
            iconCls: 'icon-add',
            handler: function () {
                var row = $('#untreated_investigation').datagrid('getSelected');
                if (row) {
                    $('#user_datagrid').datagrid({
                        width: 'auto',
                        height: 'auto',
                        striped: true,
                        fit: true,
                        scrollbarSize: 0,
                        singleSelect: true,
                        url: '<%=basePath%>xyData/badSurvey/findByCondition.do?id=' + row.sur_id + '&&SerialNum=' + row.SerialNum,
                        loadMsg: '数据加载中请稍后……',
                        columns: [[
                            {
                                field: 'id',
                                title: '报告号',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            },
                            {
                                field: 'time',
                                title: '上传时间',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            },
                            {
                                field: 'untoward_reaction_name',
                                title: '不良名称',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            },
                            {
                                field: 'index',
                                title: '不良程度',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            }
                        ]],
                        onLoadSuccess: function (data) {
                            for (var i = 0; i < data.total; i++) {
                                var rowspan = 1;
                                for (var j = i + 1; j < data.total; j++) {
                                    if (data.rows[i].id == data.rows[j].id) {
                                        rowspan++;
                                    }
                                }
                                $(this).datagrid('mergeCells', {
                                    index: i,
                                    field: 'id',
                                    rowspan: rowspan
                                });
                                i += rowspan - 1;
                            }
                        },
                        method: 'get'
                    });
                    $('#user_dialog').dialog('open');
                } else {
                    $.messager.show({
                        title: '提示',
                        msg: '请选择一条!',
                        showType: 'show'
                    });
                }
            }
        }]
    });
    $("#effective_investigation").datagrid({
        width: 'auto',
        height: 'auto',
        striped: true,
        fit: true,
        pagination: true,
        scrollbarSize: 0,
        singleSelect: true,
        url: '<%=basePath%>xyData/health/getProductByCompanyId.do',
        queryParams: {
            flag:'1',
            product_name: $('#product_name').combobox('getValue'),
            patient_name: $('#patient_name').val(),
        },
        loadMsg: '数据加载中请稍后……',
        columns: [[
            {
                field: 'SerialNum',
                title: '药品id',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'company_id',
                title: '公司id',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'sur_id',
                title: '监测的唯一标识',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'name',
                title: '患者姓名',
                align: 'center',
                resizable: false,
                width: '13%',
                formatter: function (value, row) {
                    return row.userInfo.name;
                }
            },
            {
                field: 'gender',
                title: '性别',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.gender == "0" ? "男" : "女";
                }
            },
            {
                field: 'birthday',
                title: '出生年月',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.birthday;
                }
            },
            {
                field: 'productInfo',
                title: '药品名称',
                align: 'center',
                resizable: false,
                width: '20%',
                formatter: function (value, row) {
                    return value.productName;
                }
            },
            {
                field: 'contact_way',
                title: '联系方式',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.contact_way;
                }
            },
            {
                field: 'contact_num',
                title: '联系号码',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.contact_num;
                }
            },{
                field: 'time',
                title: '上传时间',
                align: 'center',
                resizable: false,
                width: '10%'
            }, {
                field: 'remark',
                title: '评价结果',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    if (row.remark == null) {
                        return "无";
                    }
                    return value;
                }
            }
        ]],
        method: 'post',
        toolbar: [{
            text: '查看异常指标',
            iconCls: 'icon-add',
            handler: function () {
                var row = $('#effective_investigation').datagrid('getSelected');
                if (row) {
                    $('#user_datagrid').datagrid({
                        width: 'auto',
                        height: 'auto',
                        striped: true,
                        fit: true,
                        scrollbarSize: 0,
                        singleSelect: true,
                        url: '<%=basePath%>xyData/badSurvey/findByCondition.do?id=' + row.sur_id + '&&SerialNum=' + row.SerialNum,
                        loadMsg: '数据加载中请稍后……',
                        columns: [[
                            {
                                field: 'id',
                                title: '报告号',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            },
                            {
                                field: 'time',
                                title: '上传时间',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            },
                            {
                                field: 'untoward_reaction_name',
                                title: '不良名称',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            },
                            {
                                field: 'index',
                                title: '不良程度',
                                align: 'center',
                                resizable: false,
                                width: '25%'
                            }
                        ]],
                        onLoadSuccess: function (data) {
                            for (var i = 0; i < data.total; i++) {
                                var rowspan = 1;
                                for (var j = i + 1; j < data.total; j++) {
                                    if (data.rows[i].id == data.rows[j].id) {
                                        rowspan++;
                                    }
                                }
                                $(this).datagrid('mergeCells', {
                                    index: i,
                                    field: 'id',
                                    rowspan: rowspan
                                });
                                i += rowspan - 1;
                            }
                        },
                        method: 'get'
                    });
                    $('#user_dialog').dialog('open');
                } else {
                    $.messager.show({
                        title: '提示',
                        msg: '请选择一条!',
                        showType: 'show'
                    });
                }
            }
        },'-',{
            text: '不良调查列表',
            iconCls: 'icon-add',
            handler: function () {
                //不良调查列表
                badSurveylist();
            }
        }]
    });
    $("#invalid_investigation").datagrid({
        width: 'auto',
        height: 'auto',
        striped: true,
        fit: true,
        pagination: true,
        scrollbarSize: 0,
        singleSelect: true,
        url: '<%=basePath%>xyData/health/getProductByCompanyId.do',
        queryParams: {
            flag:'2',
            product_name: $('#product_name').combobox('getValue'),
            patient_name: $('#patient_name').val(),
        },
        loadMsg: '数据加载中请稍后……',
        columns: [[
            {
                field: 'SerialNum',
                title: '药品id',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'company_id',
                title: '公司id',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'sur_id',
                title: '监测的唯一标识',
                align: 'center',
                resizable: false,
                hidden: true
            },
            {
                field: 'name',
                title: '患者姓名',
                align: 'center',
                resizable: false,
                width: '13%',
                formatter: function (value, row) {
                    return row.userInfo.name;
                }
            },
            {
                field: 'gender',
                title: '性别',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.gender == "0" ? "男" : "女";
                }
            },
            {
                field: 'birthday',
                title: '出生年月',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.birthday;
                }
            },
            {
                field: 'productInfo',
                title: '药品名称',
                align: 'center',
                resizable: false,
                width: '20%',
                formatter: function (value, row) {
                    return value.productName;
                }
            },
            {
                field: 'contact_way',
                title: '联系方式',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.contact_way;
                }
            },
            {
                field: 'contact_num',
                title: '联系号码',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    return row.userInfo.contact_num;
                }
            }, {
                field: 'remark',
                title: '评价结果',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value, row) {
                    if (row.remark == null) {
                        return "无";
                    }
                    return value;
                }
            }
        ]],
        method: 'post',
        toolbar: [{
            text: '不良调查列表',
            iconCls: 'icon-add',
            handler: function () {
                //不良调查列表
                badSurveylist();
            }
        }]
    });
    //======================================================================不良调查=============================================
    //不良调查列表====
    function badSurveylist() {
        //不良调查列表弹框
        $('#ProductBadSurveytablelistdiv').dialog({
            title: '不良调查列表',
            width: "60%",
            height: "75%",
            iconCls: 'icon-add',
            closed: true,
            closable: true,
            draggable: false,
            modal: true,
            buttons: []
        });
        $('#ProductBadSurveytablelistdiv').dialog('open').dialog('setTitle', '不良调查列表');
        //不良调查列表
        $('#ProductBadSurveytable').datagrid({
            width: 'auto',
            height: 'auto',
            striped: true,
            fit: true,
            pagination: true, scrollbarSize: 0,
            singleSelect: true,
            url: '<%=basePath%>xyData/badSurvey/findproductBadSurvey.do?company_id=' + '<%=company_id%>',
            loadMsg: '数据加载中请稍后……',
            columns: [[
            	
                {
                    field: 'id_card_num',
                    title: '患者身份证号',
                    align: 'center',
                    resizable: false,
                    width: '15%',
                    formatter: function (value) {
                    	var id=value.substring(0,1)+'*****************';
                        return "<span title='" + id + "'>" + id + "</span>";
                   }
}, {
                    field: 'name',
                    title: '患者名称',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
}, {
                    field: 'creation_time',
                    title: '不良调查上传时间',
                    align: 'center',
                    resizable: false,
                    width: '13%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
}, {
                    field: 'survey_time',
                    title: '调查时间',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'result_handling',
                    title: '事件结果及处理',
                    align: 'center',
                    resizable: false,
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'handling_expressions',
                    title: '表现',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'cause_death',
                    title: '直接死因',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'death_time',
                    title: '死亡时间',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'sickness_influence',
                    title: '对原患疾病的影响',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'influence_expressions',
                    title: '导致后遗症表现',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    hidden: true,
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'influence_cause_death',
                    title: '原患疾病直接死因',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    hidden: true,
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'message_source',
                    title: '信息来源',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
}, {
                    field: 'remarks',
                    title: '备注',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'hospital_name',
                    title: '医院名称',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'hospital_address',
                    title: '医院地址',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'case_report_upload',
                    title: '病例上传',
                    align: 'center',
                    resizable: false,
                    width: '10%'
}, {
                    field: 'case_report_no',
                    title: '病历号/门诊号',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'original_disease',
                    title: '原患疾病',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'relevant_information',
                    title: '相关信息',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'allergen',
                    title: '过敏源',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'bad_survey_no',
                    title: '不良调查编号',
                    align: 'center',
                    resizable: false,
                    width: '15%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'flag',
                    title: '是否处理',
                    align: 'center',
                    resizable: false,
                    width: '10%'
}, {
                    field: 'passing_bad_reaction',
                    title: '既往药品不良反应',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    hidden: true
                }, {
                    field: 'reaction_expressions',
                    title: '反应/事件描述',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'company_id',
                    title: '生产企业id',
                    align: 'center',
                    resizable: false,
                    width: '15%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'family_passing_bad_reaction',
                    title: '家族药品不良反应/事件',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'serialNum',
                    title: '产品编号',
                    align: 'center',
                    resizable: false,
                    width: '21%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'productName',
                    title: '产品名称',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'company_nm',
                    title: '单位名称',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'trace',
                    title: '反应/事件是否消失或减轻',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }, {
                    field: 'reuse',
                    title: '不良反应/事件是否再次出现',
                    align: 'center',
                    resizable: false,
                    width: '10%',
                    formatter: function (value) {
                        return "<span title='" + value + "'>" + value + "</span>";
                    }
                }
            ]],
            method: 'post',
            toolbar: [
{
                    text: '删除',
                    iconCls: 'icon-delete3',
                    handler: function () {
                        var row = $('#ProductBadSurveytable').datagrid('getSelected');
                        if (row) {
                            $.messager.confirm('删除数据', '您确定删除此数据吗?', function (r) {
                                if (r) {
                                    $.post('<%=basePath%>xyData/badSurvey/deleteProductBadSurvey.do?bad_survey_no=' + row.bad_survey_no,
                                        function (result) {
                                            //$.messager.alert('提示','删除成功');
                                            $.messager.show({
                                                title: '提示',
                                                msg: result.msg,
                                                showType: 'show'
                                            });
$('#ProductBadSurveytable').datagrid('reload'); // reload the user data
}, 'json');
                                }
                            });
                        } else {
$.messager.show({
                                title: '提示',
                                msg: '请至少选择一条记录',
                                showType: 'show'
                            });
                        }
                    }
                }
]
        });
    }
//添加不良调查弹框
    $('#ProductBadSurveyadd').dialog({
        title: '添加不良调查',
        width: '60%',
        height: '90%',
        iconCls: 'icon-add',
        closed: true,
        closable: true,
        draggable: false,
        modal: true,
        buttons: [{
            text: '保存',
            iconCls: 'icon-ok',
            handler: function () {
                $('#ProductBadSurveyaddform').form('submit', {
                    onSubmit: function () {
                        return $(this).form('enableValidation').form('validate');
                    },
                    url: '<%=basePath%>xyData/badSurvey/addProductBadSurvey.do',
                    success: function (data) {
                        data = eval("(" + data + ")");//JSON字符串转对象
var rows = $("#addusingprodcetheal").datagrid("getRows"); //这段代码是获取当前页的所有行。
                        //alert("rows==================="+rows);
                        //alert("bad_survey_no==="+data.bad_survey_no);
                        //alert(rows.length==0);
                        if (rows.length != 0) {
                            for (var i = 0; i < rows.length; i++) {
                                //获取每一行的数据
                                //alert(rows[i].ProductName);//假设有ProductName这个字段
                                $.ajax({
                                    url: "<%=basePath%>xyData/badSurvey/addUsingProduct.do?bad_survey_no=" + data.bad_survey_no,
                                    type: 'POST',
                                    dataType: 'json',
                                    async:false,
                                    data: rows[i],
                                    success: function (data) {
                                        if (i == rows.length - 1) {
                                            //alert("jinlaikankan=============");
                                            $.messager.show({
                                                title: '提示',
                                                msg: data.msg,
                                                showType: 'show'
                                            });
                                        }
                                    },
                                    error: function (data) {
                                        $.messager.show({
                                            title: '提示',
                                            msg: data.msg,
                                            showType: 'show'
                                        });
                                    }
                                });
                            }
                        } else {
                            //alert("data.msg=="+data.msg);
                            $.messager.show({
                                title: '提示',
                                msg: data.msg,
                                showType: 'show'
                            });
                        }
                     
                        $('#ProductBadSurveyadd').dialog('close');
                        $('#untreated_investigation').datagrid('reload');
                        $('#effective_investigation').datagrid('reload');
                        $('#invalid_investigation').datagrid('reload');
                    },
                    error: function () {
                        //$.messager.alert('提示', '添加失败');
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            showType: 'show'
                        });
                    }
                });
            }
        }, {
            text: '取消',
            iconCls: 'icon-cancel',
            handler: function () {
                $('#ProductBadSurveyadd').dialog('close');
            }
        }]
    });
//=====================================================添加并用药品===================================================
    //不良调查添加并用药===============
    function badfindusingproduct() {
        $('#ProductName').validatebox({
            required: true
        });
        $('#usingSerialNum').validatebox({
            required: true
        });
        $('#UnitName').validatebox({
            required: true
        });
        $('#Symbol').validatebox({
            required: true
        });
        $('#usingcompany_id').validatebox({
            required: true
        });
$('#time_frame').datebox({
            required: true,
            editable: false
});
$('#time_frame1').datebox({
            required: true,
            editable: false
        });
$("#time_frame").datebox({
            onSelect: function (beginDate) {
                $('#time_frame1').datebox().datebox('calendar').calendar({
                    validator: function (endDate) {
                        var date = new Date();
                        return beginDate <= endDate;
                    }
                });
            }
        });
//survey_time death_time
        $('#survey_time').datebox({
            required: true,
            editable: false
        });
        $('#death_time').datebox({
            editable: false
        });
        //没有选择死亡前隐藏时间框
        //document.getElementById('dethmessage').style.visibility = "hidden ";
$('#common_name').validatebox({
            required: true
        });
        $('#medical_reason').validatebox({
            required: true
        });
        $('#usage').validatebox({
            required: true
        });
        $('#lot_num').validatebox({
            required: true
        });
$('#addusingprodcetheal').datagrid({
            width: 'auto',
            height: 'auto',
            striped: true,
            fit: true,
            singleSelect: false,
            loadMsg: '数据加载中请稍后……',
            columns: [[{
                field: 'ProductName',
                title: '商品名称',
                align: 'center',
                resizable: false,
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'SerialNum',
                title: '产品编号',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'UnitName',
                title: '生产企业',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'lot_num',
                title: '产品批号',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'usage',
                title: '用法用量',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'medical_reason',
                title: '用药原因',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'common_name',
                title: '通用名称',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'Symbol',
                title: '批准文号',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'company_id',
                title: '生产企业id',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'starttime_frame',
                title: '用药开始时间',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'endtime_frame',
                title: '用药结束时间',
                align: 'center',
                resizable: false,
                width: '10%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }
            ]],
            method: 'post',
            toolbar: [
{
                    text: '添加',
                    iconCls: 'icon-add',
                    handler: function () {
                        $('#xyccproductUsingProductaddform').form('clear');
                        $('#xyccproductUsingProductadddiv').dialog('open').dialog('setTitle', '添加并用药品');
                    }
                },
                {
                    text: '清空',
                    iconCls: 'icon-delete3',
                    handler: function () {
                        $('#addusingprodcetheal').datagrid('loadData', {total: 0, rows: []});
                    }
                }
]
        });
    }
//添加并用药信息弹框
    $('#xyccproductUsingProductadddiv').dialog({
        title: '添加并用药品',
        width: "60%",
        height: "75%",
        iconCls: 'icon-add',
        closed: true,
        closable: true,
        draggable: false,
        modal: true,
        buttons: [
            {
                text: '保存',
                iconCls: 'icon-ok',
                handler: function () {
                    $('#xyccproductUsingProductaddform').form('submit', {
                        onSubmit: function () {
                            //必输项进行验证======================
                            if (!$(this).form('enableValidation').form('validate')) {
                                $.messager.show({
                                    title: '提示',
                                    msg: '请将必输项填写完整',
                                    showType: 'show'
                                });
                            }
                            return $(this).form('enableValidation').form('validate');
                        },
                        url: '',
                        success: function (data) {
                            //var data = $("#xyccproductUsingProductaddform").serialize();
                            var data = $('#xyccproductUsingProductaddform').serializeArray();
                            var json = {};
                            for (var i = 0; i < data.length; i++) {
                                json[data[i]["name"]] = data[i]["value"];
                            }
                            //alert(JSON.stringify(json));
                            $('#addusingprodcetheal').datagrid('appendRow', json);
                            $('#xyccproductUsingProductadddiv').dialog('close');
},
                        error: function () {
}
                    });
}
            }, {
                text: '取消',
                iconCls: 'icon-cancel',
                handler: function () {
                    $('#xyccproductUsingProductadddiv').dialog('close');
                }
            }
        ]
    });
function selectuseing() {
        /* 查询全部并用药品====================================================================  */
        /* 全部病用药 */
        $('#xyccproductUsingProductdiv').dialog({
            title: '添加并用药品',
            width: "60%",
            height: "75%",
            iconCls: 'icon-add',
            closed: true,
            closable: true,
            draggable: false,
            modal: true,
            buttons: []
        });
        //全部并用药品列表让添加并用药品进行选择
        $('#xyccproductUsingProductdiv').dialog('open').dialog('setTitle', '添加并用药品');
        $('#xyccproductUsingProducttable').datagrid({
            width: 'auto',
            height: 'auto',
            striped: true,
            fit: true,
            pagination: true, scrollbarSize: 0,
            singleSelect: true,
            url: '<%=basePath%>xyData/badSurvey/findAllUsingProduct.do',
            loadMsg: '数据加载中请稍后……',
            columns: [[{
                field: 'ProductName',
                title: '商品名称',
                align: 'center',
                resizable: false,
                width: '15%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'SerialNum',
                title: '产品编号',
                align: 'center',
                resizable: false,
                width: '23%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'UnitName',
                title: '生产企业',
                align: 'center',
                resizable: false,
                width: '15%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'common_name',
                title: '通用名称',
                align: 'center',
                resizable: false,
                width: '15%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'Symbol',
                title: '批准文号',
                align: 'center',
                resizable: false,
                width: '15%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'company_id',
                title: '生产企业id',
                align: 'center',
                resizable: false,
                width: '18%',
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'lot_num',
                title: '产品批号',
                align: 'center',
                resizable: false,
                width: '10%',
                hidden: true,
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'usage',
                title: '用法用量',
                align: 'center',
                resizable: false,
                width: '10%',
                hidden: true,
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'time_frame',
                title: '用药时间',
                align: 'center',
                resizable: false,
                width: '10%',
                hidden: true,
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'medical_reason',
                title: '用药原因',
                align: 'center',
                resizable: false,
                width: '10%',
                hidden: true,
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
            }, {
                field: 'bad_survey_no',
                title: '不良调查编号',
                align: 'center',
                resizable: false,
                width: '10%',
                hidden: true,
                formatter: function (value) {
                    return "<span title='" + value + "'>" + value + "</span>";
                }
}
]],
            method: 'post',
            toolbar: [
{
                    text: '保存',
                    iconCls: 'icon-edit',
                    handler: function () {
                        var row = $('#xyccproductUsingProducttable').datagrid('getSelected');
                        if (row) {
                            //$('#addusingprodcetheal').datagrid('reload');
                            $('#xyccproductUsingProductdiv').dialog('close');
                            $('#xyccproductUsingProductaddform').form('load', row);
} else {
                            $.messager.show({
                                title: '提示',
                                msg: '请至少选择一条记录',
                                showType: 'show'
                            });
                        }
                    }
                }, '-',
]
        });
    }
//分页
    var up = $('#untreated_investigation').datagrid('getPager');
    $(up).pagination({
        pageSize: 10,//每页显示的记录条数,默认为10
        pageList: [<%=CUtil.numPerPage_1 %>, <%=CUtil.numPerPage_2 %>, <%=CUtil.numPerPage_3 %>],//可以设置每页记录条数的列表
        beforePageText: '第',//页数文本框前显示的汉字
        afterPageText: '页    共 {pages} 页',
        displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
    });
    var ep = $('#effective_investigation').datagrid('getPager');
    $(ep).pagination({
        pageSize: 10,//每页显示的记录条数,默认为10
        pageList: [<%=CUtil.numPerPage_1 %>, <%=CUtil.numPerPage_2 %>, <%=CUtil.numPerPage_3 %>],//可以设置每页记录条数的列表
        beforePageText: '第',//页数文本框前显示的汉字
        afterPageText: '页    共 {pages} 页',
        displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
    });
    var ip = $('#invalid_investigation').datagrid('getPager');
    $(ip).pagination({
        pageSize: 10,//每页显示的记录条数,默认为10
        pageList: [<%=CUtil.numPerPage_1 %>, <%=CUtil.numPerPage_2 %>, <%=CUtil.numPerPage_3 %>],//可以设置每页记录条数的列表
        beforePageText: '第',//页数文本框前显示的汉字
        afterPageText: '页    共 {pages} 页',
        displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录',
    });
</script>
</body>
</html>
easyui模板页面 不良调查的更多相关文章
- 通用easyui查询页面组件
		
easyui查询页面组件使用指南 本组件开发需求:信息系统的查询页面基本是包括:搜索区域,列表显示区域,按钮条. 1.录入一个查询语句(如:select * from Strudents),录入列表显 ...
 - discuz怎么根据连接知道调用的是什么模板页面
		
其实不怎么难,基本都可以看出discuz是怎么样调用模板页面的 这个是论坛的帖子的列表页,看到url就可以看出是forum目录下的forumdisplay这个模板,forumdisplay.html这 ...
 - 关于aspx模板页面元素路径的问题,以及对模板页面的理解
		
模板页面仅是模板,它不是单独存在的页面,它的路径就是引用它的内容页面的路径. 换句话说,模板页面,只是内容页面上固定的部分. 模板页面引用了的js和CSS,内容页面就不用重新引用了 css ...
 - php tpl 模板页面如和给js文件传参数
		
有一个参数,服务器传给了php 模板页面,但模板包含的js需要得到这个参数值.如何处理: 一,在引入页面前加一句代码 <script type="text/javascript&quo ...
 - 学习ASP.NET Core Razor 编程系列四——Asp.Net Core Razor列表模板页面
		
学习ASP.NET Core Razor 编程系列目录 学习ASP.NET Core Razor 编程系列一 学习ASP.NET Core Razor 编程系列二——添加一个实体 学习ASP.NET ...
 - 学习ASP.NET Core Razor 编程系列五——Asp.Net Core Razor新建模板页面
		
学习ASP.NET Core Razor 编程系列目录 学习ASP.NET Core Razor 编程系列一 学习ASP.NET Core Razor 编程系列二——添加一个实体 学习ASP.NET ...
 - SpringBoot thymeleaf模板页面没提示,SpringBoot thymeleaf模板插件安装
		
SpringBoot thymeleaf模板插件安装 SpringBoot thymeleaf模板Html页面没提示 SpringBoot thymeleaf模板页面没提示 SpringBoot t ...
 - Xamarin XAML语言教程模板页面TemplatedPage
		
Xamarin XAML语言教程模板页面TemplatedPage 模板页面TemplatedPage 在上文中我们提到了TemplatedPage,它被称为模板页面,用来显示控件模版.Templat ...
 - 【php】模板页面展示复选框已选中选项和数据
		
写在最开始: 2)我们这里流程是编辑.修改 已经存储的数据. 1.[修改]功能页面: 2.代码:HTML <dt>民宿设施</dt> <dd><label&g ...
 
随机推荐
- High-Resolution Image Inpainting using Multi-Scale Neural Patch Synthesis
			
论文来源:CVPR 2017 摘要 之前方法的缺点:之前的方法是基于语义和上下文信息的,在填充较大holes的表现得很好,能够捕获更高级的图像特征,但是由于内存限制和难以训练网络的因素,只能处理分辨率 ...
 - Java 关于策略模式+简单工厂模式下的思考
			
导读 最近在做公司一个消息网关的服务,包括:短信.微信.邮件等,所有请求通过一个入口,方便接口的管理(记录日志.接口限流白名单啥的).如何写这个接口呢,还有为了以后扩展,对接过短信.微信.公众号的童鞋 ...
 - LeetCode 040 Combination Sum II
			
题目要求:Combination Sum II Given a collection of candidate numbers (C) and a target number (T), find al ...
 - 【Usaco 2009 Gold】JZOJ2020年9月19日提高B组T4 过路费
			
[Usaco 2009 Gold]JZOJ2020年9月19日提高B组T4 过路费 题目 Description 跟所有人一样,农夫约翰以着宁教我负天下牛,休叫天下牛负我的伟大精神,日日夜夜苦思生财之 ...
 - JZOJ2020年8月12日提高组反思
			
JZOJ2020年8月12日提高组反思 真·难亿一点点 T1 题目长并附带伤害-- 暴力搜 对于字符串,我选择\(Pascal\) T2 概率问题,再见 T3 样例没懂,再见 T4 有史以来见过的条件 ...
 - k8s实验操作记录文档
			
k8s实验操作记录文档,仅供学习参考! 文档以实验操作的过程及内容为主进行记录,涉及少量的介绍性文字(来自网络开源). 仅汇总主题所有链接,详细内容查看需要切换到相关链接.https://github ...
 - Python中判断字符串是否为数字、字母、标识符、浮点数、大小写、可打印的方法
			
1.判断s是否都是大写字母:s.isupper(): 2.判断s是否都是小写字母:s.islower(): 3.判断s中的每个单词首字母是否都是大写字母且其他位置无大写字母:s.istitle(),要 ...
 - DFS,BFS 练习(深搜,广搜,图,leetcode)
			
https://leetcode-cn.com/problems/route-between-nodes-lcci/ 节点间通路.给定有向图,设计一个算法,找出两个节点之间是否存在一条路径. 示例1: ...
 - Panda Global 要点聚焦,区块链在数字医疗的落地应
			
据Panda Global,随着区块链技术影响力的不断扩大,其应用性已涉及更加广泛的领域,不断更新着人们的认知.在区块链技术未介入之前,关于医疗行业和数字经济结合早已不是什么新鲜话题,相关研究不少 但 ...
 - Luogu-P3205-HNOI2010-合唱队
			
题目地址 思路 这道题其实是P3146 [USACO16OPEN]248的升级版,但是N的范围很大,为262144.原先的O(N3)的方法自然会TLE,甚至O(N2)的方法也不足以解决. 定义f[i] ...