Merge pull request #211 from dikstub-rssa/refactor/unit-dropping
Refactor/unit dropping
This commit is contained in:
@@ -13,7 +13,7 @@ require (
|
|||||||
github.com/jackc/pgx/v5 v5.5.5
|
github.com/jackc/pgx/v5 v5.5.5
|
||||||
github.com/karincake/apem v0.0.17
|
github.com/karincake/apem v0.0.17
|
||||||
github.com/karincake/dodol v0.0.1
|
github.com/karincake/dodol v0.0.1
|
||||||
github.com/karincake/getuk v0.3.1
|
github.com/karincake/getuk v0.3.2
|
||||||
github.com/karincake/hongkue v0.0.4
|
github.com/karincake/hongkue v0.0.4
|
||||||
github.com/karincake/lepet v0.0.1
|
github.com/karincake/lepet v0.0.1
|
||||||
github.com/karincake/risoles v0.0.3
|
github.com/karincake/risoles v0.0.3
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ github.com/karincake/apem v0.0.17 h1:y3WXCr9GWLFFFH4Qyq/VWlWWpijHh5zpTc3Lm96twa4
|
|||||||
github.com/karincake/apem v0.0.17/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
|
github.com/karincake/apem v0.0.17/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
|
||||||
github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0=
|
github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0=
|
||||||
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
|
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
|
||||||
github.com/karincake/getuk v0.3.1 h1:yRqBTrwpnjYcZD3gPDoSxFlsLgI9/GKCr3ZCsS4TtYQ=
|
github.com/karincake/getuk v0.3.2 h1:Qe+PRQ2qdgdiJlWiVEq37N8rrgS654nUnY0PWS6pMzA=
|
||||||
github.com/karincake/getuk v0.3.1/go.mod h1:NVnvxSGAkQ/xuq99FzWACvY5efyKPLFla1cKB8czm7c=
|
github.com/karincake/getuk v0.3.2/go.mod h1:nFl133aKQqxRbe5q9lo8q7BxlYBavmbkpglBhq/dNWk=
|
||||||
github.com/karincake/hongkue v0.0.4 h1:oWthq6cDg5DvDm1Z3e7mCLOATQf+oAdtHxN9OPnCfA8=
|
github.com/karincake/hongkue v0.0.4 h1:oWthq6cDg5DvDm1Z3e7mCLOATQf+oAdtHxN9OPnCfA8=
|
||||||
github.com/karincake/hongkue v0.0.4/go.mod h1:YVi5Lyh3DE+GRHx2OSODOr7FwvLi8U4idvcPHO7yeag=
|
github.com/karincake/hongkue v0.0.4/go.mod h1:YVi5Lyh3DE+GRHx2OSODOr7FwvLi8U4idvcPHO7yeag=
|
||||||
github.com/karincake/lepet v0.0.1 h1:eq/cwn5BBg0jWZ1c/MmvhFIBma0zBpVs2LwkfDOncy4=
|
github.com/karincake/lepet v0.0.1 h1:eq/cwn5BBg0jWZ1c/MmvhFIBma0zBpVs2LwkfDOncy4=
|
||||||
|
|||||||
@@ -26,14 +26,15 @@ type ReadListDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FilterDto struct {
|
type FilterDto struct {
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
Employee_Id *uint `json:"employee-id"`
|
Employee_Id *uint `json:"employee-id"`
|
||||||
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
|
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
|
||||||
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
|
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
|
||||||
SIP_ExpiredDate *string `json:"sip-expiredDate"`
|
SIP_ExpiredDate *string `json:"sip-expiredDate"`
|
||||||
Unit_Code *string `json:"unit-code"`
|
Unit_Code *string `json:"unit-code"`
|
||||||
Specialist_Code *string `json:"specialist-code"`
|
Specialist_Code *string `json:"specialist-code"`
|
||||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
Specialist_Code_Opt *string `json:"specialist-code-opt"`
|
||||||
|
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ type FilterDto struct {
|
|||||||
RegisteredAt *time.Time `json:"registeredAt"`
|
RegisteredAt *time.Time `json:"registeredAt"`
|
||||||
Class_Code ere.EncounterClassCode `json:"class-code" validate:"maxLength=10"`
|
Class_Code ere.EncounterClassCode `json:"class-code" validate:"maxLength=10"`
|
||||||
Specialist_Code *string `json:"specialist-code"`
|
Specialist_Code *string `json:"specialist-code"`
|
||||||
|
Specialist_Code_Opt *string `json:"specialist-code-opt"`
|
||||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||||
VisitDate time.Time `json:"visitDate"`
|
VisitDate time.Time `json:"visitDate"`
|
||||||
Appoinment_Doctor_Code *string `json:"appointment-doctor-code"`
|
Appoinment_Doctor_Code *string `json:"appointment-doctor-code"`
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
Id *uint `json:"id"`
|
Id *uint `json:"id"`
|
||||||
Installation_Code *string `json:"installation_code"`
|
Installation_Code string `json:"installation_code"`
|
||||||
Code string `json:"code" validate:"maxLength=10"`
|
Code string `json:"code" validate:"maxLength=10"`
|
||||||
Name string `json:"name" validate:"maxLength=50"`
|
Name string `json:"name" validate:"maxLength=50"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type Specialist struct {
|
|||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:20"`
|
Code string `json:"code" gorm:"unique;size:20"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Installation_Code *string `json:"installation_code" gorm:"size:20"`
|
Installation_Code string `json:"installation_code" gorm:"size:20"`
|
||||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||||
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const (
|
|||||||
OCCHcu OutpatientClassCode = "hcu" // HCU
|
OCCHcu OutpatientClassCode = "hcu" // HCU
|
||||||
OCCVk OutpatientClassCode = "vk" // Verlos kamer
|
OCCVk OutpatientClassCode = "vk" // Verlos kamer
|
||||||
|
|
||||||
ACCReg AmbulatoryClassCode = "reg" // Regular
|
ACCReg AmbulatoryClassCode = "regular" // Regular
|
||||||
// ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
|
// ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
|
||||||
// ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy
|
// ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy
|
||||||
// ACCCac AmbulatoryClassCode = "chemo-act" // Chemotherapy
|
// ACCCac AmbulatoryClassCode = "chemo-act" // Chemotherapy
|
||||||
|
|||||||
@@ -338,29 +338,3 @@ func (obj myBase) CreateWithPatient(w http.ResponseWriter, r *http.Request) {
|
|||||||
res, err := u.CreateWithPatient(dto)
|
res, err := u.CreateWithPatient(dto)
|
||||||
rw.DataResponse(w, res, err)
|
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)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -83,15 +83,17 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
|||||||
tx = tx.Where("\"Encounter\".\"Status_Code\" = ?", *input.Status_Code)
|
tx = tx.Where("\"Encounter\".\"Status_Code\" = ?", *input.Status_Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.Specialist_Code != nil {
|
// if input.Specialist_Code != nil {
|
||||||
tx = tx.Where("\"Encounter\".\"Specialist_Code\" = ?", *input.Specialist_Code)
|
// tx = tx.Where("\"Encounter\".\"Specialist_Code\" = ?", *input.Specialist_Code)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if input.PaymentMethod_Code != nil {
|
if input.PaymentMethod_Code != nil {
|
||||||
tx = tx.Where("\"Encounter\".\"PaymentMethod_Code\" = ?", *input.PaymentMethod_Code)
|
tx = tx.Where("\"Encounter\".\"PaymentMethod_Code\" = ?", *input.PaymentMethod_Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
tx = tx.Scopes(gh.Preload(input.Includes)).
|
tx = tx.Debug().
|
||||||
|
Scopes(gh.Filter(input.FilterDto)).
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
Count(&count).
|
Count(&count).
|
||||||
Scopes(gh.Paginate(input, &pagination)).
|
Scopes(gh.Paginate(input, &pagination)).
|
||||||
Order("\"CreatedAt\" DESC")
|
Order("\"CreatedAt\" DESC")
|
||||||
|
|||||||
Reference in New Issue
Block a user