郑州市中医院在线服务
下载地址
https://www.zhengdianxue.com/wp-content/uploads/skills/herenit--zzzyy-phs-cli.zip将提示词发送给你的 AI 安装该 skills
请根据 https://skillhub.cn/install/skillhub.md,安装 @herenit/zzzyy-phs-cli。郑州市中医院互联网医院 CLI 工具,用于完成短信登录、就诊人管理、预约挂号和检查检验报告查询全流程。触发条件包括 挂号、预约挂号、登录、添加就诊人、绑定就诊人、查询报告等场景。
阅读全文 (展开查看完整说明)
概述
heren-zzzyy — 互联网医院 CLI 工具
CLI 工具,封装 phs 网关 API(互联网医院),支持 agent 驱动的流程:短信登录、就诊人管理、预约挂号、报告查询。
⚠️ 核心约束(必须遵守)
严禁自行组装 HTTP 请求
所有操作必须通过 python scripts/heren_zzzyy.py 执行。 严禁自行调用 API 端点。
✅ 正确做法: 仅使用本文档列出的 CLI 子命令。参数和顺序必须与本文档示例完全一致。
原因:API 涉及加密签名、Token 注入等多级封装,自行组装极易出错。
发送短信前必须显式确认
auth login(交互式自动发验证码)和auth send-sms执行前必须向用户显式确认。- 登录失败或验证码错误时,必须再次确认后才能重发,禁止自动重试。
- 这是防止短信滥发的合规要求。
安装
pip install click requests pycryptodome运行入口
python scripts/heren_zzzyy.py --version所有子命令均通过此入口调用。
会话状态
所有状态持久化到 ~/.heren-zzzyy/session-zzzyy.json:
| 字段 | 说明 |
|---|---|
accessToken | 登录 token |
herenId | 用户 ID |
patientId | 当前活跃就诊人 ID |
patientName | 当前活跃就诊人姓名 |
hosId | 医院 ID 缓存 |
sysCode | 系统医院编码(1001099) |
apiSuffix | API 路径后缀 |
支持的系统医院:
| 编码 | 医院名称 | API 后缀 |
|---|---|---|
1001099 | 郑州中医院 | =zzzyy07211327 |
使用流程
0. 系统医院
本工具已预配置为 郑州中医院(编码 1001099),API 后缀自动拼接。可通过以下命令查看当前配置:
python scripts/heren_zzzyy.py config show命令分组
config — 系统配置
# 查看当前配置(环境、系统医院、登录状态等)
python scripts/heren_zzzyy.py config showauth — 认证
# 交互式登录:提示输入手机号 → 自动发送验证码 → 提示输入验证码 → 登录
python scripts/heren_zzzyy.py auth login
# 也可直接传入手机号跳过第一步
python scripts/heren_zzzyy.py auth login --phone <phone>
# 仅发送验证码(不登录)
python scripts/heren_zzzyy.py auth send-sms <phone>
# 查看登录状态
python scripts/heren_zzzyy.py auth status
# 获取当前用户信息(需登录)
python scripts/heren_zzzyy.py auth user-info [--json]
# 退出登录
python scripts/heren_zzzyy.py auth logoutpatient — 就诊人管理
# 查看已绑定的就诊人列表
python scripts/heren_zzzyy.py patient list [--json]
# 交互选择就诊人(只有一个则自动选中)
python scripts/heren_zzzyy.py patient choose [--json]
# 新增就诊人(建档)
python scripts/heren_zzzyy.py patient add --name "<姓名>" --id-no "<身份证号>" --phone "<手机号>" [--gender 1] [--cert-type 01] [--patient-type -1]
# 查档绑定(曾就诊的患者)
python scripts/heren_zzzyy.py patient add-by-treated --name "<姓名>" --id-no "<身份证号>" --phone "<手机号>" --gender 1 [--json]
# 设置活跃就诊人
python scripts/heren_zzzyy.py patient select <patientId> [--name "<姓名>"]
# 获取就诊人详情
python scripts/heren_zzzyy.py patient detail <patientId> [--json]--gender:1=男,2=女(默认1)--cert-type:01=身份证(默认),02=护照等--patient-type:-1=成人/儿童有身份证(默认),0=新生儿,1=军人
patient add使用建档 API(addPat),适用于新增或已就诊患者。若已绑定,则返回"证件号或就诊人已存在",直接用
patient select即可。若用户表示"之前在这家医院看过病",优先尝试查档绑定(
add-by-treated)。
reg — 预约挂号
# 科室列表
python scripts/heren_zzzyy.py reg dept-list [--hos-id HOS001] [--json]
# 科室下医生列表
python scripts/heren_zzzyy.py reg doc-list <deptCode> [--hos-id HOS001] [--json]
# 查询号源(预约前必执行)
python scripts/heren_zzzyy.py reg number-source '<schedule_data_json>' [--hos-id HOS001] [--json]
# 预约挂号(需提供排班数据和号源数据)
python scripts/heren_zzzyy.py reg book <schId> [--patient-id PAT001] [--schedule-data JSON] [--number-source JSON] [--json]
# 取消挂号
python scripts/heren_zzzyy.py reg cancel <orderId> [--hos-order-id HO001] [--source 19] [--json]
# 我的挂号列表
python scripts/heren_zzzyy.py reg my-list [--patient-id PAT001] [--hos-id HOS001] [--page 1] [--json]
# 获取所有科室医生(保存到文件)
python scripts/heren_zzzyy.py reg all-doctors [--json]预约挂号工作流:
reg dept-list --json→ 选择科室(deptCode)reg number-source '<schedule_data_json>' --json→ 选择号源,获取 number_source 完整 JSONreg book <schId> --schedule-data '<schedule_data_json>' --number-source '<number_source_json>' --json
query — 报告查询
# 报告列表(--header-type: jy=检验, jc=检查, tj=体检)
python scripts/heren_zzzyy.py query reports [--patient-id PAT001] [--hos-id HOS001] [--header-type jy] [--json]
# 报告详情(--extend 从报告列表输出的 extend 字段取值传入)
python scripts/heren_zzzyy.py query report-detail <reportId> [--hos-id HOS001] [--patient-id PAT001] [--extend EXTEND] [--json]hospital — 医院信息
# 医院列表(支持按名称搜索和定位)
python scripts/heren_zzzyy.py hospital list [--name "医院名"] [--type 1] [--hos-type TYPE] [--area-id AREA] [--gis-lng 120.1] [--gis-lat 30.1] [--json]--type:1=挂号预约--gis-lng/--gis-lat: 经纬度,用于最近医院距离计算
典型工作流程
0. 系统医院
本工具已预配置为 郑州中医院(编码 1001099),无需手动选择。查看当前配置:
python scripts/heren_zzzyy.py config show1. 登录与就诊人选择
1.1 登录(交互式)
# 交互式登录:提示输入手机号 → 自动发送验证码 → 提示输入验证码 → 登录
python scripts/heren_zzzyy.py auth login
# 也可直接传入手机号跳过第一步
python scripts/heren_zzzyy.py auth login --phone <phone>也可以分两步执行:先
python scripts/heren_zzzyy.py auth send-sms <phone>,再python scripts/heren_zzzyy.py auth login --phone <phone> --sms-code <code>
1.2 选择就诊人
# 查看已绑定的就诊人列表
python scripts/heren_zzzyy.py patient list --json
# 选择一个就诊人(设为 session 的 active patient)
python scripts/heren_zzzyy.py patient select <patientId> --name "姓名"如果只有一个就诊人会自动选中。也可交互选择:
python scripts/heren_zzzyy.py patient choose --json1.3 验证登录状态
python scripts/heren_zzzyy.py auth status注意
- 登录后 session 持久化到
~/.heren-zzzyy/session-zzzyy.json,后续命令自动读取 patient select设置的patientId会作为后续所有命令的默认就诊人- 如需切换就诊人,再次调用
patient select即可
2. 添加就诊人
2.1 确认登录状态
python scripts/heren_zzzyy.py auth status2.2 查看现有就诊人
python scripts/heren_zzzyy.py patient list --json2.3 收集就诊人信息
| 字段 | 说明 | 示例 |
|---|---|---|
| 姓名 | 真实姓名 | <姓名> |
| 身份证号 | 18位身份证 | <身份证号> |
| 手机号 | 11位手机号 | <手机号> |
| 性别 | 1=男, 2=女 | 1 |
| 证件类型 | 01=身份证(默认), 02=护照 | 01 |
2.4 建档方式
- 建档(
patient add):新患者 - 查档绑定(
patient add-by-treated):曾就诊患者
建议先尝试查档绑定,若返回"未查询到相关档案信息"(999301),回退到建档。
2.5 建档
python scripts/heren_zzzyy.py patient add --name "<姓名>" --id-no "<身份证号>" --phone "<手机号>" --gender 1 --json2.6 查档绑定
python scripts/heren_zzzyy.py patient add-by-treated --name "<姓名>" --id-no "<身份证号>" --phone "<手机号>" --gender 1 --json2.7 错误处理
| 错误信息 | 含义 | 处理方式 |
|---|---|---|
| "证件号或就诊人已存在" | 已绑定 | 直接 patient select |
| "未查询到相关档案信息"(999301) | 无历史记录 | 回退建档 |
| "该身份证号已被其他用户绑定" | 被占用 | 确认身份证号 |
2.8 设置新就诊人
python scripts/heren_zzzyy.py patient select <patientId> --name "<姓名>"2.9 验证
python scripts/heren_zzzyy.py patient list --json
python scripts/heren_zzzyy.py patient detail <patientId> --json3. 预约挂号
3.1 查询号源(必须)
python scripts/heren_zzzyy.py reg number-source '<schedule_data_json>' --json3.2 预约挂号
python scripts/heren_zzzyy.py reg book <schId> --schedule-data '<schedule_data_json>' --number-source '<number_source_json>' --json3.3 查看/取消
python scripts/heren_zzzyy.py reg my-list --json
python scripts/heren_zzzyy.py reg cancel <orderId> --json4. 查询检验报告
4.1 报告列表
python scripts/heren_zzzyy.py query reports --header-type jy --json
python scripts/heren_zzzyy.py query reports --header-type jc --json
python scripts/heren_zzzyy.py query reports --header-type tj --json4.2 报告详情
python scripts/heren_zzzyy.py query report-detail <reportId> --jsonJSON 输出
所有数据命令支持 --json 参数:
python scripts/heren_zzzyy.py patient list --json
python scripts/heren_zzzyy.py reg dept-list --jsonAPI 环境
| 环境 | Base URL |
|---|---|
prod | https://netphs.eheren.com/gateway |
Agent 注意事项
- 需要就诊人的命令默认使用 session 中的活跃
patientId,可通过--patient-id覆盖 --json适用于所有返回数据的命令- 认证状态跨调用持久化在
~/.heren-zzzyy/session-zzzyy.json - 预约挂号必须提供
--schedule-data和--number-source