Merge branch 'migration-vanilia' of https://github.com/dikstub-rssa/simrs-be into feat/encounter-adjustment-142
# Conflicts: # internal/domain/main-entities/rehab/dto.go # internal/use-case/main-use-case/encounter/lib.go
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package antibioticinuse
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eas "simrs-vx/internal/domain/main-entities/antibiotic-src"
|
||||
emo "simrs-vx/internal/domain/main-entities/mcu-order"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
McuOrder_Id *uint `json:"mcuOrder_id"`
|
||||
AntibioticSrc_Id *uint `json:"antibioticSrc_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
McuOrder_Id *uint `json:"mcu-order-id"`
|
||||
AntibioticSrc_Id *uint `json:"mcu-src-id"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status-code"`
|
||||
}
|
||||
type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
}
|
||||
|
||||
type SetScheduleDto struct {
|
||||
Id uint `json:"id"`
|
||||
ExaminationDate *time.Time `json:"examinationDate"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
McuOrder_Id *uint `json:"mcuOrder_id"`
|
||||
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty"`
|
||||
AntibioticSrc_Id *uint `json:"antibioticSrc_id"`
|
||||
Antibiotic *eas.CreateDto `json:"mcuSrc,omitempty"`
|
||||
}
|
||||
|
||||
func (d AntibioticInUse) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
McuOrder_Id: d.McuOrder_Id,
|
||||
McuOrder: d.McuOrder,
|
||||
AntibioticSrc_Id: d.AntibioticSrc_Id,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []AntibioticInUse) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package antibioticinuse
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eas "simrs-vx/internal/domain/main-entities/antibiotic-src"
|
||||
emo "simrs-vx/internal/domain/main-entities/mcu-order"
|
||||
)
|
||||
|
||||
type AntibioticInUse struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
McuOrder_Id *uint `json:"mcuOrder_id" gorm:"uniqueIndex:idx_order_src"`
|
||||
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty" gorm:"foreignKey:McuOrder_Id;references:Id"`
|
||||
AntibioticSrc_Id *uint `json:"antibioticSrcSrc_id" gorm:"uniqueIndex:idx_order_src"`
|
||||
AntibioticSrc *eas.AntibioticSrc `json:"antibioticSrc,omitempty" gorm:"foreignKey:AntibioticSrc_Id;references:Id"`
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package antibioticsrccategory
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Sort string `json:"sort"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
func (d AntibioticSrcCategory) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []AntibioticSrcCategory) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package antibioticsrccategory
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type AntibioticSrcCategory struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package antibioticsrc
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ei "simrs-vx/internal/domain/main-entities/item"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
AntibioticSrcCategory_Code *string `json:"antibioticSrcCategory_code" validate:"maxLength=20"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Sort string `json:"sort"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
AntibioticSrcCategory_Code *string `json:"antibiotic-src-category-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
AntibioticSrcCategory_Code *string `json:"antibioticSrcCategory_code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
}
|
||||
|
||||
func (d AntibioticSrc) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
AntibioticSrcCategory_Code: d.AntibioticSrcCategory_Code,
|
||||
// Item_Id: d.Item_Id,
|
||||
// Item: d.Item,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []AntibioticSrc) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package antibioticsrc
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
easc "simrs-vx/internal/domain/main-entities/antibiotic-src-category"
|
||||
)
|
||||
|
||||
type AntibioticSrc struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
AntibioticSrcCategory_Code *string `json:"antibioticSrcCategory_code" gorm:"size:20"`
|
||||
AntibioticSrcCategory *easc.AntibioticSrcCategory `json:"antibioticSrcCategory,omitempty" gorm:"foreignKey:AntibioticSrcCategory_Code;references:Code"`
|
||||
// Item_Id *uint `json:"item_id"`
|
||||
// Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package authpartner
|
||||
|
||||
import (
|
||||
// internal - domain - main-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
SecretKey string `json:"secretKey"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
Sort string `json:"sort"`
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code *string `json:"code"`
|
||||
Name *string `json:"name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
PageNumber int `json:"page_number"`
|
||||
PageSize int `json:"page_size"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
SecretKey string `json:"secretKey"`
|
||||
}
|
||||
|
||||
func (d AuthPartner) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
SecretKey: d.SecretKey,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []AuthPartner) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package authpartner
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
)
|
||||
|
||||
type AuthPartner struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:50"`
|
||||
Name string `json:"name" gorm:"unique;size:100"`
|
||||
SecretKey string `json:"secretKey" gorm:"size:255"`
|
||||
}
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -32,17 +32,18 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
|
||||
@@ -14,7 +14,9 @@ type Device struct {
|
||||
Uom_Code string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Division_Id *uint16 `json:"division_id"`
|
||||
Division_Code *string `json:"division_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Division_Id *uint16 `json:"division_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Division_Code *string `json:"division_code"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,26 +22,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Division_Id *uint16 `json:"division-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Division_Code *string `json:"division-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,23 +53,23 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Division_Id *uint16 `json:"division_id"`
|
||||
Division *ed.Division `json:"division,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
Division_Code *string `json:"division_code"`
|
||||
Division *ed.Division `json:"division,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d DivisionPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Division_Id: d.Division_Id,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
Division_Code: d.Division_Code,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
if d.Division != nil {
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type DivisionPosition struct {
|
||||
eb.Basic
|
||||
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"`
|
||||
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Parent_Code *string `json:"parent_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -20,25 +20,26 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Id *uint16 `json:"parent-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Code *string `json:"parent-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -51,7 +52,7 @@ type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent_Code *string `json:"parent_code"`
|
||||
Parent *Division `json:"parent,omitempty"`
|
||||
Childrens []Division `json:"childrens,omitempty"`
|
||||
DivisionPosition []edpb.Basic `json:"divisionPositions,omitempty"`
|
||||
@@ -61,7 +62,7 @@ func (d Division) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Parent_Id: d.Parent_Id,
|
||||
Parent_Code: d.Parent_Code,
|
||||
Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
DivisionPosition: d.DivisionPositions,
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
|
||||
type Division struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Code string `json:"code" gorm:"uniqueIndex;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent *Division `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"`
|
||||
Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
||||
DivisionPositions []edpb.Basic `json:"divisionPositions,omitempty" gorm:"foreignKey:Division_Id;references:Id"`
|
||||
Parent_Code *string `json:"parent_code" gorm:"size:10"`
|
||||
Parent *Division `json:"parent" gorm:"foreignKey:Parent_Code;references:Code"`
|
||||
Childrens []Division `json:"childrens" gorm:"foreignKey:Parent_Code;references:Code"` // may need references to self
|
||||
DivisionPositions []edpb.Basic `json:"divisionPositions,omitempty" gorm:"foreignKey:Division_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -6,16 +6,18 @@ import (
|
||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code *string `json:"code" validate:"maxLength=20"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
SIP_Number *string `json:"sip_number"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Code *string `json:"code" validate:"maxLength=20"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
SIP_Number *string `json:"sip_number"`
|
||||
SIP_ExpiredDate *time.Time `json:"sip_expiredDate"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -25,13 +27,14 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code *string `json:"code"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
|
||||
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
|
||||
Unit_Id *uint `json:"unit-id"`
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
||||
Code *string `json:"code"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
|
||||
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
|
||||
SIP_ExpiredDate *string `json:"sip-expiredDate"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -59,32 +62,32 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Code *string `json:"code"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
SIP_Number *string `json:"sip_number"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" `
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
Code *string `json:"code"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
SIP_Number *string `json:"sip_number"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" `
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
}
|
||||
|
||||
func (d Doctor) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
IHS_Number: d.IHS_Number,
|
||||
SIP_Number: d.SIP_Number,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Id: d.Subspecialist_Id,
|
||||
Subspecialist: d.Subspecialist,
|
||||
Code: d.Code,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
IHS_Number: d.IHS_Number,
|
||||
SIP_Number: d.SIP_Number,
|
||||
Unit_Code: d.Unit_Code,
|
||||
Unit: d.Unit,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Code: d.Subspecialist_Code,
|
||||
Subspecialist: d.Subspecialist,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -6,19 +6,21 @@ import (
|
||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Doctor struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code *string `json:"code" gorm:"unique;size:20"`
|
||||
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"`
|
||||
SIP_Number *string `json:"sip_number" gorm:"unique;size:20"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Code *string `json:"code" gorm:"unique;size:20"`
|
||||
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"`
|
||||
SIP_Number *string `json:"sip_number" gorm:"unique;size:20"`
|
||||
SIP_ExpiredDate *time.Time `json:"sip_expiredDate"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -6,15 +6,17 @@ import (
|
||||
eu "simrs-vx/internal/domain/main-entities/user"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
erg "simrs-vx/internal/domain/references/organization"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Employee struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
|
||||
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
|
||||
Number *string `json:"number" gorm:"size:20"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id;references:Id"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id;references:Id"`
|
||||
Position_Code *erg.EmployeePositionCode `json:"position_code" gorm:"size:20"`
|
||||
Number *string `json:"number" gorm:"size:20"`
|
||||
Contract_ExpiredDate *time.Time `json:"contract_expiredDate"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code" validate:"maxLength=15"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Infra_Id *uint16 `json:"-"` // for room
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code" validate:"maxLength=15"`
|
||||
Parent_Code *string `json:"parent_code"`
|
||||
Item_Code *string `json:"-"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Infra_Code *string `json:"infra_code"` // for room
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -32,24 +32,25 @@ type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup-code"`
|
||||
Parent_Id *uint16 `json:"parent-id"`
|
||||
Item_Id *uint `json:"item-id"`
|
||||
Parent_Code *string `json:"parent-code"`
|
||||
Item_Id *string `json:"item-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -63,10 +64,10 @@ type ResponseDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent_Code *string `json:"parent_code"`
|
||||
Parent *Infra `json:"parent,omitempty"`
|
||||
Childrens []Infra `json:"childrens,omitempty"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
Rooms []erb.Basic `json:"rooms,omitempty"`
|
||||
}
|
||||
@@ -76,12 +77,12 @@ func (d Infra) ToResponse() ResponseDto {
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
InfraGroup_Code: d.InfraGroup_Code,
|
||||
Parent_Id: d.Parent_Id,
|
||||
Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
Item_Id: d.Item_Id,
|
||||
Item: d.Item,
|
||||
Rooms: d.Rooms,
|
||||
Parent_Code: d.Parent_Code,
|
||||
// Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
Item_Code: d.Item_Code,
|
||||
Item: d.Item,
|
||||
Rooms: d.Rooms,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -3,6 +3,7 @@ package infra
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ei "simrs-vx/internal/domain/main-entities/item"
|
||||
|
||||
erb "simrs-vx/internal/domain/main-entities/room/base"
|
||||
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
@@ -10,13 +11,13 @@ import (
|
||||
|
||||
type Infra struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Code string `json:"code" gorm:"uniqueIndex;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
InfraGroup_Code ero.InfraGroupCode `json:"infraGroup_code" gorm:"size:15"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent *Infra `json:"parent" gorm:"foreignKey:Parent_Id;references:Id"`
|
||||
Childrens []Infra `json:"childrens" gorm:"foreignKey:Parent_Id"` // may need references to self
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
Rooms []erb.Basic `json:"rooms" gorm:"foreignKey:Infra_Id"`
|
||||
Parent_Code *string `json:"parent_code" gorm:"size:10"`
|
||||
Parent *Infra `json:"parent" gorm:"foreignKey:Parent_Code;references:Code"`
|
||||
Childrens []Infra `json:"childrens" gorm:"foreignKey:Parent_Code;references:Code"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Code;references:Code"`
|
||||
Rooms []erb.Basic `json:"rooms" gorm:"foreignKey:Infra_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Code *string `json:"installation_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Installation_Id *uint16 `json:"installation_id" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Installation_Code *string `json:"installation_code" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,26 +22,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Installation_Id *uint16 `json:"installation-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Installation_Code *string `json:"installation-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,24 +53,24 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d InstallationPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Installation_Id: d.Installation_Id,
|
||||
Installation: d.Installation,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
Installation_Code: d.Installation_Code,
|
||||
Installation: d.Installation,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type InstallationPosition struct {
|
||||
eib.Basic // adjust this according to the needs
|
||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -11,5 +11,5 @@ type Installation struct {
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"`
|
||||
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ type CreateDto struct {
|
||||
Name string `json:"name" validate:"maxLength=100"`
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code" validate:"maxLength=10"`
|
||||
Uom_Code *string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
}
|
||||
|
||||
@@ -27,23 +27,24 @@ type FilterDto struct {
|
||||
Name string `json:"name"`
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup-code"`
|
||||
Uom_Code *string `json:"uom-code"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Stock *int `json:"stock"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -59,7 +60,7 @@ type ResponseDto struct {
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code"`
|
||||
Uom_Code *string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom,omitempty"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ func (d Item) ToResponse() ResponseDto {
|
||||
ItemGroup_Code: d.ItemGroup_Code,
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Stock: d.Stock,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
|
||||
@@ -14,6 +14,6 @@ type Item struct {
|
||||
ItemGroup_Code ero.ItemGroupCode `json:"itemGroup_code" gorm:"size:15"`
|
||||
Uom_Code *string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Stock *int `json:"stock"`
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Uom_Code string `json:"uom_code" validate:"maxLength=10"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -24,28 +24,29 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom-code"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom-code"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Code *string `json:"item-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -56,28 +57,28 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom,omitempty"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra *ein.Infra `json:"infra,omitempty"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Uom_Code string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom,omitempty"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ein.Infra `json:"infra,omitempty"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
Item *ei.Item `json:"item,omitempty"`
|
||||
}
|
||||
|
||||
func (d Material) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra: d.Infra,
|
||||
Stock: d.Stock,
|
||||
Item_Id: d.Item_Id,
|
||||
Item: d.Item,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
Stock: d.Stock,
|
||||
Item_Code: d.Item_Code,
|
||||
Item: d.Item,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -14,8 +14,10 @@ type Material struct {
|
||||
Uom_Code string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom,omitempty" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ type CreateDto struct {
|
||||
Number uint8 `json:"number"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code"`
|
||||
Scope_Code ercl.McuScopeCode `json:"scope_code"`
|
||||
|
||||
pa.AuthInfo
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
ercl "simrs-vx/internal/domain/references/clinical"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
)
|
||||
|
||||
type McuOrder struct {
|
||||
@@ -23,7 +22,7 @@ type McuOrder struct {
|
||||
Number uint8 `json:"number"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
UrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"urgencyLevel_code" gorm:"not null;size:15"`
|
||||
Scope_Code *ere.CheckupScopeCode `json:"scope_code" gorm:"index;size:10"`
|
||||
Scope_Code ercl.McuScopeCode `json:"scope_code" gorm:"index;size:10"`
|
||||
}
|
||||
|
||||
func (d McuOrder) IsCompleted() bool {
|
||||
|
||||
@@ -3,13 +3,13 @@ package division
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
erc "simrs-vx/internal/domain/references/clinical"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Scope_Code *ere.CheckupScopeCode `json:"scope_code" validate:"maxLength=10"`
|
||||
Code string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Scope_Code erc.McuScopeCode `json:"scope_code" validate:"maxLength=10"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -20,10 +20,10 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Scope_Code *ere.CheckupScopeCode `json:"scope-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Scope_Code *erc.McuScopeCode `json:"scope-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -48,9 +48,9 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Scope_Code *ere.CheckupScopeCode `json:"scope_code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Scope_Code erc.McuScopeCode `json:"scope_code"`
|
||||
}
|
||||
|
||||
func (d McuSrcCategory) ToResponse() ResponseDto {
|
||||
|
||||
@@ -2,12 +2,12 @@ package division
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
erc "simrs-vx/internal/domain/references/clinical"
|
||||
)
|
||||
|
||||
type McuSrcCategory struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Scope_Code *ere.CheckupScopeCode `json:"scope_code" gorm:"index;size:10"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:20"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Scope_Code erc.McuScopeCode `json:"scope_code" gorm:"index;size:10"`
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ type CreateDto struct {
|
||||
MedicineMethod_Code *string `json:"medicineMethod_code" validate:"maxLength=10"`
|
||||
Uom_Code *string `json:"uom_code" validate:"maxLength=10"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -35,25 +35,26 @@ type FilterDto struct {
|
||||
MedicineMethod_Code *string `json:"medicineMethod-code"`
|
||||
Uom_Code *string `json:"uom-code"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item-id"`
|
||||
Item_Code *string `json:"item-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Item_Code *uint `json:"item_code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -73,10 +74,10 @@ type ResponseDto struct {
|
||||
Uom_Code *string `json:"uom_code"`
|
||||
Uom *eu.Uom `json:"uom"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ein.Infra `json:"infra,omitempty"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code"`
|
||||
Item *eit.Item `json:"item,omitempty"`
|
||||
}
|
||||
|
||||
@@ -91,10 +92,10 @@ func (d Medicine) ToResponse() ResponseDto {
|
||||
Uom_Code: d.Uom_Code,
|
||||
Uom: d.Uom,
|
||||
Dose: d.Dose,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
Stock: d.Stock,
|
||||
Item_Id: d.Item_Id,
|
||||
Item_Code: d.Item_Code,
|
||||
Item: d.Item,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
|
||||
@@ -21,8 +21,10 @@ type Medicine struct {
|
||||
Uom *eu.Uom `json:"uom" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *eit.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ type CreateDto struct {
|
||||
Code *string `json:"code" validate:"maxLength=20"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -25,8 +25,8 @@ type FilterDto struct {
|
||||
Code *string `json:"code"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
IHS_Number *string `json:"ihs-number"`
|
||||
Unit_Id *uint16 `json:"unit-id"`
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
}
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
@@ -56,9 +56,9 @@ type ResponseDto struct {
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
IHS_Number *string `json:"ihs_number"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ei.Infra `json:"infra,omitempty"`
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ func (d Nurse) ToResponse() ResponseDto {
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
IHS_Number: d.IHS_Number,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit_Code: d.Unit_Code,
|
||||
Unit: d.Unit,
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
|
||||
@@ -13,8 +13,8 @@ type Nurse struct {
|
||||
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"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor_Code *string `json:"doctor_code"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
|
||||
@@ -29,7 +29,7 @@ type ReadListDto struct {
|
||||
|
||||
type FilterDto struct {
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
Doctor_Id *uint `json:"doctor-id"`
|
||||
Doctor_Code *string `json:"doctor-code"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Status_Code *erc.DataStatusCode `json:"status-code"`
|
||||
}
|
||||
@@ -58,7 +58,7 @@ type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor_Code *string `json:"doctor_code"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
@@ -68,7 +68,7 @@ func (d Prescription) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Encounter: d.Encounter,
|
||||
Doctor_Id: d.Doctor_Id,
|
||||
Doctor_Code: d.Doctor_Code,
|
||||
Doctor: d.Doctor,
|
||||
IssuedAt: d.IssuedAt,
|
||||
Status_Code: d.Status_Code,
|
||||
|
||||
@@ -14,8 +14,8 @@ type Prescription struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
|
||||
Doctor_Code *string `json:"doctor_code" gorm:"size:20"`
|
||||
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,10 +22,10 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Infra_Id *uint16 `json:"infra-id"`
|
||||
Unit_Id *uint16 `json:"unit-id"`
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
||||
Infra_Code *string `json:"infra-code"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -49,26 +49,26 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra *ei.Infra `json:"infra,omitempty"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Infra *ei.Infra `json:"infra,omitempty"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
}
|
||||
|
||||
func (d Room) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Infra_Id: d.Infra_Id,
|
||||
Infra: d.Infra,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit: d.Unit,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Id: d.Subspecialist_Id,
|
||||
Subspecialist: d.Subspecialist,
|
||||
Infra_Code: d.Infra_Code,
|
||||
Infra: d.Infra,
|
||||
Unit_Code: d.Unit_Code,
|
||||
Unit: d.Unit,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Code: d.Subspecialist_Code,
|
||||
Subspecialist: d.Subspecialist,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type Room struct {
|
||||
ebase.Basic
|
||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id"`
|
||||
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,10 +22,10 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Person_Id *uint `json:"person-id"`
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
||||
User_Id *uint `json:"user-id"`
|
||||
Person_Id *uint `json:"person-id"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||
User_Id *uint `json:"user-id"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
@@ -50,26 +50,26 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty"`
|
||||
}
|
||||
|
||||
func (d SpecialistIntern) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Person_Id: d.Person_Id,
|
||||
Person: d.Person,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Id: d.Subspecialist_Id,
|
||||
Subspecialist: d.Subspecialist,
|
||||
User_Id: d.User_Id,
|
||||
User: d.User,
|
||||
Person_Id: d.Person_Id,
|
||||
Person: d.Person,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist_Code: d.Subspecialist_Code,
|
||||
Subspecialist: d.Subspecialist,
|
||||
User_Id: d.User_Id,
|
||||
User: d.User,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
)
|
||||
|
||||
type SpecialistIntern struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty" gorm:"foreignKey:Person_Id"`
|
||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
||||
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty" gorm:"foreignKey:User_Id"`
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"`
|
||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Specialist_Id *uint16 `json:"specialist_id" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Specialist_Code *string `json:"specialist_code" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,26 +22,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,24 +53,24 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d SpecialistPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type SpecialistPosition struct {
|
||||
esb.Basic
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -21,25 +21,26 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Id *uint16 `json:"unit-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,7 +53,7 @@ type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"`
|
||||
Subspecialists []essb.Basic `json:"subspecialists,omitempty"`
|
||||
@@ -63,7 +64,7 @@ func (d Specialist) ToResponse() ResponseDto {
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Unit: d.Unit,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit_Code: d.Unit_Code,
|
||||
SpecialistPositions: d.SpecialistPositions,
|
||||
Subspecialists: d.Subspecialists,
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ type Specialist struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id"`
|
||||
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_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"`
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Subspecialist_Code *string `json:"subspecialist_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -22,26 +22,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Subspecialist_Id *uint16 `json:"subspecialist-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
Employee_Id *uint `json:"employee-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,24 +53,24 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
Subspecialist_Code *string `json:"subspecialist_id"`
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty"`
|
||||
}
|
||||
|
||||
func (d SubspecialistPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Subspecialist_Id: d.Subspecialist_Id,
|
||||
Subspecialist: d.Subspecialist,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
Subspecialist_Code: d.Subspecialist_Code,
|
||||
Subspecialist: d.Subspecialist,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
HeadStatus: d.HeadStatus,
|
||||
Employee_Id: d.Employee_Id,
|
||||
Employee: d.Employee,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type SubspecialistPosition struct {
|
||||
esb.Basic
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist_Code *string `json:"specialist_code" gorm:"size:10"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -20,25 +20,26 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Code *string `json:"code"`
|
||||
Name *string `json:"name"`
|
||||
Specialist_Id *uint16 `json:"specialist-id"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Code *string `json:"code"`
|
||||
Name *string `json:"name"`
|
||||
Specialist_Code *string `json:"specialist-code"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -49,20 +50,20 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty"`
|
||||
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Subspecialist) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist: d.SubspecialistPositions,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Specialist_Code: d.Specialist_Code,
|
||||
Specialist: d.Specialist,
|
||||
Subspecialist: d.SubspecialistPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -8,6 +8,6 @@ import (
|
||||
|
||||
type Subspecialist struct {
|
||||
esb.Basic
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Unit_Id *uint16 `json:"unit_id" gorm:"not null"`
|
||||
Unit_Code *string `json:"unit_code" gorm:"size:10"`
|
||||
Code string `json:"code" gorm:"unique;size:10;not null"`
|
||||
Name string `json:"name" gorm:"size:30;not null"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Unit_Id *uint16 `json:"unit_id" validate:"required"`
|
||||
Unit_Code *string `json:"unit_code" validate:"required"`
|
||||
Code string `json:"code" validate:"maxLength=10;required"`
|
||||
Name string `json:"name" validate:"maxLength=30;required"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
@@ -22,7 +22,7 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Unit_Id *uint16 `json:"unit-id"`
|
||||
Unit_Code *string `json:"unit-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
HeadStatus *bool `json:"head-status"`
|
||||
@@ -31,17 +31,18 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -52,7 +53,7 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Unit *eu.Unit `json:"unit,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
@@ -63,7 +64,7 @@ type ResponseDto struct {
|
||||
|
||||
func (d UnitPosition) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Unit_Id: d.Unit_Id,
|
||||
Unit_Code: d.Unit_Code,
|
||||
Unit: d.Unit,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
|
||||
@@ -7,5 +7,5 @@ import (
|
||||
|
||||
type UnitPosition struct {
|
||||
eub.Basic
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -20,26 +20,27 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Installation_Id *uint16 `json:"installation-id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
Installation_Code *string `json:"installation-code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Search string `json:"search" gormhelper:"searchColumns=Code,Name"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
Id *uint16 `json:"id"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
@@ -50,19 +51,19 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
|
||||
Installation_Code *string `json:"installation_code"`
|
||||
Installation *ei.Installation `json:"installation,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Unit) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Installation_Id: d.Installation_Id,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
UnitPositions: d.UnitPositions,
|
||||
Installation_Code: d.Installation_Code,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
UnitPositions: d.UnitPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
if d.Installation != nil {
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
)
|
||||
|
||||
type Unit struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Id"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Type_Code *ero.UnitTypeCode `json:"type_code"`
|
||||
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Code *string `json:"installation_code" gorm:"size:10"`
|
||||
Installation *ei.Installation `json:"installation" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
Type_Code *ero.UnitTypeCode `json:"type_code"`
|
||||
UnitPositions []eub.Basic `json:"unitPositions,omitempty" gorm:"foreignKey:Unit_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// FES = From External Source
|
||||
package userfes
|
||||
|
||||
import (
|
||||
// internal - domain - main-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eap "simrs-vx/internal/domain/main-entities/auth-partner"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Name string `json:"name"`
|
||||
AuthPartner_Code string `json:"authPartner_code"`
|
||||
User_Name string `json:"user_name"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
Sort string `json:"sort"`
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Name *string `json:"name"`
|
||||
AuthPartner_Code *string `json:"authPartner_code"`
|
||||
User_Name *string `json:"user_name"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
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
|
||||
Name string `json:"name"`
|
||||
AuthPartner_Code string `json:"authPartner_code"`
|
||||
AuthPartner *eap.AuthPartner `json:"authPartner,omitempty"`
|
||||
User_Name string `json:"user_name"`
|
||||
}
|
||||
|
||||
func (d UserFes) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Name: d.Name,
|
||||
AuthPartner_Code: d.AuthPartner_Code,
|
||||
AuthPartner: d.AuthPartner,
|
||||
User_Name: d.User_Name,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
}
|
||||
|
||||
func ToResponseList(data []UserFes) []ResponseDto {
|
||||
resp := make([]ResponseDto, len(data))
|
||||
for i, u := range data {
|
||||
resp[i] = u.ToResponse()
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// FES = From External Source
|
||||
package userfes
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eap "simrs-vx/internal/domain/main-entities/auth-partner"
|
||||
eau "simrs-vx/internal/domain/main-entities/user"
|
||||
)
|
||||
|
||||
type UserFes struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Name string `json:"name" gorm:"size:100"`
|
||||
AuthPartner_Code string `json:"authPartner_code" gorm:"size:30"`
|
||||
AuthPartner *eap.AuthPartner `json:"authPartner,omitempty" gorm:"foreignKey:AuthPartner_Code;references:Code"`
|
||||
User_Name string `json:"user_name" gorm:"size:50"`
|
||||
User *eau.User `json:"user,omitempty" gorm:"foreignKey:User_Name;references:Name"`
|
||||
}
|
||||
@@ -24,10 +24,10 @@ type CreateDto struct {
|
||||
Employee *EmployeUpdateDto `json:"employee"`
|
||||
IHS_Number *string `json:"ihs_number" validate:"maxLength=20"`
|
||||
SIP_Number *string `json:"sip_number" validate:"maxLength=20"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id"`
|
||||
Unit_Code *string `json:"unit_code"`
|
||||
Infra_Code *string `json:"infra_code"`
|
||||
Specialist_Code *string `json:"specialist_code"`
|
||||
Subspecialist_Code *string `json:"subspecialist_code"`
|
||||
ContractPosition_Code erg.ContractPositionCode `json:"contractPosition_code" gorm:"not null;size:20"`
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ type (
|
||||
InstructionCode string
|
||||
HeadToToeCode string
|
||||
McuUrgencyLevelCode string
|
||||
McuScopeCode string
|
||||
SoapiTypeCode string
|
||||
MedicalActionTypeCode string
|
||||
VehicleTypeCode string
|
||||
@@ -24,6 +25,7 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
SCDetail SubjectCode = "detail" // Detail
|
||||
SCPrimaryComplain SubjectCode = "pri-complain" // Keluhan Utama
|
||||
SCSecComplain SubjectCode = "sec-complain" // Secondary Complaint
|
||||
SCCurrentDiseaseHistory SubjectCode = "cur-disea-hist" // Current Disease History
|
||||
@@ -34,6 +36,7 @@ const (
|
||||
SCMedicationHistory SubjectCode = "med-hist" // Medication History
|
||||
SCBloodType SubjectCode = "blood-type" // Blood Type
|
||||
|
||||
Detail ObjectCode = "detail" // Detail
|
||||
OCConsciousnessLevel ObjectCode = "consc-level" // Tingkat Kesadaran
|
||||
OCConsciousnessLevelDet ObjectCode = "consc-level-det" // Detail Tingkat Kesadaran
|
||||
OCSystolicBloodPressure ObjectCode = "syst-bp" // Tekanan Darah Systolic
|
||||
@@ -63,6 +66,7 @@ const (
|
||||
OCHeight ObjectCode = "height" // Tinggi Badan
|
||||
OCHeadToToe ObjectCode = "head-to-toe" // Kepala Sampai Kaki
|
||||
|
||||
ACDetail AssessmentCode = "detail" // Detail
|
||||
ACEarlyDiag AssessmentCode = "early-diag" // Diagnosis Awal
|
||||
ACLateDiag AssessmentCode = "late-diag" // Diagnosis Akhir
|
||||
ACSecDiag AssessmentCode = "sec-diag" // Diagnosis Sekunder
|
||||
@@ -193,7 +197,7 @@ type Soapi struct {
|
||||
|
||||
// ---------------- SUBJECT ----------------
|
||||
type SubjectSection struct {
|
||||
Note string `json:"note,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
PrimComplain string `json:"prim-compl,omitempty"`
|
||||
SecComplainQ string `json:"sec-compl,omitempty"`
|
||||
PrimaryComplain string `json:"pri-complain,omitempty"`
|
||||
@@ -209,7 +213,7 @@ type SubjectSection struct {
|
||||
|
||||
// ---------------- OBJECT ----------------
|
||||
type ObjectSection struct {
|
||||
Note string `json:"note,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
ConsciousnessLevel string `json:"consc-level,omitempty"`
|
||||
ConsciousnessLevelDet string `json:"consc-level-det,omitempty"`
|
||||
SystolicBloodPressure string `json:"syst-bp,omitempty"`
|
||||
@@ -242,9 +246,16 @@ type ObjectSection struct {
|
||||
|
||||
// ---------------- ASSESSMENT ----------------
|
||||
type AssessmentSection struct {
|
||||
EarlyDiagnosis DiagnosisDetail `json:"early-diag,omitempty"`
|
||||
LateDiagnosis DiagnosisDetail `json:"late-diag,omitempty"`
|
||||
SecondaryDiag DiagnosisDetail `json:"sec-diag,omitempty"`
|
||||
Detail string `json:"detail,omitempty"`
|
||||
EarlyDiagnosis DiagnosisDetail `json:"early-diag,omitempty"`
|
||||
LateDiagnosis DiagnosisDetail `json:"late-diag,omitempty"`
|
||||
SecondaryDiag DiagnosisDetail `json:"sec-diag,omitempty"`
|
||||
EarlyDiagnosisMed DiagnosisDetail `json:"early-med-diag,omitempty"`
|
||||
LateDiagnosisMed DiagnosisDetail `json:"late-med-diag,omitempty"`
|
||||
SecondaryDiagnosisMed DiagnosisDetail `json:"sec-med-diag,omitempty"`
|
||||
EarlyDiagnosisFunc DiagnosisDetail `json:"early-func-diag,omitempty"`
|
||||
LateDiagnosisFunc DiagnosisDetail `json:"late-func-diag,omitempty"`
|
||||
SecondaryDiagnosisFunc DiagnosisDetail `json:"sec-func-diag,omitempty"`
|
||||
}
|
||||
|
||||
// nested object {note, codes}
|
||||
|
||||
@@ -8,7 +8,6 @@ type (
|
||||
PersonConditionCode string
|
||||
EmergencyClassCode string
|
||||
OutpatientClassCode string
|
||||
CheckupScopeCode string
|
||||
AmbulatoryClassCode string
|
||||
InpatientClassCode string
|
||||
UploadCode string
|
||||
@@ -33,18 +32,19 @@ const (
|
||||
QSCCancel QueueStatusCode = "cancel" // Dibatalkan
|
||||
QSCSkip QueueStatusCode = "skip" // Dilewati
|
||||
|
||||
DMCHome DischargeMethodCode = "home" // Pulang
|
||||
DMCHomeReq DischargeMethodCode = "home-request" // Pulang Atas Permintaan Sendiri
|
||||
DMCConsulBack DischargeMethodCode = "consul-back" // Konsultasi Balik / Lanjutan
|
||||
//DMCConsulPoly DischargeMethodCode = "consul-poly" // Konsultasi Poliklinik Lain
|
||||
//DMCConsulExecutive DischargeMethodCode = "consul-executive" // Konsultasi Antar Dokter Eksekutif
|
||||
DMCConsulChDay DischargeMethodCode = "consul-ch-day" // Konsultasi Hari Lain
|
||||
DMCEmergency DischargeMethodCode = "emergency" // Rujuk IGD
|
||||
DMCEmergencyCovid DischargeMethodCode = "emergency-covid" // Rujuk IGD Covid
|
||||
DMCInpatient DischargeMethodCode = "inpatient" // Rujuk Rawat Inap
|
||||
DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain
|
||||
DMCDeath DischargeMethodCode = "death" // Meninggal
|
||||
DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba
|
||||
DMCHome DischargeMethodCode = "home" // Pulang
|
||||
DMCHomeReq DischargeMethodCode = "home-request" // Pulang Atas Permintaan Sendiri
|
||||
DMCConsulBack DischargeMethodCode = "consul-back" // Konsultasi Balik / Lanjutan
|
||||
DMCConsulPoly DischargeMethodCode = "consul-poly" // Konsultasi Poliklinik Lain
|
||||
DMCConsulExecutive DischargeMethodCode = "consul-executive" // Konsultasi Antar Dokter Eksekutif
|
||||
DMCConsulChDay DischargeMethodCode = "consul-ch-day" // Konsultasi Hari Lain
|
||||
DMCEmergency DischargeMethodCode = "emergency" // Rujuk IGD
|
||||
DMCEmergencyCovid DischargeMethodCode = "emergency-covid" // Rujuk IGD Covid
|
||||
DMCInpatient DischargeMethodCode = "inpatient" // Rujuk Rawat Inap
|
||||
DMCExtRef DischargeMethodCode = "external" // Rujuk Faskes Lain
|
||||
DMCDeath DischargeMethodCode = "death" // Meninggal
|
||||
DMCDeathOnArrival DischargeMethodCode = "death-on-arrival" // Meninggal Saat Tiba
|
||||
DMCRunAway DischargeMethodCode = "run-away" // Melarikan Diri
|
||||
|
||||
TCAmbulance TransportationCode = "ambulance" // Ambulans
|
||||
TCCar TransportationCode = "car" // Mobil
|
||||
@@ -66,11 +66,6 @@ const (
|
||||
OCCHcu OutpatientClassCode = "hcu" // HCU
|
||||
OCCVk OutpatientClassCode = "vk" // Verlos kamer
|
||||
|
||||
CSCLab CheckupScopeCode = "lab" // Laboratorium
|
||||
CSCMLab CheckupScopeCode = "mic-lab" // Microbacterial Laboratorium
|
||||
CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium
|
||||
CSCRad CheckupScopeCode = "radiology" // Radiology
|
||||
|
||||
ACCReg AmbulatoryClassCode = "reg" // Regular
|
||||
// ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
|
||||
// ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,19 +55,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import (
|
||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||
|
||||
/******************** actor ********************/
|
||||
|
||||
doctor "simrs-vx/internal/interface/main-handler/doctor"
|
||||
employee "simrs-vx/internal/interface/main-handler/employee"
|
||||
nurse "simrs-vx/internal/interface/main-handler/nurse"
|
||||
@@ -270,8 +271,8 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/person-contact", personcontact.O)
|
||||
hc.RegCrud(r, "/v1/person-insurance", personinsurance.O)
|
||||
hc.RegCrud(r, "/v1/employee", employee.O)
|
||||
hc.RegCrud(r, "/v1/doctor", doctor.O)
|
||||
hc.RegCrud(r, "/v1/nurse", nurse.O)
|
||||
hc.RegCrudByCode(r, "/v1/doctor", doctor.O)
|
||||
hc.RegCrudByCode(r, "/v1/nurse", nurse.O)
|
||||
hc.RegCrud(r, "/v1/nutritionist", nutritionist.O)
|
||||
hc.RegCrud(r, "/v1/pharmacist", pharmacist.O)
|
||||
hk.GroupRoutes("/v1/user", r, hk.MapHandlerFunc{
|
||||
@@ -295,40 +296,40 @@ func SetRoutes() http.Handler {
|
||||
})
|
||||
|
||||
/******************** sources ********************/
|
||||
hc.RegCrud(r, "/v1/division", division.O)
|
||||
hc.RegCrud(r, "/v1/division-position", divisionposition.O)
|
||||
hc.RegCrud(r, "/v1/installation", installation.O)
|
||||
hc.RegCrud(r, "/v1/unit", unit.O)
|
||||
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)
|
||||
hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
|
||||
hc.RegCrudByCode(r, "/v1/infra", infra.O)
|
||||
hc.RegCrud(r, "/v1/pharmacy-company", pharmacycompany.O)
|
||||
hc.RegCrud(r, "/v1/diagnose-src", diagnosesrc.O)
|
||||
hc.RegCrud(r, "/v1/procedure-src", proceduresrc.O)
|
||||
hc.RegCrud(r, "/v1/uom", uom.O)
|
||||
hc.RegCrud(r, "/v1/item", item.O)
|
||||
hc.RegCrudByCode(r, "/v1/item", item.O)
|
||||
hc.RegCrud(r, "/v1/item-price", itemprice.O)
|
||||
hc.RegCrud(r, "/v1/infra", infra.O)
|
||||
hc.RegCrud(r, "/v1/medicine-group", medicinegroup.O)
|
||||
hc.RegCrud(r, "/v1/medicine-method", medicinemethod.O)
|
||||
hc.RegCrud(r, "/v1/mcu-src-category", mcusrccategory.O)
|
||||
hc.RegCrud(r, "/v1/mcu-src", mcusrc.O)
|
||||
hc.RegCrud(r, "/v1/ethnic", ethnic.O)
|
||||
hc.RegCrud(r, "/v1/insurance-company", insurancecompany.O)
|
||||
hc.RegCrud(r, "/v1/medicine", medicine.O)
|
||||
hc.RegCrud(r, "/v1/device", device.O)
|
||||
hc.RegCrud(r, "/v1/material", material.O)
|
||||
hc.RegCrudByCode(r, "/v1/medicine", medicine.O)
|
||||
hc.RegCrudByCode(r, "/v1/device", device.O)
|
||||
hc.RegCrudByCode(r, "/v1/material", material.O)
|
||||
hc.RegCrud(r, "/v1/doctor-fee", doctorfee.O)
|
||||
hc.RegCrud(r, "/v1/medical-action-src", medicalactionsrc.O)
|
||||
hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O)
|
||||
hc.RegCrud(r, "/v1/language", language.O)
|
||||
hc.RegCrud(r, "/v1/specialist", specialist.O)
|
||||
hc.RegCrud(r, "/v1/subspecialist", subspecialist.O)
|
||||
hc.RegCrud(r, "/v1/mcu-sub-src", mcusubsrc.O)
|
||||
hc.RegCrud(r, "/v1/vehicle", vehicle.O)
|
||||
hc.RegCrud(r, "/v1/vehicle-hist", vehiclehist.O)
|
||||
hc.RegCrud(r, "/v1/edu-assessment", eduassesment.O)
|
||||
hc.RegCrud(r, "/v1/installation-position", installationposition.O)
|
||||
hc.RegCrud(r, "/v1/unit-position", unitposition.O)
|
||||
hc.RegCrud(r, "/v1/specialist-position", specialistposition.O)
|
||||
hc.RegCrud(r, "/v1/subspecialist-position", subspecialistposition.O)
|
||||
|
||||
hc.RegCrud(r, "/v1/village", village.O)
|
||||
hc.RegCrud(r, "/v1/district", district.O)
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
id := rw.ValidateInt(w, "code", r.PathValue("code"))
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,19 +55,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,19 +55,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,21 +33,21 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,19 +55,19 @@ 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.Code = code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ import (
|
||||
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"
|
||||
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"
|
||||
chemoprotocol "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||
consultation "simrs-vx/internal/domain/main-entities/consultation"
|
||||
@@ -90,6 +93,7 @@ import (
|
||||
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"
|
||||
vehicle "simrs-vx/internal/domain/main-entities/vehicle"
|
||||
vehiclehist "simrs-vx/internal/domain/main-entities/vehicle-hist"
|
||||
village "simrs-vx/internal/domain/main-entities/village"
|
||||
@@ -103,7 +107,9 @@ import (
|
||||
|
||||
func getMainEntities() []any {
|
||||
return []any{
|
||||
&authpartner.AuthPartner{},
|
||||
&user.User{},
|
||||
&userfes.UserFes{},
|
||||
&division.Division{},
|
||||
&divisionposition.DivisionPosition{},
|
||||
&installation.Installation{},
|
||||
@@ -175,6 +181,8 @@ func getMainEntities() []any {
|
||||
&mcuorderitem.McuOrderItem{},
|
||||
&mcusubsrc.McuSubSrc{},
|
||||
&mcuordersubitem.McuOrderSubItem{},
|
||||
&antibioticsrccategory.AntibioticSrcCategory{},
|
||||
&antibioticinuse.AntibioticInUse{},
|
||||
&consultation.Consultation{},
|
||||
&chemo.Chemo{},
|
||||
&midwife.Midwife{},
|
||||
|
||||
@@ -14,12 +14,12 @@ type AuthInfo struct {
|
||||
User_ContractPosition_code string
|
||||
Employee_Position_Code *string
|
||||
Employee_Id *uint
|
||||
Doctor_Id *uint
|
||||
Nurse_Id *uint
|
||||
Midwife_Id *uint
|
||||
Nutritionist_Id *uint
|
||||
Laborant_Id *uint
|
||||
Pharmachist_Id *uint
|
||||
Doctor_Code *string
|
||||
Nurse_Code *string
|
||||
Midwife_Code *string
|
||||
Nutritionist_Code *string
|
||||
Laborant_Code *string
|
||||
Pharmachist_Code *string
|
||||
Intern_Position_Code *string
|
||||
Roles []string
|
||||
// User_DivisionPositions []DivisionPosition
|
||||
|
||||
@@ -9,28 +9,28 @@ import (
|
||||
|
||||
"github.com/golang-jwt/jwt"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"simrs-vx/internal/domain/main-entities/intern"
|
||||
eu "simrs-vx/internal/domain/main-entities/user"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
el "simrs-vx/pkg/logger"
|
||||
p "simrs-vx/pkg/password"
|
||||
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
em "simrs-vx/internal/domain/main-entities/midwife"
|
||||
en "simrs-vx/internal/domain/main-entities/nurse"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
erg "simrs-vx/internal/domain/references/organization"
|
||||
|
||||
a "github.com/karincake/apem"
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
ms "github.com/karincake/apem/ms-redis"
|
||||
d "github.com/karincake/dodol"
|
||||
l "github.com/karincake/lepet"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
pl "simrs-vx/pkg/logger"
|
||||
p "simrs-vx/pkg/password"
|
||||
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
"simrs-vx/internal/domain/main-entities/intern"
|
||||
em "simrs-vx/internal/domain/main-entities/midwife"
|
||||
en "simrs-vx/internal/domain/main-entities/nurse"
|
||||
eu "simrs-vx/internal/domain/main-entities/user"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
erg "simrs-vx/internal/domain/references/organization"
|
||||
)
|
||||
|
||||
const source = "authentication"
|
||||
|
||||
var authCfg AuthCfg
|
||||
|
||||
func init() {
|
||||
@@ -40,13 +40,18 @@ func init() {
|
||||
// Generates token and store in redis at one place
|
||||
// just return the error code
|
||||
func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
event := pl.Event{
|
||||
Feature: "Create",
|
||||
Source: source,
|
||||
}
|
||||
|
||||
// Get User
|
||||
user := &eu.User{Name: input.Name}
|
||||
// if input.Position_Code != "" {
|
||||
// user.Position_Code = input.Position_Code
|
||||
// }
|
||||
if errCode := getAndCheck(user, user); errCode != "" {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: errCode, Message: el.GenMessage(errCode)}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: errCode, Message: pl.GenMessage(errCode)}}
|
||||
}
|
||||
|
||||
if user.LoginAttemptCount > 5 {
|
||||
@@ -54,7 +59,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
now := time.Now()
|
||||
lastAllowdLogin := user.LastAllowdLogin
|
||||
if lastAllowdLogin.After(now.Add(-time.Hour * 1)) {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-tooMany", Message: el.GenMessage("auth-login-tooMany")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-tooMany", Message: pl.GenMessage("auth-login-tooMany")}}
|
||||
} else {
|
||||
tn := time.Now()
|
||||
user.LastAllowdLogin = &tn
|
||||
@@ -65,18 +70,18 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
tn := time.Now()
|
||||
user.LastAllowdLogin = &tn
|
||||
dg.I.Save(&user)
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-tooMany", Message: el.GenMessage("auth-login-tooMany")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-tooMany", Message: pl.GenMessage("auth-login-tooMany")}}
|
||||
}
|
||||
}
|
||||
|
||||
if !p.Check(input.Password, user.Password) {
|
||||
user.LoginAttemptCount++
|
||||
dg.I.Save(&user)
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-incorrect", Message: el.GenMessage("auth-login-incorrect")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-incorrect", Message: pl.GenMessage("auth-login-incorrect")}}
|
||||
} else if user.Status_Code == erc.USCBlocked {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-blocked", Message: el.GenMessage("auth-login-blocked")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-blocked", Message: pl.GenMessage("auth-login-blocked")}}
|
||||
} else if user.Status_Code == erc.USCNew {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-unverified", Message: el.GenMessage("auth-login-unverified")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-unverified", Message: pl.GenMessage("auth-login-unverified")}}
|
||||
}
|
||||
|
||||
// Access token prep
|
||||
@@ -115,7 +120,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
employee := ee.Employee{}
|
||||
dg.I.Where("\"User_Id\" = ?", user.Id).First(&employee)
|
||||
if employee.Id == 0 {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noEmployee", Message: el.GenMessage("auth-noEmployee")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noEmployee", Message: pl.GenMessage("auth-noEmployee")}}
|
||||
}
|
||||
atClaims["employee_id"] = employee.Id
|
||||
outputData["employee_id"] = employee.Id
|
||||
@@ -134,66 +139,66 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
doctor := ed.Doctor{}
|
||||
dg.I.Where("\"Employee_Id\" = ?", employee.Id).First(&doctor)
|
||||
if doctor.Id == 0 {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noDoctor", Message: el.GenMessage("auth-noDoctor")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noDoctor", Message: pl.GenMessage("auth-noDoctor")}}
|
||||
}
|
||||
atClaims["doctor_id"] = doctor.Id
|
||||
outputData["doctor_id"] = doctor.Id
|
||||
atClaims["doctor_code"] = doctor.Code
|
||||
outputData["doctor_code"] = doctor.Code
|
||||
|
||||
// specialist
|
||||
if doctor.Specialist_Id != nil {
|
||||
atClaims["specialist_id"] = doctor.Specialist_Id
|
||||
outputData["specialist_id"] = doctor.Specialist_Id
|
||||
if doctor.Specialist_Code != nil {
|
||||
atClaims["specialist_code"] = doctor.Specialist_Code
|
||||
outputData["specialist_code"] = doctor.Specialist_Code
|
||||
}
|
||||
if doctor.Subspecialist_Id != nil {
|
||||
atClaims["subspecialist_id"] = doctor.Subspecialist_Id
|
||||
outputData["subspecialist_id"] = doctor.Subspecialist_Id
|
||||
if doctor.Subspecialist_Code != nil {
|
||||
atClaims["subspecialist_code"] = doctor.Subspecialist_Code
|
||||
outputData["subspecialist_code"] = doctor.Subspecialist_Code
|
||||
}
|
||||
case erg.EPCNur:
|
||||
empData := en.Nurse{}
|
||||
dg.I.Where("\"Employee_Id\" = ?", employee.Id).First(&empData)
|
||||
if empData.Id == 0 {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noNurse", Message: el.GenMessage("auth-noNurse")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noNurse", Message: pl.GenMessage("auth-noNurse")}}
|
||||
}
|
||||
atClaims["nurse_id"] = empData.Id
|
||||
outputData["nurse_id"] = empData.Id
|
||||
atClaims["nurse_code"] = empData.Code
|
||||
outputData["nurse_code"] = empData.Code
|
||||
case erg.EPCMwi:
|
||||
empData := em.Midwife{}
|
||||
dg.I.Where("\"Employee_Id\" = ?", employee.Id).First(&empData)
|
||||
if empData.Id == 0 {
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noNurse", Message: el.GenMessage("auth-noNurse")}}
|
||||
return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-noMidwife", Message: pl.GenMessage("auth-noMidwife")}}
|
||||
}
|
||||
atClaims["nurse_id"] = empData.Id
|
||||
outputData["nurse_id"] = empData.Id
|
||||
atClaims["midwife_code"] = empData.Code
|
||||
outputData["midwife_code"] = empData.Code
|
||||
}
|
||||
|
||||
errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}}
|
||||
errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: pl.GenMessage("auth-getData-failed")}}
|
||||
|
||||
// division position
|
||||
divisionPositions, err := getDivisionPosition(employee.Id)
|
||||
divisionPositions, err := getDivisionPosition(employee.Id, &event)
|
||||
if err != nil {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
|
||||
// installation position
|
||||
installationPositions, err := getInstallationPosition(employee.Id)
|
||||
installationPositions, err := getInstallationPosition(employee.Id, &event)
|
||||
if err != nil {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
|
||||
// unit position
|
||||
unitPositions, err := getUnitPosition(employee.Id)
|
||||
unitPositions, err := getUnitPosition(employee.Id, &event)
|
||||
if err != nil {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
|
||||
// specialist position
|
||||
specialistPositions, err := getSpecialistPosition(employee.Id)
|
||||
specialistPositions, err := getSpecialistPosition(employee.Id, &event)
|
||||
if err != nil {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
|
||||
// subspecialist position
|
||||
subspecialistPositions, err := getSubspecialistPosition(employee.Id)
|
||||
subspecialistPositions, err := getSubspecialistPosition(employee.Id, &event)
|
||||
if err != nil {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
@@ -220,7 +225,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
at := jwt.NewWithClaims(jwt.SigningMethodHS256, atClaims)
|
||||
ats, err := at.SignedString([]byte(atSecretKey))
|
||||
if err != nil {
|
||||
return nil, d.FieldErrors{"user": d.FieldError{Code: "token-sign-err", Message: el.GenMessage("token-sign-err")}}
|
||||
return nil, d.FieldErrors{"user": d.FieldError{Code: "token-sign-err", Message: pl.GenMessage("token-sign-err")}}
|
||||
}
|
||||
outputData["accessToken"] = ats
|
||||
|
||||
@@ -283,21 +288,21 @@ func VerifyToken(r *http.Request, tokenType TokenType) (data *jwt.Token, errCode
|
||||
func ExtractToken(r *http.Request, tokenType TokenType) (data *pa.AuthInfo, err error) {
|
||||
token, errCode, errDetail := VerifyToken(r, tokenType)
|
||||
if errCode != "" {
|
||||
return nil, d.FieldError{Code: errCode, Message: el.GenMessage(errCode, errDetail)}
|
||||
return nil, d.FieldError{Code: errCode, Message: pl.GenMessage(errCode, errDetail)}
|
||||
}
|
||||
claims, ok := token.Claims.(jwt.MapClaims)
|
||||
if ok && token.Valid {
|
||||
accessUuid, ok := claims["uuid"].(string)
|
||||
if !ok {
|
||||
return nil, d.FieldError{Code: "token-invalid", Message: el.GenMessage("token-invalid", "uuid not available")}
|
||||
return nil, d.FieldError{Code: "token-invalid", Message: pl.GenMessage("token-invalid", "uuid not available")}
|
||||
}
|
||||
user_id, myErr := strconv.ParseInt(fmt.Sprintf("%.f", claims["user_id"]), 10, 64)
|
||||
if myErr != nil {
|
||||
return nil, d.FieldError{Code: "token-invalid", Message: el.GenMessage("token-invalid", "uuid is not available")}
|
||||
return nil, d.FieldError{Code: "token-invalid", Message: pl.GenMessage("token-invalid", "uuid is not available")}
|
||||
}
|
||||
accessUuidRedis := ms.I.Get(accessUuid)
|
||||
if accessUuidRedis.String() == "" {
|
||||
return nil, d.FieldError{Code: "token-unidentified", Message: el.GenMessage("token-unidentified")}
|
||||
return nil, d.FieldError{Code: "token-unidentified", Message: pl.GenMessage("token-unidentified")}
|
||||
}
|
||||
|
||||
data = &pa.AuthInfo{
|
||||
@@ -308,12 +313,12 @@ func ExtractToken(r *http.Request, tokenType TokenType) (data *pa.AuthInfo, err
|
||||
|
||||
data.User_ContractPosition_code = checkStrClaims(claims, "contractPosition_code")
|
||||
data.Employee_Position_Code = checkStrPtrClaims(claims, "employee_position_code")
|
||||
data.Doctor_Id = checkUntPtrClaims(claims, "doctor_id")
|
||||
data.Nurse_Id = checkUntPtrClaims(claims, "nurse_id")
|
||||
data.Midwife_Id = checkUntPtrClaims(claims, "midwife_id")
|
||||
data.Nutritionist_Id = checkUntPtrClaims(claims, "nutritionist_id")
|
||||
data.Laborant_Id = checkUntPtrClaims(claims, "laborant_id")
|
||||
data.Pharmachist_Id = checkUntPtrClaims(claims, "pharmachist_id")
|
||||
data.Doctor_Code = checkStrPtrClaims(claims, "doctor_string")
|
||||
data.Nurse_Code = checkStrPtrClaims(claims, "nurse_string")
|
||||
data.Midwife_Code = checkStrPtrClaims(claims, "midwife_string")
|
||||
data.Nutritionist_Code = checkStrPtrClaims(claims, "nutritionist_string")
|
||||
data.Laborant_Code = checkStrPtrClaims(claims, "laborant_string")
|
||||
data.Pharmachist_Code = checkStrPtrClaims(claims, "pharmachist_string")
|
||||
data.Intern_Position_Code = checkStrPtrClaims(claims, "intern_position_code")
|
||||
data.Employee_Id = checkUntPtrClaims(claims, "employee_id")
|
||||
return
|
||||
@@ -324,41 +329,3 @@ func ExtractToken(r *http.Request, tokenType TokenType) (data *pa.AuthInfo, err
|
||||
func GetConfig() {
|
||||
a.ParseCfg(&authCfg)
|
||||
}
|
||||
|
||||
func checkStrClaims(claim map[string]interface{}, key string) string {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
return v.(string)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func checkStrPtrClaims(claim map[string]interface{}, key string) *string {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
val := v.(string)
|
||||
return &val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkIntClaims(claim map[string]interface{}, key string) int {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
return v.(int)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func checkIntPtrClaims(claim map[string]interface{}, key string) *int {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
val := int(v.(float64))
|
||||
return &val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkUntPtrClaims(claim map[string]interface{}, key string) *uint {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
val := uint(v.(float64))
|
||||
return &val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package authentication
|
||||
|
||||
import (
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
|
||||
pl "simrs-vx/pkg/logger"
|
||||
|
||||
edp "simrs-vx/internal/domain/main-entities/division-position"
|
||||
eip "simrs-vx/internal/domain/main-entities/installation-position"
|
||||
esp "simrs-vx/internal/domain/main-entities/specialist-position"
|
||||
@@ -12,8 +16,6 @@ import (
|
||||
usp "simrs-vx/internal/use-case/main-use-case/specialist-position"
|
||||
ussp "simrs-vx/internal/use-case/main-use-case/subspecialist-position"
|
||||
uup "simrs-vx/internal/use-case/main-use-case/unit-position"
|
||||
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
)
|
||||
|
||||
// just return the error code
|
||||
@@ -28,43 +30,21 @@ func getAndCheck(input, condition any) (eCode string) {
|
||||
return ""
|
||||
}
|
||||
|
||||
func getDivisionPosition(employee_id uint) ([]string, error) {
|
||||
func getDivisionPosition(employee_id uint, event *pl.Event) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
// var employee ee.Employee
|
||||
// if err := dg.I.Where("\"Employee_Id\" = ?", employee_id).First(&employee).Error; err != nil {
|
||||
// if err == gorm.ErrRecordNotFound {
|
||||
// return result, nil
|
||||
// }
|
||||
// return result, errors.New("no employee found")
|
||||
// }
|
||||
|
||||
//var divisionPositions []edp.DivisionPosition
|
||||
//err := dg.I.
|
||||
// Preload("Division").
|
||||
// Where("\"Employee_Id\" = ?", employee_id).
|
||||
// Find(&divisionPositions).Error
|
||||
//if err != nil {
|
||||
// if err == gorm.ErrRecordNotFound {
|
||||
// return result, nil
|
||||
// }
|
||||
// return result, err
|
||||
//}
|
||||
|
||||
// get data division_position based on employee_id
|
||||
dataDivisionPosition, err := udp.ReadList(edp.ReadListDto{
|
||||
data, _, err := udp.ReadListData(edp.ReadListDto{
|
||||
FilterDto: edp.FilterDto{Employee_Id: &employee_id},
|
||||
Includes: "division"})
|
||||
Includes: "Division"}, event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if list, ok := dataDivisionPosition.Data.([]edp.ResponseDto); ok {
|
||||
if len(list) > 0 {
|
||||
for _, dp := range list {
|
||||
if dp.Division != nil {
|
||||
result = append(result, "div-"+dp.Division.Code+"-"+dp.Code)
|
||||
}
|
||||
if len(data) > 0 {
|
||||
for _, dp := range data {
|
||||
if dp.Division != nil {
|
||||
result = append(result, "div-"+dp.Division.Code+"-"+dp.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,23 +52,21 @@ func getDivisionPosition(employee_id uint) ([]string, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func getInstallationPosition(employeeId uint) ([]string, error) {
|
||||
func getInstallationPosition(employeeId uint, event *pl.Event) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
// get data unit_position based on employee_id
|
||||
dataInstallationPosition, err := uip.ReadList(eip.ReadListDto{
|
||||
data, _, err := uip.ReadListData(eip.ReadListDto{
|
||||
FilterDto: eip.FilterDto{Employee_Id: &employeeId},
|
||||
Includes: "installation"})
|
||||
Includes: "installation"}, event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if list, ok := dataInstallationPosition.Data.([]eip.ResponseDto); ok {
|
||||
if len(list) > 0 {
|
||||
for _, dp := range list {
|
||||
if dp.Installation != nil {
|
||||
result = append(result, "inst-"+dp.Installation.Code+"-"+dp.Code)
|
||||
}
|
||||
if len(data) > 0 {
|
||||
for _, dp := range data {
|
||||
if dp.Installation != nil {
|
||||
result = append(result, "inst-"+dp.Installation.Code+"-"+dp.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,23 +74,21 @@ func getInstallationPosition(employeeId uint) ([]string, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func getUnitPosition(employeeId uint) ([]string, error) {
|
||||
func getUnitPosition(employeeId uint, event *pl.Event) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
// get data unit_position based on employee_id
|
||||
dataUnitPosition, err := uup.ReadList(eup.ReadListDto{
|
||||
data, _, err := uup.ReadListData(eup.ReadListDto{
|
||||
FilterDto: eup.FilterDto{Employee_Id: &employeeId},
|
||||
Includes: "unit"})
|
||||
Includes: "unit"}, event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if list, ok := dataUnitPosition.Data.([]eup.ResponseDto); ok {
|
||||
if len(list) > 0 {
|
||||
for _, dp := range list {
|
||||
if dp.Unit != nil {
|
||||
result = append(result, "unit-"+dp.Unit.Code+"-"+dp.Code)
|
||||
}
|
||||
if len(data) > 0 {
|
||||
for _, dp := range data {
|
||||
if dp.Unit != nil {
|
||||
result = append(result, "unit-"+dp.Unit.Code+"-"+dp.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,23 +96,21 @@ func getUnitPosition(employeeId uint) ([]string, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func getSpecialistPosition(employeeId uint) ([]string, error) {
|
||||
func getSpecialistPosition(employeeId uint, event *pl.Event) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
// get data unit_position based on employee_id
|
||||
dataSpecialistPosition, err := usp.ReadList(esp.ReadListDto{
|
||||
data, _, err := usp.ReadListData(esp.ReadListDto{
|
||||
FilterDto: esp.FilterDto{Employee_Id: &employeeId},
|
||||
Includes: "specialist"})
|
||||
Includes: "specialist"}, event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if list, ok := dataSpecialistPosition.Data.([]esp.ResponseDto); ok {
|
||||
if len(list) > 0 {
|
||||
for _, dp := range list {
|
||||
if dp.Specialist != nil {
|
||||
result = append(result, "spec-"+dp.Specialist.Code+"-"+dp.Code)
|
||||
}
|
||||
if len(data) > 0 {
|
||||
for _, dp := range data {
|
||||
if dp.Specialist != nil {
|
||||
result = append(result, "spec-"+dp.Specialist.Code+"-"+dp.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,26 +118,47 @@ func getSpecialistPosition(employeeId uint) ([]string, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func getSubspecialistPosition(employeeId uint) ([]string, error) {
|
||||
func getSubspecialistPosition(employeeId uint, event *pl.Event) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
// get data unit_position based on employee_id
|
||||
dataSubspecialistPosition, err := ussp.ReadList(essp.ReadListDto{
|
||||
data, _, err := ussp.ReadListData(essp.ReadListDto{
|
||||
FilterDto: essp.FilterDto{Employee_Id: &employeeId},
|
||||
Includes: "subspecialist"})
|
||||
Includes: "subspecialist"}, event)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if list, ok := dataSubspecialistPosition.Data.([]essp.ResponseDto); ok {
|
||||
if len(list) > 0 {
|
||||
for _, dp := range list {
|
||||
if dp.Subspecialist != nil {
|
||||
result = append(result, "subspec-"+dp.Subspecialist.Code+"-"+dp.Code)
|
||||
}
|
||||
if len(data) > 0 {
|
||||
for _, dp := range data {
|
||||
if dp.Subspecialist != nil {
|
||||
result = append(result, "subspec-"+dp.Subspecialist.Code+"-"+dp.Code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func checkStrClaims(claim map[string]interface{}, key string) string {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
return v.(string)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func checkStrPtrClaims(claim map[string]interface{}, key string) *string {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
val := v.(string)
|
||||
return &val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkUntPtrClaims(claim map[string]interface{}, key string) *uint {
|
||||
if v, exist := claim[key]; exist && v != nil {
|
||||
val := uint(v.(float64))
|
||||
return &val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: uint16(input.Id)}
|
||||
rdDto := e.ReadDetailDto{Code: &input.Code}
|
||||
var data *e.Device
|
||||
var err error
|
||||
|
||||
@@ -225,7 +225,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: uint16(input.Id)}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.Device
|
||||
var err error
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Device) {
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.Uom_Code = inputSrc.Uom_Code
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
data.Infra_Id = inputSrc.Infra_Id
|
||||
data.Item_Code = inputSrc.Item_Code
|
||||
data.Infra_Code = inputSrc.Infra_Code
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
@@ -40,13 +40,13 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
Name: input.Name,
|
||||
ItemGroup_Code: ero.ITGCDevice,
|
||||
Uom_Code: &input.Uom_Code,
|
||||
Infra_Id: input.Infra_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
input.Item_Code = &item.Code
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -81,6 +81,13 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", *input.Id)
|
||||
}
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
|
||||
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: &input.Code}
|
||||
var data *e.DivisionPosition
|
||||
var err error
|
||||
|
||||
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.DivisionPosition
|
||||
var err error
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.DivisionPosition) {
|
||||
inputSrc = &inputTemp.CreateDto
|
||||
}
|
||||
|
||||
data.Division_Id = inputSrc.Division_Id
|
||||
data.Division_Code = inputSrc.Division_Code
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.HeadStatus = inputSrc.HeadStatus
|
||||
|
||||
@@ -81,7 +81,14 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", input.Id)
|
||||
}
|
||||
|
||||
if err := tx.First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: &input.Code}
|
||||
var data *e.Division
|
||||
var err error
|
||||
|
||||
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.Division
|
||||
var err error
|
||||
|
||||
|
||||
@@ -19,5 +19,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Division) {
|
||||
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.Parent_Id = inputSrc.Parent_Id
|
||||
data.Parent_Code = inputSrc.Parent_Code
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Di
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM "Division" c
|
||||
WHERE c."Parent_Id" = "Division"."Id"
|
||||
WHERE c."Parent_Code" = "Division"."Code"
|
||||
)
|
||||
`)
|
||||
}
|
||||
@@ -91,9 +91,16 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", input.Id)
|
||||
}
|
||||
|
||||
if err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
First(&data, input.Id).Error; err != nil {
|
||||
First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Doctor) {
|
||||
data.Employee_Id = inputSrc.Employee_Id
|
||||
data.IHS_Number = inputSrc.IHS_Number
|
||||
data.SIP_Number = inputSrc.SIP_Number
|
||||
data.Unit_Id = inputSrc.Unit_Id
|
||||
data.Specialist_Id = inputSrc.Specialist_Id
|
||||
data.Subspecialist_Id = inputSrc.Subspecialist_Id
|
||||
data.Unit_Code = inputSrc.Unit_Code
|
||||
data.Specialist_Code = inputSrc.Code
|
||||
data.Subspecialist_Code = inputSrc.Code
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
gh "github.com/karincake/getuk"
|
||||
"gorm.io/gorm"
|
||||
|
||||
// pkg
|
||||
plh "simrs-vx/pkg/lib-helper"
|
||||
pl "simrs-vx/pkg/logger"
|
||||
@@ -61,8 +62,8 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
||||
}
|
||||
tx = tx.Model(&e.Encounter{})
|
||||
|
||||
if input.AuthInfo.Doctor_Id != nil {
|
||||
tx.Where("\"Responsible_Doctor_Id\" = ?", *input.AuthInfo.Doctor_Id)
|
||||
if input.AuthInfo.Doctor_Code != nil {
|
||||
tx.Where("\"Responsible_Doctor_Id\" = ?", *input.AuthInfo.Doctor_Code) // TODO: fix this
|
||||
}
|
||||
|
||||
tx.Scopes(gh.Preload(input.Includes)).
|
||||
|
||||
@@ -38,12 +38,12 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
if input.InfraGroup_Code == ero.IFGCRoom {
|
||||
if input.Parent_Id == nil {
|
||||
if input.Parent_Code == nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "data-create-fail",
|
||||
Detail: "parent_id is required",
|
||||
Raw: errors.New("parent_id is required"),
|
||||
Detail: "parent_code is required",
|
||||
Raw: errors.New("parent_code is required"),
|
||||
}
|
||||
return pl.SetLogError(&event, input)
|
||||
|
||||
@@ -59,7 +59,7 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
if input.InfraGroup_Code == ero.IFGCRoom {
|
||||
input.Infra_Id = &data.Id
|
||||
input.Infra_Code = &data.Code
|
||||
if err := createRoom(&input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Infra) {
|
||||
data.Code = inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
data.InfraGroup_Code = inputSrc.InfraGroup_Code
|
||||
data.Parent_Id = inputSrc.Parent_Id
|
||||
data.Item_Id = inputSrc.Item_Id
|
||||
data.Parent_Code = inputSrc.Parent_Code
|
||||
data.Item_Code = inputSrc.Item_Code
|
||||
}
|
||||
|
||||
func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
@@ -42,23 +42,23 @@ func createItem(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
tmp := "unit"
|
||||
return &tmp
|
||||
}(),
|
||||
Infra_Id: input.Parent_Id,
|
||||
Infra_Code: input.Parent_Code,
|
||||
}
|
||||
item, err := ui.CreateData(itemCreate, event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
input.Item_Id = &item.Id
|
||||
input.Item_Code = &item.Code
|
||||
return nil
|
||||
}
|
||||
|
||||
func createRoom(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
|
||||
roomCreate := er.CreateDto{
|
||||
Infra_Id: input.Infra_Id,
|
||||
Unit_Id: input.Unit_Id,
|
||||
Specialist_Id: input.Specialist_Id,
|
||||
Subspecialist_Id: input.Subspecialist_Id,
|
||||
Infra_Code: input.Infra_Code,
|
||||
Unit_Code: input.Unit_Code,
|
||||
Specialist_Code: input.Specialist_Code,
|
||||
Subspecialist_Code: input.Subspecialist_Code,
|
||||
}
|
||||
_, err := ur.CreateData(roomCreate, event, tx)
|
||||
if err != nil {
|
||||
|
||||
@@ -52,7 +52,7 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.In
|
||||
EXISTS (
|
||||
SELECT 1
|
||||
FROM "Infra" c
|
||||
WHERE c."Parent_Id" = "Infra"."Id"
|
||||
WHERE c."Parent_Code" = "Infra"."Code"
|
||||
)
|
||||
`)
|
||||
}
|
||||
@@ -91,6 +91,13 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", *input.Id)
|
||||
}
|
||||
|
||||
tx = tx.Preload("Parent").
|
||||
Preload("Childrens").
|
||||
Preload("Item").
|
||||
@@ -99,7 +106,7 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
Preload("Rooms.Subspecialist").
|
||||
Preload("Rooms.Unit")
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if err := tx.First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
@@ -119,7 +126,7 @@ func UpdateData(input e.UpdateDto, data *e.Infra, event *pl.Event, dbx ...*gorm.
|
||||
} else {
|
||||
tx = dg.I
|
||||
}
|
||||
data.Parent = nil
|
||||
// data.Parent = nil
|
||||
data.Childrens = nil
|
||||
data.Item = nil
|
||||
data.Rooms = nil
|
||||
|
||||
@@ -175,7 +175,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: &input.Code}
|
||||
var data *e.InstallationPosition
|
||||
var err error
|
||||
|
||||
@@ -235,7 +235,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.InstallationPosition
|
||||
var err error
|
||||
|
||||
@@ -290,7 +290,7 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
|
||||
func validateForeignKey(input e.CreateDto) error {
|
||||
// validate installation_id
|
||||
if _, err := ui.ReadDetail(ei.ReadDetailDto{Id: *input.Installation_Id}); err != nil {
|
||||
if _, err := ui.ReadDetail(ei.ReadDetailDto{Code: input.Installation_Code}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user