Files
chis_osi/osi_client.go
T
ilaandClaude Opus 4.8 47eaf1051e feat(handler): server 模式健康档案查询端点(T-208)
- GET /api/health-record/find 按 idCard/phrid/personName/empiId 查询
- 回写平台完整响应(Result.Raw),未建模字段不丢失
- 抽 buildOSIClient 共用构造,verify 与 server 复用
- 默认仅绑 127.0.0.1(端点返回真实档案 PII,避免暴露局域网)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 00:05:22 +08:00

30 lines
757 B
Go

package main
import (
"time"
"chis_osi/config"
"chis_osi/osi"
)
// buildOSIClient 用配置里的 OSI 段组装带签名/代理的薄客户端,供验证入口与 server 模式复用。
func buildOSIClient(cfg config.Config) (*osi.Client, error) {
transport, err := osi.NewTransport(osi.TransportConfig{
Timeout: time.Duration(cfg.OSI.TimeoutSec) * time.Second,
Socks5Proxy: cfg.OSI.Socks5Proxy,
})
if err != nil {
return nil, err
}
return osi.NewClient(osi.ClientConfig{
BaseURL: cfg.OSI.BaseURL,
OrgCode: cfg.OSI.OrgCode,
DeviceSN: cfg.OSI.DeviceSN,
UserName: cfg.OSI.UserName,
Ask: cfg.OSI.Ask,
OperateUser: cfg.OSI.OperateUser,
OperateUnit: cfg.OSI.OrgCode,
Transport: transport,
}), nil
}