WXL (wul)
8 天以前 99e0d3781cedebda6b8598a083a078a53fd313a9
src/views/index.vue
@@ -7,49 +7,49 @@
          <!-- 就诊统计盒子 -->
          <div class="grid-content bg-purple headerBox bgc1">
            <div class="title">
              患者统计<span
              门诊服务<span
                style="
                  font-size: 25px;
                  font-weight: 600;
                  text-shadow: 2px 4px 7px rgb(85 132 255 / 50%);
                  color: black;
                "
                >12322 (人)</span
              >
              ></span>
              <span>{{ endatd }} ~ {{ statd }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="8">
              <el-col :span="10">
                <div class="home-user-task-stats">
                  <p>{{ 11231 }}</p>
                  <p>{{ OutpatientData.rc }}</p>
                  <p>{{ OutpatientData.rc }}</p>
                  <div class="text-color2">
                    <p>门诊总数(人)</p>
                    <p>门诊就诊量(人次)</p>
                  </div>
                </div>
              </el-col>
              <el-col :span="7">
              <el-col :span="10">
                <div class="home-user-task-stats">
                  <p>{{ 9207 }}</p>
                  <p>{{ OutpatientData.rs }}</p>
                  <div class="text-color2">
                    <p>住院总数(人)</p>
                    <p>门诊服务量(人次)</p>
                  </div>
                </div>
              </el-col>
              <el-col :span="7">
              <!-- <el-col :span="7">
                <div class="home-user-task-stats">
                  <p>{{ 1209 }}</p>
                  <div class="text-color2">
                    <p>体检总数(人)</p>
                  </div>
                </div>
              </el-col>
              </el-col> -->
            </el-row>
          </div>
        </el-col>
        <el-col :span="9">
          <div class="grid-content bg-purple headerBox bgc2">
            <div class="title">
              门诊服务总数
              出院服务
              <span
                style="
                  font-size: 25px;
@@ -57,24 +57,23 @@
                  font-weight: 600;
                  color: red;
                "
                >12322 (人)</span
              >
              ></span>
              <span>{{ endatd }} ~ {{ statd }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="12">
              <el-col :span="10">
                <div class="home-user-task-stats">
                  <p style="color: red">{{ 3453 }}</p>
                  <p style="color: red">{{ DischargeData.rc }}</p>
                </div>
                <div class="text-color2">
                  <p>住院服务人数</p>
                  <p>出院就诊量(人次)</p>
                </div>
              </el-col>
              <el-col :span="12">
              <el-col :span="10">
                <div class="home-user-task-stats">
                  <p style="color: red">{{ 4213 }}</p>
                  <p style="color: red">{{ DischargeData.rs }}</p>
                  <div class="text-color2">
                    <p>体检服务人数</p>
                    <p>出院服务量(人次)</p>
                  </div>
                </div>
              </el-col>
@@ -88,7 +87,7 @@
          <!-- echars数据可视化 -->
          <div class="grid-content bg-purple" style="min-height: 365px">
            <div class="title">
              就诊统计
              服务统计
              <span>{{ endatd }} ~ {{ statd }}</span>
              <el-radio-group
                v-model="radio1"
@@ -96,29 +95,43 @@
                style="margin-left: 390px"
                @change="changes"
              >
                <el-radio-button label="周" @click="dyat = 7"></el-radio-button>
                <el-radio-button
                  label="月"
                  @click="dyat = 30"
                  label="近一周"
                  @click="dyat = 7"
                ></el-radio-button>
                <el-radio-button
                  label="年"
                  @click="dyat = 360"
                  label="近一月"
                  @click="dyat = 31"
                ></el-radio-button>
                <el-radio-button
                  label="近一年"
                  @click="dyat = 365"
                ></el-radio-button>
                <el-radio-button label="自定义">
                  <el-date-picker
                    v-if="radio1 === '自定义'"
                    v-model="customDateRange"
                    type="daterange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    value-format="yyyy-MM-dd"
                    @change="handleCustomDateChange"
                  ></el-date-picker>
                </el-radio-button>
              </el-radio-group>
            </div>
            <!-- 中间echars -->
            <!-- 中部线性柱状图 -->
            <div class="boxEchars">
              <div class="echars1" id="echars"></div>
              <div class="echars2" id="echars2"></div>
            </div>
          </div>
        </el-col>
        <!-- 中间和右边 -->
        <!-- 右边列表 -->
        <el-col :span="4" class="aside">
          <div class="grid-content bg-purple" style="margin-top: -180px">
            <div class="title">
              健康宣教
              科室服务量
              <span>{{ endatd }} ~ {{ statd }}</span>
            </div>
            <div style="max-height: 690px; width: 100%; overflow: auto">
@@ -131,14 +144,13 @@
                  type="index"
                ></el-table-column>
                <el-table-column
                  prop="skuName"
                  prop="deptname"
                  width="88"
                  class-name="name"
                ></el-table-column>
                <el-table-column prop="count" class-name="count">
                  <template slot-scope="scope">
                    {{ scope.row.count }}次
                  </template>
                <el-table-column prop="rc" class-name="rc">
                  <template slot-scope="scope"> {{ scope.row.rc }}次 </template>
                </el-table-column>
              </el-table>
            </div>
@@ -147,27 +159,19 @@
      </el-row>
      <!-- 底部一个 -->
      <el-row :gutter="20" style="margin-bottom: 20px">
        <el-col :span="13">
        <el-col :span="24">
          <div class="grid-content bg-purple" style="min-height: 300px">
            <div class="title">
              诊后统计
              宣教统计
              <span class="el-icon-s-unfold moreIcon"></span>
            </div>
            <div class="cooperate">
              <!-- 合作区域 -->
              <div class="pieChart" id="pieCharts"></div>
              <div class="Points">
                <p>{{ 122 }}</p>
                <span>其中随访干预人次</span>
                <p>{{ 122 }}</p>
                <span>门诊随访</span>
                <p>{{ 122 }}</p>
                <span>出院随访</span>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :span="10">
        <!-- <el-col :span="9">
          <div class="grid-content bg-purple" style="min-height: 300px">
            <div class="title">
              各项服务统计
@@ -175,99 +179,136 @@
            </div>
            <div class="empenty">
              <el-row>
                <el-col :span="4"
                  ><div class="grid-content bg-purple">诊疗预约</div></el-col
                <el-col :span="3"
                  ><div class="grid-contents bg-purples">出院:</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">123次</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">转诊服务</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">231次</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">信息推送</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">900次</div></el-col
                > </el-row
              ><el-row>
                <el-col :span="4"
                  ><div class="grid-content bg-purple">标识与导航</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">23次</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">
                    患者便利保障服务
                  </div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">13次</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">远程医疗</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">31次</div></el-col
                > </el-row
              ><el-row>
                <el-col :span="4"
                  ><div class="grid-content bg-purple">患者反馈</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">150人</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">患者管理</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">231人</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">健康宣教</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">400</div></el-col
                >
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">出院随访</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">出院宣教</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">复诊通知</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="4"
                  ><div class="grid-content bg-purple">反馈占比</div></el-col
                <el-col :span="3"
                  ><div class="grid-contents bg-purples"></div
                ></el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">出院评估</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">满意度调查</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">其他通知</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="3"
                  ><div class="grid-contents bg-purples">门诊:</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">23%</div></el-col
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">影像随访</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">门诊宣教</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">复诊通知</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="3"
                  ><div class="grid-contents bg-purples"></div
                ></el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">满意度调查</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">其他通知</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="3"
                  ><div class="grid-contents bg-purples">在院:</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple">管理占比</div></el-col
                >
                <el-col :span="4"
                  ><div class="grid-content bg-purple-light">32%</div></el-col
                >
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">在院宣教</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">在院评估</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
                <el-col :span="7">
                  <div style="display: flex">
                    <div class="subtitle">其他通知</div>
                    <div class="grid-contents bg-purple-light">0次</div>
                  </div>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-col>
        </el-col> -->
      </el-row>
    </div>
  </div>
</template>
<script>
// import {
//   getUserWork,
//   getregionCollect,
//   getregionOrderCount,
//   getregionAmountCollect,
//   getNodeCount,
//   getPrtnerCount,
//   getnodeCollect,
//   getSkuTop,
//   getOrderAmount,
// } from "@/api/home";
import {
  getEChartsPatMedOuthospCount,
  getechartsListCountdata,
  getechartsMedOuthospList,
  getechartsMedInhospList,
  getServiceStatistics,
  getDeptRanking,
} from "@/api/AiCentre/index";
import dayjs from "dayjs";
export default {
@@ -277,8 +318,25 @@
      NodeCount: "",
      PrtnerCount: "",
      NodeCount: "",
      radio1: "周",
      myChart2: null,
      mypPieCharts: null,
      lastWidth: window.innerWidth,
      lastHeight: window.innerHeight,
      radio1: "近一周",
      ticketStatistics: {},
      timeTypeMap: {
        周: "day",
        月: "month",
        年: "year",
      },
      DischargeData: {
        rs: "",
        rc: "",
      },
      OutpatientData: {
        rs: "",
        rc: "",
      },
      order: "",
      Count: "",
      datatni: [],
@@ -288,7 +346,9 @@
      SkuTop: [],
      cylinderSeries: [],
      cylinderXAxis: [],
      dyat: 30,
      customDateRange: [], // 自定义日期范围
      dyat: 6,
      intervalId: null,
    };
  },
@@ -300,148 +360,317 @@
    atd() {
      return dayjs().subtract(this.dyat, "day").format("YYYY-MM-DD HH:mm:ss");
    },
    statd() {
   statd() {
      if (this.radio1 === "自定义" && this.customDateRange.length > 0) {
        return this.customDateRange[1];
      }
      return dayjs().format("YYYY-MM-DD");
    },
    endatd() {
      if (this.radio1 === "自定义" && this.customDateRange.length > 0) {
        return this.customDateRange[0];
      }
      return dayjs().subtract(this.dyat, "day").format("YYYY-MM-DD");
    },
  },
  created() {
    this.getTopdata();
    this.getgraphdata();
    // this.getranking();
    this.$nextTick(function () {
      this.getregionAmountCollect();
      this.getUserWorks();
      this.getregionCollect();
      this.getregionOrderCount();
      this.getNodeCount();
      this.getPrtnerCount();
      this.myEcharts2();
      this.getnodeCollect();
      this.getSkuTop();
      this.getOrderAmount();
    });
  },
  mounted() {},
  mounted() {
    this.setInterval();
    // window.addEventListener("resize", this.handleResize());
  },
  beforeDestroy() {
    if (this.intervalId) {
      clearInterval(this.intervalId); // 清除定时器
    }
  },
  methods: {
    // 改变时间事件
    changes() {
      if (this.radio1 == "周") {
        this.dyat = 7;
      } else if (this.radio1 == "月") {
        this.dyat = 30;
      } else {
        this.dyat = 360;
      switch (this.radio1) {
        case "近一周":
          this.dyat = 7;
          break;
        case "近一月":
          this.dyat = 30;
          break;
        case "近一年":
          this.dyat = 365;
          break;
        case "自定义":
          // 自定义日期处理在handleCustomDateChange方法中
          return;
      }
      this.getregionAmountCollect();
      this.getUserWorks();
      this.getregionCollect();
      this.getregionOrderCount();
      this.getNodeCount();
      this.getPrtnerCount();
      this.refreshData();
    },
    // 处理自定义日期变化
    handleCustomDateChange(range) {
      if (!range || range.length !== 2) return;
      this.customDateRange = range;
      this.refreshData();
    },
    // 统一刷新数据的方法
    refreshData() {
      this.getgraphdata();
      // this.getranking();
      this.getTopdata();
      this.myEcharts2();
      this.getnodeCollect();
      this.getSkuTop();
      this.getOrderAmount();
    },
    // 柱状图
    async getOrderAmount() {
      // const res = await getOrderAmount(this.endatd, this.statd);
      // this.cylinderXAxis = res.data.xAxis;
      // this.cylinderSeries = res.data.series;
      this.cylinderXAxis = [
        "1月",
        "2月",
        "3月",
        "4月",
        "5月",
        "6月",
        "7月",
        "8月",
      ];
      this.cylinderSeries = [123, 123, 223, 212, 432, 123, 442, 234];
      this.myEcharts();
    },
    // 获取点位总数
    async getNodeCount() {
      // const res = await getNodeCount();
      // this.NodeCount = res.data;
    },
    // 获取合作商总数
    async getPrtnerCount() {
      // const res = await getPrtnerCount();
      // this.PrtnerCount = res.data;
    },
    // 合作商点位汇总统计饼状图
    async getnodeCollect() {
      // const res = await getnodeCollect();
      // this.nodeCollect = res.data;
      this.nodeCollect = [
        { name: "门诊随访", value: 1232 },
        { name: "影像随访", value: 1232 },
        { name: "出院随访", value: 342 },
      ];
      this.myPieChart();
    },
    // top排行
    async getSkuTop() {
      // const res = await getSkuTop(10, this.endatd, this.statd);
      // this.SkuTop = res.data;
      this.SkuTop = [
        { amount: 0, count: 123, skuId: "0", skuName: "心肺科" },
        { amount: 0, count: 122, skuId: "0", skuName: "肾脏科" },
        { amount: 0, count: 112, skuId: "0", skuName: "泌尿科" },
        { amount: 0, count: 111, skuId: "0", skuName: "男科" },
        { amount: 0, count: 102, skuId: "0", skuName: "妇产科" },
        { amount: 0, count: 98, skuId: "0", skuName: "外科" },
        { amount: 0, count: 89, skuId: "0", skuName: "急诊" },
        { amount: 0, count: 88, skuId: "0", skuName: "器械科" },
        { amount: 0, count: 87, skuId: "0", skuName: "骨科" },
        { amount: 0, count: 67, skuId: "0", skuName: "放射科" },
        { amount: 0, count: 89, skuId: "0", skuName: "急诊" },
        { amount: 0, count: 88, skuId: "0", skuName: "器械科" },
        { amount: 0, count: 87, skuId: "0", skuName: "骨科" },
        { amount: 0, count: 67, skuId: "0", skuName: "放射科" },
      let Rankingdata = {
        startDate: this.endatd,
        endDate: this.statd,
        cy: 1,
      };
      await getDeptRanking(Rankingdata).then((res) => {
        if (res.code == 200) {
          this.SkuTop = res.rows.sort((a, b) => b.rc - a.rc);
          console.log(this.SkuTop, "this.SkuTop");
        }
      });
      ];
      // this.SkuTop = [
      //   { amount: 0, count: 123, skuId: "0", skuName: "心肺科" },
      //   { amount: 0, count: 122, skuId: "0", skuName: "肾脏科" },
      //   { amount: 0, count: 112, skuId: "0", skuName: "泌尿科" },
      //   { amount: 0, count: 111, skuId: "0", skuName: "男科" },
      //   { amount: 0, count: 102, skuId: "0", skuName: "妇产科" },
      //   { amount: 0, count: 98, skuId: "0", skuName: "外科" },
      //   { amount: 0, count: 89, skuId: "0", skuName: "急诊" },
      //   { amount: 0, count: 88, skuId: "0", skuName: "器械科" },
      //   { amount: 0, count: 87, skuId: "0", skuName: "骨科" },
      //   { amount: 0, count: 67, skuId: "0", skuName: "放射科" },
      //   { amount: 0, count: 89, skuId: "0", skuName: "急诊" },
      //   { amount: 0, count: 88, skuId: "0", skuName: "器械科" },
      //   { amount: 0, count: 87, skuId: "0", skuName: "骨科" },
      //   { amount: 0, count: 67, skuId: "0", skuName: "放射科1" },
      //   { amount: 0, count: 67, skuId: "0", skuName: "放射科2" },
      // ];
    },
    // 获取工单数量
    async getUserWorks() {
      // const res = await getUserWork(this.atd, this.td);
      // this.ticketStatistics = res.data[0];
    // 获取头部数据
    getTopdata() {
      let hospCountdata = {
        startDate: this.endatd,
        endDate: this.statd,
        cy: 1,
      };
      let Countdata = {
        startDate: this.endatd,
        endDate: this.statd,
        cy: 1,
      };
      // 查询门诊看病人次和人数
      getEChartsPatMedOuthospCount(hospCountdata).then((res) => {
        if (res.code == 200) {
          this.OutpatientData = res.data;
        }
      });
      // 查询出、入院看病人次和人数
      getechartsListCountdata(Countdata).then((res) => {
        if (res.code == 200) {
          this.DischargeData = res.data;
        }
      });
    },
    // 获取就诊数量
    async getregionOrderCount() {
      // const res = await getregionOrderCount({
      //   start: this.atd,
      //   end: this.td,
      // });
      // this.order = res.data;
    },
    // 获取总量数量
    async getregionCollect() {
      // const res = await getregionCollect({
      //   start: this.atd,
      //   end: this.td,
      // });
      // this.Count = (res.data / 1000000).toFixed(2);
    // 获取中部线柱图数据
    getranking() {},
    async getgraphdata() {
      let params = {
        startDate: this.endatd,
        endDate: this.statd,
        timeType: this.getTimeType()
      };
      try {
        const res = await getServiceStatistics(params);
        if (res.code === 200) {
          this.processChartData(res.data);
        }
      } catch (error) {
        console.error("获取图表数据失败:", error);
      }
    },
    // 柱状图
    myEcharts() {
      // 基于准备好的dom,初始化echarts实例
      var echarts = require("echarts");
      var myChart = echarts.init(document.getElementById("echars2"));
    // 获取时间类型
    getTimeType() {
      if (this.radio1 === "近一周" || this.radio1 === "近一月") {
        return "day";
      }
      // 指定图表的配置项和数据
      var option = {
        title: {
          text: "诊中统计",
      if (this.radio1 === "近一年") {
        return "month";
      }
      // 自定义日期范围
      if (this.radio1 === "自定义" && this.customDateRange.length === 2) {
        const start = dayjs(this.customDateRange[0]);
        const end = dayjs(this.customDateRange[1]);
        const diffDays = end.diff(start, 'day');
        return diffDays > 60 ? "month" : "day";
      }
      return "day"; // 默认返回day类型
    },
    processChartData(data) {
      // 按时间排序确保数据顺序正确
      const sortedData = [...data].sort(
        (a, b) => new Date(a.timePeriod) - new Date(b.timePeriod)
      );
      const xAxisData = [];
      const dischargeFollowData = [];
      const outpatientFollowData = [];
      const pmiData = [];
      const pmoData = [];
      sortedData.forEach((item) => {
  // 根据时间类型格式化显示
  const timeType = this.getTimeType();
  const timeLabel = timeType === "day"
    ? dayjs(item.timePeriod).format("MM-DD")
    : dayjs(item.timePeriod).format("YYYY-MM");
  xAxisData.push(timeLabel);
  dischargeFollowData.push(item.dischargeFollowCount);
  outpatientFollowData.push(item.outpatientFollowCount);
  pmiData.push(item.pmiCount);
  pmoData.push(item.pmoCount);
});
      // 更新图表
      this.updateChart(
        xAxisData,
        dischargeFollowData,
        outpatientFollowData,
        pmiData,
        pmoData
      );
    },
    updateChart(
      xAxisData,
      dischargeFollowData,
      outpatientFollowData,
      pmiData,
      pmoData
    ) {
      if (!this.myChart2) {
        this.myEcharts2();
        return;
      }
      // 计算随访量的最大值
      const maxFollow = Math.max(
        ...dischargeFollowData,
        ...outpatientFollowData
      );
      // 计算服务人次的最大值
      const maxService = Math.max(...pmiData, ...pmoData);
      // 动态计算interval值
      const followInterval = this.calculateOptimalInterval(maxFollow);
      const serviceInterval = this.calculateOptimalInterval(maxService);
      const option = {
        xAxis: {
          data: xAxisData,
        },
        yAxis: [
          {
            interval: followInterval,
            max: Math.ceil(maxFollow / followInterval) * followInterval,
          },
          {
            interval: serviceInterval,
            max: Math.ceil(maxService / serviceInterval) * serviceInterval,
          },
        ],
        series: [
          { data: dischargeFollowData },
          { data: outpatientFollowData },
          { data: pmiData },
          { data: pmoData },
        ],
      };
      this.myChart2.setOption(option);
    },
    // 计算最优的interval值
    calculateOptimalInterval(maxValue) {
      if (maxValue <= 0) return 50; // 默认值
      // 根据最大值计算合适的间隔
      const magnitude = Math.pow(10, Math.floor(Math.log10(maxValue)));
      const stepRatio = maxValue / magnitude;
      let interval;
      if (stepRatio > 5) {
        interval = magnitude;
      } else if (stepRatio > 2) {
        interval = magnitude / 2;
      } else {
        interval = magnitude / 5;
      }
      // 确保interval是整数
      interval = Math.round(interval);
      // 限制最小间隔
      return Math.max(interval, 50);
    },
    // 获取线状图时间
    async getregionAmountCollect() {
      //getregionAmountCollect(1, this.endatd, this.statd);
      // this.xAxis = res.data.xAxis;
      // this.series = res.data.series;
      this.xAxis = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月"];
      this.series = [123, 123, 223, 212, 432, 123, 442, 234];
      this.myEcharts2();
    },
    // 线性图及柱状图
    myEcharts2() {
      var echarts = require("echarts");
      var myChart2 = echarts.init(document.getElementById("echars"));
      this.myChart2 = myChart2;
      var option2 = {
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["院内推送", "宣教完成"],
          axisPointer: {
            type: "cross",
            crossStyle: {
              color: "#999",
            },
          },
        },
        toolbox: {
          show: true,
          feature: {
            dataView: { show: true, readOnly: false },
            magicType: { show: true, type: ["line", "bar"] },
@@ -449,106 +678,131 @@
            saveAsImage: { show: true },
          },
        },
        calculable: true,
        legend: {
          data: ["出院服务量", "门诊服务量", "出院就诊人次", "门诊就诊人次"],
        },
        xAxis: [
          {
            type: "category",
            // prettier-ignore
            data: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月"],
            data: [], // 初始为空,将通过API数据填充
            axisPointer: {
              type: "shadow",
            },
          },
        ],
        yAxis: [
          {
            type: "value",
            name: "随访量",
            min: 0,
            axisLabel: {
              formatter: "{value} 人",
            },
          },
          {
            type: "value",
            name: "服务人次",
            min: 0,
            axisLabel: {
              formatter: "{value} 次",
            },
          },
        ],
        grid: { top: "35%" },
        series: [
          {
            name: "院内推送",
            name: "出院服务量",
            type: "bar",
            data: [20, 49, 70, 32, 56, 76, 56, 122, 26, 20, 64, 33],
            markPoint: {
              data: [
                { type: "max", name: "Max" },
                { type: "min", name: "Min" },
              ],
            tooltip: {
              valueFormatter: function (value) {
                return value + " 人";
              },
            },
            markLine: {
              data: [{ type: "average", name: "Avg" }],
            },
            data: [], // 初始为空,将通过API数据填充
          },
          {
            name: "宣教完成",
            name: "门诊服务量",
            type: "bar",
            data: [26, 59, 90, 64, 87, 70, 75, 182, 87, 82, 60, 23],
            markPoint: {
              data: [
                { name: "Max", value: 182, xAxis: 7, yAxis: 183 },
                { name: "Min", value: 2.3, xAxis: 11, yAxis: 3 },
              ],
            tooltip: {
              valueFormatter: function (value) {
                return value + " 人";
              },
            },
            markLine: {
              data: [{ type: "average", name: "Avg" }],
            data: [], // 初始为空,将通过API数据填充
          },
          {
            name: "出院就诊人次",
            type: "line",
            smooth: 0.3,
            yAxisIndex: 1,
            tooltip: {
              valueFormatter: function (value) {
                return value + " 次";
              },
            },
            data: [], // 初始为空,将通过API数据填充
          },
          {
            name: "门诊就诊人次",
            type: "line",
            smooth: 0.3,
            yAxisIndex: 1,
            tooltip: {
              valueFormatter: function (value) {
                return value + " 次";
              },
            },
            data: [], // 初始为空,将通过API数据填充
          },
        ],
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
      myChart2.setOption(option2);
      // 初始加载数据
      this.getgraphdata();
    },
    // 获取线状图时间
    async getregionAmountCollect() {
      // const res = await getregionAmountCollect(1, this.endatd, this.statd);
      // this.xAxis = res.data.xAxis;
      // this.series = res.data.series;
      this.xAxis = ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月"];
      this.series = [123, 123, 223, 212, 432, 123, 442, 234];
      this.myEcharts2();
    },
    // 线性图
    myEcharts2() {
    // 饼状图
    myPieChart() {
      // 基于准备好的dom,初始化echarts实例
      var echarts = require("echarts");
      var myChart2 = echarts.init(document.getElementById("echars"));
      var option2 = {
        title: {
          text: "诊前数据",
        },
      var mypPieCharts = echarts.init(document.getElementById("pieCharts"));
      this.mypPieCharts = mypPieCharts;
      // 指定图表的配置项和数据
      var optionPie = {
        legend: {},
        tooltip: {
          trigger: "axis",
          showContent: true,
        },
        dataset: {
          source: [
            ["product", "2018", "2019", "2020", "2021", "2022", "2023"],
            ["复诊", 256, 182, 388, 270, 253, 385],
            ["住院", 351, 451, 355, 353, 373, 468],
            ["手术", 440, 362, 569, 436, 445, 332],
            ["转诊", 525, 237, 541, 518, 433, 249],
            ["product", "2012", "2013", "2014", "2015", "2016", "2017"],
            ["出院宣教", 56, 82, 88, 70, 53, 85],
            ["在院宣教", 51, 51, 55, 53, 73, 68],
            ["门诊宣教", 40, 62, 69, 36, 45, 32],
          ],
        },
        xAxis: { type: "category" },
        yAxis: { gridIndex: 0 },
        grid: { top: "55%" },
        grid: { top: "25%", left: "10%", right: "40%", bottom: "10%" },
        series: [
          {
            name: "出院宣教",
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
            emphasis: { focus: "series" },
          },
          {
            name: "在院宣教",
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
            emphasis: { focus: "series" },
          },
          {
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
            emphasis: { focus: "series" },
          },
          {
            name: "门诊宣教",
            type: "line",
            smooth: true,
            seriesLayoutBy: "row",
@@ -557,31 +811,36 @@
          {
            type: "pie",
            id: "pie",
            radius: "30%",
            center: ["50%", "25%"],
            radius: ["40%", "70%"],
            center: ["80%", "50%"],
            emphasis: {
              focus: "self",
            },
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
            },
            label: {
              formatter: "{b}: {@2018} ({d}%)",
              formatter: "{b}: {@2012}",
            },
            encode: {
              itemName: "product",
              value: "2018",
              tooltip: "2018",
              value: "2012",
              tooltip: "2012",
            },
          },
        ],
      };
      myChart2.on("updateAxisPointer", function (event) {
      mypPieCharts.on("updateAxisPointer", function (event) {
        const xAxisInfo = event.axesInfo[0];
        if (xAxisInfo) {
          const dimension = xAxisInfo.value + 1;
          myChart2.setOption({
          mypPieCharts.setOption({
            series: {
              id: "pie",
              label: {
                formatter: "{b}: {@[" + dimension + "]} ({d}%)",
                formatter: "{b}: {@[" + dimension + "]} ",
              },
              encode: {
                value: dimension,
@@ -591,66 +850,29 @@
          });
        }
      });
      myChart2.setOption(option2);
    },
    // 饼状图
    myPieChart() {
      // 基于准备好的dom,初始化echarts实例
      var echarts = require("echarts");
      var mypPieCharts = echarts.init(document.getElementById("pieCharts"));
      // 指定图表的配置项和数据
      var optionPie = {
        // title: {
        //   left: "left",
        // },
        tooltip: {
          trigger: "item",
          formatter: "{b}<br/>总占比 : {d}% ",
        },
        toolbox: {
          show: true,
          feature: {
            mark: { show: true },
          },
        },
        legend: {
          top: "5%",
          left: "center",
        },
        series: [
          {
            name: "Access From",
            type: "pie",
            radius: ["40%", "70%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 40,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 580, name: "门诊随访" },
              { value: 484, name: "出院随访" },
            ],
          },
        ],
      };
      // 使用刚指定的配置项和数据显示图表。
      mypPieCharts.setOption(optionPie);
    },
    // 页面变化调整大小
    handleResize() {
      console.log(111);
      // 调整 ECharts 图表大小
      if (this.myChart2) {
        this.myChart2.resize();
      }
      if (this.mypPieCharts) {
        this.mypPieCharts.resize();
      }
    },
    setInterval() {
      this.intervalId = setInterval(() => {
        if (window.innerWidth != this.lastWidth) {
          this.lastWidth = window.innerWidth;
          console.log("窗口大小可能被手动调整了");
          this.handleResize();
        }
      }, 1000);
    },
  },
};
@@ -664,13 +886,10 @@
.boxEchars {
  width: 100%;
  height: 480px;
  height: 40vh;
  margin-top: 45px;
  display: flex;
  .echars1 {
    flex: 1;
  }
  .echars2 {
    flex: 1;
  }
}
@@ -757,7 +976,7 @@
.empenty {
  width: 100%;
  padding: 20px 0;
  height: 280px;
  min-height: 280px;
}
.cooperate {
  width: 100%;
@@ -765,7 +984,7 @@
  margin-top: 25px;
  display: flex;
  .pieChart {
    flex: 3;
    flex: 1;
  }
  .Points {
    width: 154px;
@@ -910,16 +1129,33 @@
.bg-purple {
  background: #fff;
}
.bg-purples {
  color: #206abe;
  font-size: 18px;
}
.bg-purple-light {
  background: #e5e9f2;
  text-align: center;
  align-items: center;
  line-height: 36px;
  width: 6vw;
}
.subtitle {
  text-align: center;
  align-items: center;
}
.grid-content {
  min-height: 36px;
  border-radius: 20px;
  padding: 0 20px;
  padding: 0 10px;
  text-align: center;
}
.grid-contents {
  min-height: 36px;
  border-radius: 20px;
  padding: 0 10px;
  padding-right: 0;
}
.row-bg {
  padding: 10px 0;