var request = getRequest(), 
    fv_id = request.fv_id,
    pro_id = request.pro_id,
    title = request.title,
    fv_class = request.fv_class,
    patiCode = request.patiCode;
    
$(function(){
    var options = $.extend(followupAPI.getPrescriptionListTableAjaxObj, {
        queryParams: queryParams,
        queryParamsType: "limit",
        pagination: true,
        paginationLoop: true,
        sidePagination: 'server',
        pageNumber: 1,
        pageSize: 5,
        responseHandler: function (res) {
            return {
                rows: res.data.list,
                total: res.data.total
            }
        },
        columns: [{
            field: '',
            title:'',
            formatter: function(val, row, index){
                var html = template('prescription_tmp', row);
                return html;
            }
        }],
        onClickRow: function(row, $el){
            document.location.href = "../../jw-prescription-info.html?code="+row.code+"&patient="+patiCode+'&fv_id='+fv_id;
        }
    })
    $("#prescritionInfo").bootstrapTable(options);
    
});

function queryParams(params) {
    return {
        diagnosisCode: fv_class=='1,2' ? 3 : fv_class,
        patient: patiCode,
        page: params.offset/params.limit,
        size: params.limit,
        isRenewal: 2
    };
}
