Files
chis_osi/osi/lnr.go
T

42 lines
1.1 KiB
Go
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.
package osi
import (
"context"
"fmt"
"chis_osi/contract"
)
// ElderlySelfCareQuery 是 LNRZLPG00002 的查询条件。
// 厂家文档要求 idCard,phrId 和 checkId 为可选定位条件。
type ElderlySelfCareQuery struct {
IDCard string
PHRID string
CheckID string
}
// QueryElderlySelfCare 查询老年人生活自理能力评估记录。
func (c *Client) QueryElderlySelfCare(ctx context.Context, query ElderlySelfCareQuery) ([]contract.ElderlySelfCareAssessment, Result, error) {
baseInfo, err := query.baseInfo()
if err != nil {
return nil, Result{}, err
}
var rows []contract.ElderlySelfCareAssessment
result, err := c.Call(ctx, ServiceIDLNRSelfCareQuery, baseInfo, &rows)
return rows, result, err
}
func (q ElderlySelfCareQuery) baseInfo() (map[string]string, error) {
if q.IDCard == "" {
return nil, fmt.Errorf("query elderly self care requires idCard")
}
baseInfo := map[string]string{"idCard": q.IDCard}
if q.PHRID != "" {
baseInfo["phrId"] = q.PHRID
}
if q.CheckID != "" {
baseInfo["checkId"] = q.CheckID
}
return baseInfo, nil
}