Merge branch 'feat/orders' of github.com:dikstub-rssa/simrs-be into feat/be-consultation-28

This commit is contained in:
dpurbosakti
2025-09-23 10:04:09 +07:00
67 changed files with 2551 additions and 147 deletions
@@ -5,13 +5,15 @@ import (
emo "simrs-vx/internal/domain/main-entities/mcu-order"
ems "simrs-vx/internal/domain/main-entities/mcu-src"
erc "simrs-vx/internal/domain/references/common"
"time"
)
type CreateDto struct {
McuOrder_Id *uint `json:"mcuOrder_id"`
McuSrc_Id *uint `json:"mcuSrc_id"`
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
McuOrder_Id *uint `json:"mcuOrder_id"`
McuSrc_Id *uint `json:"mcuSrc_id"`
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
ExaminationDate *time.Time `json:"examinationDate"`
}
type ReadListDto struct {
@@ -31,16 +33,21 @@ type FilterDto struct {
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type SetScheduleDto struct {
Id uint `json:"id"`
ExaminationDate *time.Time `json:"examinationDate"`
}
type MetaDto struct {
@@ -51,22 +58,24 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
McuOrder_Id *uint `json:"mcuOrder_id"`
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty"`
McuSrc_Id *uint `json:"mcuSrc_id"`
McuSrc *ems.McuSrc `json:"mcuSrc,omitempty"`
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
McuOrder_Id *uint `json:"mcuOrder_id"`
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty"`
McuSrc_Id *uint `json:"mcuSrc_id"`
McuSrc *ems.McuSrc `json:"mcuSrc,omitempty"`
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
ExaminationDate *time.Time `json:"examinationDate"`
}
func (d McuOrderItem) ToResponse() ResponseDto {
resp := ResponseDto{
McuOrder_Id: d.McuOrder_Id,
McuOrder: d.McuOrder,
McuSrc_Id: d.McuSrc_Id,
McuSrc: d.McuSrc,
Result: d.Result,
Status_Code: d.Status_Code,
McuOrder_Id: d.McuOrder_Id,
McuOrder: d.McuOrder,
McuSrc_Id: d.McuSrc_Id,
McuSrc: d.McuSrc,
Result: d.Result,
Status_Code: d.Status_Code,
ExaminationDate: d.ExaminationDate,
}
resp.Main = d.Main
return resp
@@ -19,3 +19,7 @@ type McuOrderItem struct {
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
func (d McuOrderItem) IsCompleted() bool {
return d.Status_Code == erc.DSCDone
}
@@ -31,16 +31,16 @@ type FilterDto struct {
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type MetaDto struct {
@@ -17,3 +17,7 @@ type McuOrderSubItem struct {
Result *string `json:"result"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
func (d McuOrderSubItem) IsCompleted() bool {
return d.Status_Code == erc.DSCDone
}
+46 -20
View File
@@ -4,13 +4,20 @@ 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"
ercl "simrs-vx/internal/domain/references/clinical"
erc "simrs-vx/internal/domain/references/common"
"time"
)
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"`
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor_id"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code""`
}
type ReadListDto struct {
@@ -20,25 +27,35 @@ 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"`
Encounter_Id *uint `json:"encounter_id"`
Status_Code erc.DataStatusCode `json:"status_code" gorm:"not null;size:10"`
Doctor_Id *uint `json:"doctor_id"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code""`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type SetScheduleDto struct {
Id uint `json:"id"`
ExaminationDate *time.Time `json:"examinationDate"`
}
type MetaDto struct {
@@ -46,23 +63,32 @@ type MetaDto struct {
PageSize int `json:"page_size"`
Count int `json:"count"`
}
type ResponseDto struct {
ecore.Main
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 *ed.Doctor `json:"doctor,omitempty"`
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 *ed.Doctor `json:"doctor,omitempty"`
SpecimenPickTime *time.Time `json:"specimenPickTime"`
ExaminationDate *time.Time `json:"examinationDate"`
Number uint8 `json:"number"`
Temperature float64 `json:"temperature"`
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code""`
}
func (d McuOrder) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Status_Code: d.Status_Code,
Doctor_Id: d.Doctor_Id,
Doctor: d.Doctor,
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Status_Code: d.Status_Code,
Doctor_Id: d.Doctor_Id,
Doctor: d.Doctor,
SpecimenPickTime: d.SpecimenPickTime,
ExaminationDate: d.ExaminationDate,
Number: d.Number,
Temperature: d.Temperature,
McuUrgencyLevel_Code: d.McuUrgencyLevel_Code,
}
resp.Main = d.Main
return resp
@@ -23,3 +23,7 @@ type McuOrder struct {
Temperature float64 `json:"temperature"`
McuUrgencyLevel_Code ercl.McuUrgencyLevelCode `json:"mcuUrgencyLevel_code" gorm:"not null;size:15"`
}
func (d McuOrder) IsCompleted() bool {
return d.Status_Code == erc.DSCDone
}
@@ -9,6 +9,7 @@ type CreateDto struct {
Code string `json:"code" validate:"maxLength=20"`
Name string `json:"name" validate:"maxLength=50"`
CheckupCategory_Code *string `json:"checkupCategory_code" validate:"maxLength=20"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
@@ -10,6 +10,7 @@ type CreateDto struct {
Code string `json:"code" validate:"maxLength=20"`
Name string `json:"name" validate:"maxLength=50"`
McuSrc_Id *uint `json:"mcuSrc_id"`
Item_Id *uint `json:"item_id"`
}
type ReadListDto struct {
@@ -17,6 +17,8 @@ type CreateDto struct {
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
IsRedeemed bool `json:"isRedeemed"`
Quantity float64 `json:"quantity"`
Note *string `json:"note" gorm:"size:1024"`
}
type ReadListDto struct {
@@ -34,6 +36,8 @@ type FilterDto struct {
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
IsRedeemed bool `json:"isRedeemed"`
Quantity float64 `json:"quantity"`
Note *string `json:"note" gorm:"size:1024"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -71,6 +75,8 @@ type ResponseDto struct {
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
IsRedeemed bool `json:"isRedeemed"`
Quantity float64 `json:"quantity"`
Note *string `json:"note" gorm:"size:1024"`
}
func (d MedicationItem) ToResponse() ResponseDto {
@@ -86,6 +92,8 @@ func (d MedicationItem) ToResponse() ResponseDto {
Interval: d.Interval,
IntervalUnit_Code: d.IntervalUnit_Code,
IsRedeemed: d.IsRedeemed,
Quantity: d.Quantity,
Note: d.Note,
}
resp.Main = d.Main
return resp
@@ -35,18 +35,19 @@ type FilterDto struct {
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
Encounter_Id *uint `json:"encounter_id"`
pa.AuthInfo
}
type UpdateDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type MetaDto struct {
@@ -6,9 +6,10 @@ import (
)
type CreateDto struct {
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
Note *string `json:"note" gom:"size:1024"`
}
type ReadListDto struct {
@@ -18,9 +19,10 @@ type ReadListDto struct {
}
type FilterDto struct {
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
MedicineMix_Id *uint `json:"medicineMix_id"`
Medicine_Id *uint `json:"medicine_id"`
Dose *uint8 `json:"dose"`
Note *string `json:"note" gom:"size:1024"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -52,6 +54,7 @@ type ResponseDto struct {
Medicine_Id *uint `json:"medicine_id"`
Medicine *em.Medicine `json:"medicine,omitempty"`
Dose *uint8 `json:"dose"`
Note *string `json:"note" gom:"size:1024"`
}
func (d MedicineMixItem) ToResponse() ResponseDto {
@@ -60,6 +63,7 @@ func (d MedicineMixItem) ToResponse() ResponseDto {
Medicine_Id: d.Medicine_Id,
Medicine: d.Medicine,
Dose: d.Dose,
Note: d.Note,
}
resp.Main = d.Main
return resp
@@ -84,7 +84,20 @@ type ResponseDto struct {
}
func (d *PersonRelative) ToResponse() ResponseDto {
resp := ResponseDto{}
resp := ResponseDto{
Person_Id: d.Person_Id,
Relationship_Code: d.Relationship_Code,
Name: d.Name,
Address: d.Address,
Village_Code: d.Village_Code,
Village: d.Village,
Gender_Code: d.Gender_Code,
PhoneNumber: d.PhoneNumber,
Education_Code: d.Education_Code,
Occupation_Code: d.Occupation_Code,
Occupation_Name: d.Occupation_Name,
Responsible: d.Responsible,
}
resp.Main = d.Main
return resp
}
@@ -16,6 +16,7 @@ type CreateDto struct {
Usage float64 `json:"usage"`
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
Quantity float64 `json:"quantity"`
}
type ReadListDto struct {
@@ -32,6 +33,7 @@ type FilterDto struct {
Usage float64 `json:"usage"`
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
Quantity float64 `json:"quantity"`
Page int `json:"page"`
PageSize int `json:"page_size"`
@@ -68,6 +70,7 @@ type ResponseDto struct {
Usage float64 `json:"usage"`
Interval uint8 `json:"interval"`
IntervalUnit_Code erc.TimeUnitCode `json:"intervalUnit_code"`
Quantity float64 `json:"quantity"`
}
func (d PrescriptionItem) ToResponse() ResponseDto {
@@ -82,6 +85,7 @@ func (d PrescriptionItem) ToResponse() ResponseDto {
Usage: d.Usage,
Interval: d.Interval,
IntervalUnit_Code: d.IntervalUnit_Code,
Quantity: d.Quantity,
}
resp.Main = d.Main
return resp
@@ -4,13 +4,17 @@ 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"
"time"
erc "simrs-vx/internal/domain/references/common"
)
type CreateDto struct {
Encounter_Id *uint `json:"encounter_id"`
Doctor_Id *uint `json:"doctor_id"`
IssuedAt *time.Time `json:"issuedAt"`
Encounter_Id *uint `json:"encounter_id"`
Doctor_Id *uint `json:"doctor_id"`
IssuedAt *time.Time `json:"issuedAt"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
type ReadListDto struct {
@@ -20,25 +24,27 @@ type ReadListDto struct {
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter_id"`
Doctor_Id *uint `json:"doctor_id"`
IssuedAt *time.Time `json:"issuedAt"`
Encounter_Id *uint `json:"encounter_id"`
Doctor_Id *uint `json:"doctor_id"`
IssuedAt *time.Time `json:"issuedAt"`
Status_Code *erc.DataStatusCode `json:"status_code"`
Page int `json:"page"`
PageSize int `json:"page_size"`
NoPagination int `json:"no_pagination"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
Encounter_Id *uint `json:"encounter_id"`
}
type UpdateDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
CreateDto
}
type DeleteDto struct {
Id uint16 `json:"id"`
Id uint `json:"id"`
}
type MetaDto struct {
@@ -49,11 +55,12 @@ type MetaDto struct {
type ResponseDto struct {
ecore.Main
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Doctor_Id *uint `json:"doctor_id"`
Doctor *ed.Doctor `json:"doctor,omitempty"`
IssuedAt *time.Time `json:"issuedAt"`
Encounter_Id *uint `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Doctor_Id *uint `json:"doctor_id"`
Doctor *ed.Doctor `json:"doctor,omitempty"`
IssuedAt *time.Time `json:"issuedAt"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
func (d Prescription) ToResponse() ResponseDto {
@@ -63,6 +70,7 @@ func (d Prescription) ToResponse() ResponseDto {
Doctor_Id: d.Doctor_Id,
Doctor: d.Doctor,
IssuedAt: d.IssuedAt,
Status_Code: d.Status_Code,
}
resp.Main = d.Main
return resp
@@ -19,3 +19,7 @@ type Prescription struct {
IssuedAt *time.Time `json:"issuedAt"`
Status_Code erc.DataStatusCode `json:"status_code"`
}
func (d Prescription) IsApproved() bool {
return d.Status_Code == erc.DSCDone
}
@@ -23,6 +23,8 @@ const (
ITGCMedicine ItemGroupCode = "medicine"
ITGCDevice ItemGroupCode = "device"
ITGCMaterial ItemGroupCode = "material"
ITGCMCU ItemGroupCode = "mcu"
ITGCMCUSub ItemGroupCode = "mcuSub"
ITGCEmpFee ItemGroupCode = "employee-fee"
ITGCDocFee ItemGroupCode = "doctor-fee"