diff --git a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc index ed3d187..22c4966 100644 Binary files a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc and b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc differ diff --git a/数据分析和可视化/新冠疫情/hello.py b/数据分析和可视化/新冠疫情/hello.py index 4322941..a3ed7ef 100644 --- a/数据分析和可视化/新冠疫情/hello.py +++ b/数据分析和可视化/新冠疫情/hello.py @@ -37,31 +37,43 @@ def chinasummary(): diedRelative=results[16],updateTime=nowtime,area=[x[0] for x in provinces], proconfirmed=[x[1] for x in provinces],suspect=results[5],suspectRelative=results[6], top5province=[x[0] for x in top5data],top5confirmed=[x[1] for x in top5data], - asymptomacNum=[x[1] for x in asymp],asymptomaticArea=[x[0] for x in asymp]) + asymptomacNum=[x[1] for x in asymp],asymptomaticArea=[x[0] for x in asymp], + proconfirmedRelative=[x[2] for x in provinces],prodied=[x[3] for x in provinces]) return data -@app.route("/gloabalInfo/",methods=['POST']) +@app.route("/globalInfo/",methods=['POST']) def GlobalInfomation(): - print('----------------------------------') + nowtime=time.strftime('%Y-%m-%d',time.localtime(time.time())) db = GetFromDB() - results=db.searchForeignInformation('2020-08-10') + results=db.searchForeignInformation(nowtime) #由于查询到的数据中没有中国的信息,因此需要查询中国的信息加到世界信息中 country = [x[3] for x in results] country.append("中国") confirmed = [x[0] for x in results] confirmed.append(db.searchSummaryChina('2020-08-10')[0][1]) + + summaryData=db.querySummaryForeign(nowtime)[0] data=jsonify(country=country, confirmed=confirmed,died=[x[1] for x in results], - crued=[x[2] for x in results],curConfirm=[x[4] for x in results],confirmedRelative=[x[5] for x in results]) + crued=[x[2] for x in results],curConfirm=[x[4] for x in results], + confirmedRelative=[x[5] for x in results],updateTime=nowtime, + TotalConfirmed=summaryData[1],TotalCurConfirm=summaryData[2], + TotalconfirmRelative=summaryData[3],TotalCrued=summaryData[4], + TotalDied=summaryData[6],TotalDiedRelative=summaryData[7], + TotalCruedRelative=summaryData[5],TotalcurConfirmRelative=summaryData[9]) return data @app.route("/") def hello(): - return render_template('index.html') + return render_template('/index.html') + +@app.route("/index") +def helloindex(): + return render_template('/index.html') @app.route("/foreign/") def foreign(): - return render_template('index.html') + return render_template('foreign.html') @app.route("/fanghu/") def hello1(): diff --git a/数据分析和可视化/新冠疫情/models.py b/数据分析和可视化/新冠疫情/models.py index 91a18b8..2c717e3 100644 --- a/数据分析和可视化/新冠疫情/models.py +++ b/数据分析和可视化/新冠疫情/models.py @@ -41,7 +41,7 @@ class GetFromDB(): #查询各省的确诊人数 def searchProvinceConfirmed(self,date): thedate = date + "%" - sql='select area,confirmed from ProvinceTable where pub_date like "%s"'%(thedate) + sql='select area,confirmed,confirmedRelative,died from ProvinceTable where pub_date like "%s"'%(thedate) self.cursor.execute(sql) return self.cursor.fetchall() @@ -60,4 +60,23 @@ class GetFromDB(): self.cursor.execute(sql) return self.cursor.fetchall() + #查询世界各国的疫情信息 + def query_foreignInfo(self,date): + thedate=date+"%" + sql='select * from ForeignCountry where pub_date like "%s"'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() + + def querySummaryForeign(self,date): + thedate=date+"%" + sql='select * from OutsideChina where updateTime like "%s"'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() + + #新增国家top10 + def query_top10(self,date): + thedate=date+"%" + sql='select confirmed,confirmedRelative from ForeignCountry where pub_date like "%s" order by confirmed desc limit 10'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() diff --git a/数据分析和可视化/新冠疫情/static/css/index.css b/数据分析和可视化/新冠疫情/static/css/index.css index fa0a83c..213e7c7 100644 --- a/数据分析和可视化/新冠疫情/static/css/index.css +++ b/数据分析和可视化/新冠疫情/static/css/index.css @@ -50,7 +50,7 @@ li{list-style:none;} } .top .logo_text .content { - + height:100%; text-align:center; } @@ -141,7 +141,7 @@ li{list-style:none;} font-size:0.25rem; background: #fff; color:rgb(56, 128, 220); - + } .middle_con .wrap .tabs .tabs_wrap span.sty { background:rgb(56, 128, 220); @@ -156,6 +156,7 @@ li{list-style:none;} .middle_con .wrap .tabs_content .tabs_list { width:92%; + display: none; position: absolute; top: 0; left: 0; @@ -168,7 +169,6 @@ li{list-style:none;} font-size:0.25rem; } - /* detail4 */ .tabs_list.gailan .detail4 { height:1.4rem; @@ -179,15 +179,12 @@ li{list-style:none;} border-bottom: 1px solid #dfdddd; margin-top:0.2rem; } - .tabs_list.gailan .detail4 .list4 p { text-align:center; } - .tabs_list.gailan .detail4 .list4 .num{ font-size:0.45rem; } - .tabs_list.gailan .detail4 .list4 .color1 { color:rgb(234, 51, 35); } @@ -255,27 +252,16 @@ li{list-style:none;} } .table_pro .title span.t_area{ - width:20%; + width:40%; background:rgb(227, 231, 243); } .table_pro .title span.t_confirm { - width:20%; background: rgb(243, 186, 176); } .table_pro .title span.t_dead { - width:20%; background: rgb(180, 192, 213); } .table_pro .title span.t_heal { - width:20%; - background: rgb(102, 204, 153); - } - .table_pro .title span.t_add { - width:10%; - background: rgb(102, 104, 100); - } - .table_pro .title span.t_all { - width:10%; background: rgb(102, 204, 153); } .table_pro .content { @@ -315,7 +301,7 @@ li{list-style:none;} width:100%; /* height:0.6rem; */ display:none; - + } .table_pro .content .c_line .line_hide .hide_content{ width:100%; @@ -344,7 +330,14 @@ li{list-style:none;} transform: rotate(90deg); } + /* 最新动态 */ + .tabs_list.dongtai { + width:100%; + } + .tabs_list.dongtai .main{ + width:100%; + } .cbp_tmtimeline { margin: 0; padding: 0; diff --git a/数据分析和可视化/新冠疫情/static/js/update.js b/数据分析和可视化/新冠疫情/static/js/update.js index 8b13789..d940037 100644 --- a/数据分析和可视化/新冠疫情/static/js/update.js +++ b/数据分析和可视化/新冠疫情/static/js/update.js @@ -1 +1,20 @@ - +console.log('----------------------------update'); +function eachchina(province,confirmed,curconfirm,died) { + var str = ''; + if (province.length!=0) { + for (var i = 0, len = province.length; i < len; i++) { + str += `
  • +
    + + `; + str += `
    ` + province[i] + `
    `; + str += `
    `; + str += `` + confirmed[i] + ``; + str += `` + curconfirm[i] + ``; + str += `` + died[i] + ``; + str += `
    `; + str += `
  • `; + } + return str; + } +} \ No newline at end of file diff --git a/数据分析和可视化/新冠疫情/templates/foreign.html b/数据分析和可视化/新冠疫情/templates/foreign.html index 08487ff..34416a9 100644 --- a/数据分析和可视化/新冠疫情/templates/foreign.html +++ b/数据分析和可视化/新冠疫情/templates/foreign.html @@ -1,21 +1,94 @@ -{% extends 'base1.html' %} -{% block title %}国外疫情{% endblock %} + + + + -{%block page%} + + + + + + + + 国外实时疫情 + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + +
    +
    +
    +
    + +
    +
    + + 第三组生产实习 + +
    + + + +
    +
    + + 国内疫情 + 国外疫情 + 防护知识 + +
    + +
    +
    +
    +
    -

    截止2020-02-02 11:52全国数据统计

    +

    截止2020-02-02 11:52统计

    -

    较昨日+110

    +

    较昨日

    0

    确诊病例
    -

    较昨日110

    +

    较昨日+110

    0

    现存确诊
    @@ -29,20 +102,15 @@

    0

    治愈人数
    -
    -

    较昨日+110

    -

    0

    -
    疑似病例
    -
    -   全国累计确诊 +   累计确诊
    -
    +
    @@ -66,57 +134,32 @@
    -   全国数据统计 +   全球各国数据统计
    地区 - 确诊 - 死亡 - 治愈 -
    -
      -
    -
    - - -
    -
    - -   海外数据统计 -
    -
    -
    -
    - 地区 - 确诊 - 死亡 - 治愈 + 累计确诊 + 新增 + 死亡
      -
    - -
    - -
    -
    -
      - -
    -
    +
    +
    +
    +
    -{% endblock%} +
    -{% block mainscript %} + + + + + + + -{% endblock %} + + diff --git a/数据分析和可视化/新冠疫情/templates/global.html b/数据分析和可视化/新冠疫情/templates/global.html index bc485d4..84b1a5b 100644 --- a/数据分析和可视化/新冠疫情/templates/global.html +++ b/数据分析和可视化/新冠疫情/templates/global.html @@ -268,7 +268,7 @@ dataRange:{ $.ajax({ cache:false, data:[], - url:'/gloabalInfo', + url:'/globalInfo', type:'POST', async:false, error:function(request){ diff --git a/数据分析和可视化/新冠疫情/templates/index.html b/数据分析和可视化/新冠疫情/templates/index.html index 884b575..39d58dc 100644 --- a/数据分析和可视化/新冠疫情/templates/index.html +++ b/数据分析和可视化/新冠疫情/templates/index.html @@ -335,6 +335,26 @@ sympoption={ }] }; +function eachchina(province,confirmed,curconfirm,died) { + var str = ''; + if (province.length!=0) { + for (var i = 0, len = province.length; i < len; i++) { + str += `
  • +
    + + `; + str += `
    ` + province[i] + `
    `; + str += `
    `; + str += `` + confirmed[i] + ``; + str += `` + curconfirm[i] + ``; + str += `` + died[i] + ``; + str += `
    `; + str += `
  • `; + } + return str; + } +} + $.ajax({ cache:false, type:'POST', @@ -363,6 +383,9 @@ $.ajax({ } top5province=results.top5province; top5confirmed=results.top5confirmed; + proconfirmedRelative=results.proconfirmedRelative; + prodied=results.prodied; + for(i=0;i + + + + + + + +