Merge branch 'migration' of https://github.com/dikstub-rssa/simrs-be into migration
This commit is contained in:
@@ -68,4 +68,4 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,12 @@ import (
|
||||
sp "github.com/karincake/semprit"
|
||||
sr "github.com/karincake/serabi"
|
||||
|
||||
is "simrs-vx/internal/infra/sync-consumer-cfg"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
m "simrs-vx/internal/domain/main-entities/user"
|
||||
mf "simrs-vx/internal/domain/main-entities/user-fes"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
esga "simrs-vx/internal/domain/sync-entities/authentication"
|
||||
s "simrs-vx/internal/use-case/main-use-case/authentication"
|
||||
)
|
||||
|
||||
@@ -66,12 +69,37 @@ func Logout(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func GuardMW(next http.Handler) http.Handler {
|
||||
var (
|
||||
accessDetail *pa.AuthInfo
|
||||
err error
|
||||
)
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
accessDetail, err := s.ExtractToken(r, s.AccessToken)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, err.(d.FieldError), nil)
|
||||
return
|
||||
// Check if it's from sync
|
||||
credential := esga.CredentialDto{}
|
||||
credential.Source = r.Header.Get("X-Sync-Source")
|
||||
credential.SecretKey = r.Header.Get("X-Sync-SecretKey")
|
||||
credential.UserName = r.Header.Get("X-Sync-UserName")
|
||||
if credential.Source != "" || credential.SecretKey != "" || credential.UserName != "" {
|
||||
// validate secretKey and source
|
||||
if credential.SecretKey != is.O.SecretKey || credential.Source != is.O.Source {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "invalid consumer credential"}, nil)
|
||||
return
|
||||
}
|
||||
|
||||
accessDetail, err = s.GetAuthInfoByUserName(credential.UserName)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, err.(d.FieldError), nil)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
// Normal flow goes here
|
||||
accessDetail, err = s.ExtractToken(r, s.AccessToken)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, err.(d.FieldError), nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx := context.WithValue(r.Context(), pa.AuthKey{}, accessDetail)
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
|
||||
@@ -240,8 +240,8 @@ func (obj myBase) Skip(w http.ResponseWriter, r *http.Request) {
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.SwitchUnitDto{}
|
||||
func (obj myBase) RequestSwitchSpecialist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.SwitchSpecialistDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -252,7 +252,7 @@ func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// validate request body
|
||||
if valid := validateRequestSwitchUnit(w, dto); !valid {
|
||||
if valid := validateRequestSwitchSpecialist(w, dto); !valid {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -263,12 +263,12 @@ func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
res, err := u.RequestSwitchUnit(dto)
|
||||
res, err := u.RequestSwitchSpecialist(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
func (obj myBase) ApproveSwitchSpecialist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelSpecialistDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -286,12 +286,12 @@ func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.ApproveSwitchUnit(dto)
|
||||
res, err := u.ApproveSwitchSpecialist(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CancelSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
func (obj myBase) CancelSwitchSpecialist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelSpecialistDto{}
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
return
|
||||
@@ -309,6 +309,32 @@ func (obj myBase) CancelSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto.AuthInfo = *authInfo
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.CancelSwitchUnit(dto)
|
||||
res, err := u.CancelSwitchSpecialist(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CreateWithPatient(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.CreateWithPatientDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
// validate SubClass
|
||||
if err := verifyClassCode(dto.Encounter); err != nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
dto.Encounter.AuthInfo = *authInfo
|
||||
dto.Patient.AuthInfo = *authInfo
|
||||
res, err := u.CreateWithPatient(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ func validateRequestCheckIn(w http.ResponseWriter, i e.CheckinDto) (valid bool)
|
||||
return true
|
||||
}
|
||||
|
||||
func validateRequestSwitchUnit(w http.ResponseWriter, i e.SwitchUnitDto) (valid bool) {
|
||||
func validateRequestSwitchSpecialist(w http.ResponseWriter, i e.SwitchSpecialistDto) (valid bool) {
|
||||
// validate poly-switch-code
|
||||
if i.PolySwitchCode == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
@@ -84,7 +84,7 @@ func validateRequestSwitchUnit(w http.ResponseWriter, i e.SwitchUnitDto) (valid
|
||||
}
|
||||
|
||||
for _, v := range *i.InternalReferences {
|
||||
if v.Unit_Code == nil {
|
||||
if v.Specialist_Code == nil {
|
||||
rw.DataResponse(w, nil, d.FieldError{
|
||||
Code: dataValidationFail,
|
||||
Message: "internalReferences.unit_code required",
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"net/http"
|
||||
|
||||
/******************** main / transaction ********************/
|
||||
actionreport "simrs-vx/internal/interface/main-handler/action-report"
|
||||
adime "simrs-vx/internal/interface/main-handler/adime"
|
||||
admemployeehist "simrs-vx/internal/interface/main-handler/adm-employee-hist"
|
||||
ambulancetransportrequest "simrs-vx/internal/interface/main-handler/ambulance-transport-req"
|
||||
@@ -34,9 +33,14 @@ import (
|
||||
practiceschedule "simrs-vx/internal/interface/main-handler/practice-schedule"
|
||||
prescription "simrs-vx/internal/interface/main-handler/prescription"
|
||||
prescriptionitem "simrs-vx/internal/interface/main-handler/prescription-item"
|
||||
procedurereport "simrs-vx/internal/interface/main-handler/procedure-report"
|
||||
procedureroom "simrs-vx/internal/interface/main-handler/procedure-room"
|
||||
procedureroomorder "simrs-vx/internal/interface/main-handler/procedure-room-order"
|
||||
procedureroomorderitem "simrs-vx/internal/interface/main-handler/procedure-room-order-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"
|
||||
screening "simrs-vx/internal/interface/main-handler/screening"
|
||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||
uploadfile "simrs-vx/internal/interface/main-handler/upload-file"
|
||||
|
||||
@@ -65,7 +69,7 @@ import (
|
||||
gs "simrs-vx/internal/infra/gorm-setting"
|
||||
minio "simrs-vx/internal/infra/minio"
|
||||
ssdb "simrs-vx/internal/infra/ss-db"
|
||||
simgossync "simrs-vx/internal/infra/sync-cfg"
|
||||
sync "simrs-vx/internal/infra/sync-consumer-cfg"
|
||||
|
||||
/******************** pkg ********************/
|
||||
cmw "simrs-vx/pkg/cors-manager-mw"
|
||||
@@ -93,6 +97,8 @@ import (
|
||||
itemprice "simrs-vx/internal/interface/main-handler/item-price"
|
||||
language "simrs-vx/internal/interface/main-handler/language"
|
||||
material "simrs-vx/internal/interface/main-handler/material"
|
||||
materialpackage "simrs-vx/internal/interface/main-handler/material-package"
|
||||
materialpackageitem "simrs-vx/internal/interface/main-handler/material-package-item"
|
||||
mcusrc "simrs-vx/internal/interface/main-handler/mcu-src"
|
||||
mcusrccategory "simrs-vx/internal/interface/main-handler/mcu-src-category"
|
||||
mcusubsrc "simrs-vx/internal/interface/main-handler/mcu-sub-src"
|
||||
@@ -109,8 +115,6 @@ import (
|
||||
subspecialist "simrs-vx/internal/interface/main-handler/subspecialist"
|
||||
subspecialistposition "simrs-vx/internal/interface/main-handler/subspecialist-position"
|
||||
therapyprotocol "simrs-vx/internal/interface/main-handler/therapy-protocol"
|
||||
unit "simrs-vx/internal/interface/main-handler/unit"
|
||||
unitposition "simrs-vx/internal/interface/main-handler/unit-position"
|
||||
uom "simrs-vx/internal/interface/main-handler/uom"
|
||||
vehicle "simrs-vx/internal/interface/main-handler/vehicle"
|
||||
vehiclehist "simrs-vx/internal/interface/main-handler/vehicle-hist"
|
||||
@@ -132,6 +136,7 @@ import (
|
||||
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"
|
||||
vclaimsepcontrolletter "simrs-vx/internal/interface/main-handler/vclaim-sep-control-letter"
|
||||
vclaimsephist "simrs-vx/internal/interface/main-handler/vclaim-sep-hist"
|
||||
vclaimsepprint "simrs-vx/internal/interface/main-handler/vclaim-sep-print"
|
||||
)
|
||||
@@ -147,7 +152,7 @@ func SetRoutes() http.Handler {
|
||||
a.RegisterExtCall(mh.I.SetClient)
|
||||
a.RegisterExtCall(ibpjs.SetConfig)
|
||||
a.RegisterExtCall(validation.RegisterValidation)
|
||||
a.RegisterExtCall(simgossync.SetConfig)
|
||||
a.RegisterExtCall(sync.SetConfig)
|
||||
a.RegisterExtCall(docscfg.ParseCfg)
|
||||
a.RegisterExtCall(ibpjs.SetConfig)
|
||||
|
||||
@@ -172,7 +177,7 @@ func SetRoutes() http.Handler {
|
||||
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/action-report", auth.GuardMW, actionreport.O)
|
||||
hc.RegCrud(r, "/v1/procedure-report", auth.GuardMW, procedurereport.O)
|
||||
|
||||
hc.RegCrud(r, "/v1/material-order-item", materialorderitem.O)
|
||||
hk.GroupRoutes("/v1/encounter", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
@@ -187,9 +192,10 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/cancel": encounter.O.Cancel,
|
||||
"PATCH /{id}/reject": encounter.O.Reject,
|
||||
"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,
|
||||
"PATCH /{id}/req-switch-unit": encounter.O.RequestSwitchSpecialist,
|
||||
"PATCH /{id}/approve-switch-unit": encounter.O.ApproveSwitchSpecialist,
|
||||
"PATCH /{id}/cancel-switch-unit": encounter.O.CancelSwitchSpecialist,
|
||||
"POST /create-with-patient": encounter.O.CreateWithPatient,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": mcuorder.O.GetList,
|
||||
@@ -267,6 +273,16 @@ func SetRoutes() http.Handler {
|
||||
"DELETE /{id}": materialorder.O.Delete,
|
||||
"PATCH /{id}/complete": materialorder.O.Complete,
|
||||
})
|
||||
hc.RegCrud(r, "/v1/procedure-room", procedureroom.O)
|
||||
hk.GroupRoutes("/v1/procedure-room-order", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": procedureroomorder.O.GetList,
|
||||
"GET /{id}": procedureroomorder.O.GetDetail,
|
||||
"POST /": procedureroomorder.O.Create,
|
||||
"PATCH /{id}": procedureroomorder.O.Update,
|
||||
"DELETE /{id}": procedureroomorder.O.Delete,
|
||||
"PATCH /{id}/submit": procedureroomorder.O.Submit,
|
||||
})
|
||||
hc.RegCrud(r, "/v1/procedure-room-order-item", procedureroomorderitem.O)
|
||||
hk.GroupRoutes("/v1/consultation", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": consultation.O.GetList,
|
||||
"GET /{id}": consultation.O.GetDetail,
|
||||
@@ -312,7 +328,11 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/verify": resume.Verify,
|
||||
"PATCH /{id}/validate": resume.Validate,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/screening", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"POST /": screening.O.Create,
|
||||
"GET /": screening.O.GetList,
|
||||
"GET /{id}": screening.O.GetDetail,
|
||||
})
|
||||
/******************** actor ********************/
|
||||
hc.RegCrud(r, "/v1/person", person.O)
|
||||
hc.RegCrud(r, "/v1/person-address", personaddress.O)
|
||||
@@ -347,9 +367,7 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/division", division.O)
|
||||
hc.RegCrudByCode(r, "/v1/division-position", divisionposition.O)
|
||||
hc.RegCrudByCode(r, "/v1/installation", installation.O)
|
||||
hc.RegCrudByCode(r, "/v1/unit", unit.O)
|
||||
hc.RegCrudByCode(r, "/v1/installation-position", installationposition.O)
|
||||
hc.RegCrudByCode(r, "/v1/unit-position", unitposition.O)
|
||||
hc.RegCrudByCode(r, "/v1/specialist", specialist.O)
|
||||
hc.RegCrudByCode(r, "/v1/subspecialist", subspecialist.O)
|
||||
hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
|
||||
@@ -370,6 +388,8 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrudByCode(r, "/v1/medicine", medicine.O)
|
||||
hc.RegCrudByCode(r, "/v1/device", device.O)
|
||||
hc.RegCrudByCode(r, "/v1/material", material.O)
|
||||
hc.RegCrudByCode(r, "/v1/material-package", materialpackage.O)
|
||||
hc.RegCrud(r, "/v1/material-package-item", materialpackageitem.O)
|
||||
hc.RegCrud(r, "/v1/doctor-fee", doctorfee.O)
|
||||
hc.RegCrudByCode(r, "/v1/medical-action-src", medicalactionsrc.O)
|
||||
hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O)
|
||||
@@ -392,6 +412,10 @@ func SetRoutes() http.Handler {
|
||||
"DELETE /{number}": vclaimsep.O.Delete,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep-control-letter", r, hk.MapHandlerFunc{
|
||||
"POST /": vclaimsepcontrolletter.O.Create,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/vclaim-sep-hist", r, hk.MapHandlerFunc{
|
||||
"GET /": vclaimsephist.O.GetList,
|
||||
})
|
||||
|
||||
+12
-14
@@ -1,4 +1,4 @@
|
||||
package unit
|
||||
package material
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/unit"
|
||||
u "simrs-vx/internal/use-case/main-use-case/unit"
|
||||
e "simrs-vx/internal/domain/main-entities/material-package-item"
|
||||
u "simrs-vx/internal/use-case/main-use-case/material-package-item"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
@@ -33,21 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id == 0 {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Code = &code
|
||||
dto.Id = uint(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Code = code
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Code = &code
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package unit_position
|
||||
package material
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/unit-position"
|
||||
u "simrs-vx/internal/use-case/main-use-case/unit-position"
|
||||
e "simrs-vx/internal/domain/main-entities/material-package"
|
||||
u "simrs-vx/internal/use-case/main-use-case/material-package"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
@@ -59,11 +59,18 @@ func (obj myBase) Update(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.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)
|
||||
}
|
||||
@@ -75,7 +82,15 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
|
||||
dto.Id = uint(id)
|
||||
dto.AuthInfo = *authInfo
|
||||
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/action-report"
|
||||
u "simrs-vx/internal/use-case/main-use-case/action-report"
|
||||
e "simrs-vx/internal/domain/main-entities/procedure-report"
|
||||
u "simrs-vx/internal/use-case/main-use-case/procedure-report"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package procedureroomorder
|
||||
|
||||
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/procedure-room-order-item"
|
||||
u "simrs-vx/internal/use-case/main-use-case/procedure-room-order-item"
|
||||
)
|
||||
|
||||
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 = uint64(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 = uint64(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 = uint64(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package procedureroomorder
|
||||
|
||||
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/procedure-room-order"
|
||||
u "simrs-vx/internal/use-case/main-use-case/procedure-room-order"
|
||||
)
|
||||
|
||||
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 = uint64(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 = uint64(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 = uint64(id)
|
||||
res, err := u.Delete(dto)
|
||||
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 = uint64(id)
|
||||
res, err := u.Submit(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package procedureroom
|
||||
|
||||
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/procedure-room"
|
||||
u "simrs-vx/internal/use-case/main-use-case/procedure-room"
|
||||
)
|
||||
|
||||
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,80 @@
|
||||
package screening
|
||||
|
||||
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/screening"
|
||||
u "simrs-vx/internal/use-case/main-use-case/screening"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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 = uint(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)
|
||||
// }
|
||||
@@ -47,7 +47,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -62,7 +62,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 := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -74,7 +74,7 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Id = uint(id)
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package vclaimsepcontrolletter
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
|
||||
e "simrs-vx/internal/domain/bpjs-entities/vclaim-sep-control-letter"
|
||||
u "simrs-vx/internal/use-case/bpjs-use-case/vclaim-sep-control-letter"
|
||||
)
|
||||
|
||||
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) {
|
||||
// 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.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) {
|
||||
// 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)
|
||||
// }
|
||||
@@ -56,12 +56,12 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
// }
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||
if number == "" {
|
||||
return
|
||||
}
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Number = &number
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -1,24 +1,29 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
actionreport "simrs-vx/internal/domain/main-entities/action-report"
|
||||
adime "simrs-vx/internal/domain/main-entities/adime"
|
||||
admemployeehist "simrs-vx/internal/domain/main-entities/adm-employee-hist"
|
||||
ambulancetransportreq "simrs-vx/internal/domain/main-entities/ambulance-transport-req"
|
||||
ambulatory "simrs-vx/internal/domain/main-entities/ambulatory"
|
||||
antibioticinuse "simrs-vx/internal/domain/main-entities/antibiotic-in-use"
|
||||
antibioticsrccategory "simrs-vx/internal/domain/main-entities/antibiotic-src-category"
|
||||
apmcuorder "simrs-vx/internal/domain/main-entities/ap-mcu-order"
|
||||
appointment "simrs-vx/internal/domain/main-entities/appointment"
|
||||
authpartner "simrs-vx/internal/domain/main-entities/auth-partner"
|
||||
chemo "simrs-vx/internal/domain/main-entities/chemo"
|
||||
chemoplan "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||
chemoprotocol "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||
consultation "simrs-vx/internal/domain/main-entities/consultation"
|
||||
controlletter "simrs-vx/internal/domain/main-entities/control-letter"
|
||||
counter "simrs-vx/internal/domain/main-entities/counter"
|
||||
cpmcuorder "simrs-vx/internal/domain/main-entities/cp-mcu-order"
|
||||
cpmcuorderitem "simrs-vx/internal/domain/main-entities/cp-mcu-order-item"
|
||||
deathcause "simrs-vx/internal/domain/main-entities/death-cause"
|
||||
device "simrs-vx/internal/domain/main-entities/device"
|
||||
deviceorder "simrs-vx/internal/domain/main-entities/device-order"
|
||||
deviceorderitem "simrs-vx/internal/domain/main-entities/device-order-item"
|
||||
devicepackage "simrs-vx/internal/domain/main-entities/device-package"
|
||||
devicepackageitem "simrs-vx/internal/domain/main-entities/device-package-item"
|
||||
diagnosesrc "simrs-vx/internal/domain/main-entities/diagnose-src"
|
||||
district "simrs-vx/internal/domain/main-entities/district"
|
||||
division "simrs-vx/internal/domain/main-entities/division"
|
||||
@@ -46,6 +51,8 @@ import (
|
||||
material "simrs-vx/internal/domain/main-entities/material"
|
||||
materialorder "simrs-vx/internal/domain/main-entities/material-order"
|
||||
materialorderitem "simrs-vx/internal/domain/main-entities/material-order-item"
|
||||
materialpackage "simrs-vx/internal/domain/main-entities/material-package"
|
||||
materialpackageitem "simrs-vx/internal/domain/main-entities/material-package-item"
|
||||
mcuorder "simrs-vx/internal/domain/main-entities/mcu-order"
|
||||
mcuorderitem "simrs-vx/internal/domain/main-entities/mcu-order-item"
|
||||
mcuordersubitem "simrs-vx/internal/domain/main-entities/mcu-order-sub-item"
|
||||
@@ -63,6 +70,8 @@ import (
|
||||
medicinemethod "simrs-vx/internal/domain/main-entities/medicine-method"
|
||||
medicinemix "simrs-vx/internal/domain/main-entities/medicine-mix"
|
||||
medicinemixitem "simrs-vx/internal/domain/main-entities/medicine-mix-item"
|
||||
micromcuorder "simrs-vx/internal/domain/main-entities/micro-mcu-order"
|
||||
micromcuorderitem "simrs-vx/internal/domain/main-entities/micro-mcu-order-item"
|
||||
midwife "simrs-vx/internal/domain/main-entities/midwife"
|
||||
nurse "simrs-vx/internal/domain/main-entities/nurse"
|
||||
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
|
||||
@@ -78,13 +87,19 @@ import (
|
||||
practiceschedule "simrs-vx/internal/domain/main-entities/practice-schedule"
|
||||
prescription "simrs-vx/internal/domain/main-entities/prescription"
|
||||
prescriptionitem "simrs-vx/internal/domain/main-entities/prescription-item"
|
||||
procedurereport "simrs-vx/internal/domain/main-entities/procedure-report"
|
||||
procedureroom "simrs-vx/internal/domain/main-entities/procedure-room"
|
||||
procedureroomorder "simrs-vx/internal/domain/main-entities/procedure-room-order"
|
||||
procedureroomorderitem "simrs-vx/internal/domain/main-entities/procedure-room-order-item"
|
||||
proceduresrc "simrs-vx/internal/domain/main-entities/procedure-src"
|
||||
province "simrs-vx/internal/domain/main-entities/province"
|
||||
radiologymcuorder "simrs-vx/internal/domain/main-entities/radiology-mcu-order"
|
||||
radiologymcuorderitem "simrs-vx/internal/domain/main-entities/radiology-mcu-order-item"
|
||||
regency "simrs-vx/internal/domain/main-entities/regency"
|
||||
registrator "simrs-vx/internal/domain/main-entities/registrator"
|
||||
rehab "simrs-vx/internal/domain/main-entities/rehab"
|
||||
responsibledoctorhist "simrs-vx/internal/domain/main-entities/responsible-doctor-hist"
|
||||
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"
|
||||
@@ -94,8 +109,6 @@ import (
|
||||
subspecialist "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||
subspecialistposition "simrs-vx/internal/domain/main-entities/subspecialist-position"
|
||||
therapyprotocol "simrs-vx/internal/domain/main-entities/therapy-protocol"
|
||||
unit "simrs-vx/internal/domain/main-entities/unit"
|
||||
unitposition "simrs-vx/internal/domain/main-entities/unit-position"
|
||||
uom "simrs-vx/internal/domain/main-entities/uom"
|
||||
user "simrs-vx/internal/domain/main-entities/user"
|
||||
userfes "simrs-vx/internal/domain/main-entities/user-fes"
|
||||
@@ -121,7 +134,6 @@ func getMainEntities() []any {
|
||||
&division.Division{},
|
||||
&divisionposition.DivisionPosition{},
|
||||
&installation.Installation{},
|
||||
&unit.Unit{},
|
||||
&village.Village{},
|
||||
&district.District{},
|
||||
®ency.Regency{},
|
||||
@@ -135,6 +147,7 @@ func getMainEntities() []any {
|
||||
&proceduresrc.ProcedureSrc{},
|
||||
&employee.Employee{},
|
||||
&intern.Intern{},
|
||||
®istrator.Registrator{},
|
||||
&doctor.Doctor{},
|
||||
&nurse.Nurse{},
|
||||
&nutritionist.Nutritionist{},
|
||||
@@ -145,6 +158,7 @@ func getMainEntities() []any {
|
||||
&item.Item{},
|
||||
&itemprice.ItemPrice{},
|
||||
&infra.Infra{},
|
||||
&procedureroom.ProcedureRoom{},
|
||||
&medicinegroup.MedicineGroup{},
|
||||
&medicinemethod.MedicineMethod{},
|
||||
&mcusrccategory.McuSrcCategory{},
|
||||
@@ -164,13 +178,17 @@ func getMainEntities() []any {
|
||||
&personrelative.PersonRelative{},
|
||||
&patient.Patient{},
|
||||
&appointment.Appointment{},
|
||||
&devicepackage.DevicePackage{},
|
||||
&devicepackageitem.DevicePackageItem{},
|
||||
&materialpackage.MaterialPackage{},
|
||||
&materialpackageitem.MaterialPackageItem{},
|
||||
|
||||
&vclaimsep.VclaimSep{},
|
||||
&encounter.Encounter{},
|
||||
&laborant.Laborant{},
|
||||
&specialist.Specialist{},
|
||||
&subspecialist.Subspecialist{},
|
||||
&specialistintern.SpecialistIntern{},
|
||||
&room.Room{},
|
||||
&soapi.Soapi{},
|
||||
&sbar.Sbar{},
|
||||
&adime.Adime{},
|
||||
@@ -190,6 +208,13 @@ func getMainEntities() []any {
|
||||
&mcuorderitem.McuOrderItem{},
|
||||
&mcusubsrc.McuSubSrc{},
|
||||
&mcuordersubitem.McuOrderSubItem{},
|
||||
&apmcuorder.ApMcuOrder{},
|
||||
&radiologymcuorder.RadiologyMcuOrder{},
|
||||
&radiologymcuorderitem.RadiologyMcuOrderItem{},
|
||||
&cpmcuorder.CpMcuOrder{},
|
||||
&cpmcuorderitem.CpMcuOrderItem{},
|
||||
µmcuorder.MicroMcuOrder{},
|
||||
µmcuorderitem.MicroMcuOrderItem{},
|
||||
&antibioticsrccategory.AntibioticSrcCategory{},
|
||||
&antibioticinuse.AntibioticInUse{},
|
||||
&consultation.Consultation{},
|
||||
@@ -197,6 +222,9 @@ func getMainEntities() []any {
|
||||
&midwife.Midwife{},
|
||||
&postalregion.PostalRegion{},
|
||||
&internalreference.InternalReference{},
|
||||
&procedureroomorder.ProcedureRoomOrder{},
|
||||
&procedureroomorderitem.ProcedureRoomOrderItem{},
|
||||
|
||||
&vclaimsephist.VclaimSepHist{},
|
||||
&vclaimsepprint.VclaimSepPrint{},
|
||||
&vehicle.Vehicle{},
|
||||
@@ -207,7 +235,6 @@ func getMainEntities() []any {
|
||||
&generalconsent.GeneralConsent{},
|
||||
&deathcause.DeathCause{},
|
||||
&installationposition.InstallationPosition{},
|
||||
&unitposition.UnitPosition{},
|
||||
&specialistposition.SpecialistPosition{},
|
||||
&subspecialistposition.SubspecialistPosition{},
|
||||
&responsibledoctorhist.ResponsibleDoctorHist{},
|
||||
@@ -222,6 +249,7 @@ func getMainEntities() []any {
|
||||
&resume.Resume{},
|
||||
&vclaimreference.VclaimReference{},
|
||||
&screening.Screening{},
|
||||
&actionreport.ActionReport{},
|
||||
&procedurereport.ProcedureReport{},
|
||||
&chemoplan.ChemoPlan{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,5 +39,4 @@ func getEntities(input string) []any {
|
||||
|
||||
func Migrate(input string) {
|
||||
loader(input)
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package migration
|
||||
import (
|
||||
/************** Source ***************/
|
||||
division "simrs-vx/internal/domain/sync-entities/division"
|
||||
doctor "simrs-vx/internal/domain/sync-entities/doctor"
|
||||
encounter "simrs-vx/internal/domain/sync-entities/encounter"
|
||||
installation "simrs-vx/internal/domain/sync-entities/installation"
|
||||
internalreference "simrs-vx/internal/domain/sync-entities/internal-reference"
|
||||
nurse "simrs-vx/internal/domain/sync-entities/nurse"
|
||||
patient "simrs-vx/internal/domain/sync-entities/patient"
|
||||
soapi "simrs-vx/internal/domain/sync-entities/soapi"
|
||||
specialist "simrs-vx/internal/domain/sync-entities/specialist"
|
||||
subspecialist "simrs-vx/internal/domain/sync-entities/subspecialist"
|
||||
unit "simrs-vx/internal/domain/sync-entities/unit"
|
||||
@@ -38,5 +41,14 @@ func getSyncEntities() []any {
|
||||
&internalreference.InternalReferenceLink{},
|
||||
&internalreference.InternalReferenceSimxLog{},
|
||||
&internalreference.InternalReferenceSimgosLog{},
|
||||
&soapi.SoapiLink{},
|
||||
&soapi.SoapiSimxLog{},
|
||||
&soapi.SoapiSimgosLog{},
|
||||
&doctor.DoctorLink{},
|
||||
&doctor.DoctorSimxLog{},
|
||||
&doctor.DoctorSimgosLog{},
|
||||
&nurse.NurseLink{},
|
||||
&nurse.NurseSimxLog{},
|
||||
&nurse.NurseSimgosLog{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,32 +87,32 @@ func (obj myBase) UpdateStatus(w http.ResponseWriter, r *http.Request) {
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) RequestSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
func (obj myBase) RequestSwitchSpecialist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.Encounter{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.RequestSwitchUnit(dto)
|
||||
res, err := u.RequestSwitchSpecialist(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) ApproveSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
func (obj myBase) ApproveSwitchSpecialist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelSpecialistDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.ApproveSwitchUnit(dto)
|
||||
res, err := u.ApproveSwitchSpecialist(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) CancelSwitchUnit(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelUnitDto{}
|
||||
func (obj myBase) CancelSwitchSpecialist(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.ApproveCancelSpecialistDto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := u.CancelSwitchUnit(dto)
|
||||
res, err := u.CancelSwitchSpecialist(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
+6
-15
@@ -1,4 +1,4 @@
|
||||
package unit
|
||||
package soapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
rw "github.com/karincake/risoles"
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/unit"
|
||||
e "simrs-vx/internal/domain/main-entities/soapi"
|
||||
esync "simrs-vx/internal/domain/sync-entities/log"
|
||||
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/unit"
|
||||
u "simrs-vx/internal/use-case/simgos-sync-use-case/new/soapi"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
@@ -17,7 +17,7 @@ type myBase struct{}
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.CreateDto{}
|
||||
dto := e.Soapi{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
@@ -35,19 +35,11 @@ func (obj myBase) CreateLog(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
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{}
|
||||
dto := e.Soapi{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
val := uint16(id)
|
||||
dto.Id = &val
|
||||
|
||||
res, err := u.Update(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -59,8 +51,7 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
val := uint16(id)
|
||||
dto.Id = &val
|
||||
dto.Id = uint(id)
|
||||
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
@@ -0,0 +1,52 @@
|
||||
package authentication
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
rw "github.com/karincake/risoles"
|
||||
|
||||
sc "simrs-vx/internal/lib/sync-credential"
|
||||
|
||||
e "simrs-vx/internal/domain/sync-entities/authentication"
|
||||
is "simrs-vx/internal/infra/sync-cfg"
|
||||
)
|
||||
|
||||
func NewGuardMW(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// check the data format
|
||||
input := e.CredentialDto{}
|
||||
if success := sc.CheckCredentialData(&input, r, w); !success {
|
||||
return
|
||||
}
|
||||
|
||||
// check the validity
|
||||
if input.Source != is.O.NewSource || input.SecretKey != is.O.NewSecretKey {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "invalid consumer credential"}, nil)
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.WithValue(r.Context(), e.SyncKey{}, input)
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
func OldGuardMW(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// check the data format
|
||||
input := e.CredentialDto{}
|
||||
if success := sc.CheckCredentialData(&input, r, w); !success {
|
||||
return
|
||||
}
|
||||
|
||||
// check the validity
|
||||
if input.Source != is.O.OldSource || input.SecretKey != is.O.OldSecretKey {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "invalid consumer credential"}, nil)
|
||||
return
|
||||
}
|
||||
|
||||
ctx := context.WithValue(r.Context(), e.SyncKey{}, input)
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package patient
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
p "simrs-vx/internal/domain/simgos-entities/m-pasien"
|
||||
uo "simrs-vx/internal/use-case/simgos-sync-use-case/old/patient"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
dto := p.MPasienDto{}
|
||||
if !rw.ValidateStructByIOR(w, r.Body, &dto) {
|
||||
return
|
||||
}
|
||||
|
||||
// mapping m_patient to patient
|
||||
patient := dto.ToPatient()
|
||||
res, err := uo.Create(patient)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
dto := p.MPasienDto{}
|
||||
if !rw.ValidateStructByIOR(w, r.Body, &dto) {
|
||||
return
|
||||
}
|
||||
patient := dto.ToPatient()
|
||||
res, err := uo.Update(patient)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
dto := p.MPasienDto{}
|
||||
if !rw.ValidateStructByIOR(w, r.Body, &dto) {
|
||||
return
|
||||
}
|
||||
patient := dto.ToPatient()
|
||||
res, err := uo.Delete(patient)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package seeder
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
seeder "simrs-vx/internal/use-case/simgos-sync-use-case/seeder"
|
||||
main "simrs-vx/internal/use-case/simgos-sync-use-case/seeder/seeder"
|
||||
|
||||
rw "github.com/karincake/risoles"
|
||||
)
|
||||
|
||||
type myBase struct{}
|
||||
|
||||
var O myBase
|
||||
|
||||
func (obj myBase) Seeder(w http.ResponseWriter, r *http.Request) {
|
||||
dto := seeder.Dto{}
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
|
||||
res, err := main.SeedToSimx(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
/******************** infra ********************/
|
||||
gs "simrs-vx/internal/infra/gorm-setting"
|
||||
simgosdb "simrs-vx/internal/infra/simgos-db"
|
||||
sync "simrs-vx/internal/infra/sync-cfg"
|
||||
|
||||
/******************** pkg ********************/
|
||||
cmw "simrs-vx/pkg/cors-manager-mw"
|
||||
@@ -24,9 +25,15 @@ import (
|
||||
"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/soapi"
|
||||
"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"
|
||||
|
||||
sd "simrs-vx/internal/interface/simgos-sync-handler/seeder"
|
||||
|
||||
oldpatient "simrs-vx/internal/interface/simgos-sync-handler/old/patient"
|
||||
|
||||
oauth "simrs-vx/internal/interface/simgos-sync-handler/old/authentication" // just a reminder, an openauth
|
||||
)
|
||||
|
||||
func SetRoutes() http.Handler {
|
||||
@@ -34,6 +41,7 @@ func SetRoutes() http.Handler {
|
||||
a.RegisterExtCall(gs.Adjust)
|
||||
a.RegisterExtCall(zlc.Adjust)
|
||||
a.RegisterExtCall(lh.Populate)
|
||||
a.RegisterExtCall(sync.SetConfig)
|
||||
a.RegisterExtCall(simgosdb.SetInstance)
|
||||
|
||||
r := http.NewServeMux()
|
||||
@@ -44,7 +52,6 @@ func SetRoutes() http.Handler {
|
||||
/******************** 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)
|
||||
@@ -63,13 +70,24 @@ func SetRoutes() http.Handler {
|
||||
"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,
|
||||
"PATCH /{id}/req-switch-unit": encounter.O.RequestSwitchSpecialist,
|
||||
"PATCH /{id}/approve-switch-unit": encounter.O.ApproveSwitchSpecialist,
|
||||
"PATCH /{id}/cancel-switch-unit": encounter.O.CancelSwitchSpecialist,
|
||||
})
|
||||
hc.SyncCrud(r, prefixnew+"/v1/soapi", soapi.O)
|
||||
|
||||
/******************** Seeder ******************/
|
||||
prefixseeder := "/seeder"
|
||||
hk.GroupRoutes(prefixseeder+"/v1", r, hk.MapHandlerFunc{
|
||||
"POST /": sd.O.Seeder,
|
||||
})
|
||||
|
||||
/******************** SvcToNew ******************/
|
||||
//prefixold := "/old-to-new"
|
||||
|
||||
prefixold := "/old-to-new"
|
||||
hk.GroupRoutes(prefixold+"/v1/patient", r, oauth.OldGuardMW, hk.MapHandlerFunc{
|
||||
"POST /": oldpatient.O.Create,
|
||||
"PATCH /{id}": oldpatient.O.Update,
|
||||
"DELETE /{id}": oldpatient.O.Delete,
|
||||
}) // FINISH THIS
|
||||
return cmw.SetCors(handlerlogger.SetLog(r))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user