feat(handler): 暴露公开查询 HTTP API(T-210)

This commit is contained in:
ila
2026-07-09 21:24:09 +08:00
parent 1903fa476b
commit 816a992f00
8 changed files with 662 additions and 158 deletions
+9
View File
@@ -17,12 +17,17 @@ func runServer(cfg config.Config, addr string) error {
hr := handler.NewHealthRecordHandler(client)
hc := handler.NewHealthCheckHandler(client)
pub := handler.NewPublicHandler(client)
mux := http.NewServeMux()
mux.HandleFunc("/api/health-record/find", hr.Find)
mux.HandleFunc("/api/health-record/crowd", hr.Crowd)
mux.HandleFunc("/api/health-check/last", hc.Last)
mux.HandleFunc("/api/health-check/all", hc.All)
mux.HandleFunc("/api/health-check/list", hc.List)
mux.HandleFunc("/api/dictionaries/grid-addresses", pub.GridAddresses)
mux.HandleFunc("/api/dictionaries/doctors", pub.Doctors)
mux.HandleFunc("/api/dictionaries/drugs", pub.Drugs)
mux.HandleFunc("/api/dictionaries/orgs", pub.Orgs)
fmt.Printf("chis_osi server listening on %s\n", addr)
fmt.Printf(" GET http://%s/api/health-record/find?idCard=<身份证>\n", addr)
@@ -30,6 +35,10 @@ func runServer(cfg config.Config, addr string) error {
fmt.Printf(" GET http://%s/api/health-check/last?idCard=<身份证>\n", addr)
fmt.Printf(" GET http://%s/api/health-check/all?idCard=<身份证>\n", addr)
fmt.Printf(" GET http://%s/api/health-check/list?checkYear=<年度>&idCard=<身份证>\n", addr)
fmt.Printf(" GET http://%s/api/dictionaries/grid-addresses?parentCode=<区划码>\n", addr)
fmt.Printf(" GET http://%s/api/dictionaries/doctors?manaUnitId=<机构码>\n", addr)
fmt.Printf(" GET http://%s/api/dictionaries/drugs?ypmc=<药品名>\n", addr)
fmt.Printf(" GET http://%s/api/dictionaries/orgs?parentId=<上级机构ID>\n", addr)
server := &http.Server{Addr: addr, Handler: mux}
return server.ListenAndServe()