fix conflict
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
package adime
|
||||
|
||||
import (
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eem "simrs-vx/internal/domain/main-entities/employee"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package chemo
|
||||
|
||||
import (
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - references
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
// internal - domain - main-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
eun "simrs-vx/internal/domain/main-entities/unit"
|
||||
eus "simrs-vx/internal/domain/main-entities/user"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package consultation
|
||||
|
||||
import (
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - main-entities
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package deviceorder
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - references
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
// internal - domain - main-entities
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Division_Id *uint16 `json:"division_id"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
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 {
|
||||
return "DivisionPosition"
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
package divisionposition
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/division"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eb "simrs-vx/internal/domain/main-entities/division-position/base"
|
||||
)
|
||||
|
||||
type DivisionPosition struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Division_Id *uint16 `json:"division_id"`
|
||||
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"`
|
||||
Code string `json:"code" gorm:"unique;size:10"`
|
||||
Name string `json:"name" gorm:"size:50"`
|
||||
HeadStatus bool `json:"headStatus"`
|
||||
Employee_Id *uint `json:"employee_id"`
|
||||
Employee *ee.Employee `json:"employee,omitempty" gorm:"foreignKey:Employee_Id;references:Id"`
|
||||
eb.Basic
|
||||
Division *ed.Division `json:"division" gorm:"foreignKey:Division_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package division
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
edpb "simrs-vx/internal/domain/main-entities/division-position/base"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -26,8 +27,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -47,20 +49,22 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent *Division `json:"parent,omitempty"`
|
||||
Childrens []Division `json:"childrens,omitempty"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Parent_Id *uint16 `json:"parent_id"`
|
||||
Parent *Division `json:"parent,omitempty"`
|
||||
Childrens []Division `json:"childrens,omitempty"`
|
||||
DivisionPosition []edpb.Basic `json:"divisionPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Division) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Parent_Id: d.Parent_Id,
|
||||
Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Parent_Id: d.Parent_Id,
|
||||
Parent: d.Parent,
|
||||
Childrens: d.Childrens,
|
||||
DivisionPosition: d.DivisionPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -2,13 +2,15 @@ package division
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
edpb "simrs-vx/internal/domain/main-entities/division-position/base"
|
||||
)
|
||||
|
||||
type Division struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;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
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Code string `json:"code" gorm:"unique;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"`
|
||||
}
|
||||
|
||||
@@ -2,18 +2,16 @@ package employee
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/division"
|
||||
ep "simrs-vx/internal/domain/main-entities/person"
|
||||
eu "simrs-vx/internal/domain/main-entities/user"
|
||||
erg "simrs-vx/internal/domain/references/organization"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
erg "simrs-vx/internal/domain/references/organization"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
User_Id *uint `json:"user_id"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Division_Code *string `json:"division_code"`
|
||||
Number *string `json:"number" validate:"maxLength=20"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code" validate:"maxLength=10"`
|
||||
Position_Code *erg.EmployeePositionCode `json:"position_code"`
|
||||
@@ -28,7 +26,6 @@ type ReadListDto struct {
|
||||
type FilterDto struct {
|
||||
User_Id *uint `json:"user-id"`
|
||||
Person_Id *uint `json:"person-id"`
|
||||
Division_Code *string `json:"division-code"`
|
||||
Position_Code *string `json:"position-code"`
|
||||
Number *string `json:"number"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status-code"`
|
||||
@@ -58,28 +55,22 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty"`
|
||||
Division_Code *string `json:"division_code"`
|
||||
Division *ed.Division `json:"division,omitempty"`
|
||||
Position_Code *erg.EmployeePositionCode `json:"position_code"`
|
||||
Number *string `json:"number"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||
User_Id *uint `json:"user_id"`
|
||||
User *eu.User `json:"user,omitempty"`
|
||||
Person_Id *uint `json:"person_id"`
|
||||
Person *ep.Person `json:"person,omitempty"`
|
||||
Number *string `json:"number"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code"`
|
||||
}
|
||||
|
||||
func (d Employee) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
User_Id: d.User_Id,
|
||||
User: d.User,
|
||||
Person_Id: d.Person_Id,
|
||||
Person: d.Person,
|
||||
Division_Code: d.Division_Code,
|
||||
Division: d.Division,
|
||||
Number: d.Number,
|
||||
Status_Code: d.Status_Code,
|
||||
Position_Code: d.Position_Code,
|
||||
User_Id: d.User_Id,
|
||||
User: d.User,
|
||||
Person_Id: d.Person_Id,
|
||||
Person: d.Person,
|
||||
Number: d.Number,
|
||||
Status_Code: d.Status_Code,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -2,7 +2,6 @@ package employee
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/division"
|
||||
ep "simrs-vx/internal/domain/main-entities/person"
|
||||
eu "simrs-vx/internal/domain/main-entities/user"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
@@ -16,8 +15,6 @@ type Employee struct {
|
||||
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"`
|
||||
Division_Code *string `json:"division_code"`
|
||||
Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"`
|
||||
Number *string `json:"number" gorm:"size:20"`
|
||||
Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"`
|
||||
}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
package encounter
|
||||
|
||||
import (
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - references
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
|
||||
// internal - domain - main-entities
|
||||
evs "simrs-vx/internal/domain/bpjs-entities/vclaim-sep"
|
||||
ea "simrs-vx/internal/domain/main-entities/appointment"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
@@ -13,11 +24,6 @@ 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"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -48,6 +54,8 @@ type ReadListDto struct {
|
||||
FilterDto
|
||||
Includes string `json:"includes"`
|
||||
Pagination ecore.Pagination
|
||||
|
||||
pa.AuthInfo
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
return "InstallationPosition"
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
package installation_position
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
ei "simrs-vx/internal/domain/main-entities/installation"
|
||||
eib "simrs-vx/internal/domain/main-entities/installation-position/base"
|
||||
)
|
||||
|
||||
type InstallationPosition struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Installation_Id *uint16 `json:"installation_id" gorm:"not null"`
|
||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||
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"`
|
||||
eib.Basic // adjust this according to the needs
|
||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package installation
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eipb "simrs-vx/internal/domain/main-entities/installation-position/base"
|
||||
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
)
|
||||
@@ -27,8 +28,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -48,16 +50,18 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"`
|
||||
InstallationPositions []eipb.Basic `json:"installationPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Installation) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
EncounterClass_Code: d.EncounterClass_Code,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
EncounterClass_Code: d.EncounterClass_Code,
|
||||
InstallationPositions: d.InstallationPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -2,12 +2,14 @@ package installation
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eipb "simrs-vx/internal/domain/main-entities/installation-position/base"
|
||||
ere "simrs-vx/internal/domain/references/encounter"
|
||||
)
|
||||
|
||||
type Installation struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
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"`
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package materialorder
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - references
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
// internal - domain - main-entities
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
package mcuorder
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - references
|
||||
ercl "simrs-vx/internal/domain/references/clinical"
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
// internal - domain - main-entities
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -20,7 +27,7 @@ type CreateDto struct {
|
||||
ExaminationDate *time.Time `json:"examinationDate"`
|
||||
Number uint8 `json:"number"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code""`
|
||||
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code"`
|
||||
|
||||
pa.AuthInfo
|
||||
}
|
||||
@@ -39,7 +46,7 @@ type FilterDto struct {
|
||||
ExaminationDate *time.Time `json:"examinationDate"`
|
||||
Number uint8 `json:"number"`
|
||||
Temperature float64 `json:"temperature"`
|
||||
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel-code""`
|
||||
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel-code"`
|
||||
}
|
||||
type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package medicationitem
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
emi "simrs-vx/internal/domain/main-entities/medication-item"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - main-entities
|
||||
emi "simrs-vx/internal/domain/main-entities/medication-item"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package medication
|
||||
|
||||
import (
|
||||
// std
|
||||
"time"
|
||||
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
ep "simrs-vx/internal/domain/main-entities/pharmacist"
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - references
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
// internal - domain - main-entities
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
ep "simrs-vx/internal/domain/main-entities/pharmacist"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -57,8 +57,8 @@ type DeleteDto struct {
|
||||
}
|
||||
|
||||
type SearchDto struct {
|
||||
Search string `json:"search"`
|
||||
Mode SearchMode `json:"mode"`
|
||||
Search string `json:"search"`
|
||||
Pagination ecore.Pagination
|
||||
}
|
||||
|
||||
type UploadDto struct {
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
)
|
||||
|
||||
@@ -15,6 +17,8 @@ type CreateDto struct {
|
||||
Doctor_Id *uint `json:"doctor_id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
|
||||
pa.AuthInfo
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
package sbar
|
||||
|
||||
import (
|
||||
// std
|
||||
"time"
|
||||
|
||||
// internal - lib
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
// internal - domain - base-entities
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
|
||||
// internal - domain - main-entities
|
||||
eem "simrs-vx/internal/domain/main-entities/employee"
|
||||
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
erc "simrs-vx/internal/domain/references/clinical"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Specialist_Id *uint16 `json:"specialist_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"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
return "SpecialistPosition"
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
package specialist_position
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||
esb "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||
)
|
||||
|
||||
type SpecialistPosition struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Specialist_Id *uint16 `json:"specialist_id" gorm:"not null"`
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||
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"`
|
||||
esb.Basic
|
||||
Specialist *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package specialist
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
espb "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -46,16 +48,18 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Unit_Id *uint16 `json:"unit_id"`
|
||||
SpecialistPositions []espb.Basic `json:"specialistPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Specialist) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Unit_Id: d.Unit_Id,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Unit_Id: d.Unit_Id,
|
||||
SpecialistPositions: d.SpecialistPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -2,13 +2,15 @@ package specialist
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
eub "simrs-vx/internal/domain/main-entities/specialist-position/base"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
)
|
||||
|
||||
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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
return "SubspecialistPosition"
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
package subspecialist_position
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
es "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||
esb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||
)
|
||||
|
||||
type SubspecialistPosition struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Subspecialist_Id *uint16 `json:"subspecialist_id" gorm:"not null"`
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||
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"`
|
||||
esb.Basic
|
||||
Subspecialist *es.Subspecialist `json:"subspecialist,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package subspecialist
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -25,8 +26,9 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Id uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -46,9 +48,10 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Specialist_Id *uint16 `json:"specialist_id"`
|
||||
Subspecialist []espb.Basic `json:"subspecialistPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Subspecialist) ToResponse() ResponseDto {
|
||||
@@ -56,6 +59,7 @@ func (d Subspecialist) ToResponse() ResponseDto {
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
Specialist_Id: d.Specialist_Id,
|
||||
Subspecialist: d.SubspecialistPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
return resp
|
||||
|
||||
@@ -3,12 +3,14 @@ package subspecialist
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||
espb "simrs-vx/internal/domain/main-entities/subspecialist-position/base"
|
||||
)
|
||||
|
||||
type Subspecialist 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 *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
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 *es.Specialist `json:"specialist,omitempty" gorm:"foreignKey:Specialist_Id"`
|
||||
SubspecialistPositions []espb.Basic `json:"subspecialistPositions,omitempty" gorm:"foreignKey:Subspecialist_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
)
|
||||
|
||||
type Basic struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Unit_Id *uint16 `json:"unit_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"`
|
||||
}
|
||||
|
||||
func (Basic) TableName() string {
|
||||
return "UnitPosition"
|
||||
}
|
||||
@@ -1,18 +1,11 @@
|
||||
package unit_position
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eu "simrs-vx/internal/domain/main-entities/unit"
|
||||
eub "simrs-vx/internal/domain/main-entities/unit-position/base"
|
||||
)
|
||||
|
||||
type UnitPosition struct {
|
||||
ecore.SmallMain // adjust this according to the needs
|
||||
Unit_Id *uint16 `json:"unit_id" gorm:"not null"`
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
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"`
|
||||
eub.Basic
|
||||
Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Id;references:Id"`
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package unit
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ei "simrs-vx/internal/domain/main-entities/installation"
|
||||
eipb "simrs-vx/internal/domain/main-entities/unit-position/base"
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
@@ -29,6 +30,7 @@ type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Code *string `json:"code"`
|
||||
Includes string `json:"includes"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
@@ -50,8 +52,9 @@ type ResponseDto struct {
|
||||
ecore.SmallMain
|
||||
Installation_Id *uint16 `json:"installation_id"`
|
||||
Installation *ei.Installation
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
UnitPositions []eipb.Basic `json:"unitPositions,omitempty"`
|
||||
}
|
||||
|
||||
func (d Unit) ToResponse() ResponseDto {
|
||||
@@ -59,6 +62,7 @@ func (d Unit) ToResponse() ResponseDto {
|
||||
Installation_Id: d.Installation_Id,
|
||||
Code: d.Code,
|
||||
Name: d.Name,
|
||||
UnitPositions: d.UnitPositions,
|
||||
}
|
||||
resp.SmallMain = d.SmallMain
|
||||
if d.Installation != nil {
|
||||
|
||||
@@ -3,6 +3,7 @@ package unit
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ei "simrs-vx/internal/domain/main-entities/installation"
|
||||
eub "simrs-vx/internal/domain/main-entities/unit-position/base"
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
)
|
||||
|
||||
@@ -13,4 +14,5 @@ type Unit struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/adime"
|
||||
u "simrs-vx/internal/use-case/main-use-case/adime"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
m "simrs-vx/internal/domain/main-entities/user"
|
||||
s "simrs-vx/internal/use-case/main-use-case/authentication"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
)
|
||||
|
||||
func Login(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
u "simrs-vx/internal/use-case/main-use-case/chemo"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/consultation"
|
||||
u "simrs-vx/internal/use-case/main-use-case/consultation"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/device-order"
|
||||
u "simrs-vx/internal/use-case/main-use-case/device-order"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -37,7 +37,9 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
if id <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.ReadDetailDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
u "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
@@ -36,7 +36,12 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
dto := e.ReadListDto{}
|
||||
dto.AuthInfo = *authInfo
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
res, err := u.ReadList(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
/******************** main / transaction ********************/
|
||||
adime "simrs-vx/internal/interface/main-handler/adime"
|
||||
admemployeehist "simrs-vx/internal/interface/main-handler/adm-employee-hist"
|
||||
ambulancetransportrequest "simrs-vx/internal/interface/main-handler/ambulance-transport-req"
|
||||
auth "simrs-vx/internal/interface/main-handler/authentication"
|
||||
chemo "simrs-vx/internal/interface/main-handler/chemo"
|
||||
@@ -27,11 +28,11 @@ import (
|
||||
practiceschedule "simrs-vx/internal/interface/main-handler/practice-schedule"
|
||||
prescription "simrs-vx/internal/interface/main-handler/prescription"
|
||||
prescriptionitem "simrs-vx/internal/interface/main-handler/prescription-item"
|
||||
responsibledoctorhist "simrs-vx/internal/interface/main-handler/responsible-doctor-hist"
|
||||
sbar "simrs-vx/internal/interface/main-handler/sbar"
|
||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||
|
||||
/******************** actor ********************/
|
||||
admemployeehist "simrs-vx/internal/interface/main-handler/adm-employee-hist"
|
||||
doctor "simrs-vx/internal/interface/main-handler/doctor"
|
||||
employee "simrs-vx/internal/interface/main-handler/employee"
|
||||
nurse "simrs-vx/internal/interface/main-handler/nurse"
|
||||
@@ -42,7 +43,6 @@ import (
|
||||
personcontact "simrs-vx/internal/interface/main-handler/person-contact"
|
||||
personinsurance "simrs-vx/internal/interface/main-handler/person-insurance"
|
||||
pharmacist "simrs-vx/internal/interface/main-handler/pharmacist"
|
||||
responsibledoctorhist "simrs-vx/internal/interface/main-handler/responsible-doctor-hist"
|
||||
user "simrs-vx/internal/interface/main-handler/user"
|
||||
|
||||
/******************** external ********************/
|
||||
@@ -137,6 +137,20 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/prescription-item", prescriptionitem.O)
|
||||
hc.RegCrud(r, "/v1/device-order-item", deviceorderitem.O)
|
||||
hc.RegCrud(r, "/v1/material-order-item", materialorderitem.O)
|
||||
|
||||
hk.GroupRoutes("/v1/encounter", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": encounter.O.GetList,
|
||||
"GET /{id}": encounter.O.GetDetail,
|
||||
"POST /": encounter.O.Create,
|
||||
"PATCH /{id}": encounter.O.Update,
|
||||
"DELETE /{id}": encounter.O.Delete,
|
||||
"PATCH /{id}/check-out": encounter.O.CheckOut,
|
||||
"PATCH /{id}/check-in": encounter.O.CheckIn,
|
||||
"PATCH /{id}/proccess": encounter.O.Process,
|
||||
"PATCH /{id}/cancel": encounter.O.Cancel,
|
||||
"PATCH /{id}/reject": encounter.O.Reject,
|
||||
"PATCH /{id}/skip": encounter.O.Skip,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": mcuorder.O.GetList,
|
||||
"GET /{id}": mcuorder.O.GetDetail,
|
||||
@@ -155,7 +169,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/complete": mcuorderitem.O.Complete,
|
||||
"PATCH /{id}/set-schedule": mcuorderitem.O.SetSchedule,
|
||||
})
|
||||
hk.GroupRoutes("/v1/prescription", r, hk.MapHandlerFunc{
|
||||
hk.GroupRoutes("/v1/prescription", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": prescription.O.GetList,
|
||||
"GET /{id}": prescription.O.GetDetail,
|
||||
"POST /": prescription.O.Create,
|
||||
@@ -163,7 +177,7 @@ func SetRoutes() http.Handler {
|
||||
"DELETE /{id}": prescription.O.Delete,
|
||||
"PATCH /{id}/approve": prescription.O.Approve,
|
||||
})
|
||||
hk.GroupRoutes("/v1/mcu-order-sub-item", r, hk.MapHandlerFunc{
|
||||
hk.GroupRoutes("/v1/mcu-order-sub-item", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": mcuordersubitem.O.GetList,
|
||||
"GET /{id}": mcuordersubitem.O.GetDetail,
|
||||
"POST /": mcuordersubitem.O.Create,
|
||||
@@ -171,19 +185,6 @@ func SetRoutes() http.Handler {
|
||||
"DELETE /{id}": mcuordersubitem.O.Delete,
|
||||
"PATCH /{id}/complete": mcuordersubitem.O.Complete,
|
||||
})
|
||||
hk.GroupRoutes("/v1/encounter", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": encounter.O.GetList,
|
||||
"GET /{id}": encounter.O.GetDetail,
|
||||
"POST /": encounter.O.Create,
|
||||
"PATCH /{id}": encounter.O.Update,
|
||||
"DELETE /{id}": encounter.O.Delete,
|
||||
"PATCH /{id}/check-out": encounter.O.CheckOut,
|
||||
"PATCH /{id}/check-in": encounter.O.CheckIn,
|
||||
"PATCH /{id}/proccess": encounter.O.Process,
|
||||
"PATCH /{id}/cancel": encounter.O.Cancel,
|
||||
"PATCH /{id}/reject": encounter.O.Reject,
|
||||
"PATCH /{id}/skip": encounter.O.Skip,
|
||||
})
|
||||
hk.GroupRoutes("/v1/medication", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": medication.O.GetList,
|
||||
"GET /{id}": medication.O.GetDetail,
|
||||
@@ -193,7 +194,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}/complete": medication.O.Complete,
|
||||
})
|
||||
|
||||
hk.GroupRoutes("/v1/medication-item", r, hk.MapHandlerFunc{
|
||||
hk.GroupRoutes("/v1/medication-item", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||
"GET /": medicationitem.O.GetList,
|
||||
"GET /{id}": medicationitem.O.GetDetail,
|
||||
"POST /": medicationitem.O.Create,
|
||||
@@ -279,7 +280,7 @@ func SetRoutes() http.Handler {
|
||||
"PATCH /{id}": patient.O.Update,
|
||||
"DELETE /{id}": patient.O.Delete,
|
||||
"GET /search/{keyword}": patient.O.Search,
|
||||
"GET /by-resident-identity": patient.O.SearchByResidentIdentity,
|
||||
"GET /by-resident-identity": patient.O.SearchByResidentIdentityNumber,
|
||||
"POST /{id}/upload": patient.O.Upload,
|
||||
})
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/material-order"
|
||||
u "simrs-vx/internal/use-case/main-use-case/material-order"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/mcu-order"
|
||||
u "simrs-vx/internal/use-case/main-use-case/mcu-order"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/medication-item-dist"
|
||||
u "simrs-vx/internal/use-case/main-use-case/medication-item-dist"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
rw "github.com/karincake/risoles"
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/medication"
|
||||
u "simrs-vx/internal/use-case/main-use-case/medication"
|
||||
|
||||
@@ -76,21 +76,22 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (obj myBase) Search(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.SearchDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
keyword := rw.ValidateString(w, "keyword", r.PathValue("keyword"))
|
||||
if keyword == "" {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": "keyword is required"}, nil)
|
||||
}
|
||||
dto.Mode = e.SMIdent
|
||||
|
||||
dto.Search = keyword
|
||||
res, err := u.Search(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
func (obj myBase) SearchByResidentIdentity(w http.ResponseWriter, r *http.Request) {
|
||||
func (obj myBase) SearchByResidentIdentityNumber(w http.ResponseWriter, r *http.Request) {
|
||||
dto := e.SearchDto{}
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Mode = e.SMNik
|
||||
res, err := u.Search(dto)
|
||||
res, err := u.SearchByResidentIdentityNumber(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ import (
|
||||
sf "github.com/karincake/semprit"
|
||||
|
||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||
d "github.com/karincake/dodol"
|
||||
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/prescription"
|
||||
u "simrs-vx/internal/use-case/main-use-case/prescription"
|
||||
@@ -21,6 +24,11 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
authInfo, err := pa.GetAuthInfo(r)
|
||||
if err != nil {
|
||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||
}
|
||||
dto.AuthInfo = *authInfo
|
||||
res, err := u.Create(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/sbar"
|
||||
u "simrs-vx/internal/use-case/main-use-case/sbar"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
e "simrs-vx/internal/domain/main-entities/soapi"
|
||||
u "simrs-vx/internal/use-case/main-use-case/soapi"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
pa "simrs-vx/internal/lib/auth"
|
||||
|
||||
d "github.com/karincake/dodol"
|
||||
)
|
||||
|
||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -38,6 +38,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
|
||||
sf.UrlQueryParam(&dto, *r.URL)
|
||||
dto.Id = uint16(id)
|
||||
res, err := u.ReadDetail(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package authhelper
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetAuthInfo(r *http.Request) (*AuthInfo, error) {
|
||||
ctxVal := r.Context().Value(AuthKey{})
|
||||
if ctxVal == nil {
|
||||
return nil, errors.New("can't get auth info")
|
||||
}
|
||||
authInfo := ctxVal.(*AuthInfo)
|
||||
return authInfo, nil
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package authhelper
|
||||
|
||||
import (
|
||||
ero "simrs-vx/internal/domain/references/organization"
|
||||
)
|
||||
|
||||
type AuthKey struct{}
|
||||
|
||||
// const AuthKey = struct{}{}
|
||||
type AuthInfo struct {
|
||||
Uuid string
|
||||
User_Id uint
|
||||
User_Name string
|
||||
User_ContractPosition_code string
|
||||
Employee_Position_Code *string
|
||||
Employee_Id *int
|
||||
Doctor_Id *int
|
||||
Nurse_Id *int
|
||||
Midwife_Id *int
|
||||
Nutritionist_Id *int
|
||||
Laborant_Id *int
|
||||
Pharmachist_Id *int
|
||||
Intern_Position_Code *string
|
||||
Roles []string
|
||||
// User_DivisionPositions []DivisionPosition
|
||||
}
|
||||
|
||||
type DivisionPosition struct {
|
||||
Division_Code string `json:"division_code"`
|
||||
DivisionPosition_Code string `json:"divisionPosition_code"`
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsDoctor() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCDoc)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsNurse() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCNur)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsNutritionist() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCNut)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsLaborant() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCLab)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsPharmacist() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCPha)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsPayment() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCPay)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsManagement() bool {
|
||||
if a.Employee_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Employee_Position_Code == string(ero.EPCMan)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsSpecialistIntern() bool {
|
||||
if a.Intern_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Intern_Position_Code == string(ero.IPCSpecialist)
|
||||
}
|
||||
|
||||
func (a AuthInfo) IsNurseIntern() bool {
|
||||
if a.Intern_Position_Code == nil {
|
||||
return false
|
||||
}
|
||||
return *a.Intern_Position_Code == string(ero.IPCNurse)
|
||||
}
|
||||
@@ -13,12 +13,13 @@ import (
|
||||
"simrs-vx/internal/domain/main-entities/intern"
|
||||
eu "simrs-vx/internal/domain/main-entities/user"
|
||||
|
||||
pa "simrs-vx/pkg/auth-helper"
|
||||
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"
|
||||
@@ -120,10 +121,10 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
outputData["employee_id"] = employee.Id
|
||||
role = append(role, "emp-"+string(*employee.Position_Code))
|
||||
|
||||
if employee.Division_Code != nil {
|
||||
atClaims["employee_division_code"] = employee.Division_Code
|
||||
outputData["employee_division_code"] = employee.Division_Code
|
||||
}
|
||||
//if employee.Division_Code != nil {
|
||||
// atClaims["employee_division_code"] = employee.Division_Code
|
||||
// outputData["employee_division_code"] = employee.Division_Code
|
||||
//}
|
||||
|
||||
// employee position
|
||||
if employee.Id > 0 && employee.Position_Code != nil {
|
||||
@@ -147,19 +148,27 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
outputData["subspecialist_id"] = doctor.Subspecialist_Id
|
||||
}
|
||||
case erg.EPCNur:
|
||||
nurse := en.Nurse{}
|
||||
dg.I.Where("\"Employee_Id\" = ?", employee.Id).First(&nurse)
|
||||
if nurse.Id == 0 {
|
||||
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")}}
|
||||
}
|
||||
atClaims["nurse_id"] = nurse.Id
|
||||
outputData["nurse_id"] = nurse.Id
|
||||
atClaims["nurse_id"] = empData.Id
|
||||
outputData["nurse_id"] = empData.Id
|
||||
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")}}
|
||||
}
|
||||
atClaims["nurse_id"] = empData.Id
|
||||
outputData["nurse_id"] = empData.Id
|
||||
}
|
||||
|
||||
errorGetPosition := d.FieldErrors{"authentication": d.FieldError{Code: "auth-getData-failed", Message: el.GenMessage("auth-getData-failed")}}
|
||||
|
||||
// division position
|
||||
divsionPositions, err := getDivisionPosition(employee.Id)
|
||||
divisionPositions, err := getDivisionPosition(employee.Id)
|
||||
if err != nil {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
@@ -188,7 +197,7 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
return nil, errorGetPosition
|
||||
}
|
||||
|
||||
role = append(role, divsionPositions...)
|
||||
role = append(role, divisionPositions...)
|
||||
role = append(role, installationPositions...)
|
||||
role = append(role, unitPositions...)
|
||||
role = append(role, specialistPositions...)
|
||||
@@ -200,6 +209,8 @@ func GenToken(input eu.LoginDto) (*d.Data, error) {
|
||||
intern := intern.Intern{}
|
||||
dg.I.Where("\"User_Id\" = ?", user.Id).First(&intern)
|
||||
role = append(role, "int-"+string(*intern.Position_Code))
|
||||
case erg.CSCSys:
|
||||
role = append(role, "system")
|
||||
}
|
||||
atClaims["roles"] = role
|
||||
outputData["roles"] = role
|
||||
@@ -287,43 +298,22 @@ func ExtractToken(r *http.Request, tokenType TokenType) (data *pa.AuthInfo, err
|
||||
if accessUuidRedis.String() == "" {
|
||||
return nil, d.FieldError{Code: "token-unidentified", Message: el.GenMessage("token-unidentified")}
|
||||
}
|
||||
user_name := fmt.Sprintf("%v", claims["user_name"])
|
||||
// user_email := ""
|
||||
// if v, exist := claims["user_email"]; exist && v != nil {
|
||||
// user_email = v.(string)
|
||||
// }
|
||||
// ref_id := 0
|
||||
// if v, exist := claims["user_ref_id"]; exist && v != nil {
|
||||
// tmp := v.(float64)
|
||||
// ref_id = int(tmp)
|
||||
// }
|
||||
// position_code := ""
|
||||
// if v, exist := claims["user_position_code"]; exist && v != nil {
|
||||
// position_code = v.(string)
|
||||
// }
|
||||
// data = &AuthInfo{
|
||||
// Uuid: accessUuid,
|
||||
// User_Id: int(user_id),
|
||||
// User_Name: user_name,
|
||||
// User_Email: user_email,
|
||||
// User_Ref_Id: ref_id,
|
||||
// User_Position_Code: position_code,
|
||||
contractPosition_code := ""
|
||||
if v, exist := claims["contractPosition_code"]; exist && v != nil {
|
||||
contractPosition_code = v.(string)
|
||||
}
|
||||
employee_position_code := ""
|
||||
if v, exist := claims["employee_position_code"]; exist && v != nil {
|
||||
employee_position_code = v.(string)
|
||||
}
|
||||
|
||||
data = &pa.AuthInfo{
|
||||
Uuid: accessUuid,
|
||||
User_Id: uint(user_id),
|
||||
User_Name: user_name,
|
||||
User_ContractPosition_code: contractPosition_code,
|
||||
Employee_Position_Code: &employee_position_code,
|
||||
Uuid: accessUuid,
|
||||
User_Id: uint(user_id),
|
||||
User_Name: fmt.Sprintf("%v", claims["user_name"]),
|
||||
}
|
||||
|
||||
data.User_ContractPosition_code = checkStrClaims(claims, "contractPosition_code")
|
||||
data.Employee_Position_Code = checkStrPtrClaims(claims, "employee_position_code")
|
||||
data.Doctor_Id = checkIntPtrClaims(claims, "doctor_id")
|
||||
data.Nurse_Id = checkIntPtrClaims(claims, "nurse_id")
|
||||
data.Midwife_Id = checkIntPtrClaims(claims, "midwife_id")
|
||||
data.Nutritionist_Id = checkIntPtrClaims(claims, "nutritionist_id")
|
||||
data.Laborant_Id = checkIntPtrClaims(claims, "laborant_id")
|
||||
data.Pharmachist_Id = checkIntPtrClaims(claims, "pharmachist_id")
|
||||
data.Intern_Position_Code = checkStrPtrClaims(claims, "intern_position_code")
|
||||
return
|
||||
}
|
||||
return nil, d.FieldError{Code: "token", Message: "token-invalid"}
|
||||
@@ -332,3 +322,33 @@ 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
|
||||
}
|
||||
|
||||
@@ -28,10 +28,6 @@ func getAndCheck(input, condition any) (eCode string) {
|
||||
return ""
|
||||
}
|
||||
|
||||
func getDocName(id uint) string {
|
||||
return "authentication"
|
||||
}
|
||||
|
||||
func getDivisionPosition(employee_id uint) ([]string, error) {
|
||||
var result []string
|
||||
|
||||
|
||||
@@ -91,7 +91,9 @@ 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 err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Employee) {
|
||||
|
||||
data.User_Id = inputSrc.User_Id
|
||||
data.Person_Id = inputSrc.Person_Id
|
||||
data.Division_Code = inputSrc.Division_Code
|
||||
data.Number = inputSrc.Number
|
||||
data.Status_Code = inputSrc.Status_Code
|
||||
data.Position_Code = inputSrc.Position_Code
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package encounter
|
||||
|
||||
import (
|
||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||
// std
|
||||
"errors"
|
||||
|
||||
// external
|
||||
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"
|
||||
pu "simrs-vx/pkg/use-case-helper"
|
||||
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
gh "github.com/karincake/getuk"
|
||||
"gorm.io/gorm"
|
||||
// internal
|
||||
e "simrs-vx/internal/domain/main-entities/encounter"
|
||||
)
|
||||
|
||||
func CreateData(input e.CreateDto, event *pl.Event, dbx ...*gorm.DB) (*e.Encounter, error) {
|
||||
@@ -34,6 +40,10 @@ func CreateData(input e.CreateDto, event *pl.Event, dbx ...*gorm.DB) (*e.Encount
|
||||
}
|
||||
|
||||
func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Encounter, *e.MetaDto, error) {
|
||||
if input.AuthInfo.User_Id == 0 {
|
||||
return nil, nil, plh.HandleListError(input, event, errors.New("user_id is required"))
|
||||
}
|
||||
|
||||
pl.SetLogInfo(event, input, "started", "DBReadList")
|
||||
data := []e.Encounter{}
|
||||
pagination := gh.Pagination{}
|
||||
@@ -46,10 +56,13 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
||||
} else {
|
||||
tx = dg.I
|
||||
}
|
||||
tx = tx.Model(&e.Encounter{})
|
||||
|
||||
tx = tx.
|
||||
Model(&e.Encounter{}).
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
if input.AuthInfo.Doctor_Id != nil {
|
||||
tx.Where("\"Responsible_Doctor_Id\" = ?", *input.AuthInfo.Doctor_Id)
|
||||
}
|
||||
|
||||
tx.Scopes(gh.Preload(input.Includes)).
|
||||
Scopes(gh.Filter(input.FilterDto)).
|
||||
Count(&count).
|
||||
Scopes(gh.Paginate(input, &pagination)).
|
||||
|
||||
@@ -81,7 +81,9 @@ 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 err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -352,18 +352,18 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
|
||||
}
|
||||
|
||||
func Search(input e.SearchDto) (*d.Data, error) {
|
||||
func SearchByResidentIdentityNumber(input e.SearchDto) (*d.Data, error) {
|
||||
var data *e.Patient
|
||||
var err error
|
||||
|
||||
event := pl.Event{
|
||||
Feature: "Search",
|
||||
Feature: "Search By Resident Identity Number",
|
||||
Source: source,
|
||||
}
|
||||
|
||||
// Start log
|
||||
pl.SetLogInfo(&event, input, "started", "search")
|
||||
if data, err = SearchData(input, &event); err != nil {
|
||||
if data, err = SearchDataByRIN(input, &event); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -377,6 +377,46 @@ func Search(input e.SearchDto) (*d.Data, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func Search(input e.SearchDto) (*d.Data, error) {
|
||||
var dataList []e.Patient
|
||||
var metaList *e.MetaDto
|
||||
var err error
|
||||
|
||||
event := pl.Event{
|
||||
Feature: "Search",
|
||||
Source: source,
|
||||
}
|
||||
|
||||
// Start log
|
||||
pl.SetLogInfo(&event, input, "started", "readList")
|
||||
|
||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
if dataList, metaList, err = SearchData(input, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &d.Data{
|
||||
Meta: d.IS{
|
||||
"source": source,
|
||||
"structure": "list-data",
|
||||
"status": "fetched",
|
||||
"page_number": strconv.Itoa(metaList.PageNumber),
|
||||
"page_size": strconv.Itoa(metaList.PageSize),
|
||||
"record_totalCount": strconv.Itoa(metaList.Count),
|
||||
"record_currentCount": strconv.Itoa(len(dataList)),
|
||||
},
|
||||
Data: e.ToResponseList(dataList),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func Upload(input e.UploadDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: uint16(input.Id)}
|
||||
var data *e.Patient
|
||||
|
||||
@@ -154,11 +154,11 @@ func DeleteData(data *e.Patient, event *pl.Event, dbx ...*gorm.DB) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SearchData(input e.SearchDto, event *pl.Event, dbx ...*gorm.DB) (*e.Patient, error) {
|
||||
// Search By Resident Identity Number
|
||||
func SearchDataByRIN(input e.SearchDto, event *pl.Event, dbx ...*gorm.DB) (*e.Patient, error) {
|
||||
pl.SetLogInfo(event, input, "started", "DBSearch")
|
||||
|
||||
var patient e.Patient
|
||||
var err error
|
||||
var data e.Patient
|
||||
|
||||
var tx *gorm.DB
|
||||
if len(dbx) > 0 {
|
||||
@@ -174,27 +174,60 @@ func SearchData(input e.SearchDto, event *pl.Event, dbx ...*gorm.DB) (*e.Patient
|
||||
Preload("Person.Relatives").
|
||||
Preload("Person.Insurances")
|
||||
|
||||
switch input.Mode {
|
||||
case e.SMIdent:
|
||||
// Search by patient number OR person's resident identity number (exact match) OR person's name (partial match)
|
||||
err = tx.Joins("JOIN \"Person\" ON \"Patient\".\"Person_Id\" = \"Person\".\"Id\"").
|
||||
Where("\"Patient\".\"Number\" = ? OR \"Person\".\"ResidentIdentityNumber\" = ? OR \"Person\".\"Name\" ILIKE ?",
|
||||
input.Search, input.Search, "%"+input.Search+"%").
|
||||
First(&patient).Error
|
||||
case e.SMNik:
|
||||
// Search by patient person's resident identity number (exact match)
|
||||
err = tx.Joins("JOIN \"Person\" ON \"Patient\".\"Person_Id\" = \"Person\".\"Id\"").
|
||||
Where("\"Person\".\"ResidentIdentityNumber\" = ?",
|
||||
input.Search).
|
||||
First(&patient).Error
|
||||
}
|
||||
// Search by patient person's resident identity number (exact match)
|
||||
err := tx.Joins("JOIN \"Person\" ON \"Patient\".\"Person_Id\" = \"Person\".\"Id\"").
|
||||
Where("\"Person\".\"ResidentIdentityNumber\" = ?",
|
||||
input.Search).
|
||||
First(&data).Error
|
||||
|
||||
if err != nil {
|
||||
if processedErr := pu.HandleSearchError(err, event, source, input.Search, patient); processedErr != nil {
|
||||
if processedErr := pu.HandleSearchError(err, event, source, input.Search, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
}
|
||||
|
||||
pl.SetLogInfo(event, nil, "complete")
|
||||
return &patient, nil
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
func SearchData(input e.SearchDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Patient, *e.MetaDto, error) {
|
||||
pl.SetLogInfo(event, input, "started", "DBSearch")
|
||||
|
||||
var data []e.Patient
|
||||
pagination := gh.Pagination{}
|
||||
count := int64(0)
|
||||
meta := e.MetaDto{}
|
||||
|
||||
var tx *gorm.DB
|
||||
if len(dbx) > 0 {
|
||||
tx = dbx[0]
|
||||
} else {
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
// Preload associations for complete data
|
||||
tx = tx.Preload(clause.Associations)
|
||||
tx = tx.Preload("Person.Addresses").
|
||||
Preload("Person.Contacts").
|
||||
Preload("Person.Relatives").
|
||||
Preload("Person.Insurances")
|
||||
|
||||
// Search by patient number OR person's resident identity number (exact match) OR person's name (partial match)
|
||||
tx = tx.Joins("JOIN \"Person\" ON \"Patient\".\"Person_Id\" = \"Person\".\"Id\"").
|
||||
Where("\"Patient\".\"Number\" ILIKE ? OR \"Person\".\"ResidentIdentityNumber\" ILIKE ? OR \"Person\".\"Name\" ILIKE ?",
|
||||
"%"+input.Search+"%", "%"+input.Search+"%", "%"+input.Search+"%")
|
||||
err := tx.Scopes(gh.Paginate(input, &pagination)).Find(&data).Error
|
||||
|
||||
if err != nil {
|
||||
if processedErr := pu.HandleSearchError(err, event, source, input.Search, data); processedErr != nil {
|
||||
return nil, nil, processedErr
|
||||
}
|
||||
}
|
||||
|
||||
meta.Count = int(count)
|
||||
meta.PageNumber = pagination.PageNumber
|
||||
meta.PageSize = pagination.PageSize
|
||||
|
||||
pl.SetLogInfo(event, nil, "complete")
|
||||
return data, &meta, nil
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ 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 err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ 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 err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -81,7 +81,9 @@ 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 err := tx.
|
||||
Scopes(gh.Preload(input.Includes)).
|
||||
First(&data, input.Id).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ func setDataEmployeeUpdate(src e.EmployeUpdateDto) ee.UpdateDto {
|
||||
CreateDto: ee.CreateDto{
|
||||
User_Id: src.User_Id,
|
||||
Person_Id: src.Person_Id,
|
||||
Division_Code: src.Division_Code,
|
||||
Number: src.Number,
|
||||
Status_Code: src.Status_Code,
|
||||
Position_Code: &src.Position_Code,
|
||||
|
||||
Reference in New Issue
Block a user