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) }