feat/things-munaja: adjust employee - person
This commit is contained in:
No files matched your search
@@ -4,6 +4,7 @@ import (
|
|||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
ep "simrs-vx/internal/domain/main-entities/person"
|
ep "simrs-vx/internal/domain/main-entities/person"
|
||||||
eu "simrs-vx/internal/domain/main-entities/user"
|
eu "simrs-vx/internal/domain/main-entities/user"
|
||||||
|
"time"
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
erg "simrs-vx/internal/domain/references/organization"
|
erg "simrs-vx/internal/domain/references/organization"
|
||||||
@@ -55,22 +56,26 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.Main
|
ecore.Main
|
||||||
User_Id *uint `json:"user_id"`
|
User_Id *uint `json:"user_id"`
|
||||||
User *eu.User `json:"user,omitempty"`
|
User *eu.User `json:"user,omitempty"`
|
||||||
Person_Id *uint `json:"person_id"`
|
Person_Id *uint `json:"person_id"`
|
||||||
Person *ep.Person `json:"person,omitempty"`
|
Person *ep.Person `json:"person,omitempty"`
|
||||||
Number *string `json:"number"`
|
Number *string `json:"number"`
|
||||||
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
Position_Code *erg.EmployeePositionCode `json:"position_code"`
|
||||||
|
Contract_ExpiredDate *time.Time `json:"contract_expiredDate"`
|
||||||
|
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Employee) ToResponse() ResponseDto {
|
func (d Employee) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
User_Id: d.User_Id,
|
User_Id: d.User_Id,
|
||||||
User: d.User,
|
User: d.User,
|
||||||
Person_Id: d.Person_Id,
|
Person_Id: d.Person_Id,
|
||||||
Person: d.Person,
|
Person: d.Person,
|
||||||
Number: d.Number,
|
Number: d.Number,
|
||||||
Status_Code: d.Status_Code,
|
Position_Code: d.Position_Code,
|
||||||
|
Contract_ExpiredDate: d.Contract_ExpiredDate,
|
||||||
|
Status_Code: d.Status_Code,
|
||||||
}
|
}
|
||||||
resp.Main = d.Main
|
resp.Main = d.Main
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package personaddress
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
epr "simrs-vx/internal/domain/main-entities/postal-region"
|
||||||
|
ev "simrs-vx/internal/domain/main-entities/village"
|
||||||
|
|
||||||
|
erp "simrs-vx/internal/domain/references/person"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PersonAddress struct {
|
||||||
|
ecore.Main // adjust this according to the needs
|
||||||
|
Person_Id uint `json:"person_id"`
|
||||||
|
Address string `json:"address" gorm:"size:150"`
|
||||||
|
LocationType_Code erp.AddressLocationTypeCode `json:"locationType_code" gorm:"size:10"`
|
||||||
|
Rt string `json:"rt" gorm:"size:2"`
|
||||||
|
Rw string `json:"rw" gorm:"size:2"`
|
||||||
|
PostalRegion_Code *string `json:"postalRegion_code" gorm:"size:6"`
|
||||||
|
PostalRegion *epr.PostalRegion `json:"postalRegion,omitempty" gorm:"foreignKey:PostalRegion_Code;references:Code"`
|
||||||
|
Village_Code *string `json:"village_code" gorm:"size:10"`
|
||||||
|
Village *ev.Village `json:"village,omitempty" gorm:"foreignKey:Village_Code;references:Code"`
|
||||||
|
}
|
||||||
@@ -1,22 +1,9 @@
|
|||||||
package personaddress
|
package personaddress
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
eb "simrs-vx/internal/domain/main-entities/person-address/base"
|
||||||
epr "simrs-vx/internal/domain/main-entities/postal-region"
|
|
||||||
ev "simrs-vx/internal/domain/main-entities/village"
|
|
||||||
|
|
||||||
erp "simrs-vx/internal/domain/references/person"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PersonAddress struct {
|
type PersonAddress struct {
|
||||||
ecore.Main // adjust this according to the needs
|
eb.PersonAddress
|
||||||
Person_Id uint `json:"person_id"`
|
|
||||||
Address string `json:"address" gorm:"size:150"`
|
|
||||||
LocationType_Code erp.AddressLocationTypeCode `json:"locationType_code" gorm:"size:10"`
|
|
||||||
Rt string `json:"rt" gorm:"size:2"`
|
|
||||||
Rw string `json:"rw" gorm:"size:2"`
|
|
||||||
PostalRegion_Code *string `json:"postalRegion_code" gorm:"size:6"`
|
|
||||||
PostalRegion *epr.PostalRegion `json:"postalRegion,omitempty" gorm:"foreignKey:PostalRegion_Code;references:Code"`
|
|
||||||
Village_Code *string `json:"village_code" gorm:"size:10"`
|
|
||||||
Village *ev.Village `json:"village,omitempty" gorm:"foreignKey:Village_Code;references:Code"`
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package personcontact
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
erp "simrs-vx/internal/domain/references/person"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PersonContact struct {
|
||||||
|
ecore.Main // adjust this according to the needs
|
||||||
|
Person_Id uint `json:"person_id"`
|
||||||
|
Type_Code erp.ContactTypeCode `json:"type_code" gorm:"size:15"`
|
||||||
|
Value string `json:"value" gorm:"size:100"`
|
||||||
|
}
|
||||||
@@ -1,13 +1,9 @@
|
|||||||
package personcontact
|
package personcontact
|
||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
eb "simrs-vx/internal/domain/main-entities/person-contact/base"
|
||||||
erp "simrs-vx/internal/domain/references/person"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PersonContact struct {
|
type PersonContact struct {
|
||||||
ecore.Main // adjust this according to the needs
|
eb.PersonContact
|
||||||
Person_Id uint `json:"person_id"`
|
|
||||||
Type_Code erp.ContactTypeCode `json:"type_code" gorm:"size:15"`
|
|
||||||
Value string `json:"value" gorm:"size:100"`
|
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ type Person struct {
|
|||||||
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
|
Ocupation_Code *erp.OcupationCode `json:"occupation_code" gorm:"size:15"`
|
||||||
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
|
Ocupation_Name *string `json:"occupation_name" gorm:"size:50"`
|
||||||
MaritalStatus_Code *erp.MaritalStatusCode `json:"maritalStatus_code" gorm:"size:10"`
|
MaritalStatus_Code *erp.MaritalStatusCode `json:"maritalStatus_code" gorm:"size:10"`
|
||||||
Nationality *string `json:"nationality": gorm:"size:50"`
|
Nationality *string `json:"nationality" gorm:"size:50"`
|
||||||
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
|
Ethnic_Code *string `json:"ethnic_code" gorm:"size:20"`
|
||||||
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
|
Ethnic *ee.Ethnic `json:"ethnic,omitempty" gorm:"foreignKey:Ethnic_Code;references:Code"`
|
||||||
Language_Code *string `json:"language_code" gorm:"size:10"`
|
Language_Code *string `json:"language_code" gorm:"size:10"`
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ type FilterDto struct {
|
|||||||
Encounter_Id *uint `json:"encounter-id"`
|
Encounter_Id *uint `json:"encounter-id"`
|
||||||
Employee_Id *uint `json:"employee-id"`
|
Employee_Id *uint `json:"employee-id"`
|
||||||
Time *time.Time `json:"time"`
|
Time *time.Time `json:"time"`
|
||||||
TypeCode erc.SoapiTypeCode `json:"typeCode"`
|
TypeCode erc.SoapiTypeCode `json:"type-code"`
|
||||||
Value *string `json:"value"`
|
Value *string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,16 @@ const (
|
|||||||
EPCReg EmployeePositionCode = "reg" // Admisi/Pendaftaran
|
EPCReg EmployeePositionCode = "reg" // Admisi/Pendaftaran
|
||||||
EPCNur EmployeePositionCode = "nur" // Perawat
|
EPCNur EmployeePositionCode = "nur" // Perawat
|
||||||
EPCDoc EmployeePositionCode = "doc" // Dokter
|
EPCDoc EmployeePositionCode = "doc" // Dokter
|
||||||
EPCNut EmployeePositionCode = "nut" // Ahli gizi
|
|
||||||
EPCMwi EmployeePositionCode = "miw" // Bidan
|
EPCMwi EmployeePositionCode = "miw" // Bidan
|
||||||
|
EPCThr EmployeePositionCode = "thr" // Terapis
|
||||||
|
EPCNut EmployeePositionCode = "nut" // Ahli gizi
|
||||||
EPCLab EmployeePositionCode = "lab" // Laboran
|
EPCLab EmployeePositionCode = "lab" // Laboran
|
||||||
EPCPha EmployeePositionCode = "pha" // Farmasi
|
EPCPha EmployeePositionCode = "pha" // Farmasi
|
||||||
EPCPay EmployeePositionCode = "pay" // Pembayaran
|
EPCNom EmployeePositionCode = "nom" // Non Medic
|
||||||
EPCHur EmployeePositionCode = "hue" // Sumber Daya Manusia
|
// EPCPay EmployeePositionCode = "pay" // Pembayaran
|
||||||
EPCGea EmployeePositionCode = "gea" // Bagian Umum
|
// EPCHur EmployeePositionCode = "hue" // Sumber Daya Manusia
|
||||||
EPCMan EmployeePositionCode = "man" // Manajemen
|
// EPCGea EmployeePositionCode = "gea" // Bagian Umum
|
||||||
|
// EPCMan EmployeePositionCode = "man" // Manajemen
|
||||||
|
|
||||||
IPCSpecialist = "specialist-intern"
|
IPCSpecialist = "specialist-intern"
|
||||||
IPCNurse = "nurse-intern"
|
IPCNurse = "nurse-intern"
|
||||||
|
|||||||
@@ -65,19 +65,19 @@ func (a AuthInfo) IsPharmacist() bool {
|
|||||||
return *a.Employee_Position_Code == string(ero.EPCPha)
|
return *a.Employee_Position_Code == string(ero.EPCPha)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a AuthInfo) IsPayment() bool {
|
// func (a AuthInfo) IsPayment() bool {
|
||||||
if a.Employee_Position_Code == nil {
|
// if a.Employee_Position_Code == nil {
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
return *a.Employee_Position_Code == string(ero.EPCPay)
|
// return *a.Employee_Position_Code == string(ero.EPCPay)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (a AuthInfo) IsManagement() bool {
|
// func (a AuthInfo) IsManagement() bool {
|
||||||
if a.Employee_Position_Code == nil {
|
// if a.Employee_Position_Code == nil {
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
return *a.Employee_Position_Code == string(ero.EPCMan)
|
// return *a.Employee_Position_Code == string(ero.EPCMan)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (a AuthInfo) IsSpecialistIntern() bool {
|
func (a AuthInfo) IsSpecialistIntern() bool {
|
||||||
if a.Intern_Position_Code == nil {
|
if a.Intern_Position_Code == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user