42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
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
|
|||
|
|
}
|