feat (patient): add search

This commit is contained in:
dpurbosakti
2025-09-04 11:32:11 +07:00
parent e658b9adc2
commit 4f6a781341
6 changed files with 104 additions and 1 deletions
@@ -105,6 +105,15 @@ func SetRoutes() http.Handler {
"PATCH /{id}/block": user.O.Block,
"PATCH /{id}/active": user.O.Active,
})
hk.GroupRoutes("/v1/patient", r, hk.MapHandlerFunc{
"GET /": patient.O.GetList,
"GET /{id}": patient.O.GetDetail,
"POST /": patient.O.Create,
"PATCH /{id}": patient.O.Update,
"DELETE /{id}": patient.O.Delete,
"GET /by-identifier": patient.O.Search,
})
hc.RegCrud(r, "/v1/person", person.O)
hc.RegCrud(r, "/v1/person-address", personaddress.O)
hc.RegCrud(r, "/v1/person-contact", personcontact.O)
@@ -113,7 +122,6 @@ func SetRoutes() http.Handler {
hc.RegCrud(r, "/v1/nurse", nurse.O)
hc.RegCrud(r, "/v1/nutritionist", nutritionist.O)
hc.RegCrud(r, "/v1/pharmacist", pharmacist.O)
hc.RegCrud(r, "/v1/patient", patient.O)
/******************** sources ********************/
hc.RegCrud(r, "/v1/division", division.O)
@@ -69,3 +69,10 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
res, err := u.Delete(dto)
rw.DataResponse(w, res, err)
}
func (obj myBase) Search(w http.ResponseWriter, r *http.Request) {
dto := e.SearchDto{}
sf.UrlQueryParam(&dto, *r.URL)
res, err := u.Search(dto)
rw.DataResponse(w, res, err)
}