| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- """Word 报告组装。"""
- from __future__ import annotations
- import os
- from datetime import datetime
- from typing import Any, Dict, List, Optional
- from docx import Document
- from docx.enum.section import WD_SECTION
- from docx.enum.table import WD_TABLE_ALIGNMENT
- from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_BREAK
- from docx.oxml import OxmlElement
- from docx.oxml.ns import qn
- from docx.shared import Cm, Inches, Pt, RGBColor
- from app.report import charts, narrative
- HEADER_TEXT = "基于RCM的风电机组健康度检测系统平台"
- PRIMARY = RGBColor(0x1A, 0x3B, 0x7F)
- GRAY = RGBColor(0x66, 0x66, 0x66)
- def _font(run, size=10.5, bold=False, color=None, name="微软雅黑"):
- run.font.name = name
- run._element.rPr.rFonts.set(qn("w:eastAsia"), name)
- run.font.size = Pt(size)
- run.bold = bold
- if color is not None:
- run.font.color.rgb = color
- def _para(doc, text="", size=10.5, bold=False, color=None, align=None, indent=True, space_after=6):
- p = doc.add_paragraph()
- if align is not None:
- p.alignment = align
- fmt = p.paragraph_format
- fmt.line_spacing = 1.5
- fmt.space_after = Pt(space_after)
- if indent:
- fmt.first_line_indent = Pt(21)
- run = p.add_run(text)
- _font(run, size, bold, color)
- return p
- def _heading(doc, text, level=1):
- p = doc.add_heading(level=level)
- run = p.add_run(text)
- sizes = {0: 22, 1: 16, 2: 13, 3: 11.5}
- _font(run, sizes.get(level, 11.5), True, PRIMARY, "微软雅黑")
- p.paragraph_format.space_before = Pt(12)
- p.paragraph_format.space_after = Pt(6)
- return p
- def _shade(cell, color="1A3B7F"):
- tc_pr = cell._tc.get_or_add_tcPr()
- shd = OxmlElement("w:shd")
- shd.set(qn("w:val"), "clear")
- shd.set(qn("w:color"), "auto")
- shd.set(qn("w:fill"), color)
- tc_pr.append(shd)
- def _cell_text(cell, text, bold=False, color=None, size=9, align=WD_ALIGN_PARAGRAPH.CENTER):
- cell.text = ""
- p = cell.paragraphs[0]
- p.alignment = align
- run = p.add_run("" if text is None else str(text))
- _font(run, size, bold, color)
- def _table(doc, headers: List[str], rows: List[List[Any]], widths: Optional[List[float]] = None):
- table = doc.add_table(rows=1, cols=len(headers))
- table.style = "Table Grid"
- table.alignment = WD_TABLE_ALIGNMENT.CENTER
- hdr = table.rows[0].cells
- for i, h in enumerate(headers):
- _cell_text(hdr[i], h, True, RGBColor(0xFF, 0xFF, 0xFF), 9)
- _shade(hdr[i])
- for row in rows:
- cells = table.add_row().cells
- for i, v in enumerate(row):
- _cell_text(cells[i], v, False, None, 9)
- if widths:
- total = sum(widths)
- if total > 15.5:
- widths = [w * 15.5 / total for w in widths]
- table.autofit = False
- for i, w in enumerate(widths):
- table.columns[i].width = Cm(w)
- for row in table.rows:
- for i, w in enumerate(widths):
- row.cells[i].width = Cm(w)
- doc.add_paragraph().paragraph_format.space_after = Pt(2)
- return table
- def _image(doc, path: Optional[str], caption: str):
- if not path or not os.path.exists(path):
- return
- p = doc.add_paragraph()
- p.alignment = WD_ALIGN_PARAGRAPH.CENTER
- p.add_run().add_picture(path, width=Inches(6.1))
- cap = doc.add_paragraph()
- cap.alignment = WD_ALIGN_PARAGRAPH.CENTER
- run = cap.add_run(caption)
- _font(run, 9, False, GRAY)
- cap.paragraph_format.space_after = Pt(8)
- def _page_field(paragraph):
- run = paragraph.add_run()
- fld_begin = OxmlElement("w:fldChar")
- fld_begin.set(qn("w:fldCharType"), "begin")
- instr = OxmlElement("w:instrText")
- instr.set(qn("xml:space"), "preserve")
- instr.text = "PAGE"
- fld_end = OxmlElement("w:fldChar")
- fld_end.set(qn("w:fldCharType"), "end")
- run._r.append(fld_begin)
- run._r.append(instr)
- run._r.append(fld_end)
- def _setup_header_footer(doc):
- for section in doc.sections:
- header = section.header
- hp = header.paragraphs[0]
- hp.alignment = WD_ALIGN_PARAGRAPH.RIGHT
- hr = hp.add_run(HEADER_TEXT)
- _font(hr, 9, False, GRAY)
- footer = section.footer
- fp = footer.paragraphs[0]
- fp.alignment = WD_ALIGN_PARAGRAPH.CENTER
- r1 = fp.add_run("第 ")
- _font(r1, 9, False, GRAY)
- _page_field(fp)
- r2 = fp.add_run(" 页")
- _font(r2, 9, False, GRAY)
- def _cover(doc, title: str, data: Dict[str, Any]):
- for _ in range(4):
- doc.add_paragraph()
- p = doc.add_paragraph()
- p.alignment = WD_ALIGN_PARAGRAPH.CENTER
- run = p.add_run(title)
- _font(run, 24, True, PRIMARY)
- p = doc.add_paragraph()
- p.alignment = WD_ALIGN_PARAGRAPH.CENTER
- run = p.add_run("——风电机组健康度检测与可靠性分析")
- _font(run, 14, False, GRAY)
- for _ in range(5):
- doc.add_paragraph()
- info = [
- ("风电场", data["wind"]["name"]),
- ("所属单位", data["wind"].get("company") or "—"),
- ("分析时段", f"{data['period']['start']} 至 {data['period']['end']}"),
- ("装机容量", f"{data['wind'].get('capacity_kw', 0) / 1000:.1f} MW"),
- ("机组数量", f"{data['wind'].get('turbine_count', 0)} 台"),
- ("生成时间", data["meta"]["generated_at"]),
- ]
- table = doc.add_table(rows=0, cols=2)
- table.alignment = WD_TABLE_ALIGNMENT.CENTER
- for k, v in info:
- cells = table.add_row().cells
- _cell_text(cells[0], k, True, PRIMARY, 11, WD_ALIGN_PARAGRAPH.RIGHT)
- _cell_text(cells[1], v, False, None, 11, WD_ALIGN_PARAGRAPH.LEFT)
- cells[0].width = Cm(4.0)
- cells[1].width = Cm(8.5)
- for _ in range(4):
- doc.add_paragraph()
- p = doc.add_paragraph()
- p.alignment = WD_ALIGN_PARAGRAPH.CENTER
- run = p.add_run("基于RCM的风电机组健康度检测系统平台")
- _font(run, 12, True, PRIMARY)
- p = doc.add_paragraph()
- p.alignment = WD_ALIGN_PARAGRAPH.CENTER
- run = p.add_run("二〇二六年")
- _font(run, 11, False, GRAY)
- doc.add_page_break()
- def _statement(doc):
- _heading(doc, "报告说明", 1)
- items = [
- "本报告由“基于RCM的风电机组健康度检测系统平台”自动生成,数据来源为平台数据库 energy_prod 与业务数据库 energy_data_prod。",
- "报告数据与平台「分析概览、健康评估、算法健康评估、故障诊断、振动分析」页面同源;页面无对应时间段结果时,报告明确标注并不回退底层表。",
- "报告文字由本机部署的 27B 模型辅助归纳,数值、图表和统计口径由系统程序计算,模型不参与数值计算。",
- "受数据接入范围、测点配置、模型适用性和现场检修记录完整性限制,报告结论应作为运维分析的参考,需经专业技术人员复核后使用。",
- "本报告所有数据处理与模型调用均在本机完成,不上传互联网。",
- ]
- for i, t in enumerate(items, 1):
- _para(doc, f"{i}. {t}", indent=False)
- doc.add_page_break()
- def _toc(doc, sections: List[str]):
- _heading(doc, "目 录", 1)
- for s in sections:
- p = doc.add_paragraph()
- p.paragraph_format.line_spacing = 2.0
- run = p.add_run(s)
- _font(run, 11)
- doc.add_page_break()
- def _section_intro(doc, data: Dict[str, Any]):
- _heading(doc, "1 概述", 1)
- _heading(doc, "1.1 风场情况", 2)
- w = data["wind"]
- _table(
- doc,
- ["项目", "内容"],
- [
- ["风电场名称", w.get("name")],
- ["所属单位", w.get("company") or "—"],
- ["装机容量", f"{w.get('capacity_kw', 0) / 1000:.2f} MW"],
- ["机组数量", f"{w.get('turbine_count', 0)} 台"],
- ["分析时段", f"{data['period']['start']} 至 {data['period']['end']}({data['period']['month_count']} 个月)"],
- ],
- [4.0, 11.0],
- )
- _available_dims = []
- if (data.get("overview") or {}).get("available"):
- _available_dims.append("分析概览")
- if (data.get("health") or {}).get("available"):
- _available_dims.append("健康评估")
- if (data.get("fault") or {}).get("available"):
- _available_dims.append("故障诊断")
- if (data.get("vibration") or {}).get("available"):
- _available_dims.append("振动分析")
- _dim_text = "、".join(_available_dims) if _available_dims else "所选数据"
- _para(
- doc,
- f"本报告以{w.get('name')}为分析对象,围绕{_dim_text},"
- "对所选时间段内的机组运行状态进行综合分析,识别健康短板与可靠性风险,并提出针对性的运维建议。",
- )
- _heading(doc, "1.2 分析依据与方法", 2)
- _para(
- doc,
- "分析依据包括风电机组 SCADA 运行数据、故障日志、CMS 振动波形数据以及平台台账与健康评估模型。"
- "分析概览采用分钟级数据聚合;健康评估采用风场预训练模型对发电子系统、机舱系统、电网环境和传动系统进行评分;"
- "故障诊断按故障发生时间与故障码统计;振动分析对典型测点波形开展时域与频域特征提取。",
- )
- def _section_data(doc, data: Dict[str, Any]):
- _heading(doc, "2 数据与方法", 1)
- _heading(doc, "2.1 数据来源", 2)
- _table(
- doc,
- ["数据类别", "来源", "用途"],
- [
- ["台账数据", "energy_prod.wind_field / wind_engine_group", "风场、机组、机型与容量"],
- ["SCADA 分钟数据", f"energy_data_prod.{data['wind']['code']}_minute", "发电量、风速、功率、数据完整率"],
- ["健康评估", "健康评估模型 + 平台台账", "机组与子系统健康得分"],
- ["故障日志", f"energy_data_prod.{data['wind']['code']}_fault", "故障次数、故障码与影响机组"],
- ["振动波形", f"energy_data_prod.{data['wind']['code']}_wave", "测点覆盖、采样频率与频谱特征"],
- ],
- [4.0, 8.5, 6.0],
- )
- _heading(doc, "2.2 数据质量与口径", 2)
- ov = data.get("overview") or {}
- notes = []
- if ov.get("available"):
- notes.append(f"分钟级数据完整率约 {ov.get('completeness')}%,统计口径为月内实际记录数与应有分钟数之比。")
- else:
- notes.append(f"分析概览数据不足:{ov.get('error', '未取得分钟级数据')}。")
- for key, label in [("health", "健康评估"), ("fault", "故障日志"), ("vibration", "振动波形")]:
- sec = data.get(key) or {}
- if not sec.get("available"):
- notes.append(f"{label}数据不足:{sec.get('error', '未取得有效记录')}。")
- if not notes:
- notes.append("各类数据均已取得有效记录,具体覆盖范围见各章节。")
- for n in notes:
- _para(doc, f"· {n}", indent=False, size=10)
- def _section_overview(doc, data: Dict[str, Any], tmp: str):
- _heading(doc, "3 分析概览", 1)
- ov = data.get("overview") or {}
- _para(doc, narrative.overview_text(data))
- if not ov.get("available"):
- return
- _heading(doc, "3.1 关键指标", 2)
- _table(
- doc,
- ["指标", "数值", "说明"],
- [
- ["累计发电量", f"{ov.get('total_mwh'):,.2f} MWh", "分钟级有功功率积分"],
- ["等效满负荷小时", f"{ov.get('equivalent_hours')} h", "发电量 / 装机容量"],
- ["平均风速", f"{ov.get('avg_wind')} m/s", "按记录数加权"],
- ["容量系数", f"{ov.get('capacity_factor')}%", "发电量 /(容量×时段小时数)"],
- ["数据完整率", f"{ov.get('completeness')}%", "实际记录 / 应有分钟记录"],
- ],
- [4.2, 5.0, 7.0],
- )
- _heading(doc, "3.2 月度趋势", 2)
- rows = [
- [m["month"], f"{m.get('gen_mwh', 0):,.2f}", f"{m.get('avg_wind')}", f"{m.get('completeness')}%"]
- for m in ov.get("monthly", [])
- ]
- if rows:
- _table(doc, ["月份", "发电量(MWh)", "平均风速(m/s)", "完整率"], rows, [3.0, 4.5, 4.5, 3.5])
- _image(doc, charts.monthly_generation(ov.get("monthly", []), os.path.join(tmp, "monthly_gen.png")), "图 3-1 月度发电量与平均风速")
- _heading(doc, "3.3 机组发电量对比", 2)
- _para(
- doc,
- "按机组统计发电量并排序,可快速识别低效机组。机组间差异需结合机位风速、限电、停机与故障记录综合判断,"
- "不宜仅凭发电量排名直接认定机组性能异常。",
- )
- trows = [
- [t.get("rank"), t.get("name"), f"{t.get('gen_mwh', 0):,.2f}", f"{t.get('avg_wind')}", t.get("points")]
- for t in ov.get("turbines", [])[:12]
- ]
- if trows:
- _table(doc, ["排名", "机组", "发电量(MWh)", "平均风速(m/s)", "记录数"], trows, [2.0, 4.0, 4.5, 4.0, 3.0])
- _image(doc, charts.turbine_generation(ov.get("turbines", []), os.path.join(tmp, "turbine_gen.png")), "图 3-2 机组发电量排名")
- def _section_health(doc, data: Dict[str, Any], tmp: str):
- _heading(doc, "4 健康评估", 1)
- h = data.get("health") or {}
- _para(doc, narrative.health_text(data))
- if not h.get("available"):
- return
- _heading(doc, "4.1 总体健康水平", 2)
- dist = h.get("distribution") or {}
- _table(
- doc,
- ["指标", "数值"],
- [
- ["评估机组数", len(h.get("turbines", []))],
- ["平均健康得分", h.get("avg_score")],
- ["健康 / 亚健康", f"{dist.get('healthy', 0)} / {dist.get('subhealthy', 0)} 台"],
- ["一般 / 故障", f"{dist.get('normal', 0)} / {dist.get('fault', 0)} 台"],
- ["无数据", f"{dist.get('nodata', 0)} 台"],
- ["评估月份", "、".join(h.get("assessed_months", []))],
- ],
- [5.0, 9.0],
- )
- _image(doc, charts.health_distribution(dist, os.path.join(tmp, "health_dist.png")), "图 4-1 机组健康等级分布")
- _heading(doc, "4.2 子系统健康水平", 2)
- sub = h.get("subsystems") or {}
- _table(
- doc,
- ["子系统", "平均得分", "关注点"],
- [
- ["发电机组", sub.get("generator"), "绕组、轴承温度与电气量"],
- ["机舱系统", sub.get("nacelle"), "机舱振动、温度与位置"],
- ["电网环境", sub.get("grid"), "电流、功率与并网质量"],
- ["传动系统", sub.get("drive_train"), "主轴承、齿轮箱温度"],
- ],
- [4.5, 4.0, 8.0],
- )
- _image(doc, charts.health_subsystems(sub, os.path.join(tmp, "health_subsys.png")), "图 4-2 子系统平均健康得分")
- _heading(doc, "4.3 机组健康明细", 2)
- rows = [
- [
- t.get("name"),
- t.get("score"),
- t.get("generator"),
- t.get("nacelle"),
- t.get("grid"),
- t.get("drive_train"),
- ]
- for t in h.get("turbines", [])[:20]
- ]
- if rows:
- _table(doc, ["机组", "总分", "发电机组", "机舱", "电网", "传动"], rows, [4.0, 2.5, 3.0, 2.6, 2.6, 2.6])
- _image(doc, charts.health_ranking(h.get("turbines", []), os.path.join(tmp, "health_rank.png")), "图 4-3 机组健康得分")
- if h.get("low_turbines"):
- _para(doc, "建议优先关注以下低分机组:", indent=False, bold=True)
- for t in h["low_turbines"][:8]:
- _para(doc, f"· {t.get('name')}:总分 {t.get('score')},发电机组 {t.get('generator')},机舱 {t.get('nacelle')},电网 {t.get('grid')},传动 {t.get('drive_train')}。", indent=False, size=9.5)
- def _section_fault(doc, data: Dict[str, Any], tmp: str):
- _heading(doc, "5 故障诊断", 1)
- f = data.get("fault") or {}
- _para(doc, narrative.fault_text(data))
- if not f.get("available"):
- return
- _heading(doc, "5.1 故障统计", 2)
- _table(
- doc,
- ["指标", "数值"],
- [["故障总次数", f.get("total")], ["影响机组数", f.get("affected_turbines")]],
- [5.0, 9.0],
- )
- _image(doc, charts.fault_monthly(f.get("monthly", []), os.path.join(tmp, "fault_monthly.png")), "图 5-1 月度故障次数")
- _heading(doc, "5.2 高频故障码", 2)
- rows = [[c.get("code"), c.get("count"), c.get("turbines")] for c in f.get("top_codes", [])]
- if rows:
- _table(doc, ["故障码", "次数", "影响机组数"], rows, [8.0, 3.0, 4.0])
- _image(doc, charts.fault_top(f.get("top_codes", []), os.path.join(tmp, "fault_top.png")), "图 5-2 高频故障码")
- _heading(doc, "5.3 故障机组分布", 2)
- rows = [[t.get("name"), t.get("count")] for t in f.get("turbines", [])]
- if rows:
- _table(doc, ["机组", "故障次数"], rows, [7.0, 5.0])
- def _section_vibration(doc, data: Dict[str, Any], tmp: str):
- _heading(doc, "6 振动分析", 1)
- v = data.get("vibration") or {}
- _para(doc, narrative.vibration_text(data))
- if not v.get("available"):
- return
- _heading(doc, "6.1 波形覆盖情况", 2)
- _table(
- doc,
- ["指标", "数值"],
- [
- ["波形记录数", v.get("total")],
- ["覆盖机组数", v.get("turbine_count")],
- ["测点数", v.get("point_count")],
- ["最早记录", v.get("min_time")],
- ["最新记录", v.get("max_time")],
- ],
- [5.0, 9.0],
- )
- _image(doc, charts.vibration_monthly(v.get("monthly", []), os.path.join(tmp, "vib_monthly.png")), "图 6-1 月度振动波形记录量")
- _heading(doc, "6.2 测点与采样频率", 2)
- rows = [[p.get("point"), p.get("count"), p.get("fs")] for p in v.get("points", [])]
- if rows:
- _table(doc, ["测点", "记录数", "平均采样频率(Hz)"], rows, [9.0, 3.0, 4.0])
- _heading(doc, "6.3 典型频谱", 2)
- spec = v.get("spectrum")
- if spec:
- _para(
- doc,
- f"示例波形来自 {spec.get('point')},采集时间 {spec.get('time')},采样频率 {spec.get('fs')} Hz,"
- f"转速 {spec.get('rpm')} rpm,振动有效值约 {spec.get('rms')}。频谱仅用于展示波形特征,"
- "部件级诊断仍需结合轴承参数、测点方向和历史趋势。",
- )
- _image(doc, charts.vibration_spectrum(spec, os.path.join(tmp, "vib_spectrum.png")), "图 6-2 典型振动频谱")
- else:
- _para(doc, "所选时间段内未找到可解析的波形记录,无法生成频谱示例。", indent=False)
- def _section_conclusion(doc, data: Dict[str, Any]):
- _heading(doc, "7 结论与建议", 1)
- text = narrative.conclusion_text(data)
- for line in text.split("\n"):
- line = line.strip()
- if not line:
- continue
- if line.startswith("(") or line.startswith("-") or line[:2].isdigit():
- _para(doc, line, indent=False)
- else:
- _para(doc, line)
- def _appendix(doc, data: Dict[str, Any]):
- _heading(doc, "附录 数据与模型说明", 1)
- _para(
- doc,
- "1. 健康评估得分范围为0-100分,分数越低表示健康状态越差;-1表示该机组在该月无有效评估结果。",
- indent=False,
- )
- _para(
- doc,
- "2. 分析概览的发电量由分钟级有功功率积分得到,未扣减场用电、线损及限电损失,与电量结算口径可能存在差异。",
- indent=False,
- )
- _para(
- doc,
- "3. 故障统计仅基于故障日志表,未区分电网、输变电、计划检修等外部原因,需结合现场记录复核。",
- indent=False,
- )
- _para(
- doc,
- "4. 振动频谱示例仅取所选时段内一条典型波形,不能代表机组全部运行工况。",
- indent=False,
- )
- _para(
- doc,
- f"5. 本报告生成时间:{data['meta']['generated_at']};生成模型:{os.getenv('OLLAMA_MODEL', 'qwen3.8:27b-q8_0')}(本机 Ollama),审核模型:{os.getenv('REVIEW_MODEL', 'deepseek-r1:14b')}。",
- indent=False,
- )
- def _section_skipped(doc, title: str):
- _heading(doc, title, 1)
- _para(doc, "本报告生成时未勾选该章节,故不包含对应分析内容。", indent=False)
- def build_report(data: Dict[str, Any], tmp_dir: str, output_path: str, title: Optional[str] = None,
- sections: Optional[List[str]] = None):
- os.makedirs(tmp_dir, exist_ok=True)
- os.makedirs(os.path.dirname(output_path), exist_ok=True)
- doc = Document()
- section = doc.sections[0]
- section.top_margin = Cm(2.2)
- section.bottom_margin = Cm(2.2)
- section.left_margin = Cm(2.6)
- section.right_margin = Cm(2.6)
- _setup_header_footer(doc)
- normal = doc.styles["Normal"]
- normal.font.name = "微软雅黑"
- normal.font.size = Pt(10.5)
- normal._element.rPr.rFonts.set(qn("w:eastAsia"), "微软雅黑")
- report_title = title or f"{data['wind']['name']}风电机组健康度分析报告"
- _cover(doc, report_title, data)
- _statement(doc)
- toc_items = [
- "1 概述",
- "2 数据与方法",
- "3 分析概览",
- "4 健康评估",
- "5 故障诊断",
- "6 振动分析",
- "7 结论与建议",
- "附录 数据与模型说明",
- ]
- _toc(doc, toc_items)
- _section_intro(doc, data)
- _section_data(doc, data)
- selected = set(sections or ["overview", "health", "fault", "vibration"])
- if "overview" in selected:
- _section_overview(doc, data, tmp_dir)
- else:
- _section_skipped(doc, "3 分析概览")
- if "health" in selected:
- _section_health(doc, data, tmp_dir)
- else:
- _section_skipped(doc, "4 健康评估")
- if "fault" in selected:
- _section_fault(doc, data, tmp_dir)
- else:
- _section_skipped(doc, "5 故障诊断")
- if "vibration" in selected:
- _section_vibration(doc, data, tmp_dir)
- else:
- _section_skipped(doc, "6 振动分析")
- _section_conclusion(doc, data)
- _appendix(doc, data)
- doc.core_properties.title = report_title
- doc.core_properties.author = HEADER_TEXT
- doc.core_properties.subject = f"{data['wind']['name']} {data['period']['start']} 至 {data['period']['end']}"
- doc.save(output_path)
- return output_path
|