GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - eastyou/firstaid: 急救步骤卡:常见意外的处理步骤、禁忌与可打印练习页

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
examples
examples
 
 
firstaid
firstaid
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

firstaid · 急救步骤卡

CI License: MIT Python 3.9+

面向师生的 Python 标准库小作品:把常见意外的处理步骤、禁忌和「何时拨打 120」整理成可打印的 A4 步骤卡、练习页与速查表。全部内容使用标准库实现,零第三方依赖,适合作为教学演示与课堂练习材料。

仅供教学参考,紧急情况请立即拨打 120。

本项目不是医疗器械,也不能替代专业急救培训与诊断。遇到真实紧急情况,请优先呼叫急救人员并听从调度员指导。

场景一览

内置 12 个场景,支持按名称、别名、关键词模糊查询:

场景 可查询的别名 / 关键词示例
烫伤 烧伤、灼伤、开水、热油、burn
鼻出血 流鼻血、鼻子出血、鼻腔出血
异物卡喉 噎住、卡喉、海姆立克、choking
中暑 热射病、暑热、高温、heatstroke
扭伤 崴脚、踝扭伤、拉伤、sprain
割伤出血 切割伤、外伤出血、刀伤、cut
触电 电击、漏电、电源、插座、shock
溺水 落水、淹溺、drowning
癫痫发作 抽搐、羊癫疯、抽风、seizure
低血糖 血糖低、手抖、出冷汗、hypoglycemia
蜂蜇 蜂蛰、蜜蜂蜇伤、毒刺、sting
疑似骨折 骨折、骨头断了、骨伤、fracture

每个场景都包含 4~6 条有序步骤、2~3 条禁忌、拨打 120 的时机与关键词。

安装

需要 Python 3.9 或更高版本,无第三方依赖。

cd firstaid
python3 -m pip install -e .
firstaid --help

不安装也可以直接在仓库根目录以模块方式运行:

cd firstaid
python3 -m firstaid info 烫伤

命令行用法

firstaid info 烫伤                     # 步骤 + 禁忌 + 呼叫时机 + 免责声明
firstaid steps 异物卡喉                # 只输出处理步骤
firstaid donts 中暑                    # 只输出禁忌
firstaid card 烫伤 -o burn.html        # 生成 A4 单页步骤卡
firstaid quiz --count 10 --seed 5 -o quiz.html
firstaid ordering --count 3 --seed 2 -o ordering.html
firstaid poster -o poster.html         # 全部场景速查表

说明:

  • --count 的取值范围为 1-30(quiz)与 1-12(ordering)。
  • --seed 用于复现同一套题目。
  • 生成 HTML 时可加 --answers,把答案与解析一起打印。
  • -o/--output 成功后会输出 已生成:<路径>。
  • 参数错误统一返回退出码 2,并在标准错误输出中文提示。

info 的实际输出示例:

【烫伤】急救步骤卡
别名:烧伤、灼伤、烫到

步骤:
  1. 立即远离热源,用流动的凉水(约 15~25 ℃)持续冲洗伤处 15~20 分钟,帮助皮肤降温。
  2. 冲洗时轻轻取下伤处附近的戒指、手表和过紧衣物;衣物粘住皮肤时不要强行撕开。
  ...
禁忌:
  × 不要涂抹牙膏、酱油、香油、酒精或紫药水,这些做法会刺激伤口并影响医生判断。
  ...
何时拨打 120:烫伤面积超过手掌大小、伤及面部/关节/会阴、皮肤发白或焦黑,或伤者为儿童、老人且情况较重时,立即拨打 120。

免责声明:仅供教学参考,紧急情况请立即拨打 120。

库用法

from firstaid import (
    DISCLAIMER,
    find_scenario,
    steps,
    donts,
    quiz_items,
    ordering_items,
    card_html,
    quiz_html,
    poster_html,
    all_scenarios,
)

scenario = find_scenario("烧伤")          # 别名同样可以命中「烫伤」
print(scenario.name)                       # 烫伤
print(len(steps("烫伤")))                  # 5
print(donts("烫伤")[0])

items = quiz_items(6, seed=7)              # 选择题与判断题交替
print(items[0]["question"])
print(quiz_html(items, with_answers=True))

ordering = ordering_items(3, seed=1)       # 步骤排序练习
print(ordering[0]["shuffled"])
print(ordering[0]["answer"])

html = card_html(scenario)                 # A4 单页步骤卡
poster = poster_html(all_scenarios())      # 场景速查表
print(DISCLAIMER)                          # 每个页面与输出都会带上

所有渲染函数都会对文本做 html.escape,输出自带 @media print 与 A4 页面设置,用浏览器「打印 / 另存为 PDF」即可得到纸质讲义。

示例文件

examples/ 中已生成可直接打开的三份示例:

  • examples/choking.html:异物卡喉步骤卡
  • examples/quiz.html:10 道随机练习题(--seed 5)
  • examples/poster.html:12 个场景的速查表

项目结构

firstaid/
  __init__.py          公共 API 与 __version__
  __main__.py          python -m firstaid 入口
  model.py             场景数据、查询与题目生成
  render.py            HTML 渲染(步骤卡 / 练习页 / 排序 / 速查表)
  cli.py               命令行
  tests/               125 个 unittest 单元测试
  examples/*.html      示例产物
  README.md
  LICENSE
  pyproject.toml
  .gitignore
  .github/workflows/ci.yml

测试

共 125 个单元测试,全部使用标准库 unittest:

cd firstaid
python3 -m unittest discover -s tests -v

已在以下解释器上验证通过:

  • Python 3.9.6(/usr/bin/python3):Ran 125 tests ... OK
  • Python 3.15.2(python3):Ran 125 tests ... OK

测试覆盖场景数据完整性、别名/关键词查询、随机题目结构、排序题、HTML 转义与打印样式、CLI 退出码、文件写入与错误提示等。

设计与安全说明

  • 仅使用 Python 标准库,兼容 3.9 与 3.15,未使用 match、X | None、海象运算符等 3.10+ 语法。
  • 所有函数带类型注解;外部输入做类型与取值校验,错误消息为中文。
  • 内容遵循常见公共急救常识,措辞保守;不包含随意移动疑似脊柱损伤者、徒手拉扯触电者等危险操作。
  • 页面与 info 输出固定包含「仅供教学参考,紧急情况请立即拨打 120。」

License

MIT © 2026 eastyou

About

急救步骤卡:常见意外的处理步骤、禁忌与可打印练习页

Topics

educationfirst-aidpythonsafetyteaching

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.