Generate annual insurance welfare Word reports from
gh_hg_bscyearall_dues in OpenClaw format. The packaged Python entry extracts the target year, inspects...Latest: v1.0.0
Annual Insurance Word Report v1.0.0
- Initial release: Generate annual insurance welfare Word reports in OpenClaw format.
- Automatically extracts the target year from input or natural-language request.
- Queries MySQL table
gh_hg_bscyearall_duesand reads column comments for field mapping. - Fills and exports yearly business data into a bundled Word
.docxtemplate without Word COM. - Supports flexible configuration for database connection, template, and output paths.
- Falls back to
mysqlCLI ifPyMySQLis unavailable.
Full description
Generate annual insurance welfare Word reports from gh_hg_bscyearall_dues in OpenClaw format. The packaged Python entry extracts the target year, inspects MySQL column comments, maps business fields into the bundled Word template, and writes the final .docx report.
Annual Insurance Word Report
What this package does
- Resolves the target year from
yearor fromrequest_text - Queries
gh_hg_bscyearall_dues - Reads
INFORMATION_SCHEMA.COLUMNScomments before rendering - Fills the bundled yearly Word template without depending on Word COM
- Writes the finished
.docxfile tooutputs/by default
Inputs
request_text: optional natural-language request, for example帮我生成2023年业务报告year: optional explicit year, for example2023template_path: optional custom.docxtemplate pathoutput_path: optional custom output.docxpathdb_host: optional, default127.0.0.1db_port: optional, default3306db_user: optional, defaultrootdb_password: optional, defaultrootdatabase: optional, defaulttest_dbtable_name: optional, defaultgh_hg_bscyearall_duescharset: optional, defaultutf8mb4mysql_cli: optional fallback path tomysqlCLI ifPyMySQLis unavailable
Run
Install dependencies:
pip install -r requirements.txt
Run with an explicit year:
python src/main.py --year 2023
Run with request text extraction:
python src/main.py --request-text "帮我生成2023年业务报告"
Custom database example:
python src/main.py --year 2023 --database test_db --db-user root --db-password root
Notes
- The default output path is
outputs/annual-insurance-report-<year>.docx. - The default template is stored as text in
assets/beijing_office_annual_template.docx.base64.txtand is restored to a temporary.docxat runtime. - The package keeps the original business mapping:
团意、子女、女工、重疾、轻症、住院、津贴、补充、两癌、综合A、综合B、合计. - If
PyMySQLis not installed, the entry falls back to themysqlCLI whenmysql_cliis provided ormysqlis onPATH.
