{
  "openapi": "3.0.1",
  "info": {
    "title": "健康管理系统统计接口",
    "description": "基于 weightStatis.vue 提取的仪表盘接口，支持部门与日期维度筛选",
    "version": "1.2.0"
  },
  "components": {
    "parameters": {
      "dept": {
        "name": "dept",
        "in": "query",
        "description": "部门筛选项 (如: tech, market, all)",
        "schema": { "type": "string", "default": "all" }
      },
      "startDate": {
        "name": "startDate",
        "in": "query",
        "description": "开始日期 (yyyy-mm-dd)",
        "schema": { "type": "string", "format": "date", "example": "2025-01-01" }
      },
      "endDate": {
        "name": "endDate",
        "in": "query",
        "description": "结束日期 (yyyy-mm-dd)",
        "schema": { "type": "string", "format": "date", "example": "2025-12-31" }
      }
    }
  },
  "paths": {
    "/p/weightStatis/summary": {
      "get": {
        "summary": "获取仪表盘综合统计",
        "parameters": [
          { "$ref": "#/components/parameters/dept" },
          { "$ref": "#/components/parameters/startDate" },
          { "$ref": "#/components/parameters/endDate" }
        ],
        "responses": {
          "200": {
            "description": "成功返回精简指标、排行和参与度",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": { "type": "integer", "example": 200 },
                    "data": {
                      "type": "object",
                      "properties": {
                        "topStats": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": { "type": "string", "description": "指标标题" },
                              "value": { "type": "string", "description": "指标数值" },
                              "trend": { "type": "number", "description": "环比百分比" }
                            }
                          }
                        },
                        "rankData": { "type": "array", "description": "排行榜列表" },
                        "engagement": { "type": "object", "description": "参与度分析数据" }
                      }
                    }
                  }
                },
                "example": {
                  "code": 200,
                  "data": {
                    "topStats": [
                      { "label": "总人数 (人)", "value": "765", "trend": 12.5 },
                      { "label": "累计减重 (kg)", "value": "65", "trend": 8.5 }
                    ],
                    "rankData": [
                      { "rank": 1, "name": "张**", "dept": "技术部", "weight": "10.1" }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/weightStatis/target-trends": {
      "get": {
        "summary": "获取管理目标趋势",
        "parameters": [
          { "$ref": "#/components/parameters/dept" },
          { "$ref": "#/components/parameters/startDate" },
          { "$ref": "#/components/parameters/endDate" }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "example": {
                  "code": 200,
                  "data": {
                    "months": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
                    "series": [{ "name": "减控体重", "color": "#52c41a", "data": [42, 22, 45, 32, 45, 45, 45, 32, 45, 32, 45, 22] }]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/p/weightStatis/distribution": {
      "get": {
        "summary": "获取成果分布分析",
        "parameters": [
          { "$ref": "#/components/parameters/dept" },
          { "$ref": "#/components/parameters/startDate" },
          { "$ref": "#/components/parameters/endDate" }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "example": {
                  "code": 200,
                  "data": {
                    "bmiPie": [
                      { "value": 50, "name": "正常" },
                      { "value": 20, "name": "超重" },
                      { "value": 15, "name": "肥胖" },
                      { "value": 15, "name": "消瘦" }
                    ],
                    "bmiTrend": [65.5, 65.2, 64.8, 64.5, 64.1, 63.8, 63.5, 63.2, 62.9, 62.6, 62.3, 62],
                    "fatPie": [
                      { "value": 50, "name": "正常" },
                      { "value": 44, "name": "偏低" },
                      { "value": 16, "name": "偏高" }
                    ],
                    "fatTrend": [27, 26, 25, 24, 23, 22.5],
                    "groupPie": [
                      { "value": 35, "name": "减脂" },
                      { "value": 15, "name": "增肌" },
                      { "value": 50, "name": "保持" }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}