sync encounter
This commit is contained in:
@@ -174,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: uint(id),
|
||||
StatusCode: erc.DSCProcess,
|
||||
AuthInfo: *authInfo,
|
||||
}
|
||||
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
@@ -197,9 +203,9 @@ func (obj myBase) Cancel(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.UpdateStatusDto{
|
||||
Id: uint(id),
|
||||
StatusCode: erc.DSCCancel,
|
||||
AuthInfo: *authInfo,
|
||||
}
|
||||
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.UpdateStatusCode(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
@@ -250,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
|
||||
@@ -266,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)
|
||||
}
|
||||
|
||||
@@ -60,6 +60,14 @@ 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,
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -175,6 +175,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,
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
division "simrs-vx/internal/domain/sync-entities/division"
|
||||
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"
|
||||
patient "simrs-vx/internal/domain/sync-entities/patient"
|
||||
specialist "simrs-vx/internal/domain/sync-entities/specialist"
|
||||
subspecialist "simrs-vx/internal/domain/sync-entities/subspecialist"
|
||||
@@ -34,5 +35,8 @@ func getSyncEntities() []any {
|
||||
&encounter.EncounterLink{},
|
||||
&encounter.EncounterSimxLog{},
|
||||
&encounter.EncounterSimgosLog{},
|
||||
&internalreference.InternalReferenceLink{},
|
||||
&internalreference.InternalReferenceSimxLog{},
|
||||
&internalreference.InternalReferenceSimgosLog{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,3 +86,33 @@ func (obj myBase) UpdateStatus(w http.ResponseWriter, r *http.Request) {
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -56,13 +56,16 @@ func SetRoutes() http.Handler {
|
||||
"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,
|
||||
"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 ******************/
|
||||
|
||||
Reference in New Issue
Block a user