# -*- coding: utf-8 -*- """临时验证脚本:用实际 Excel 数据验证新 _match_rule 筛选(用后即删)""" import sys sys.path.insert(0, r"d:\work\code\37duAutomation\workflows\XQ0015 参保成功及异常告知书制作与下发") import py_compile py_compile.compile(r"d:\work\code\37duAutomation\workflows\XQ0015 参保成功及异常告知书制作与下发\notice_mail_merge.py", doraise=True) print("SYNTAX OK") import notice_mail_merge as nm excel = r"D:\资料\人资\告知书制作与下发\2026年9月社保变更及增减名单及人数统计.xlsx" records = nm._read_insurance_records(excel) print("参保名单记录数:", len(records)) if records: keys = [k for k in records[0].keys()] print("首条字段数:", len(keys), "含参保告知:", "参保告知" in keys, "含费用:", "费用" in keys) for rn, rule in nm.TEMPLATES.items(): if rn == "社保转移": continue matched = [r for r in records if nm._match_rule(r, rule["status"], rule["type"])] print(f"[{rn}] status={rule['status']} type={rule['type']} -> 命中 {len(matched)} 人") for r in matched[:10]: print(" ", r.get("姓名"), "| 参保类型:", r.get("参保类型"), "| 办理状态:", r.get("办理状态"), "| 参保告知:", repr(r.get("参保告知")), "| 费用:", r.get("费用"), "| 人员类型:", r.get("人员类型"), "| 二级部门:", r.get("二级部门"))