readcard-c/README.md
2026-10-19 18:08:35 +08:00

34 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# readcard-c
面向旧版 Windows 的原生 C++/Win32 本地读卡与医保电子凭证程序。程序必须构建为 **Win32/x86**,因为 `CardReaderDLL.dll` 与 `NationECCode.dll` 均为 32 位 DLL。
## Windows 兼容性
项目使用 Win32 API 和静态链接 MSVC 运行时。建议用 Visual Studio 2017 的 `v141_xp` 工具集构建,目标为 Windows XP SP3 及以上;实际下限还取决于读卡器、扫码墩驱动及医保厂商 DLL 的支持范围。
```powershell
cmake -S . -B build -A Win32 -T v141_xp
cmake --build build --config Release
```
也可双击 `一键打包.bat`。若直接运行 `build.ps1`,请在 PowerShell 中执行 `./build.ps1`,而不是在资源管理器中双击 `.ps1` 文件。
将以下内容一起发布:
```text
readcard-c.exe
config.json
package/DWCardReaderDLL/
package/EMICDLL/
```
## GUI 与后续接口
当前首版已实现 Win32 GUI、两套 DLL 的加载、医保扫码墩输入到 `NationEcTrans` 的调用、电子凭证解析展示,以及逐步骤日志。医保电子凭证按钮会把焦点交给隐藏的扫码输入框;扫码墩输入完成并发送回车后,程序通过 `NationEcTrans` 调用医保 DLL,并显示姓名、证件号、`ecToken`。
旧项目的本地 HTTP 接口(`/health`、`/api/card/read-nopin`、`/api/card/read`、`/api/hmac-sm3`、`/api/emic/scan`)应作为下一阶段迁移到本项目;在未完成前,PC 前端仍应继续调用旧的 `readcard-go` 服务。
## 逐步骤日志
`operation_trace_enabled` 控制流程日志,开发期默认为 `true`。`operation_trace_include_sensitive` 控制是否记录姓名、身份证号、卡号、医保码和 `ecToken`,开发期默认为 `true`,正式环境应设为 `false`。日志写入 `logs/operation-YYYYMMDD.log`。