var request = getRequest(),
    patient = request.patient,
    totalCount = 0;

$(function(){
    getList();
});

function getList(isRefresh){
    var options = $.extend(janchaAPI.getListTableAjaxObj, {
        queryParams: queryParams,
        queryParamsType: "limit",
        pagination: true,
        paginationLoop: true,
        sidePagination: 'server',
        pageNumber: 1,
        pageSize: 15,
        responseHandler: function (res) {
            return {
                rows: res.data,
                total: res.data.length
            }
        },
        columns: [{
            field: '',
            title:'',
            formatter: function(val, row, index){
                var html = template('info_tmp', row);
                return html;
            }
        },{
            field: 'eventDate',
            title: '申请时间',
            class: 'c-999 pr20',
            align: 'right',
            formatter: function(val, row, index){
                return '<span class="pr10">'+val+'</span>';
            }
        }],
        onClickRow: function(row, $el){
        	window.localStorage.setItem('checkRow', JSON.stringify(row));
        	if(row.dataFrom == 2) {// json格式
            	document.location.href = "jiuzhenxiangqing.html?patient="+patient;
          	} else {// xml格式：来源基卫
          		document.location.href = "jianchajianyan-detail.html?patient="+patient;
          	}
       	}
    })
    $("#prescriptTable").bootstrapTable(options);
}

function queryParams(params) {
    return {
        page: params.offset/params.limit + 1,
        pageSize: params.limit,
        patient: patient
    };
}