48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
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)
|
|
}
|