feat(osi): 实现老年人自理能力查询(T-303)
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user