feat(osi): 实现老年人自理能力查询(T-303)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"chis_osi/osi"
|
||||
)
|
||||
|
||||
// ElderlyHandler 暴露老年人业务查询 HTTP 入口。
|
||||
type ElderlyHandler struct {
|
||||
client *osi.Client
|
||||
}
|
||||
|
||||
func NewElderlyHandler(client *osi.Client) *ElderlyHandler {
|
||||
return &ElderlyHandler{client: client}
|
||||
}
|
||||
|
||||
// SelfCare 处理 GET /api/elderly/self-care?idCard=..&phrId=..&checkId=..
|
||||
func (h *ElderlyHandler) SelfCare(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
writeJSONError(w, http.StatusMethodNotAllowed, "only GET is supported")
|
||||
return
|
||||
}
|
||||
q := r.URL.Query()
|
||||
if q.Get("idCard") == "" {
|
||||
writeJSONError(w, http.StatusBadRequest, "idCard is required")
|
||||
return
|
||||
}
|
||||
_, result, err := h.client.QueryElderlySelfCare(r.Context(), osi.ElderlySelfCareQuery{
|
||||
IDCard: q.Get("idCard"),
|
||||
PHRID: q.Get("phrId"),
|
||||
CheckID: q.Get("checkId"),
|
||||
})
|
||||
writeRawOrError(w, result, err)
|
||||
}
|
||||
Reference in New Issue
Block a user