2026-07-06 23:03:14 +08:00
|
|
|
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")
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-08 00:05:22 +08:00
|
|
|
client, err := buildOSIClient(cfg)
|
2026-07-06 23:03:14 +08:00
|
|
|
if err != nil {
|
|
|
|
|
return jkdaFindCheckResult{}, err
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-07 10:14:40 +08:00
|
|
|
records, result, err := client.FindHealthRecord(ctx, osi.FindHealthRecordQuery{IDCard: idCard})
|
|
|
|
|
check := jkdaFindCheckResult{Code: result.Code, Message: result.Message, DataCount: len(records)}
|
2026-07-06 23:03:14 +08:00
|
|
|
if err != nil {
|
|
|
|
|
return check, err
|
|
|
|
|
}
|
|
|
|
|
return check, nil
|
|
|
|
|
}
|