- 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>
34 lines
715 B
Go
34 lines
715 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"chis_osi/config"
|
|
"chis_osi/osi"
|
|
)
|
|
|
|
type jkdaFindCheckResult struct {
|
|
Code string
|
|
Message string
|
|
DataCount int
|
|
}
|
|
|
|
func runJKDAFindCheck(ctx context.Context, cfg config.Config, idCard string) (jkdaFindCheckResult, error) {
|
|
if idCard == "" {
|
|
return jkdaFindCheckResult{}, fmt.Errorf("id card is required")
|
|
}
|
|
|
|
client, err := buildOSIClient(cfg)
|
|
if err != nil {
|
|
return jkdaFindCheckResult{}, err
|
|
}
|
|
|
|
records, result, err := client.FindHealthRecord(ctx, osi.FindHealthRecordQuery{IDCard: idCard})
|
|
check := jkdaFindCheckResult{Code: result.Code, Message: result.Message, DataCount: len(records)}
|
|
if err != nil {
|
|
return check, err
|
|
}
|
|
return check, nil
|
|
}
|