feat (encounter): update entity and adjust

This commit is contained in:
dpurbosakti
2025-10-14 13:23:58 +07:00
parent 467ed1401e
commit 9c49b90bb6
3 changed files with 33 additions and 3 deletions

No files matched your search

@@ -4,8 +4,10 @@ import (
"time"
ecore "simrs-vx/internal/domain/base-entities/core"
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"
ee "simrs-vx/internal/domain/main-entities/employee"
ep "simrs-vx/internal/domain/main-entities/patient"
es "simrs-vx/internal/domain/main-entities/specialist"
ess "simrs-vx/internal/domain/main-entities/subspecialist"
@@ -25,7 +27,13 @@ type CreateDto struct {
Specialist_Id *uint16 `json:"specialist_id"`
Subspecialist_Id *uint16 `json:"subspecialist_id"`
VisitDate time.Time `json:"visitDate"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code" gorm:"size:10"`
InsuranceCompany_Id *uint `json:"insuranceCompany_id"`
Member_Number *string `json:"memberNumber" validate:"maxLength=20"`
Ref_Number *string `json:"refNumber" validate:"maxLength=20"`
Trx_Number *string `json:"trxNumber" validate:"maxLength=20"`
Appointment_Doctor_Id *uint `json:"appointment_doctor_id"`
Adm_Employee_Id *uint `json:"adm_employee_id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
RefSource_Name *string `json:"refSource_name" validate:"maxLength=100"`
Appointment_Id *uint `json:"appointment_id"`
@@ -97,10 +105,17 @@ type ResponseDto struct {
Subspecialist *ess.Subspecialist `json:"subspecialist,omitempty"`
Unit *eu.Unit `json:"unit,omitempty"`
VisitDate time.Time `json:"visitDate"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code"`
InsuranceCompany_Id *uint `json:"insuranceCompany_id"`
Member_Number *string `json:"memberNumber"`
Ref_Number *string `json:"refNumber"`
Trx_Number *string `json:"trxNumber"`
Appointment_Doctor_Id *uint `json:"assignment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"assignment_doctor,omitempty"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty"`
Adm_Employee_Id *uint `json:"adm_employee_id"`
Adm_Employee *ee.Employee `json:"adm_employee,omitempty"`
DischargeMethod_Code *ere.DischargeMethodCode `json:"dischargeMethod_code"`
RefSource_Name *string `json:"refSource_name"`
Appointment_Id *uint `json:"appointment_id"`
@@ -110,6 +125,7 @@ type ResponseDto struct {
AdmDischargeEducation *string `json:"admDischargeEducation"`
DischargeReason *string `json:"dischargeReason"`
Status_Code erc.DataStatusCode `json:"status_code"`
VclaimSep *evs.VClaimSep `json:"vclaimSep,omitempty"`
}
func (d Encounter) ToResponse() ResponseDto {
@@ -125,8 +141,15 @@ func (d Encounter) ToResponse() ResponseDto {
Subspecialist_Id: d.Subspecialist_Id,
Subspecialist: d.Subspecialist,
VisitDate: d.VisitDate,
PaymentMethod_Code: d.PaymentMethod_Code,
InsuranceCompany_Id: d.InsuranceCompany_Id,
Member_Number: d.Member_Number,
Ref_Number: d.Ref_Number,
Trx_Number: d.Trx_Number,
Appointment_Doctor_Id: d.Appointment_Doctor_Id,
Appointment_Doctor: d.Appointment_Doctor,
Adm_Employee_Id: d.Adm_Employee_Id,
Adm_Employee: d.Adm_Employee,
Responsible_Doctor_Id: d.Responsible_Doctor_Id,
Responsible_Doctor: d.Responsible_Doctor,
DischargeMethod_Code: d.DischargeMethod_Code,
@@ -138,6 +161,7 @@ func (d Encounter) ToResponse() ResponseDto {
AdmDischargeEducation: d.AdmDischargeEducation,
DischargeReason: d.DischargeReason,
Status_Code: d.Status_Code,
VclaimSep: d.VclaimSep,
}
resp.Main = d.Main
return resp
@@ -32,14 +32,14 @@ type Encounter struct {
VisitDate time.Time `json:"visitDate"`
PaymentMethod_Code erc.PaymentMethodCode `json:"paymentMethod_code" gorm:"size:10"`
InsuranceCompany_Id *uint `json:"insuranceCompany_id"`
InsuranceCompany *ei.InsuranceCompany `json:"insuranceCompany,omitempty" gorm:"foreignKey:InsuranceCompany_Id;references:Id"`
Member_Number *string `json:"memberNumber" gorm:"unique;size:20"`
Ref_Number *string `json:"refNumber" gorm:"unique;size:20"`
Trx_Number *string `json:"trxNumber" gorm:"unique;size:20"`
InsuranceCompany *ei.InsuranceCompany `json:"insuranceCompany,omitempty" gorm:"foreignKey:InsuranceCompany_Id;references:Id"`
Appointment_Doctor_Id *uint `json:"appointment_doctor_id"`
Appointment_Doctor *ed.Doctor `json:"appointment_doctor,omitempty" gorm:"foreignKey:Appointment_Doctor_Id;references:Id"`
Adm_Employee_Id *uint `json:"admEmployee_id"`
Adm_Employee *ee.Employee `json:"admEmployee,omitempty" gorm:"foreignKey:Adm_Employee_Id;references:Id"`
Adm_Employee_Id *uint `json:"adm_employee_id"`
Adm_Employee *ee.Employee `json:"adm_employee,omitempty" gorm:"foreignKey:Adm_Employee_Id;references:Id"`
Responsible_Doctor_Id *uint `json:"responsible_doctor_id"`
Responsible_Doctor *ed.Doctor `json:"responsible_doctor,omitempty" gorm:"foreignKey:Responsible_Doctor_Id;references:Id"`
DischargeMethod_Code *ere.DischargeMethodCode `json:"dischargeMethod_code" gorm:"size:16"`