update personaddress + midwife

This commit is contained in:
dpurbosakti
2025-10-08 10:16:21 +07:00
parent e630e3ac38
commit 88ae9d5f30
8 changed files with 139 additions and 36 deletions
@@ -0,0 +1,69 @@
package midwife
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type CreateDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Preloads []string `json:"-"`
Pagination ecore.Pagination
}
type FilterDto struct {
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Employee_Id *uint `json:"employee_id"`
IHS_Number *string `json:"ihs_number"`
}
type UpdateDto struct {
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint `json:"id"`
}
type MetaDto struct {
PageNumber int `json:"page_number"`
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty"`
IHS_Number *string `json:"ihs_number"`
}
func (d Midwife) ToResponse() ResponseDto {
resp := ResponseDto{
Employee_Id: d.Employee_Id,
Employee: d.Employee,
IHS_Number: d.IHS_Number,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []Midwife) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,13 @@
package midwife
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/employee"
)
type Midwife struct {
ecore.Main // adjust this according to the needs
Employee_Id *uint `json:"employee_id"`
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
IHS_Number *string `json:"ihs_number" gorm:"unique;size:20"`
}
@@ -10,5 +10,6 @@ type PersonAddress struct {
Address string `json:"address" gorm:"size:150"`
Rt string `json:"rt" gorm:"size:2"`
Rw string `json:"rw" gorm:"size:2"`
PostalCode string `json:"postalCode" gorm:"size:6"`
Village_Code string `json:"village_code" gorm:"size:10"`
}
@@ -31,12 +31,14 @@ const (
ITGCEmpFee ItemGroupCode = "employee-fee"
ITGCDocFee ItemGroupCode = "doctor-fee"
IFGCBuilding InfraGroupCode = "building" // Bangunan
IFGCFloor InfraGroupCode = "floor" // Lantai
IFGCRoom InfraGroupCode = "room" // Ruang
IFGCChamber InfraGroupCode = "chamber" // Kamar
IFGCBed InfraGroupCode = "bed" // Ranjang
IFGCWarehouse InfraGroupCode = "warehouse" // Gudang/Depo
IFGCBuilding InfraGroupCode = "building" // Bangunan
IFGCFloor InfraGroupCode = "floor" // Lantai
IFGCRoom InfraGroupCode = "room" // Ruang
IFGCChamber InfraGroupCode = "chamber" // Kamar
IFGCBed InfraGroupCode = "bed" // Ranjang
IFGCWarehouse InfraGroupCode = "warehouse" // Gudang/Depo
IFGCCounter InfraGroupCode = "counter" // Counter
IFGCPubScreen InfraGroupCode = "public-screen" // Public Screen
UTCReg UnitTypeCode = "reg" // Registrasi
UTCExa UnitTypeCode = "exa" // Pemeriksaan
@@ -47,6 +47,7 @@ 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"
midwife "simrs-vx/internal/domain/main-entities/midwife"
nurse "simrs-vx/internal/domain/main-entities/nurse"
nutritionist "simrs-vx/internal/domain/main-entities/nutritionist"
patient "simrs-vx/internal/domain/main-entities/patient"
@@ -147,5 +148,6 @@ func getMainEntities() []any {
&mcuordersubitem.McuOrderSubItem{},
&consultation.Consultation{},
&chemo.Chemo{},
&midwife.Midwife{},
}
}