<template>
  <div class="main-contain">
    <div class="position">
      <bread-crumb :crumbs="crumbs"></bread-crumb>
    </div>
    <div class="app-container">
      <div class="cell clearfix">
        <label class="title">
          <span class="name">转归状态</span> :
        </label>
        <div class="time">
          <ul class>
            <li
              :class="item.state == stateType ? 'active' : ''"
              @click="selectLapseTo(item.state)"
              v-for="item in month"
              :key="item.value"
            >{{ item.label }}</li>
          </ul>
        </div>
        <el-date-picker
          v-model="listQuery.start_time"
          prefix-icon="el-icon-date"
          @change="changeTime"
          :editable="false"
          style="width: 196px;"
          type="date"
          placeholder="选择日期时间"
          align="right"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          :picker-options="pickerOptions"
        ></el-date-picker>
        <span class>-</span>
        <el-date-picker
          v-model="listQuery.end_time"
          prefix-icon="el-icon-date"
          @change="changeEndTime"
          :editable="false"
          style="width: 196px;"
          type="date"
          placeholder="选择日期时间"
          align="right"
          format="yyyy-MM-dd"
          value-format="yyyy-MM-dd"
          :picker-options="pickerOptions"
        ></el-date-picker>
      </div>
      <div class="cell clearfix" style="align-items:normal">
        <div style="float:left">
          <div class="infoBox">
            <div class="infoOne">
              <div class="titleBox">
                <span class="point"></span>
                <p class="infoTitle">透析总量({{total}}次)</p>
              </div>

              <div class="borderBox">
               <div v-for="(item,index) in modetype" :key="index">
                 <span v-if="item.mode_id == 1">
                    <p>HD:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 2">
                    <p>HDF:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 3">
                    <p>HD+HP:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 4">
                    <p>HP:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 5">
                    <p>HF:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 6">
                    <p>SCUF:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 7">
                    <p>IUF:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 8">
                    <p>HFHD:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 9">
                    <p>HFHD+HP:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 10">
                    <p>PHF:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                   <span v-if="item.mode_id == 11">
                    <p>HFR:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 12">
                    <p>HDF+HP:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.mode_id == 13">
                      <p>HFHD+HP:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                   <span v-if="item.mode_id == 14">
                      <p>腹水回输:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
                   <span v-if="item.mode_id == 15">
                      <p>HD前置换:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                   </span>
                    <span v-if="item.mode_id == 16">
                      <p>HD后置换:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                   </span>
                    <span v-if="item.mode_id == 17">
                      <p>HDF前置换:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                   </span>
                    <span v-if="item.mode_id == 18">
                      <p>HDF后置换:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                   </span>
                   <span v-if="item.mode_id == 19">
                      <p>IUF+HD:{{item.count}}次({{(item.count/total*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/total*100).toFixed(1)"></el-progress>
                  </span>
               </div>
              </div>
            </div>
            <div class="infoOne">
              <div class="titleBox">
                <span class="point2"></span>
                <p class="infoTitle">传染病统计</p>
              </div>
              <div class="borderBox2">
               <div v-for="(item,i) in this.InfectiousList" :key="i">
                 <span v-if="item.disease_id == 2">
                    <p>乙肝:{{item.count}}人({{(item.count/InfectiousTotal*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/InfectiousTotal*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.disease_id == 3">
                    <p>丙肝:{{item.count}}人({{(item.count/InfectiousTotal*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/InfectiousTotal*100).toFixed(1)"></el-progress>
                  </span>
                   <span v-if="item.disease_id == 4">
                    <p>艾滋病:{{item.count}}人({{(item.count/InfectiousTotal*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/InfectiousTotal*100).toFixed(1)"></el-progress>
                  </span>
                  <span v-if="item.disease_id == 5">
                    <p>肺结核:{{item.count}}人({{(item.count/InfectiousTotal*100).toFixed(1)}}%)</p>
                    <el-progress :percentage="(item.count/InfectiousTotal*100).toFixed(1)"></el-progress>
                  </span>
                   <span v-if="item.disease_id == 6">
                      <p>梅毒:{{item.count}}人({{(item.count/InfectiousTotal*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/InfectiousTotal*100).toFixed(1)"></el-progress>
                  </span>
                    <span v-if="item.disease_id == 1">
                      <p>其他:{{item.count}}人({{((item.count)/InfectiousTotal*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="((item.count)/InfectiousTotal*100).toFixed(1)"></el-progress>
                  </span>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div style="float:left">
          <div class="infoBox">
            <div class="infoOne">
              <div class="titleBox">
                <span class="point1"></span>
                <p class="infoTitle">转归统计(总人数{{patientCount}}人)</p>
              </div>
              <div class="borderBox1">
                <p>留治:{{rollOutTotal}}人({{(rollOutTotal/patientCount*100).toFixed(1)}}%)</p>
                <el-progress :percentage="(rollOutTotal/patientCount*100).toFixed(1)"></el-progress>
                <p>转出:{{outTotal}}人({{(outTotal/patientCount*100).toFixed(1)}}%)</p>
                <el-progress :percentage="(outTotal/patientCount*100).toFixed(1)"></el-progress>
              </div>
            </div>
            <div class="infoOne">
              <div class="titleBox">
                <span class="point2"></span>
                <p class="infoTitle">男女比例</p>
              </div>
              <div class="borderBox2">
                <p>男:{{totalMan}}人({{(totalMan/totalGender*100).toFixed(1)}}%)</p>
                <el-progress :percentage="(totalMan/totalGender*100).toFixed(1)"></el-progress>
                <p>女:{{totalWoman}}人({{(totalWoman/totalGender*100).toFixed(1)}}%)</p>
                <el-progress :percentage="(totalWoman/totalGender*100).toFixed(1)"></el-progress>
              </div>
            </div>
            <div class="infoOne">
              <div class="titleBox">
                <span class="point"></span>
                <p class="infoTitle">年龄统计</p>
              </div>
              <div class="borderBox">
                <div v-for="(item,j) in ageCount" :key="j">
                    <span v-if="item.age == 20">
                     <p>年龄≤20:{{item.count}}人({{(item.count/ageTotal*100).toFixed(1)}}%)</p>
                     <el-progress :percentage="(item.count/ageTotal*100).toFixed(1)"></el-progress>
                    </span>
                   <span v-if="item.age == 40">
                      <p>20&lt;年龄≤40:{{item.count}}人({{(item.count/ageTotal*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/ageTotal*100).toFixed(1)"></el-progress>
                    </span>
                    <span v-if="item.age == 60">
                      <p>40&lt;年龄≤60:{{item.count}}人({{(item.count/ageTotal*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/ageTotal*100).toFixed(1)"></el-progress>
                    </span>
                    <span v-if="item.age == 80">
                     <p>60&lt;年龄≤80:{{item.count}}人({{(item.count/ageTotal*100).toFixed(1)}}%)</p>
                     <el-progress :percentage="(item.count/ageTotal*100).toFixed(1)"></el-progress>
                    </span>
                    <span v-if="item.age ==150">
                      <p>大于80:{{item.count}}人({{(item.count/ageTotal*100).toFixed(1)}}%)</p>
                      <el-progress :percentage="(item.count/ageTotal*100).toFixed(1)"></el-progress>
                    </span>
                </div>
              </div>
            </div>
            <div class="infoOne">
              <div class="titleBox">
                <span class="point1"></span>
                <p class="infoTitle">透龄统计</p>
              </div>
              <div class="borderBox1">
                <div v-for="(item,index) in dialysisAge" :key="index">
                 <span v-if="item.age== 1">
                  <p>透析龄≤12:{{item.count}}人({{(item.count/patientCount*100).toFixed(1)}}%)</p>
                  <el-progress :percentage="(item.count/patientCount*100).toFixed(1)"></el-progress>
                </span>
                <span v-if="item.age == 2">
                  <p>12&lt;透析龄≤36:{{item.count}}人({{(item.count/patientCount*100).toFixed(1)}}%)</p>
                 <el-progress :percentage="(item.count/patientCount*100).toFixed(1)"></el-progress>
                </span>
                <span v-if="item.age == 3">
                   <p>36≤透析龄≤60:{{item.count}}/人({{(item.count/patientCount*100).toFixed(1)}}%)</p>
                   <el-progress :percentage="(item.count/patientCount*100).toFixed(1)"></el-progress>
                </span>
                <span v-if="item.age == 4">
                   透析龄 ≥60:{{item.count}}人({{((item.count)/patientCount*100).toFixed(1)}}%)
                   <el-progress :percentage="((item.count)/patientCount*100).toFixed(1)"></el-progress>
                </span>
               </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>



<script>
const moment = require('moment')
import { GetOICData } from "@/api/qcd";
import PieChart from "../qcd/components/BarChart";
import { uParseTime } from "@/utils/tools";
import BreadCrumb from "@/xt_pages/components/bread-crumb";
import {getDialysisModeType,getTotalLapseCount,getTotalSexCount,getTotalInfectiousCount,getTotalAgeCount,getTotalDialysisCount} from "@/api/common/common"
export default {
  name: "dialysisTotal",
  components: {
    PieChart,
    BreadCrumb
  },
  data() {
    return {
       pickerOptions: {
        disabledDate(time) {
          let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
          return time.getTime() > Date.now() || time.getTime() < threeMonths;;
        }
      }, 
      crumbs: [
        { path: false, name: "质控管理" },
        { path: false, name: "基本信息统计" }
      ],
      listQuery: {
        start_time: "",
        end_time: "",
        page: 1,
        limit: 10
      },
      stateType: 0,
      month: [
        { value: 0, label: "本月", state: 0 },
        { value: 1, label: "近三个月", state: 1 },
        { value: 2, label: "近半年", state: 2 },
        { value: 3, label: "近一年", state: 3 },
        { value:4,label:"自定义",state:4}
      ],
      modetype:[],
      total:0,
      patientCount:0,
      rollOut:0,
      RetentionCount:0,
      totalMan:0,
      totalWoman:0,
      totalGender:0,
      InfectiousList:[],
      InfectiousTotal:0,
      ageCount:[],
      ageTotal:0,
      otherTotal:0,
      totalone:0,
      totaltwo:0,
      totalthree:0,
      rollOutTotal:0,
      outTotal:0,
      dialysisAge:[],
    };
  },
  methods: {
    getTimestamp(time) {
      // 把时间日期转成时间戳
      return new Date(time).getTime() / 1000;
    },
    changeTime(val) {
       this.stateType = 4
       var timeStar=Date.parse(val)/1000
       var timeEnd =Date.parse(this.listQuery.end_time)/1000
      var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
      if (time > 0) {
        this.$message.error("结束时间不能小于开始时间");
        this.start_time = "";
      } else {
         //统计透析总量
        this.getDialysisModeType(val,this.listQuery.end_time)
        //统计转归状态
        this.getTotalLapseCount(timeStar,timeEnd)
        //统计男女比例
        this.getTotalSexCount(timeStar,timeEnd)
        //统计传染病
        this.getTotalInfectiousCount(timeStar,timeEnd)
        //统计年龄
        this.getTotalAgeCount(timeStar,timeEnd)
        //统计透析年龄
        this.getTotalDialysisCount(timeStar,timeEnd)
      }
    },
    changeEndTime(val) {
       this.stateType = 4
       var timeEnd=Date.parse(val)/1000
       var timeStar =Date.parse(this.listQuery.start_time)/1000
      var time =
        this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
      if (time < 0) {
        this.$message.error("结束时间不能小于开始时间");
        this.listQuery.end_time = "";
      } else {
          //统计透析总量
        this.getDialysisModeType(this.listQuery.start_time,val)
        //统计转归状态
        this.getTotalLapseCount(timeStar,timeEnd)
        //统计男女比例
        this.getTotalSexCount(timeStar,timeEnd)
        //统计传染病
        this.getTotalInfectiousCount(timeStar,timeEnd)
        //统计年龄
        this.getTotalAgeCount(timeStar,timeEnd)
        //统计透析年龄
        this.getTotalDialysisCount(timeStar,timeEnd)
      }
    },
    selectLapseTo(state) {
      this.stateType = state;
      this.listQuery.state = state;
      //获取本月当前机构的透析模式
      const startDate = moment().subtract('month', 0).format('YYYY-MM') + '-01'
    //  console.log("开始时间",startDate)
      const endDate = moment(new Date()).format('YYYY-MM-DD')
     // console.log("结束时间",endDate)
      var now = new Date()
      var nowMonth = now.getMonth(); //当前月
      var nowYear = now.getFullYear(); //当前年
      //本月的开始时间
      var monthStartDate = new Date(nowYear, nowMonth, 1);
      var timeStar=Date.parse(monthStartDate)/1000;//s
     // console.log("本月第一天",timeStar)
      //本月的结束时间
      var monthEndDate = new Date(nowYear, nowMonth+1, 0);
      var timeEnd=Date.parse(monthEndDate)/1000-1;//s
     // console.log("本月最后一天",timeEnd)
      //本月
      if(state == 0){
       //统计透析总量
        this.getDialysisModeType(startDate,endDate)
        //统计转归状态
        this.getTotalLapseCount(timeStar,timeEnd)
        //统计男女比例
        this.getTotalSexCount(timeStar,timeEnd)
        //统计传染病
        this.getTotalInfectiousCount(timeStar,timeEnd)
        //统计年龄
        this.getTotalAgeCount(timeStar,timeEnd)
        //统计透析年龄
        this.getTotalDialysisCount(timeStar,timeEnd)
      }
      //近三月
      if(state == 1){
        const startDate = moment().subtract('month', 3).format('YYYY-MM-DD')
        console.log("三月前",startDate)
        var startunitx = Date.parse(startDate)/1000
        console.log("开始时间搓",startunitx)
        const endDate = moment(new Date()).format('YYYY-MM-DD')
        console.log("结束时间",endDate)
         var endunitx = Date.parse(endDate)/1000
        console.log("日期时间搓",endunitx)
         //统计透析总量
        this.getDialysisModeType(startDate,endDate)
         //统计转归状态
        this.getTotalLapseCount(startunitx,endunitx)
        //统计男女比例
        this.getTotalSexCount(startunitx,endunitx)
        //统计传染病
        this.getTotalInfectiousCount(startunitx,endunitx)
        //统计年龄
        this.getTotalAgeCount(startunitx,endunitx)
        //统计透析年龄
        this.getTotalDialysisCount(startunitx,endunitx)
      }

     //近半年
     if(state == 2){
        const startDate = moment().subtract('month', 6).format('YYYY-MM-DD')
        console.log("6月前",startDate)
        var startunitx = Date.parse(startDate)/1000
        console.log("开始时间搓",startunitx)
        const endDate = moment(new Date()).format('YYYY-MM-DD')
        console.log("结束时间",endDate)
         var endunitx = Date.parse(endDate)/1000
        console.log("日期时间搓",endunitx)
         //统计透析总量
        this.getDialysisModeType(startDate,endDate)
         //统计转归状态
        this.getTotalLapseCount(startunitx,endunitx)
        //统计男女比例
        this.getTotalSexCount(startunitx,endunitx)
        //统计传染病
        this.getTotalInfectiousCount(startunitx,endunitx)
        //统计年龄
        this.getTotalAgeCount(startunitx,endunitx)
        //统计透析年龄
        this.getTotalDialysisCount(startunitx,endunitx)
     }

     //近一年
     if(state == 3){
        const startDate = moment().subtract('month', 12).format('YYYY-MM-DD')
        console.log("6月前",startDate)
        var startunitx = Date.parse(startDate)/1000
        console.log("开始时间搓",startunitx)
        const endDate = moment(new Date()).format('YYYY-MM-DD')
        console.log("结束时间",endDate)
         var endunitx = Date.parse(endDate)/1000
        console.log("日期时间搓",endunitx)
         //统计透析总量
        this.getDialysisModeType(startDate,endDate)
         //统计转归状态
        this.getTotalLapseCount(startunitx,endunitx)
        //统计男女比例
        this.getTotalSexCount(startunitx,endunitx)
        //统计传染病
        this.getTotalInfectiousCount(startunitx,endunitx)
        //统计年龄
        this.getTotalAgeCount(startunitx,endunitx)
        //统计透析年龄
        this.getTotalDialysisCount(startunitx,endunitx)
     }
   
 

    },
    getDialysisModeType(startDate,endDate){
      getDialysisModeType(startDate,endDate).then(response=>{
         if(response.data.state == 1){
          var modetype =  response.data.data.modetype
            var total =  response.data.data.total
            console.log("total",total)
            this.total = total
           this.modetype = modetype
           console.log("modetype",modetype)

         }
      })
    },
    //统计转归
    getTotalLapseCount(startDate,endDate){
      getTotalLapseCount(startDate,endDate).then(response=>{
         if(response.data.state == 1){
          var patients =  response.data.data.patients
          this.rollOutTotal = patients.length
          console.log("留治病人长度",patients.length)
          var patienttwo = response.data.data.patienttwo
          this.outTotal = patienttwo.length
            console.log("转出长度", this.outTotal)
          var count = response.data.data.count
          this.patientCount = count
         }
      })
    },
    //统计男女比例
    getTotalSexCount(timeStar,timeEnd){
      getTotalSexCount(timeStar,timeEnd).then(response=>{
        if(response.data.state === 1){
          var total = response.data.data.total
        //  console.log("总人数",total)
          this.totalGender = total
          var totalMan = response.data.data.totalSex
       //  console.log("男人",totalMan)
          this.totalMan = totalMan
          var totalWoman = total - totalMan
          this.totalWoman = totalWoman
        }
      })
    },
    //统计传染病
    getTotalInfectiousCount(timeStar,timeEnd){
       getTotalInfectiousCount(timeStar,timeEnd).then(response=>{
           if(response.data.state === 1){
             this.InfectiousTotal = response.data.data.total
             console.log("===",this.InfectiousTotal)
             var infectious = response.data.data.count
             console.log("infectious",infectious)
             var otherTotal = response.data.data.otherTotal
             console.log("otherTotal",otherTotal)
             this.otherTotal = otherTotal
              var arr = [
                {count:0,disease_id:2},
                {count:0,disease_id:3},
                {count:0,disease_id:4},
                {count:0,disease_id:5},
                {count:0,disease_id:6},
              ]
             if(infectious.length == 0){
                this.InfectiousList = arr
                return false
                
             }
             this.InfectiousList = infectious
            
           }
       })
    },
    getTotalAgeCount(timeStar,timeEnd){
      getTotalAgeCount(timeStar,timeEnd).then(response=>{
         if(response.data.state == 1){
          var ageCount =  response.data.data.ageCount
          console.log("ageCount",ageCount)
          var arr = []
          arr =  ageCount.sort(this.compare('age'))
          this.ageCount = arr
          this.ageTotal =  response.data.data.total

         }
      })
    },
     compare:function (k) {
          return function (a, b) {
              var M = a[k];
              var N = b[k];
              return M - N;      // 从低向高排
              // return N - M;   // 从高向低排
          }
      },
    //统计透析年龄
    getTotalDialysisCount(timeStar,timeEnd){
      //  const endDate = moment(new Date()).format('YYYY-MM-DD')
      //  console.log("结束时间",endDate)
      //  var end = Date.parse(endDate)/1000
      //  console.log("end",end)
      //  const startDate = moment().subtract('month', 144).format('YYYY-MM-DD')
      //  var twStart = Date.parse(startDate)/1000
      //  console.log("12年前",twStart)
      // const start = moment().subtract('month', 432).format('YYYY-MM-DD')
      // console.log("start",start)
      //  var sixStart = Date.parse(start)/1000
      //  console.log("36年前",sixStart)
      //  const sevnstart = moment().subtract('month', 720).format('YYYY-MM-DD')
      //  var sevenStart = Date.parse(sevnstart)/1000
      //  console.log("60年前",sevenStart)
      getTotalDialysisCount(timeStar,timeEnd).then(response=>{
         if(response.data.state == 1){
           var dataage =  response.data.data.dataage
           console.log("dataage",dataage)
           this.dialysisAge = dataage

         }
      })
    }
  },
  created() {
        //获取本月当前机构的透析模式
      const startDate = moment().subtract('month', 0).format('YYYY-MM') + '-01'
      console.log("开始时间",startDate)
      const endDate = moment(new Date()).format('YYYY-MM-DD')
     // console.log("结束时间",endDate)
      var now = new Date()
      var nowMonth = now.getMonth(); //当前月
      var nowYear = now.getFullYear(); //当前年
      //本月的开始时间
      var monthStartDate = new Date(nowYear, nowMonth, 1);
      var timeStar=Date.parse(monthStartDate)/1000;//s
     // console.log("本月第一天",timeStar)
      //本月的结束时间
      var monthEndDate = new Date(nowYear, nowMonth+1, 0);
      var timeEnd=Date.parse(monthEndDate)/1000-1;//s
     // console.log("本月最后一天",timeEnd)
      //统计透析总量
      this.getDialysisModeType(startDate,endDate)
      //统计转归状态
      this.getTotalLapseCount(timeStar,timeEnd)
      //统计男女比例
      this.getTotalSexCount(timeStar,timeEnd)
      //统计传染病
      this.getTotalInfectiousCount(timeStar,timeEnd)
      //统计年龄
      this.getTotalAgeCount(timeStar,timeEnd)
      //统计透析年龄
      this.getTotalDialysisCount(timeStar,timeEnd)
  },
};
</script>

 <style rel="stylesheet/scss" lang="scss" scoped>
.infoBox {
  display: flex;
  flex-wrap: wrap;
  .infoOne {
    margin-right: 30px;
    margin-top: 30px;
    .titleBox {
      display: flex;
      align-items: center;
    }
    .point {
      display: inline-block;
      width: 7px;
      height: 7px;
      background: linear-gradient(
        90deg,
        rgba(169, 224, 243, 1),
        rgba(159, 189, 252, 1)
      );
      border-radius: 50%;
    }
    .point1 {
      width: 7px;
      height: 7px;
      background: linear-gradient(
        90deg,
        rgba(255, 215, 192, 1),
        rgba(255, 153, 148, 1)
      );
      border-radius: 50%;
    }
    .point2 {
      width: 7px;
      height: 7px;
      background: linear-gradient(
        90deg,
        rgba(215, 195, 253, 1),
        rgba(179, 168, 247, 1)
      );
      border-radius: 50%;
    }
    .infoTitle {
      font-size: 16px;
      font-weight: bold;
      margin-left: 5px;
      color: #000;
    }
    .borderBox {
      width: 340px;
      min-height: 140px;
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(229, 229, 229, 1);
      border-radius: 10px;
      padding: 0 14px 20px;
      margin-top: 10px;
      p {
        font-size: 14px;
        color: #000;
        margin: 10px 0 3px;
      }
    }
    .borderBox1 {
      width: 340px;
      min-height: 140px;
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(229, 229, 229, 1);
      border-radius: 10px;
      padding: 0 14px 20px;
      margin-top: 10px;
      p {
        font-size: 14px;
        color: #000;
        margin: 10px 0 3px;
      }
    }
    .borderBox2 {
      width: 340px;
      min-height: 140px;
      background: rgba(255, 255, 255, 1);
      border: 1px solid rgba(229, 229, 229, 1);
      border-radius: 10px;
      padding: 0 14px 20px;
      margin-top: 10px;
      p {
        font-size: 14px;
        color: #000;
        margin: 10px 0 3px;
      }
    }
  }
}
</style>

<style lang="scss">
.infoBox {
  .infoOne {
    .borderBox {
      .el-progress-bar__inner {
        background: linear-gradient(
          90deg,
          rgba(169, 224, 243, 1),
          rgba(159, 189, 252, 1)
        );
      }
      .el-progress-bar{
        margin-right: -59px;
        padding-right: 60px;
      }
    }
    .borderBox1 {
      .el-progress-bar__inner {
        background: linear-gradient(
          90deg,
          rgba(255, 215, 192, 1),
          rgba(255, 153, 148, 1)
        );
      }
      .el-progress-bar{
        margin-right: -59px;
        padding-right: 60px;
      }
    }
    .borderBox2 {
      .el-progress-bar__inner {
        background: linear-gradient(
          90deg,
          rgba(215, 195, 253, 1),
          rgba(179, 168, 247, 1)
        );
      }
      .el-progress-bar{
        margin-right: -59px;
        padding-right: 60px;
      }
    }
  }
}
</style>


