Files
chis_osi/verify_jkda.go
T

34 lines
715 B
Go
Raw Normal View History

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
}