WXL (wul)
22 小时以前 d93ed5c5aadcf3d49f824339c26ebfac911be06d
src/views/sfstatistics/percentage/index.vue
@@ -126,6 +126,7 @@
                >
              </el-col>
            </el-form>
            <div class="your-table-container">
            <el-table
              v-loading="loading"
              :data="userList"
@@ -133,6 +134,8 @@
              @selection-change="handleSelectionChange"
              @expand-change="handleRowClick"
              :row-key="getRowKey"
                show-summary
                :summary-method="getSummaries"
              :expand-row-keys="expands"
            >
              <!-- 展开行箭头列 -->
@@ -143,6 +146,8 @@
                    border
                    style="width: 95%; margin: 0 auto"
                    class="inner-table"
                      show-summary
                      :summary-method="getInnerSummaries"
                  >
                    <el-table-column
                      label="医生姓名"
@@ -436,7 +441,9 @@
                      type="text"
                      @click="Seedetails(scope.row)"
                      ><span class="button-zx"
                        >{{ (Number(scope.row.rate) * 100).toFixed(2) }}%</span
                          >{{
                            (Number(scope.row.rate) * 100).toFixed(2)
                          }}%</span
                      ></el-button
                    >
                  </template>
@@ -529,8 +536,11 @@
                >
                </el-table-column>
              </el-table-column>
              <el-table-column v-if="orgname=='丽水市中医院'" align="center" label="随访情况">
                <el-table-column
                  v-if="orgname == '丽水市中医院'"
                  align="center"
                  label="随访情况"
                >
                <el-table-column
                  label="正常语音"
                  align="center"
@@ -538,35 +548,40 @@
                  key="taskSituation1"
                  prop="taskSituation1"
                >
                </el-table-column><el-table-column
                  </el-table-column
                  ><el-table-column
                  label="患者拒接或拒访"
                  align="center"
                  width="100"
                  key="taskSituation2"
                  prop="taskSituation2"
                >
                </el-table-column><el-table-column
                  </el-table-column
                  ><el-table-column
                  label="面访或者接诊"
                  align="center"
                  width="100"
                  key="taskSituation3"
                  prop="taskSituation3"
                >
                </el-table-column><el-table-column
                  </el-table-column
                  ><el-table-column
                  label="微信随访"
                  align="center"
                  width="100"
                  key="taskSituation4"
                  prop="taskSituation4"
                >
                </el-table-column><el-table-column
                  </el-table-column
                  ><el-table-column
                  label="随访电话不正确"
                  align="center"
                  width="100"
                  key="taskSituation5"
                  prop="taskSituation5"
                >
                </el-table-column><el-table-column
                  </el-table-column
                  ><el-table-column
                  label="其他情况不宜随访"
                  align="center"
                  width="100"
@@ -576,6 +591,7 @@
                </el-table-column>
              </el-table-column>
            </el-table>
            </div>
            <!-- <pagination
              v-show="total > 0"
@@ -883,7 +899,7 @@
    return {
      topactiveName: "Local", //顶部选择
      activeName: "first", //侧边选择
      orgname:'',
      orgname: "",
      expands: [],
      // 遮罩层
      loading: false,
@@ -1003,7 +1019,6 @@
    this.getDeptTree();
    this.getList();
    this.orgname = localStorage.getItem("orgname");
  },
  methods: {
@@ -1064,6 +1079,162 @@
      } else {
        this.expands = [this.getRowKey(row)];
      }
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
         if (index === 1||index === 2) {
          sums[index] = "/";
          return;
        }
        // 对百分比字段特殊处理 - 取平均值
        if (
          column.property === "followUpRate" ||
          column.property === "rate" ||
          column.property === "followUpRateAgain"
        ) {
          // 提取所有有效百分比值并转换为小数
          const percentageValues = data
            .map((item) => {
              const value = item[column.property];
              if (!value || value === "-" || value === "0%") return null;
              // 处理带百分号的数据
              if (typeof value === "string" && value.includes("%")) {
                // 去除百分号并转换为小数
                const numValue = parseFloat(value.replace("%", "")) / 100;
                return isNaN(numValue) ? null : numValue;
              } else {
                // 处理已经是小数的数据
                const numValue = parseFloat(value);
                return isNaN(numValue) ? null : numValue;
              }
            })
            .filter((value) => value !== null && value !== 0); // 过滤掉null和0值
          if (percentageValues.length > 0) {
            const average =
              percentageValues.reduce((sum, value) => sum + value, 0) /
              percentageValues.length;
            sums[index] = (average * 100).toFixed(2) + "%";
          } else {
            sums[index] = "0.00%";
          }
        } else {
          // 普通数字字段 - 求和
          const values = data.map((item) => {
            const value = item[column.property];
            if (value === "-" || value === "" || value === null) return 0;
            return Number(value) || 0;
          });
          if (!values.every((value) => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => prev + curr, 0);
            sums[index] = this.formatNumber(sums[index]);
          } else {
            sums[index] = "-";
          }
        }
      });
      return sums;
    },
    // 内部表格合计行计算方法
    getInnerSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "小计";
          return;
        }
        if (column.property === "drname" || column.property === "deptname") {
          sums[index] = "-";
          return;
        }
        // 对百分比字段特殊处理 - 取平均值
        if (column.property === "followUpRate" || column.property === "rate") {
          // 提取所有有效百分比值并转换为小数
          const percentageValues = data
            .map((item) => {
              const value = item[column.property];
              if (!value || value === "-" || value === "0%") return null;
              // 处理带百分号的数据
              if (typeof value === "string" && value.includes("%")) {
                // 去除百分号并转换为小数
                const numValue = parseFloat(value.replace("%", "")) / 100;
                return isNaN(numValue) ? null : numValue;
              } else {
                // 处理已经是小数的数据
                const numValue = parseFloat(value);
                return isNaN(numValue) ? null : numValue;
              }
            })
            .filter((value) => value !== null && value !== 0);
          if (percentageValues.length > 0) {
            const average =
              percentageValues.reduce((sum, value) => sum + value, 0) /
              percentageValues.length;
            sums[index] = (average * 100).toFixed(2) + "%";
          } else {
            sums[index] = "0.00%";
          }
        } else {
          // 普通数字字段 - 求和
          const values = data.map((item) => {
            const value = item[column.property];
            if (value === "-" || value === "" || value === null) return 0;
            return Number(value) || 0;
          });
          if (!values.every((value) => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => prev + curr, 0);
            sums[index] = this.formatNumber(sums[index]);
          } else {
            sums[index] = "-";
          }
        }
      });
      return sums;
    },
    // 辅助方法:提取百分比数值
    extractPercentageValue(value) {
      if (!value) return null;
      if (typeof value === "string") {
        // 处理带百分号的字符串
        if (value.includes("%")) {
          const num = parseFloat(value.replace("%", ""));
          return isNaN(num) ? null : num / 100;
        }
        // 处理纯数字字符串
        const num = parseFloat(value);
        return isNaN(num) ? null : num;
      }
      // 处理数字类型
      return typeof value === "number" ? value : null;
    },
    // 数字格式化方法
    formatNumber(num) {
      if (isNaN(num)) return "-";
      return Number.isInteger(num) ? num.toString() : num.toFixed(0);
    },
    /** 修改标签 */
    handleUpdate(row) {
@@ -1355,9 +1526,9 @@
      text: "随访状态分布",
      left: "center",
      textStyle: {
        color: '#333',
        fontSize: 16
      }
            color: "#333",
            fontSize: 16,
          },
    },
    tooltip: {
      trigger: "item",
@@ -1368,10 +1539,10 @@
      left: "left",
      data: ["待随访", "随访成功", "随访失败"],
      textStyle: {
        color: '#666'
      }
            color: "#666",
    },
    color: ['#FF9D4D', '#36B37E', '#FF5C5C'], // 新的配色方案
        },
        color: ["#FF9D4D", "#36B37E", "#FF5C5C"], // 新的配色方案
    series: [
      {
        name: "随访状态",
@@ -1381,41 +1552,41 @@
        itemStyle: {
          borderRadius: 10,
          borderColor: "#fff",
          borderWidth: 2
              borderWidth: 2,
        },
        label: {
          show: true,
          formatter: "{b}: {c} ({d}%)",
          color: '#333'
              color: "#333",
        },
        emphasis: {
          label: {
            show: true,
            fontSize: "18",
            fontWeight: "bold"
                fontWeight: "bold",
          },
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
        },
        data: [
          {
            value: followUpData.pending,
            name: "待随访"
                name: "待随访",
          },
          {
            value: followUpData.success,
            name: "随访成功"
                name: "随访成功",
          },
          {
            value: followUpData.fail,
            name: "随访失败"
          }
        ]
      }
    ]
                name: "随访失败",
              },
            ],
          },
        ],
  };
  this.pieChart.setOption(pieOption);
@@ -1447,14 +1618,14 @@
  );
  // 新增两条折线数据
 const followUpRateData = this.userList.map(item => {
      const followUpRateData = this.userList.map((item) => {
    if (!item.followUpRate) return 0;
    // 去掉百分号并转为数字
    const rateStr = String(item.followUpRate).replace('%', '');
        const rateStr = String(item.followUpRate).replace("%", "");
    return parseFloat(rateStr) || 0;
  });
  const timelyRateData = this.userList.map(item =>
      const timelyRateData = this.userList.map((item) =>
    item.rate ? (Number(item.rate) * 100).toFixed(2) : 0
  );
@@ -1463,9 +1634,9 @@
      text: "科室/病区随访趋势",
      left: "center",
      textStyle: {
        color: '#333',
        fontSize: 16
      }
            color: "#333",
            fontSize: 16,
          },
    },
    tooltip: {
      trigger: "axis",
@@ -1480,23 +1651,23 @@
      data: ["出院人次", "应随访人次", "随访率(%)", "及时率(%)"],
      top: "bottom",
      textStyle: {
        color: '#666'
      }
            color: "#666",
    },
    color: ['#5470C6', '#91CC75', '#EE6666', '#9A60B4'], // 新增紫色用于及时率
        },
        color: ["#5470C6", "#91CC75", "#EE6666", "#9A60B4"], // 新增紫色用于及时率
    xAxis: {
      type: "category",
      data: categories,
      axisLabel: {
        interval: 0,
        rotate: 30,
        color: '#666'
            color: "#666",
      },
      axisLine: {
        lineStyle: {
          color: '#ddd'
        }
      }
              color: "#ddd",
            },
          },
    },
    yAxis: [
      {
@@ -1504,18 +1675,18 @@
        name: "人次",
        min: 0,
        axisLabel: {
          color: '#666'
              color: "#666",
        },
        axisLine: {
          lineStyle: {
            color: '#ddd'
          }
                color: "#ddd",
              },
        },
        splitLine: {
          lineStyle: {
            color: '#f0f0f0'
          }
        }
                color: "#f0f0f0",
              },
            },
      },
      {
        type: "value",
@@ -1523,18 +1694,18 @@
        min: 0,
        max: 100,
        axisLabel: {
          color: '#666',
          formatter: '{value}%'
              color: "#666",
              formatter: "{value}%",
        },
        axisLine: {
          lineStyle: {
            color: '#ddd'
          }
                color: "#ddd",
              },
        },
        splitLine: {
          show: false
        }
      }
              show: false,
            },
          },
    ],
    series: [
      {
@@ -1543,8 +1714,8 @@
        barWidth: "25%",
        data: dischargeData,
        itemStyle: {
          borderRadius: [4, 4, 0, 0]
        }
              borderRadius: [4, 4, 0, 0],
            },
      },
      {
        name: "应随访人次",
@@ -1552,8 +1723,8 @@
        barWidth: "25%",
        data: followUpData,
        itemStyle: {
          borderRadius: [4, 4, 0, 0]
        }
              borderRadius: [4, 4, 0, 0],
            },
      },
      {
        name: "随访率(%)",
@@ -1562,22 +1733,24 @@
        data: followUpRateData,
        symbolSize: 8,
        lineStyle: {
          width: 3
              width: 3,
        },
        markLine: {
          silent: true,
          data: [{
              data: [
                {
            yAxis: 80,
            lineStyle: {
              color: '#EE6666',
              type: 'dashed'
                    color: "#EE6666",
                    type: "dashed",
            },
            // label: {
            //   position: 'end',
            //   formatter: '目标80%'
            // }
          }]
        }
                },
              ],
            },
      },
      {
        name: "及时率(%)",
@@ -1587,31 +1760,33 @@
        symbolSize: 8,
        lineStyle: {
          width: 3,
          type: 'dotted' // 使用虚线区分
              type: "dotted", // 使用虚线区分
        },
        markLine: {
          silent: true,
          data: [{
              data: [
                {
            yAxis: 90,
            lineStyle: {
              color: '#9A60B4',
              type: 'dashed'
                    color: "#9A60B4",
                    type: "dashed",
            },
            // label: {
            //   position: 'end',
            //   formatter: '目标90%'
            // }
          }]
        }
      }
                },
              ],
            },
          },
    ],
    grid: {
      top: '15%',
      left: '3%',
      right: '4%',
      bottom: '15%',
      containLabel: true
    }
          top: "15%",
          left: "3%",
          right: "4%",
          bottom: "15%",
          containLabel: true,
        },
  };
  this.barLineChart.setOption(option);
@@ -1727,6 +1902,41 @@
  text-align: left;
  font-size: 20px;
}
// 美化合计行样式
::v-deep .el-table__footer {
  .el-table__cell {
    background-color: #f5f7fa;
    font-weight: 600;
    color: #409eff;
    .cell {
      font-weight: 600;
      color: #409eff;
    }
  }
}
// 内部表格合计行样式
::v-deep .inner-table .el-table__footer {
  .el-table__cell {
    background-color: #ecf5ff;
    font-weight: 500;
    color: #67c23a;
    .cell {
      font-weight: 500;
      color: #67c23a;
    }
  }
}
// 百分比字段特殊样式
.your-table-container ::v-deep .el-table__footer .el-table__cell[data-field="followUpRate"] .cell,
.your-table-container ::v-deep .el-table__footer .el-table__cell[data-field="rate"] .cell,
.your-table-container ::v-deep .el-table__footer .el-table__cell[data-field="followUpRateAgain"] .cell {
  color: #e6a23c !important;
  font-weight: 700 !important;
}
.leftvlue {
  //   display: flex;