Merge branch 'migration' of https://github.com/dikstub-rssa/simrs-be into migration-vanilia
This commit is contained in:
@@ -4,12 +4,12 @@ import (
|
||||
"net/http"
|
||||
|
||||
/******************** main / transaction ********************/
|
||||
member "simrs-vx/internal/interface/bpjs-handler/member"
|
||||
monitoring "simrs-vx/internal/interface/bpjs-handler/monitoring"
|
||||
reference "simrs-vx/internal/interface/bpjs-handler/reference"
|
||||
vclaimsep "simrs-vx/internal/interface/bpjs-handler/vclaim-sep"
|
||||
vclaimsephist "simrs-vx/internal/interface/bpjs-handler/vclaim-sep-hist"
|
||||
vclaimsepprint "simrs-vx/internal/interface/bpjs-handler/vclaim-sep-print"
|
||||
member "simrs-vx/internal/interface/main-handler/member"
|
||||
monitoring "simrs-vx/internal/interface/main-handler/monitoring"
|
||||
reference "simrs-vx/internal/interface/main-handler/reference"
|
||||
vclaimsep "simrs-vx/internal/interface/main-handler/vclaim-sep"
|
||||
vclaimsephist "simrs-vx/internal/interface/main-handler/vclaim-sep-hist"
|
||||
vclaimsepprint "simrs-vx/internal/interface/main-handler/vclaim-sep-print"
|
||||
|
||||
/******************** actor ********************/
|
||||
|
||||
@@ -49,7 +49,7 @@ func SetRoutes() http.Handler {
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep", r, hk.MapHandlerFunc{
|
||||
"POST /": vclaimsep.O.Create,
|
||||
"PATCH /{id}": vclaimsep.O.Update,
|
||||
"PATCH /{id}": vclaimsep.O.GetDetail,
|
||||
"DELETE /{id}": vclaimsep.O.Delete,
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package mcusrccategory
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/mcu-src-category"
|
||||
u "simrs-vx/internal/use-case/main-use-case/mcu-src-category"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if intId <= 0 {
|
||||
return
|
||||
}
|
||||
id := uint16(intId)
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = &id
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if intId <= 0 {
|
||||
return
|
||||
}
|
||||
id := uint16(intId)
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = &id
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
intId := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if intId <= 0 {
|
||||
return
|
||||
}
|
||||
id := uint16(intId)
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = &id
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package antibioticsrc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/antibiotic-src"
|
||||
u "simrs-vx/internal/use-case/main-use-case/antibiotic-src"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package controlplan
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/control-plan"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/control-plan"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "controlType", r.PathValue("controlType"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "controlType is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "polyCode", r.PathValue("polyCode"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "polyCode is required"}, nil)
|
||||
}
|
||||
pValue3 := rw.ValidateString(w, "date", r.PathValue("date"))
|
||||
if pValue3 == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "date is required"}, nil)
|
||||
}
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
dto.PathValue3 = pValue3
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -64,12 +64,17 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -79,30 +84,40 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CheckOut(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.DischargeDto{}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -118,12 +133,20 @@ func (obj myBase) CheckOut(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.CheckOut(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CheckIn(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CheckinDto{}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -139,6 +162,8 @@ func (obj myBase) CheckIn(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.CheckIn(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -149,9 +174,15 @@ func (obj myBase) Process(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCProcess,
|
||||
AuthInfo: *authInfo,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
@@ -170,11 +201,11 @@ func (obj myBase) Cancel(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCCancel,
|
||||
AuthInfo: *authInfo,
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -186,7 +217,7 @@ func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCRejected,
|
||||
}
|
||||
|
||||
@@ -201,7 +232,7 @@ func (obj myBase) Skip(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint16(id),
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCSkipped,
|
||||
}
|
||||
|
||||
@@ -225,13 +256,19 @@ func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
res, err := u.RequestSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveUnitDto{}
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -241,7 +278,37 @@ func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.ApproveSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CancelSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.CancelSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -59,6 +59,22 @@ func validateRequestCheckIn(w http.ResponseWriter, i e.CheckinDto) (valid bool)
|
||||
}
|
||||
|
||||
func validateRequestSwitchUnit(w http.ResponseWriter, i e.SwitchUnitDto) (valid bool) {
|
||||
// validate poly-switch-code
|
||||
if i.PolySwitchCode == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: fmt.Sprintf("polySwitchCode required"),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if *i.PolySwitchCode != ere.PSCConsulPoly && *i.PolySwitchCode != ere.PSCConsulExecutive {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "invalid PolySwitchCode",
|
||||
})
|
||||
}
|
||||
|
||||
if i.InternalReferences == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
|
||||
@@ -39,7 +39,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
dto := eir.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := uir.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := uir.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := eir.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := uir.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
prescription "simrs-vx/internal/interface/main-handler/prescription"
|
||||
prescriptionitem "simrs-vx/internal/interface/main-handler/prescription-item"
|
||||
responsibledoctorhist "simrs-vx/internal/interface/main-handler/responsible-doctor-hist"
|
||||
resume "simrs-vx/internal/interface/main-handler/resume"
|
||||
sbar "simrs-vx/internal/interface/main-handler/sbar"
|
||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||
uploadfile "simrs-vx/internal/interface/main-handler/upload-file"
|
||||
@@ -74,6 +75,8 @@ import (
|
||||
zlc "simrs-vx/pkg/zerolog-ctx"
|
||||
|
||||
/******************** sources ********************/
|
||||
antibioticsrc "simrs-vx/internal/interface/main-handler/antibiotic-src"
|
||||
antibioticsrccat "simrs-vx/internal/interface/main-handler/antibiotic-src-category"
|
||||
device "simrs-vx/internal/interface/main-handler/device"
|
||||
diagnosesrc "simrs-vx/internal/interface/main-handler/diagnose-src"
|
||||
division "simrs-vx/internal/interface/main-handler/division"
|
||||
@@ -117,9 +120,19 @@ import (
|
||||
regency "simrs-vx/internal/interface/main-handler/regency"
|
||||
village "simrs-vx/internal/interface/main-handler/village"
|
||||
|
||||
///// Internal
|
||||
/******************** Internal ********************/
|
||||
validation "simrs-vx/internal/interface/main-handler/helper/validation"
|
||||
"simrs-vx/internal/interface/main-handler/home"
|
||||
|
||||
/******************** BPJS ********************/
|
||||
controlplan "simrs-vx/internal/interface/main-handler/control-plan"
|
||||
member "simrs-vx/internal/interface/main-handler/member"
|
||||
monitoring "simrs-vx/internal/interface/main-handler/monitoring"
|
||||
reference "simrs-vx/internal/interface/main-handler/reference"
|
||||
referral "simrs-vx/internal/interface/main-handler/referral"
|
||||
vclaimsep "simrs-vx/internal/interface/main-handler/vclaim-sep"
|
||||
vclaimsephist "simrs-vx/internal/interface/main-handler/vclaim-sep-hist"
|
||||
vclaimsepprint "simrs-vx/internal/interface/main-handler/vclaim-sep-print"
|
||||
)
|
||||
|
||||
// One place route to relatively easier to manage, ESPECIALLY in tracking
|
||||
@@ -135,6 +148,7 @@ func SetRoutes() http.Handler {
|
||||
a.RegisterExtCall(validation.RegisterValidation)
|
||||
a.RegisterExtCall(simgossync.SetConfig)
|
||||
a.RegisterExtCall(docscfg.ParseCfg)
|
||||
a.RegisterExtCall(ibpjs.SetConfig)
|
||||
|
||||
r := http.NewServeMux()
|
||||
|
||||
@@ -150,11 +164,14 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/medicine-form", medicineform.O)
|
||||
hc.RegCrud(r, "/v1/medicine-mix", medicicinemix.O)
|
||||
hc.RegCrud(r, "/v1/medicine-mix-item", medicicinemixitem.O)
|
||||
hc.RegCrud(r, "/v1/antibiotic-src-category", antibioticsrccat.O)
|
||||
hc.RegCrud(r, "/v1/antibiotic-src", antibioticsrc.O)
|
||||
hc.RegCrud(r, "/v1/soapi", auth.GuardMW, soapi.O)
|
||||
hc.RegCrud(r, "/v1/adime", auth.GuardMW, adime.O)
|
||||
hc.RegCrud(r, "/v1/sbar", auth.GuardMW, sbar.O)
|
||||
hc.RegCrud(r, "/v1/prescription-item", prescriptionitem.O)
|
||||
hc.RegCrud(r, "/v1/device-order-item", deviceorderitem.O)
|
||||
|
||||
hc.RegCrud(r, "/v1/material-order-item", materialorderitem.O)
|
||||
hk.GroupRoutes("/v1/encounter", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": encounter.O.GetList,
|
||||
@@ -170,6 +187,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/skip": encounter.O.Skip,
|
||||
"PATCH /{id}/req-switch-unit": encounter.O.RequestSwitchUnit,
|
||||
"PATCH /{id}/approve-switch-unit": encounter.O.ApproveSwitchUnit,
|
||||
"PATCH /{id}/cancel-switch-unit": encounter.O.CancelSwitchUnit,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": mcuorder.O.GetList,
|
||||
@@ -177,6 +195,7 @@ func SetRoutes() http.Handler {
|
||||
"POST /": mcuorder.O.Create,
|
||||
"PATCH /{id}": mcuorder.O.Update,
|
||||
"DELETE /{id}": mcuorder.O.Delete,
|
||||
"PATCH /{id}/submit": mcuorder.O.Submit,
|
||||
"PATCH /{id}/complete": mcuorder.O.Complete,
|
||||
"PATCH /{id}/set-schedule": mcuorder.O.SetSchedule,
|
||||
})
|
||||
@@ -282,6 +301,15 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/encounter-document", encounterdocument.O)
|
||||
hc.RegCrud(r, "/v1/general-consent", generalconsent.O)
|
||||
r.HandleFunc("POST /v1/generate-file", generatefile.Generate)
|
||||
hk.GroupRoutes("/v1/resume", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"POST /": resume.Create,
|
||||
"GET /": resume.GetList,
|
||||
"GET /{id}": resume.GetDetail,
|
||||
"PATCH /{id}": resume.Update,
|
||||
"DELETE /{id}": resume.Delete,
|
||||
"PATCH /{id}/verify": resume.Verify,
|
||||
"PATCH /{id}/validate": resume.Validate,
|
||||
})
|
||||
|
||||
/******************** actor ********************/
|
||||
hc.RegCrud(r, "/v1/person", person.O)
|
||||
@@ -303,7 +331,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/active": user.O.Active,
|
||||
})
|
||||
hc.RegCrud(r, "/v1/user-fes", userfes.O)
|
||||
hk.GroupRoutes("/v1/patient", r, hk.MapHandlerFunc{
|
||||
hk.GroupRoutes("/v1/patient", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": patient.O.GetList,
|
||||
"GET /{id}": patient.O.GetDetail,
|
||||
"POST /": patient.O.Create,
|
||||
@@ -355,6 +383,51 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/province", province.O)
|
||||
hc.RegCrudByCode(r, "/v1/postal-region", postalregion.O)
|
||||
|
||||
/******************** BPJS ********************/
|
||||
hk.GroupRoutes("/v1/vclaim-sep", r, hk.MapHandlerFunc{
|
||||
"POST /": vclaimsep.O.Create,
|
||||
"GET /{number}": vclaimsep.O.GetDetail,
|
||||
"DELETE /{number}": vclaimsep.O.Delete,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep-hist", r, hk.MapHandlerFunc{
|
||||
"GET /": vclaimsephist.O.GetList,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep-print", r, hk.MapHandlerFunc{
|
||||
"POST /": vclaimsepprint.O.Create,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/reference", r, hk.MapHandlerFunc{
|
||||
"GET /province": reference.GetListProvince,
|
||||
"GET /regency/{provinceCode}": reference.GetListCities,
|
||||
"GET /district/{regencyCode}": reference.GetListDistrict,
|
||||
"GET /diagnose/{keyword}": reference.GetListDiagnose,
|
||||
"GET /diagnose-prb": reference.GetListDiagnosePrb,
|
||||
"GET /medicine-prb/{keyword}": reference.GetListMedicinePrb,
|
||||
"GET /unit/{unitCode}": reference.GetListUnit,
|
||||
"GET /healthcare/{healthcare}/{healthcareType}": reference.GetListHealthcare,
|
||||
"GET /responsible-doctor/{serviceType}/{serviceDate}/{specialistCode}": reference.GetListDoctor,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/member", r, hk.MapHandlerFunc{
|
||||
"GET /bpjs/{cardNumber}/{sepDate}": member.GetListByBpjsNumber,
|
||||
"GET /nik/{nik}/{sepDate}": member.GetListByNik,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/monitoring", r, hk.MapHandlerFunc{
|
||||
"GET /visit/{date}/{serviceType}": monitoring.GetListVisit,
|
||||
"GET /hist/{cardNumber}/{startDate}/{endDate}": monitoring.GetListHist,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/control-plan", r, hk.MapHandlerFunc{
|
||||
"GET /{controlType}/{polyCode}/{date}": controlplan.GetList,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/referral", r, hk.MapHandlerFunc{
|
||||
"GET /{number}": referral.GetList,
|
||||
})
|
||||
|
||||
/////
|
||||
return cmw.SetCors(handlerlogger.SetLog(r))
|
||||
}
|
||||
|
||||
@@ -85,6 +85,18 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Submit(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Submit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Complete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
|
||||
+4
-4
@@ -14,11 +14,11 @@ func GetListByBpjsNumber(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "cardNumber", r.PathValue("cardNumber"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "cardNumber is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "cardNumber is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "sepDate", r.PathValue("sepDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "sepDate is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "sepDate is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTBpjs
|
||||
dto.PathValue1 = pValue1
|
||||
@@ -31,11 +31,11 @@ func GetListByNik(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "nik", r.PathValue("nik"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "nik is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "nik is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "sepDate", r.PathValue("sepDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "sepDate is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "sepDate is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTNik
|
||||
dto.PathValue1 = pValue1
|
||||
+5
-5
@@ -14,11 +14,11 @@ func GetListVisit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "date", r.PathValue("date"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "date is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "date is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "serviceType", r.PathValue("serviceType"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "serviceType is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceType is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTVisit
|
||||
dto.PathValue1 = pValue1
|
||||
@@ -31,15 +31,15 @@ func GetListHist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "cardNumber", r.PathValue("cardNumber"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "cardNumber is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "cardNumber is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "startDate", r.PathValue("startDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "startDate is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "startDate is required"}, nil)
|
||||
}
|
||||
pValue3 := rw.ValidateString(w, "endDate", r.PathValue("endDate"))
|
||||
if pValue3 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "endDate is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "endDate is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTHist
|
||||
dto.PathValue1 = pValue1
|
||||
@@ -2,6 +2,7 @@ package patient
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
@@ -19,10 +20,17 @@ type myBase struct{}
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
+10
-10
@@ -21,7 +21,7 @@ func GetListCities(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "provinceCode", r.PathValue("provinceCode"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "provinceCode is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "provinceCode is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTCities
|
||||
dto.PathValue1 = pValue
|
||||
@@ -33,7 +33,7 @@ func GetListDistrict(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "regencyCode", r.PathValue("regencyCode"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "regencyCode is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "regencyCode is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTDistrict
|
||||
dto.PathValue1 = pValue
|
||||
@@ -45,7 +45,7 @@ func GetListDiagnose(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "keyword is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "keyword is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTDiagnose
|
||||
dto.PathValue1 = pValue
|
||||
@@ -64,7 +64,7 @@ func GetListMedicinePrb(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "keyword is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "keyword is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTMedicinePrb
|
||||
dto.PathValue1 = pValue
|
||||
@@ -76,7 +76,7 @@ func GetListUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue := rw.ValidateString(w, "unitCode", r.PathValue("unitCode"))
|
||||
if pValue == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "unitCode is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "unitCode is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTUnit
|
||||
dto.PathValue1 = pValue
|
||||
@@ -88,11 +88,11 @@ func GetListHealthcare(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "healthcare", r.PathValue("healthcare"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "healthcare is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "healthcare is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "healthcareType", r.PathValue("healthcareType"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "healthcareType is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "healthcareType is required"}, nil)
|
||||
}
|
||||
dto.ReferenceType = e.RTHealthcare
|
||||
dto.PathValue1 = pValue1
|
||||
@@ -105,15 +105,15 @@ func GetListDoctor(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
pValue1 := rw.ValidateString(w, "serviceType", r.PathValue("serviceType"))
|
||||
if pValue1 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "serviceType is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceType is required"}, nil)
|
||||
}
|
||||
pValue2 := rw.ValidateString(w, "serviceDate", r.PathValue("serviceDate"))
|
||||
if pValue2 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "serviceDate is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "serviceDate is required"}, nil)
|
||||
}
|
||||
pValue3 := rw.ValidateString(w, "specialistCode", r.PathValue("specialistCode"))
|
||||
if pValue3 == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "specialistCode is required"}, nil)
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "specialistCode is required"}, nil)
|
||||
}
|
||||
dto.PathValue1 = pValue1
|
||||
dto.PathValue2 = pValue2
|
||||
@@ -0,0 +1,22 @@
|
||||
package referral
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/referral"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/referral"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadDetailDto{}
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number == "" {
|
||||
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "number is required"}, nil)
|
||||
}
|
||||
dto.Number = &number
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package resume
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/resume"
|
||||
u "simrs-vx/internal/use-case/main-use-case/resume"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
)
|
||||
|
||||
func Create(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
dto := e.CreateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ReadListDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Update(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Delete(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Verify(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Status_Code = erc.DVCVerified
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func Validate(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Status_Code = erc.DVCValidated
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
+25
-31
@@ -1,7 +1,6 @@
|
||||
package vclaimsep
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
@@ -16,14 +15,9 @@ var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
body, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
http.Error(w, "failed to read body", http.StatusBadRequest)
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
defer r.Body.Close()
|
||||
|
||||
dto.RequestPayload = body
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -35,39 +29,39 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
// rw.DataResponse(w, res, err)
|
||||
// }
|
||||
|
||||
// func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
// id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
// if id <= 0 {
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number <= "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Number = &number
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
// func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
// number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
// if number != "" {
|
||||
// return
|
||||
// }
|
||||
// dto := e.ReadDetailDto{}
|
||||
// dto.Id = uint(id)
|
||||
// res, err := u.ReadDetail(dto)
|
||||
|
||||
// dto := e.UpdateDto{}
|
||||
// if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
// return
|
||||
// }
|
||||
// dto.Number = &number
|
||||
// res, err := u.Update(dto)
|
||||
// rw.DataResponse(w, res, err)
|
||||
// }
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number != "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.UpdateDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Number = &number
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number != "" {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
dto := e.DeleteDto{}
|
||||
dto.Number = &number
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -85,6 +85,7 @@ import (
|
||||
resume "simrs-vx/internal/domain/main-entities/resume"
|
||||
room "simrs-vx/internal/domain/main-entities/room"
|
||||
sbar "simrs-vx/internal/domain/main-entities/sbar"
|
||||
screening "simrs-vx/internal/domain/main-entities/screening"
|
||||
soapi "simrs-vx/internal/domain/main-entities/soapi"
|
||||
specialist "simrs-vx/internal/domain/main-entities/specialist"
|
||||
specialistintern "simrs-vx/internal/domain/main-entities/specialist-intern"
|
||||
@@ -217,5 +218,6 @@ func getMainEntities() []any {
|
||||
&vclaimsepcontrolletter.VclaimSepControlLetter{},
|
||||
&resume.Resume{},
|
||||
&vclaimreference.VclaimReference{},
|
||||
&screening.Screening{},
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -8,7 +8,8 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/division"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/division"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/division"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
@@ -0,0 +1,118 @@
|
||||
package encounter
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/encounter"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CreateLog(w http.ResponseWriter, r *http.Request) {
|
||||
dto := esync.SimxLogDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
res, err := u.CreateSimxLog(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Checkin(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.CheckIn(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Checkout(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.CheckOut(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) UpdateStatus(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatus(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.RequestSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.ApproveSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CancelSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.CancelSwitchUnit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
+2
-1
@@ -8,7 +8,8 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/installation"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/installation"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/installation"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
+2
-1
@@ -8,7 +8,8 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/patient"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/patient"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/patient"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
+2
-1
@@ -8,7 +8,8 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/specialist"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/specialist"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/specialist"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/subspecialist"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/subspecialist"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
+2
-1
@@ -8,7 +8,8 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/unit"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/unit"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/unit"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
@@ -1,29 +1,32 @@
|
||||
package simgossynchandler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
hc "simrs-vx/pkg/handler-crud-helper"
|
||||
|
||||
/******************** infra ********************/
|
||||
gs "simrs-vx/internal/infra/gorm-setting"
|
||||
simgosdb "simrs-vx/internal/infra/simgos-db"
|
||||
|
||||
/******************** pkg ********************/
|
||||
cmw "simrs-vx/pkg/cors-manager-mw"
|
||||
hc "simrs-vx/pkg/handler-crud-helper"
|
||||
lh "simrs-vx/pkg/lang-helper"
|
||||
handlerlogger "simrs-vx/pkg/middleware/handler-logger"
|
||||
zlc "simrs-vx/pkg/zerolog-ctx"
|
||||
|
||||
/******************** external ********************/
|
||||
a "github.com/karincake/apem"
|
||||
hk "github.com/karincake/hongkue"
|
||||
|
||||
/******************** internal ********************/
|
||||
"simrs-vx/internal/interface/main-handler/home"
|
||||
division "simrs-vx/internal/interface/simgos-sync-handler/division"
|
||||
installation "simrs-vx/internal/interface/simgos-sync-handler/installation"
|
||||
patient "simrs-vx/internal/interface/simgos-sync-handler/patient"
|
||||
specialist "simrs-vx/internal/interface/simgos-sync-handler/specialist"
|
||||
subspecialist "simrs-vx/internal/interface/simgos-sync-handler/subspecialist"
|
||||
unit "simrs-vx/internal/interface/simgos-sync-handler/unit"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/division"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/encounter"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/installation"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/patient"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/specialist"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/subspecialist"
|
||||
"simrs-vx/internal/interface/simgos-sync-handler/new/unit"
|
||||
)
|
||||
|
||||
func SetRoutes() http.Handler {
|
||||
@@ -38,15 +41,35 @@ func SetRoutes() http.Handler {
|
||||
/******************** Main ********************/
|
||||
r.HandleFunc("/", home.Home)
|
||||
|
||||
/******************** Source ******************/
|
||||
prefix := "/new-to-old"
|
||||
hc.SyncCrud(r, prefix+"/v1/installation", installation.O)
|
||||
hc.SyncCrud(r, prefix+"/v1/unit", unit.O)
|
||||
hc.SyncCrud(r, prefix+"/v1/division", division.O)
|
||||
hc.SyncCrud(r, prefix+"/v1/specialist", specialist.O)
|
||||
hc.SyncCrud(r, prefix+"/v1/subspecialist", subspecialist.O)
|
||||
hc.SyncCrud(r, prefix+"/v1/patient", patient.O)
|
||||
r.HandleFunc(fmt.Sprintf("GET %s/v1/patient-nomr-generator", prefix), patient.O.GenerateNomr)
|
||||
/******************** SvcToOld ******************/
|
||||
prefixnew := "/new-to-old"
|
||||
hc.SyncCrud(r, prefixnew+"/v1/installation", installation.O)
|
||||
hc.SyncCrud(r, prefixnew+"/v1/unit", unit.O)
|
||||
hc.SyncCrud(r, prefixnew+"/v1/division", division.O)
|
||||
hc.SyncCrud(r, prefixnew+"/v1/specialist", specialist.O)
|
||||
hc.SyncCrud(r, prefixnew+"/v1/subspecialist", subspecialist.O)
|
||||
hk.GroupRoutes(prefixnew+"/v1/patient", r, hk.MapHandlerFunc{
|
||||
"POST /": patient.O.Create,
|
||||
"POST /log": patient.O.CreateLog,
|
||||
"PATCH /{id}": patient.O.Update,
|
||||
"DELETE /{id}": patient.O.Delete,
|
||||
"POST /nomr": patient.O.GenerateNomr,
|
||||
})
|
||||
hk.GroupRoutes(prefixnew+"/v1/encounter", r, hk.MapHandlerFunc{
|
||||
"POST /": encounter.O.Create,
|
||||
"POST /log": encounter.O.CreateLog,
|
||||
"PATCH /{id}": encounter.O.Update,
|
||||
"DELETE /{id}": encounter.O.Delete,
|
||||
"PATCH /{id}/checkin": encounter.O.Checkin,
|
||||
"PATCH /{id}/checkout": encounter.O.Checkout,
|
||||
"PATCH /{id}/update-status": encounter.O.UpdateStatus,
|
||||
"PATCH /{id}/req-switch-unit": encounter.O.RequestSwitchUnit,
|
||||
"PATCH /{id}/approve-switch-unit": encounter.O.ApproveSwitchUnit,
|
||||
"PATCH /{id}/cancel-switch-unit": encounter.O.CancelSwitchUnit,
|
||||
})
|
||||
|
||||
/******************** SvcToNew ******************/
|
||||
//prefixold := "/old-to-new"
|
||||
|
||||
return cmw.SetCors(handlerlogger.SetLog(r))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user