add medical card service
This commit is contained in:
47
services/medical-information/checkups.go
Normal file
47
services/medical-information/checkups.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package medical_information
|
||||
|
||||
import (
|
||||
"astra-api-gateway/config"
|
||||
"astra-api-gateway/pkg/api"
|
||||
"github.com/labstack/echo/v4"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetCheckupList(c echo.Context) error {
|
||||
data, err, resp := api.GetRequest(
|
||||
config.Env.MSHosts.MedicalCardHost+"/checkups/",
|
||||
c.Request().Header, c.Request().URL.RawQuery)
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
|
||||
func GetCheckup(c echo.Context) error {
|
||||
id := c.Param("id")
|
||||
|
||||
data, err, resp := api.GetRequest(
|
||||
config.Env.MSHosts.MedicalCardHost+"/checkups/"+id,
|
||||
c.Request().Header, c.Request().URL.RawQuery)
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
|
||||
func CreateCheckup(c echo.Context) error {
|
||||
data, err, resp := api.PostRequest(
|
||||
config.Env.MSHosts.MedicalCardHost+"/checkups/",
|
||||
c.Request().Body,
|
||||
c.Request().Header)
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
33
services/medical-information/medical-cards.go
Normal file
33
services/medical-information/medical-cards.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package medical_information
|
||||
|
||||
import (
|
||||
"astra-api-gateway/config"
|
||||
"astra-api-gateway/pkg/api"
|
||||
"github.com/labstack/echo/v4"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetMCList(c echo.Context) error {
|
||||
data, err, resp := api.GetRequest(
|
||||
config.Env.MSHosts.MedicalCardHost+"/medical_cards/",
|
||||
c.Request().Header, c.Request().URL.RawQuery)
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
|
||||
func CreateMC(c echo.Context) error {
|
||||
data, err, resp := api.PostRequest(
|
||||
config.Env.MSHosts.MedicalCardHost+"/medical_cards/",
|
||||
c.Request().Body,
|
||||
c.Request().Header)
|
||||
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(resp.StatusCode, resp.Header.Get("Content-Type"), data)
|
||||
}
|
||||
Reference in New Issue
Block a user