update procedure report main api

This commit is contained in:
2025-12-04 13:52:24 +07:00
parent ac2165154f
commit 320ce99b0e
15 changed files with 277 additions and 226 deletions

No files matched your search

@@ -1,90 +0,0 @@
package actionreport
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
pa "simrs-vx/internal/lib/auth"
)
type CreateDto struct {
Encounter_Id uint64 `json:"encounter_id" validate:"required"`
Date *time.Time `json:"date" validate:"required"`
Doctor_Code string `json:"doctor_code" validate:"required"`
Operator_Employe_Id uint `json:"operator_employe_id" validate:"required"`
Assistant_Employe_Id uint `json:"assistant_employe_id" validate:"required"`
Instrumentor_Employe_Id uint `json:"instrumentor_employe_id" validate:"required"`
Diagnose *string `json:"diagnose"`
Nurse_Code string `json:"nurse_code" validate:"required"`
Value string `json:"value" validate:"required"`
pa.AuthInfo
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
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
Encounter_Id uint64 `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Date *time.Time `json:"date"`
Doctor_Code string `json:"doctor_code"`
Operator_Employe_Id uint `json:"operator_employe_id"`
Assistant_Employe_Id uint `json:"assistant_employe_id"`
Instrumentor_Employe_Id uint `json:"instrumentor_employe_id"`
Diagnose *string `json:"diagnose"`
Nurse_Code string `json:"nurse_code"`
Value *string `json:"value"`
}
func (d ActionReport) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Date: d.Date,
Doctor_Code: d.Doctor_Code,
Operator_Employe_Id: d.Operator_Employe_Id,
Assistant_Employe_Id: d.Assistant_Employe_Id,
Instrumentor_Employe_Id: d.Instrumentor_Employe_Id,
Nurse_Code: d.Nurse_Code,
Value: &d.Value,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ActionReport) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -1,51 +0,0 @@
package actionreport
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
en "simrs-vx/internal/domain/main-entities/nurse"
"time"
)
type ActionReport struct {
ecore.Main // adjust this according to the needs
Encounter_Id uint64 `json:"encounter_id" gorm:"foreignKey"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Date *time.Time `json:"date" gorm:"not null;size:20"`
Doctor_Code string `json:"doctor_code" gorm:"size:10"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Operator_Employe_Id uint `json:"operator_employe_id"`
Operator_Employe *eem.Employee `json:"operator_employe,omitempty" gorm:"foreignKey:Operator_Employe_Id;references:Id"`
Assistant_Employe_Id uint `json:"assistant_employe_id"`
Instrumentor_Employe_Id uint `json:"instrumentor_employe_id"`
Instrumentor_Employe *eem.Employee `json:"instrumentor_employe,omitempty" gorm:"foreignKey:Instrumentor_Employe_Id;references:Id"`
Diagnose *string `json:"diagnose" gorm:"size:1024"`
Nurse_Code string `json:"nurse_code" gorm:"size:10"`
Nurse *en.Nurse `json:"nurse,omitempty" gorm:"foreignKey:Nurse_Code;references:Code"`
Value string `json:"value"`
// SurgerySize_Code *string `json:"surgerySize_code" gorm:"size:10"`
// Billing_Code *string `json:"billing_code" gorm:"size:10"`
// SurgerySystem_Code *string `json:"surgerySystem_code" gorm:"size:10"`
// StartAt *string `json:"startAt" gorm:"size:20"`
// EndAt *string `json:"endAt" gorm:"size:20"`
// AnesthesiaStartAt *string `json:"anesthesiaStartAt" gorm:"size:20"`
// AnesthesiaEndAt *string `json:"anesthesiaEndAt" gorm:"size:20"`
// SurgeryType_Code *string `json:"surgeryType_code" gorm:"size:10"`
// SurgeryStage_Code *string `json:"surgeryStage_code" gorm:"size:10"`
// BornMortality_Code *string `json:"bornMortality_code" gorm:"size:10"`
// BornLocation_Code *string `json:"bornLocation_code" gorm:"size:10"`
// Weight *string `json:"weight" gorm:"size:10"`
// BornNotes *string `json:"bornNotes" gorm:"size:1024"`
// Description *string `json:"notes" gorm:"size:1024"`
// BleedingAmount *uint16 `json:"bleedingAmount" gorm:"size:10"`
// BloodInType_Code *string `json:"bloodInType_code" gorm:"size:10"`
// BloodInAmount *uint16 `json:"bloodInAmount" gorm:"size:10"`
// Brand *string `json:"brand" gorm:"size:100"`
// ImplantName *string `json:"implantName" gorm:"size:100"`
// ImplantRegisterNumber *string `json:"implantRegisterNumber" gorm:"size:100"`
// ImplantCompanionName *string `json:"implantCompanionName" gorm:"size:100"`
// SpecimentDest_Code *string `json:"specimentDest" gorm:"size:100"`
// TissueInfo *string `json:"tissueInfo" gorm:"size:100"`
}
@@ -0,0 +1,110 @@
package procedurereport
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
pa "simrs-vx/internal/lib/auth"
)
type CreateDto struct {
Encounter_Id uint64 `json:"encounter_id" validate:"required"`
Date *time.Time `json:"date" validate:"required"`
Doctor_Code string `json:"doctor_code" validate:"required"`
Operator_Name string `json:"operator_name" validate:"required"`
Assistant_Name string `json:"assistant_name" validate:"required"`
Instrumentor_Name string `json:"instrumentor_name" validate:"required"`
Anesthesia_Doctor_Code string `json:"anesthesia_doctor_code" validate:"required"`
Anesthesia_Nurse_Name string `json:"anesthesia_nurse_name" validate:"required"`
Diagnose *string `json:"diagnose"`
Nurse_Name string `json:"nurse_name" validate:"required"`
ProcedureValue string `json:"procedure_value" validate:"required"`
ExecutionValue string `json:"execution_value" validate:"required"`
Type string `json:"type" validate:"required"`
pa.AuthInfo
// PROPER
// Operator_Employe_Id uint `json:"operator_employe_id" validate:"required"`
// Assistant_Employe_Id uint `json:"assistant_employe_id" validate:"required"`
// Instrumentor_Employe_Id uint `json:"instrumentor_employe_id" validate:"required"`
// Anesthesia_Doctor_Code string `json:"anesthesia_doctor_code" validate:"required"`
// Anesthesia_Nurse_Employe_Id uint `json:"anesthesia_nurse_employe_id" validate:"required"`
// Nurse_Code string `json:"nurse_code" validate:"required"`
}
type ReadListDto struct {
FilterDto
Includes string `json:"includes"`
Pagination ecore.Pagination
}
type FilterDto struct {
Encounter_Id *uint `json:"encounter-id"`
}
type ReadDetailDto struct {
Id uint16 `json:"id"`
}
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
Encounter_Id uint64 `json:"encounter_id"`
Encounter *ee.Encounter `json:"encounter,omitempty"`
Date *time.Time `json:"date"`
Doctor_Code string `json:"doctor_code"`
Operator_Name string `json:"operator_name"`
Assistant_Name string `json:"assistant_name"`
Instrumentor_Name string `json:"instrumentor_name"`
Anesthesia_Doctor_Code string `json:"anesthesia_doctor_code"`
Anesthesia_Nurse_Name string `json:"anesthesia_nurse_name"`
Diagnose *string `json:"diagnose"`
Nurse_Name string `json:"nurse_name"`
ProcedureValue *string `json:"procedure_value"`
ExecutionValue *string `json:"execution_value"`
Type string `json:"type"`
}
func (d ProcedureReport) ToResponse() ResponseDto {
resp := ResponseDto{
Encounter_Id: d.Encounter_Id,
Encounter: d.Encounter,
Date: d.Date,
Doctor_Code: d.Doctor_Code,
Operator_Name: d.Operator_Name,
Assistant_Name: d.Assistant_Name,
Instrumentor_Name: d.Instrumentor_Name,
Anesthesia_Doctor_Code: d.Anesthesia_Doctor_Code,
Anesthesia_Nurse_Name: d.Anesthesia_Nurse_Name,
Nurse_Name: d.Nurse_Name,
ProcedureValue: &d.ProcedureValue,
ExecutionValue: &d.ExecutionValue,
Type: d.Type,
}
resp.Main = d.Main
return resp
}
func ToResponseList(data []ProcedureReport) []ResponseDto {
resp := make([]ResponseDto, len(data))
for i, u := range data {
resp[i] = u.ToResponse()
}
return resp
}
@@ -0,0 +1,68 @@
package procedurereport
import (
ecore "simrs-vx/internal/domain/base-entities/core"
ed "simrs-vx/internal/domain/main-entities/doctor"
eem "simrs-vx/internal/domain/main-entities/employee"
ee "simrs-vx/internal/domain/main-entities/encounter"
"time"
)
type ProcedureReport struct {
ecore.Main // adjust this according to the needs
Encounter_Id uint64 `json:"encounter_id" gorm:"foreignKey"`
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
Date *time.Time `json:"date" gorm:"not null;size:20"`
Doctor_Code string `json:"doctor_code" gorm:"size:10"`
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
Operator_Name string `json:"operator_name"`
Assistant_Name string `json:"assistant_name"`
Instrumentor_Name string `json:"instrumentor_name"`
Diagnose *string `json:"diagnose" gorm:"size:1024"`
Nurse_Name string `json:"nurse_code" gorm:"size:10"`
Anesthesia_Doctor_Code string `json:"anesthesia_doctor_code" gorm:"size:10"`
Anesthesia *eem.Employee `json:"anesthesia,omitempty" gorm:"foreignKey:Anesthesia_Doctor_Code;references:Code"`
Anesthesia_Nurse_Name string `json:"anesthesia_nurse_name"`
ProcedureValue string `json:"procedure_value"`
ExecutionValue string `json:"execution_value"`
Type string `json:"type"`
// SurgerySize_Code *string `json:"surgerySize_code" gorm:"size:10"`
// Billing_Code *string `json:"billing_code" gorm:"size:10"`
// SurgerySystem_Code *string `json:"surgerySystem_code" gorm:"size:10"`
// StartAt *string `json:"startAt" gorm:"size:20"`
// EndAt *string `json:"endAt" gorm:"size:20"`
// AnesthesiaStartAt *string `json:"anesthesiaStartAt" gorm:"size:20"`
// AnesthesiaEndAt *string `json:"anesthesiaEndAt" gorm:"size:20"`
// SurgeryType_Code *string `json:"surgeryType_code" gorm:"size:10"`
// SurgeryStage_Code *string `json:"surgeryStage_code" gorm:"size:10"`
// BornMortality_Code *string `json:"bornMortality_code" gorm:"size:10"`
// BornLocation_Code *string `json:"bornLocation_code" gorm:"size:10"`
// Weight *string `json:"weight" gorm:"size:10"`
// BornNotes *string `json:"bornNotes" gorm:"size:1024"`
// Description *string `json:"notes" gorm:"size:1024"`
// BleedingAmount *uint16 `json:"bleedingAmount" gorm:"size:10"`
// BloodInType_Code *string `json:"bloodInType_code" gorm:"size:10"`
// BloodInAmount *uint16 `json:"bloodInAmount" gorm:"size:10"`
// Brand *string `json:"brand" gorm:"size:100"`
// ImplantName *string `json:"implantName" gorm:"size:100"`
// ImplantRegisterNumber *string `json:"implantRegisterNumber" gorm:"size:100"`
// ImplantCompanionName *string `json:"implantCompanionName" gorm:"size:100"`
// SpecimentDest_Code *string `json:"specimentDest" gorm:"size:100"`
// TissueInfo *string `json:"tissueInfo" gorm:"size:100"`
//PROPER
// Doctor_Code string `json:"doctor_code" gorm:"size:10"`
// Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
// Operator_Employe_Id uint `json:"operator_employe_id"`
// Operator_Employe *eem.Employee `json:"operator_employe,omitempty" gorm:"foreignKey:Operator_Employe_Id;references:Id"`
// Assistant_Employe_Id uint `json:"assistant_employe_id"`
// Instrumentor_Employe_Id uint `json:"instrumentor_employe_id"`
// Instrumentor_Employe *eem.Employee `json:"instrumentor_employe,omitempty" gorm:"foreignKey:Instrumentor_Employe_Id;references:Id"`
// Nurse_Code string `json:"nurse_code" gorm:"size:10"`
// Nurse *en.Nurse `json:"nurse,omitempty" gorm:"foreignKey:Nurse_Code;references:Code"`
// Anesthesia_Doctor_Code string `json:"anesthesia_doctor_code" gorm:"size:10"`
// Anesthesia *eem.Employee `json:"anesthesia,omitempty" gorm:"foreignKey:Anesthesia_Doctor_Code;references:Code"`
// Anesthesia_Nurse_Employe_Id uint `json:"anesthesia_nurse_employe_id"`
// Anesthesia_Nurse *eem.Employee `json:"anesthesia_nurse,omitempty" gorm:"foreignKey:Anesthesia_Nurse_Employe_Id;references:Id"`
}
+21 -18
View File
@@ -204,26 +204,26 @@ const (
MSCMicroLab McuScopeCode = "micro-lab"
MSCApLab McuScopeCode = "ap-lab"
SSCSmall SurgerySizeCode = ""
SSCMedium SurgerySizeCode = ""
SSCLarge SurgerySizeCode = ""
SSCSpecial SurgerySizeCode = ""
SSCSmall SurgerySizeCode = "small"
SSCMedium SurgerySizeCode = "medium"
SSCLarge SurgerySizeCode = "large"
SSCSpecial SurgerySizeCode = "special"
SSyCCito SurgerySystemCode = ""
SSyCUrgent SurgerySystemCode = ""
SSyCEfective SurgerySystemCode = ""
SSyCSpecial SurgerySystemCode = ""
SSyCCito SurgerySystemCode = "cito"
SSyCUrgent SurgerySystemCode = "urgent"
SSyCEfective SurgerySystemCode = "efective"
SSyCSpecial SurgerySystemCode = "special"
STCClean SurgeryTypeCode = ""
STCCleanCtm SurgeryTypeCode = ""
STCUncleanCtm SurgeryTypeCode = ""
STCUnclean SurgeryTypeCode = ""
STCClean SurgeryTypeCode = "clean"
STCCleanCtm SurgeryTypeCode = "clean-ctm"
STCUncleanCtm SurgeryTypeCode = "unclean-ctm"
STCUnclean SurgeryTypeCode = "unclean"
SStCFirst SurgeryStageCode = ""
SStCRepeat SurgeryStageCode = ""
SStCFirst SurgeryStageCode = "first"
SStCRepeat SurgeryStageCode = "repeat"
BMCAlive BornMortalityCode = ""
BMCDead BornMortalityCode = ""
BMCAlive BornMortalityCode = "alive"
BMCDead BornMortalityCode = "dead"
BLCExtMiw BornLocationCode = ""
BLCExtDoc BornLocationCode = ""
@@ -360,8 +360,11 @@ type HeadToToe struct {
BodyOthers string `json:"body-others,omitempty"`
}
type RecordAction struct {
Procedures []string `json:"procedures"`
type ProcedureRecord struct {
Procedures []CodeWithName `json:"procedures"`
}
type ProcedureExecution struct {
SurgerySize_Code *string `json:"surgerySize_code"`
Billing_Code *string `json:"billing_code"`
SurgerySystem_Code *string `json:"surgerySystem_code"`