change ids into codes for device-order,material-order,mcu-order

This commit is contained in:
dpurbosakti
2025-11-10 16:14:31 +07:00
parent 2f1a857497
commit 42ac3deeb0
17 changed files with 41 additions and 74 deletions
@@ -18,7 +18,7 @@ import (
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code"`
Doctor_Id *uint `json:"doctor_id"`
Doctor_Code *string `json:"doctor_code"`
pa.AuthInfo
}
@@ -32,7 +32,7 @@ type ReadListDto struct {
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Status_Code erc.DataStatusCode `json:"status-code"`
Doctor_Id *uint `json:"doctor-id"`
Doctor_Code *string `json:"doctor-code"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
@@ -57,7 +57,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"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
@@ -66,7 +66,7 @@ func (d DeviceOrder) 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,
Status_Code: d.Status_Code,
}
@@ -12,9 +12,8 @@ type DeviceOrder 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_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
@@ -22,6 +21,6 @@ func (d DeviceOrder) IsCompleted() bool {
return d.Status_Code == erc.DSCDone
}
func (d DeviceOrder) IsSameDoctor(doctor_id *uint) bool {
return d.Doctor_Id == doctor_id
func (d DeviceOrder) IsSameDoctor(doctor_code *string) bool {
return d.Doctor_Code == doctor_code
}
@@ -37,7 +37,7 @@ type CreateDto struct {
RegisteredAt *time.Time `json:"registeredAt"`
Class_Code ere.EncounterClassCode `json:"class_code" validate:"maxLength=10"`
SubClass_Code *string `json:"subClass_code" validate:"maxLength=10"` // for sub
Infra_Id *uint16 `json:"infra_id"` // for inpatient
Infra_Code *string `json:"infra_code"` // for inpatient
Unit_Code *string `json:"unit_code"`
Specialist_Code *string `json:"specialist_code"`
Subspecialist_Code *string `json:"subspecialist_code"`
@@ -10,7 +10,7 @@ import (
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.InpatientClassCode `json:"class_code" validate:"maxLength=10"`
Infra_Id *uint16 `json:"infra_id"`
Infra_Code *string `json:"infra_code"`
}
type ReadListDto struct {
@@ -22,7 +22,7 @@ type ReadListDto struct {
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Class_Code ere.InpatientClassCode `json:"class-code"`
Infra_Id *uint16 `json:"infra-id"`
Infra_Code *string `json:"infra-code"`
}
type ReadDetailDto struct {
@@ -48,7 +48,7 @@ type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.InpatientClassCode `json:"class_code"`
Infra_Id *uint16 `json:"infra_id"`
Infra_Code *string `json:"infra_code"`
Infra *ei.Infra `json:"infra,omitempty"`
}
@@ -56,7 +56,7 @@ func (d Inpatient) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Class_Code: d.Class_Code,
Infra_Id: d.Infra_Id,
Infra_Code: d.Infra_Code,
Infra: d.Infra,
}
resp.Main = d.Main
@@ -10,7 +10,6 @@ type Inpatient struct {
ecore.Main // adjust this according to the needs
Encounter_Id *uint `json:"encounter_id"`
Class_Code ere.InpatientClassCode `json:"class_code" gorm:"size:10"`
Infra_Id *uint16 `json:"infra_id"`
Infra_Code string `json:"infra_code" gorm:"size:10"`
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
Infra_Code *string `json:"infra_code" gorm:"size:10"`
Infra *ei.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Code;references:Code"`
}
@@ -18,7 +18,7 @@ import (
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code"`
Doctor_Id *uint `json:"doctor_id"`
Doctor_Code *string `json:"doctor_code"`
pa.AuthInfo
}
@@ -56,7 +56,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"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
@@ -65,7 +65,7 @@ func (d MaterialOrder) 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,
Status_Code: d.Status_Code,
}
@@ -12,9 +12,8 @@ type MaterialOrder 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_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
@@ -22,6 +21,6 @@ func (d MaterialOrder) IsCompleted() bool {
return d.Status_Code == erc.DSCDone
}
func (d MaterialOrder) IsSameDoctor(doctor_id *uint) bool {
return d.Doctor_Id == doctor_id
func (d MaterialOrder) IsSameDoctor(doctor_code *string) bool {
return d.Doctor_Code == doctor_code
}
@@ -22,7 +22,7 @@ import (
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor_id"`
Doctor_Code *string `json:"doctor_code"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
@@ -42,7 +42,7 @@ type ReadListDto struct {
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
Status_Code erc.DataStatusCode `json:"status-code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor-id"`
Doctor_Code *string `json:"doctor-code"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
@@ -79,7 +79,7 @@ type ResponseDto struct {
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor_id"`
Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
@@ -93,7 +93,7 @@ func (d McuOrder) ToResponse() ResponseDto {
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Status_Code: d.Status_Code,
Doctor_Id: d.Doctor_Id,
Doctor_Code: d.Doctor_Code,
Doctor: d.Doctor,
SpecimenPickTime: d.SpecimenPickTime,
ExaminationDate: d.ExaminationDate,
@@ -15,9 +15,8 @@ type McuOrder struct {
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor_id"`
Doctor_Code *string `json:"doctor_code"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
@@ -30,6 +29,6 @@ func (d McuOrder) IsCompleted() bool {
return d.Status_Code == erc.DSCDone
}
func (d McuOrder) IsSameDoctor(doctor_id *uint) bool {
return d.Doctor_Id == doctor_id
func (d McuOrder) IsSameDoctor(doctor_code *string) bool {
return d.Doctor_Code == doctor_code
}