Exemplo n.º 1
0
def aqiquery():
    db = AQIDatabase()

    if request.method == 'POST':
        conds = {'region': request.form.getlist('city'),
                 'sdate': request.form.get('startpick'),
                 'edate': request.form.get('endpick')}

        region_query = RegionQueryAndSave(db, conds)
        mdata = region_query.data
        filename = region_query.save_temp_file()
        session['filename'] = filename
        return render_template("queryresult.html", header=mdata.get('header'), data=mdata.get('data'))
    return render_template('aqiquery.html', cities=db.city)
Exemplo n.º 2
0
def hospitalquery():
    db = HospitalDatabase()
    province_list = [[id,db.Province_dict[id]]for id in db.provinceid]
    if request.method == 'POST':
        conds = {'region': request.form.getlist('province'),
                 '医院等级': request.form.getlist('hgrade'),
                 '医院类别': request.form.getlist('htype')}
        print(conds)
        region_query = RegionQueryAndSave(db, conds)
        mdata = region_query.data
        print(mdata)
        filename = region_query.save_temp_file()
        session['filename'] = filename
        return render_template("queryresult.html", header=mdata.get('header'), data=mdata.get('data'))
    return render_template('hospitalquery.html',province=province_list,hgrade=db.grade,htype=db.type)
Exemplo n.º 3
0
def provincedataquery():
    # 设置数据
    period = range(1978, 2014)
    db = ProvinceStatisticsDatabase()

    if request.method == 'POST':
        conds = {'region': re.split(',', request.form.getlist('hregion')[0]),
                 'year': request.form.getlist('period'),
                 'variable': request.form.getlist('variable')}

        region_query = RegionQueryAndSave(db, conds)
        mdata = region_query.data
        filename = region_query.save_temp_file()
        session['filename'] = filename
        return render_template("queryresult.html", header=mdata.get('header'), data=mdata.get('data'))
    return render_template("provincedataquery.html", period=period)