1 Commits
5 changed files with 1872 additions and 1757 deletions

No files matched your search

File diff suppressed because it is too large Load diff
File diff suppressed because it is too large Load diff
+52 -134
View File
@@ -90,29 +90,24 @@ import (
// Patient represents the data structure for the patient table // Patient represents the data structure for the patient table
// with proper null handling and optimized JSON marshaling // with proper null handling and optimized JSON marshaling
type Patient struct { type Patient struct {
ID int64 `json:"id" db:"id"` ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name,omitempty" db:"name"` Name sql.NullString `json:"name,omitempty" db:"name"`
MedicalRecordNumber sql.NullString `json:"medical_record_number,omitempty" db:"medical_record_number"` MedicalRecordNumber sql.NullString `json:"medical_record_number,omitempty" db:"medical_record_number"`
PhoneNumber sql.NullString `json:"phone_number,omitempty" db:"phone_number"` PhoneNumber sql.NullString `json:"phone_number,omitempty" db:"phone_number"`
Gender sql.NullString `json:"gender,omitempty" db:"gender"` Gender sql.NullString `json:"gender,omitempty" db:"gender"`
BirthDate sql.NullTime `json:"birth_date,omitempty" db:"birth_date"` BirthDate sql.NullTime `json:"birth_date,omitempty" db:"birth_date"`
Address sql.NullString `json:"address,omitempty" db:"address"` Address sql.NullString `json:"address,omitempty" db:"address"`
Active sql.NullBool `json:"active,omitempty" db:"active"` Active sql.NullBool `json:"active,omitempty" db:"active"`
FKSdProvinsiID sql.NullInt64 `json:"fk_sd_provinsi_id,omitempty" db:"fk_sd_provinsi_id"` FKSdProvinsiID models.NullableInt32 `json:"fk_sd_provinsi_id,omitempty" db:"fk_sd_provinsi_id"`
FKSdKabupatenKotaID sql.NullInt64 `json:"fk_sd_kabupaten_kota_id,omitempty" db:"fk_sd_kabupaten_kota_id"` FKSdKabupatenKotaID models.NullableInt32 `json:"fk_sd_kabupaten_kota_id,omitempty" db:"fk_sd_kabupaten_kota_id"`
FKSdKecamatanID sql.NullInt64 `json:"fk_sd_kecamatan_id,omitempty" db:"fk_sd_kecamatan_id"` FKSdKecamatanID models.NullableInt32 `json:"fk_sd_kecamatan_id,omitempty" db:"fk_sd_kecamatan_id"`
FKSdKelurahanID sql.NullInt64 `json:"fk_sd_kelurahan_id,omitempty" db:"fk_sd_kelurahan_id"` FKSdKelurahanID models.NullableInt32 `json:"fk_sd_kelurahan_id,omitempty" db:"fk_sd_kelurahan_id"`
DsSdProvinsi sql.NullString `json:"ds_sd_provinsi,omitempty" db:"ds_sd_provinsi"` DsSdProvinsi sql.NullString `json:"ds_sd_provinsi,omitempty" db:"ds_sd_provinsi"`
DsSdKabupatenKota sql.NullString `json:"ds_sd_kabupaten_kota,omitempty" db:"ds_sd_kabupaten_kota"` DsSdKabupatenKota sql.NullString `json:"ds_sd_kabupaten_kota,omitempty" db:"ds_sd_kabupaten_kota"`
DsSdKecamatan sql.NullString `json:"ds_sd_kecamatan,omitempty" db:"ds_sd_kecamatan"` DsSdKecamatan sql.NullString `json:"ds_sd_kecamatan,omitempty" db:"ds_sd_kecamatan"`
DsSdKelurahan sql.NullString `json:"ds_sd_kelurahan,omitempty" db:"ds_sd_kelurahan"` DsSdKelurahan sql.NullString `json:"ds_sd_kelurahan,omitempty" db:"ds_sd_kelurahan"`
// ProvinsiName sql.NullString `json:"Provinsi,omitempty" db:"Provinsi"` Attachments []PatientAttachment `json:"attachments,omitempty"`
// KabupatenKotaName sql.NullString `json:"Kabupaten_kota,omitempty" db:"Kabupaten_kota"` PaymentTypes []PatientPaymentType `json:"payment_types,omitempty"`
// KecamatanName sql.NullString `json:"Kecamatan,omitempty" db:"Kecamatan"`
// KelurahanName sql.NullString `json:"Desa_kelurahan,omitempty" db:"Desa_kelurahan"`
Attachments []PatientAttachment `json:"attachments,omitempty"`
PaymentTypes []PatientPaymentType `json:"payment_types,omitempty"`
Visits []PatientVisit `json:"visits,omitempty"`
} }
type PatientPaymentType struct { type PatientPaymentType struct {
@@ -133,17 +128,6 @@ type PatientAttachment struct {
FKMsPatientID models.NullableInt32 `json:"fk_ms_patient_id,omitempty" db:"fk_ms_patient_id"` FKMsPatientID models.NullableInt32 `json:"fk_ms_patient_id,omitempty" db:"fk_ms_patient_id"`
} }
type PatientVisit struct {
ID int64 `json:"id" db:"id"`
Barcode models.NullableInt32 `json:"barcode,omitempty" db:"barcode"`
RegistrationDate sql.NullTime `json:"registration_date,omitempty" db:"registration_date"`
ServiceDate sql.NullTime `json:"service_date,omitempty" db:"service_date"`
CheckInDate sql.NullTime `json:"check_in_date,omitempty" db:"check_in_date"`
CheckIn sql.NullBool `json:"check_in,omitempty" db:"check_in"`
Active sql.NullBool `json:"active,omitempty" db:"active"`
FKMsPatientID models.NullableInt32 `json:"fk_ms_patient_id,omitempty" db:"fk_ms_patient_id"`
}
// Custom JSON marshaling untuk Patient agar NULL values tidak muncul di response // Custom JSON marshaling untuk Patient agar NULL values tidak muncul di response
func (r Patient) MarshalJSON() ([]byte, error) { func (r Patient) MarshalJSON() ([]byte, error) {
type Alias Patient type Alias Patient
@@ -155,10 +139,10 @@ func (r Patient) MarshalJSON() ([]byte, error) {
BirthDate *string `json:"birth_date,omitempty"` BirthDate *string `json:"birth_date,omitempty"`
Address *string `json:"address,omitempty"` Address *string `json:"address,omitempty"`
Active *bool `json:"active,omitempty"` Active *bool `json:"active,omitempty"`
FKSdProvinsiID *int `json:"fk_sd_provinsi_id,omitempty"` FKSdProvinsiID *int32 `json:"fk_sd_provinsi_id,omitempty"`
FKSdKabupatenKotaID *int `json:"fk_sd_kabupaten_kota_id,omitempty"` FKSdKabupatenKotaID *int32 `json:"fk_sd_kabupaten_kota_id,omitempty"`
FKSdKecamatanID *int `json:"fk_sd_kecamatan_id,omitempty"` FKSdKecamatanID *int32 `json:"fk_sd_kecamatan_id,omitempty"`
FKSdKelurahanID *int `json:"fk_sd_kelurahan_id,omitempty"` FKSdKelurahanID *int32 `json:"fk_sd_kelurahan_id,omitempty"`
DsSdProvinsi *string `json:"ds_sd_provinsi,omitempty"` DsSdProvinsi *string `json:"ds_sd_provinsi,omitempty"`
DsSdKabupatenKota *string `json:"ds_sd_kabupaten_kota,omitempty"` DsSdKabupatenKota *string `json:"ds_sd_kabupaten_kota,omitempty"`
DsSdKecamatan *string `json:"ds_sd_kecamatan,omitempty"` DsSdKecamatan *string `json:"ds_sd_kecamatan,omitempty"`
@@ -191,19 +175,19 @@ func (r Patient) MarshalJSON() ([]byte, error) {
aux.Active = &r.Active.Bool aux.Active = &r.Active.Bool
} }
if r.FKSdProvinsiID.Valid { if r.FKSdProvinsiID.Valid {
fksp := int(r.FKSdProvinsiID.Int64) fksp := int32(r.FKSdProvinsiID.Int32)
aux.FKSdProvinsiID = &fksp aux.FKSdProvinsiID = &fksp
} }
if r.FKSdKabupatenKotaID.Valid { if r.FKSdKabupatenKotaID.Valid {
fksk := int(r.FKSdKabupatenKotaID.Int64) fksk := int32(r.FKSdKabupatenKotaID.Int32)
aux.FKSdKabupatenKotaID = &fksk aux.FKSdKabupatenKotaID = &fksk
} }
if r.FKSdKecamatanID.Valid { if r.FKSdKecamatanID.Valid {
fksc := int(r.FKSdKecamatanID.Int64) fksc := int32(r.FKSdKecamatanID.Int32)
aux.FKSdKecamatanID = &fksc aux.FKSdKecamatanID = &fksc
} }
if r.FKSdKelurahanID.Valid { if r.FKSdKelurahanID.Valid {
fksl := int(r.FKSdKelurahanID.Int64) fksl := int32(r.FKSdKelurahanID.Int32)
aux.FKSdKelurahanID = &fksl aux.FKSdKelurahanID = &fksl
} }
if r.DsSdProvinsi.Valid { if r.DsSdProvinsi.Valid {
@@ -287,50 +271,6 @@ func (r PatientAttachment) MarshalJSON() ([]byte, error) {
return json.Marshal(aux) return json.Marshal(aux)
} }
func (r PatientVisit) MarshalJSON() ([]byte, error) {
type Alias PatientVisit
aux := &struct {
*Alias
Barcode *int `json:"barcode,omitempty"`
RegistrationDate *string `json:"registration_date,omitempty"`
ServiceDate *string `json:"service_date,omitempty"`
CheckInDate *string `json:"check_in_date,omitempty"`
CheckIn *bool `json:"check_in,omitempty"`
Active *bool `json:"active,omitempty"`
FKMsPatientID *int `json:"fk_ms_patient_id,omitempty"`
}{
Alias: (*Alias)(&r),
}
if r.Barcode.Valid {
barcode := int(r.Barcode.Int32)
aux.Barcode = &barcode
}
if r.RegistrationDate.Valid {
regDateStr := r.RegistrationDate.Time.Format(time.RFC3339)
aux.RegistrationDate = &regDateStr
}
if r.ServiceDate.Valid {
svcDateStr := r.ServiceDate.Time.Format(time.RFC3339)
aux.ServiceDate = &svcDateStr
}
if r.CheckInDate.Valid {
checkInDateStr := r.CheckInDate.Time.Format(time.RFC3339)
aux.CheckInDate = &checkInDateStr
}
if r.CheckIn.Valid {
aux.CheckIn = &r.CheckIn.Bool
}
if r.Active.Valid {
aux.Active = &r.Active.Bool
}
if r.FKMsPatientID.Valid {
fkmp := int(r.FKMsPatientID.Int32)
aux.FKMsPatientID = &fkmp
}
return json.Marshal(aux)
}
// Helper methods untuk mendapatkan nilai yang aman // Helper methods untuk mendapatkan nilai yang aman
func (r *Patient) GetName() string { func (r *Patient) GetName() string {
if r.Name.Valid { if r.Name.Valid {
@@ -363,41 +303,20 @@ type PatientCreateRequest struct {
BirthDate *time.Time `json:"birth_date"` BirthDate *time.Time `json:"birth_date"`
Address *string `json:"address" validate:"min=1,max=255"` Address *string `json:"address" validate:"min=1,max=255"`
Active *bool `json:"active"` Active *bool `json:"active"`
FKSdProvinsiID *int `json:"fk_sd_provinsi_id"` FKSdProvinsiID *int32 `json:"fk_sd_provinsi_id"`
FKSdKabupatenKotaID *int `json:"fk_sd_kabupaten_kota_id"` FKSdKabupatenKotaID *int32 `json:"fk_sd_kabupaten_kota_id"`
FKSdKecamatanID *int `json:"fk_sd_kecamatan_id"` FKSdKecamatanID *int32 `json:"fk_sd_kecamatan_id"`
FKSdKelurahanID *int `json:"fk_sd_kelurahan_id"` FKSdKelurahanID *int32 `json:"fk_sd_kelurahan_id"`
DsSdProvinsi *string `json:"ds_sd_provinsi"` DsSdProvinsi *string `json:"ds_sd_provinsi" validate:"min=1,max=255"`
DsSdKabupatenKota *string `json:"ds_sd_kabupaten_kota"` DsSdKabupatenKota *string `json:"ds_sd_kabupaten_kota" validate:"min=1,max=255"`
DsSdKecamatan *string `json:"ds_sd_kecamatan"` DsSdKecamatan *string `json:"ds_sd_kecamatan" validate:"min=1,max=255"`
DsSdKelurahan *string `json:"ds_sd_kelurahan"` DsSdKelurahan *string `json:"ds_sd_kelurahan" validate:"min=1,max=255"`
Attachments []PatientAttachmentCreateRequest `json:"attachments,omitempty"` Attachments []PatientAttachmentCreateRequest `json:"attachments,omitempty"`
Payments []PatientPaymentTypeCreateRequest `json:"payment_types,omitempty"` Payments []PatientPaymentTypeCreateRequest `json:"payment_types,omitempty"`
Visits []VisitCreateRequest `json:"visits,omitempty"`
}
type VisitCreateRequest struct {
// ID *int `json:"id"`
Barcode *int32 `json:"barcode" validate:"omitempty,min=1"`
RegistrationDate *time.Time `json:"registration_date" validate:"omitempty"`
ServiceDate *time.Time `json:"service_date" validate:"omitempty"`
CheckInDate *time.Time `json:"check_in_date" validate:"omitempty"`
CheckIn *bool `json:"check_in" validate:"omitempty"`
Active *bool `json:"active" validate:"omitempty"`
}
type VisitUpdateRequest struct {
ID *int `json:"id" validate:"required"`
Barcode *int32 `json:"barcode" validate:"omitempty,min=1"`
RegistrationDate *time.Time `json:"registration_date" validate:"omitempty"`
ServiceDate *time.Time `json:"service_date" validate:"omitempty"`
CheckInDate *time.Time `json:"check_in_date" validate:"omitempty"`
CheckIn *bool `json:"check_in" validate:"omitempty"`
Active *bool `json:"active" validate:"omitempty"`
} }
type PatientPostRequest struct { type PatientPostRequest struct {
// ID int64 `json:"id" validate:"required"` // ID int64 `json:"id" validate:"required,min=1"`
MedicalRecordNumber string `json:"medical_record_number" validate:"required,min=1"` MedicalRecordNumber string `json:"medical_record_number" validate:"required,min=1"`
} }
@@ -409,25 +328,24 @@ type PatientCreateResponse struct {
// Update request // Update request
type PatientUpdateRequest struct { type PatientUpdateRequest struct {
// ID *int `json:"-" validate:"required,min=1"` ID *int `json:"-" validate:"required,min=1"`
Name *string `json:"name"` Name *string `json:"name" validate:"min=1,max=100"`
MedicalRecordNumber *string `json:"medical_record_number" validate:"required,min=1,max=20"` MedicalRecordNumber *string `json:"medical_record_number" validate:"min=1,max=20"`
PhoneNumber *string `json:"phone_number"` PhoneNumber *string `json:"phone_number" validate:"min=1,max=20"`
Gender *string `json:"gender"` Gender *string `json:"gender" validate:"max=1"`
BirthDate *time.Time `json:"birth_date"` BirthDate *time.Time `json:"birth_date"`
Address *string `json:"address"` Address *string `json:"address" validate:"min=1,max=255"`
Active *bool `json:"active"` Active *bool `json:"active"`
FKSdProvinsiID *int `json:"fk_sd_provinsi_id"` FKSdProvinsiID *int32 `json:"fk_sd_provinsi_id"`
FKSdKabupatenKotaID *int `json:"fk_sd_kabupaten_kota_id"` FKSdKabupatenKotaID *int32 `json:"fk_sd_kabupaten_kota_id"`
FKSdKecamatanID *int `json:"fk_sd_kecamatan_id"` FKSdKecamatanID *int32 `json:"fk_sd_kecamatan_id"`
FKSdKelurahanID *int `json:"fk_sd_kelurahan_id"` FKSdKelurahanID *int32 `json:"fk_sd_kelurahan_id"`
DsSdProvinsi *string `json:"ds_sd_provinsi"` DsSdProvinsi *string `json:"ds_sd_provinsi" validate:"max=255"`
DsSdKabupatenKota *string `json:"ds_sd_kabupaten_kota"` DsSdKabupatenKota *string `json:"ds_sd_kabupaten_kota" validate:"max=255"`
DsSdKecamatan *string `json:"ds_sd_kecamatan"` DsSdKecamatan *string `json:"ds_sd_kecamatan" validate:"max=255"`
DsSdKelurahan *string `json:"ds_sd_kelurahan"` DsSdKelurahan *string `json:"ds_sd_kelurahan" validate:"max=255"`
Attachments []PatientAttachmentUpdateRequest `json:"attachments,omitempty"` Attachments []PatientAttachmentCreateRequest `json:"attachments,omitempty"`
Payments []PatientPaymentTypeUpdateRequest `json:"payment_types,omitempty"` Payments []PatientPaymentTypeCreateRequest `json:"payment_types,omitempty"`
Visits []VisitUpdateRequest `json:"visits,omitempty"`
} }
type PatientAttachmentCreateRequest struct { type PatientAttachmentCreateRequest struct {
@@ -443,7 +361,7 @@ type PatientPaymentTypeCreateRequest struct {
Name *string `json:"name" validate:"omitempty,min=1,max=20"` Name *string `json:"name" validate:"omitempty,min=1,max=20"`
Number *string `json:"number" validate:"omitempty,min=1,max=20"` Number *string `json:"number" validate:"omitempty,min=1,max=20"`
Active *bool `json:"active" validate:"omitempty"` Active *bool `json:"active" validate:"omitempty"`
FKRefPaymentType *int `json:"fk_ref_payment_type" validate:"omitempty,min=1"` FkRefPaymentType *int `json:"fk_ref_payment_type" validate:"omitempty,min=1"`
} }
type PatientAttachmentUpdateRequest struct { type PatientAttachmentUpdateRequest struct {
+355
View File
@@ -0,0 +1,355 @@
package referecnce
import (
"api-service/internal/models"
"database/sql"
"encoding/json"
)
// table ref_service_type table
type RefServiceType struct {
ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name,omitempty" db:"name"`
Active sql.NullBool `json:"active,omitempty" db:"active"`
}
// Custom JSON marshaling untuk RefServiceType agar NULL values tidak muncul di response
func (r RefServiceType) MarshalJSON() ([]byte, error) {
type Alias RefServiceType
aux := &struct {
*Alias
Name *string `json:"name,omitempty"`
Active *bool `json:"active,omitempty"`
}{
Alias: (*Alias)(&r),
}
if r.Name.Valid {
aux.Name = &r.Name.String
}
if r.Active.Valid {
aux.Active = &r.Active.Bool
}
return json.Marshal(aux)
}
// Helper methods untuk mendapatkan nilai yang aman
func (r *RefServiceType) GetName() string {
if r.Name.Valid {
return r.Name.String
}
return ""
}
func (r *RefServiceType) GetActive() bool {
if r.Active.Valid {
return r.Active.Bool
}
return false
}
// table ref_payment_type table
type RefPaymentType struct {
ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name,omitempty" db:"name"`
Active sql.NullBool `json:"active,omitempty" db:"active"`
}
// Custom JSON marshaling untuk RefPaymentType agar NULL values tidak muncul di response
func (r RefPaymentType) MarshalJSON() ([]byte, error) {
type Alias RefPaymentType
aux := &struct {
*Alias
Name *string `json:"name,omitempty"`
Active *bool `json:"active,omitempty"`
}{
Alias: (*Alias)(&r),
}
if r.Name.Valid {
aux.Name = &r.Name.String
}
if r.Active.Valid {
aux.Active = &r.Active.Bool
}
return json.Marshal(aux)
}
// Helper methods untuk mendapatkan nilai yang aman
func (r *RefPaymentType) GetName() string {
if r.Name.Valid {
return r.Name.String
}
return ""
}
func (r *RefPaymentType) GetActive() bool {
if r.Active.Valid {
return r.Active.Bool
}
return false
}
// table ref_visit_type table
type RefVisitType struct {
ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name,omitempty" db:"name"`
Active sql.NullBool `json:"active,omitempty" db:"active"`
}
// Custom JSON marshaling untuk RefVisitType agar NULL values tidak muncul di response
func (r RefVisitType) MarshalJSON() ([]byte, error) {
type Alias RefVisitType
aux := &struct {
*Alias
Name *string `json:"name,omitempty"`
Active *bool `json:"active,omitempty"`
}{
Alias: (*Alias)(&r),
}
if r.Name.Valid {
aux.Name = &r.Name.String
}
if r.Active.Valid {
aux.Active = &r.Active.Bool
}
return json.Marshal(aux)
}
// Helper methods untuk mendapatkan nilai yang aman
func (r *RefVisitType) GetName() string {
if r.Name.Valid {
return r.Name.String
}
return ""
}
func (r *RefVisitType) GetActive() bool {
if r.Active.Valid {
return r.Active.Bool
}
return false
}
// table ref_healthcare_type table
type RefHealthcareType struct {
ID int64 `json:"id" db:"id"`
Name sql.NullString `json:"name,omitempty" db:"name"`
Active sql.NullBool `json:"active,omitempty" db:"active"`
}
// Custom JSON marshaling untuk RefHealthcareType agar NULL values tidak muncul di response
func (r RefHealthcareType) MarshalJSON() ([]byte, error) {
type Alias RefHealthcareType
aux := &struct {
*Alias
Name *string `json:"name,omitempty"`
Active *bool `json:"active,omitempty"`
}{
Alias: (*Alias)(&r),
}
if r.Name.Valid {
aux.Name = &r.Name.String
}
if r.Active.Valid {
aux.Active = &r.Active.Bool
}
return json.Marshal(aux)
}
// Helper methods untuk mendapatkan nilai yang aman
func (r *RefHealthcareType) GetName() string {
if r.Name.Valid {
return r.Name.String
}
return ""
}
func (r *RefHealthcareType) GetActive() bool {
if r.Active.Valid {
return r.Active.Bool
}
return false
}
// Response structs for RefServiceType
type RefServiceTypeGetByIDResponse struct {
Message string `json:"message"`
Data *RefServiceType `json:"data"`
}
type RefServiceTypeGetResponse struct {
Message string `json:"message"`
Data []RefServiceType `json:"data"`
Meta models.MetaResponse `json:"meta"`
Summary *models.AggregateData `json:"summary,omitempty"`
}
type RefServiceTypeCreateRequest struct {
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefServiceTypeCreateResponse struct {
Message string `json:"message"`
Data *RefServiceType `json:"data"`
}
type RefServiceTypeUpdateRequest struct {
ID *int `json:"-" validate:"required,min=1"`
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefServiceTypeUpdateResponse struct {
Message string `json:"message"`
Data *RefServiceType `json:"data"`
}
type RefServiceTypeDeleteResponse struct {
Message string `json:"message"`
ID string `json:"id"`
}
type RefServiceTypeFilter struct {
Status *string `json:"status,omitempty" form:"status"`
Search *string `json:"search,omitempty" form:"search"`
}
// Response structs for RefPaymentType
type RefPaymentTypeGetByIDResponse struct {
Message string `json:"message"`
Data *RefPaymentType `json:"data"`
}
type RefPaymentTypeGetResponse struct {
Message string `json:"message"`
Data []RefPaymentType `json:"data"`
Meta models.MetaResponse `json:"meta"`
Summary *models.AggregateData `json:"summary,omitempty"`
}
type RefPaymentTypeCreateRequest struct {
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefPaymentTypeCreateResponse struct {
Message string `json:"message"`
Data *RefPaymentType `json:"data"`
}
type RefPaymentTypeUpdateRequest struct {
ID *int `json:"-" validate:"required,min=1"`
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefPaymentTypeUpdateResponse struct {
Message string `json:"message"`
Data *RefPaymentType `json:"data"`
}
type RefPaymentTypeDeleteResponse struct {
Message string `json:"message"`
ID string `json:"id"`
}
type RefPaymentTypeFilter struct {
Status *string `json:"status,omitempty" form:"status"`
Search *string `json:"search,omitempty" form:"search"`
}
// Response structs for RefVisitType
type RefVisitTypeGetByIDResponse struct {
Message string `json:"message"`
Data *RefVisitType `json:"data"`
}
type RefVisitTypeGetResponse struct {
Message string `json:"message"`
Data []RefVisitType `json:"data"`
Meta models.MetaResponse `json:"meta"`
Summary *models.AggregateData `json:"summary,omitempty"`
}
type RefVisitTypeCreateRequest struct {
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefVisitTypeCreateResponse struct {
Message string `json:"message"`
Data *RefVisitType `json:"data"`
}
type RefVisitTypeUpdateRequest struct {
ID *int `json:"-" validate:"required,min=1"`
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefVisitTypeUpdateResponse struct {
Message string `json:"message"`
Data *RefVisitType `json:"data"`
}
type RefVisitTypeDeleteResponse struct {
Message string `json:"message"`
ID string `json:"id"`
}
type RefVisitTypeFilter struct {
Status *string `json:"status,omitempty" form:"status"`
Search *string `json:"search,omitempty" form:"search"`
}
// Response structs for RefHealthcareType
type RefHealthcareTypeGetByIDResponse struct {
Message string `json:"message"`
Data *RefHealthcareType `json:"data"`
}
type RefHealthcareTypeGetResponse struct {
Message string `json:"message"`
Data []RefHealthcareType `json:"data"`
Meta models.MetaResponse `json:"meta"`
Summary *models.AggregateData `json:"summary,omitempty"`
}
type RefHealthcareTypeCreateRequest struct {
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefHealthcareTypeCreateResponse struct {
Message string `json:"message"`
Data *RefHealthcareType `json:"data"`
}
type RefHealthcareTypeUpdateRequest struct {
ID *int `json:"-" validate:"required,min=1"`
Name *string `json:"name" validate:"required,min=1,max=20"`
Active *bool `json:"active"`
}
type RefHealthcareTypeUpdateResponse struct {
Message string `json:"message"`
Data *RefHealthcareType `json:"data"`
}
type RefHealthcareTypeDeleteResponse struct {
Message string `json:"message"`
ID string `json:"id"`
}
type RefHealthcareTypeFilter struct {
Status *string `json:"status,omitempty" form:"status"`
Search *string `json:"search,omitempty" form:"search"`
}
+5 -4
View File
@@ -195,11 +195,12 @@ func RegisterRoutes(cfg *config.Config) *gin.Engine {
patientMspatientHandler := patientMspatientHandlers.NewPatientHandler() patientMspatientHandler := patientMspatientHandlers.NewPatientHandler()
patientMspatientGroup := v1.Group("/patient") patientMspatientGroup := v1.Group("/patient")
{ {
patientMspatientGroup.PUT("/:medical_record_number", patientMspatientHandler.UpdatePatient) // patientMspatientGroup.GET("/", patientMspatientHandler.GetMs_patient)
patientMspatientGroup.DELETE("/:medical_record_number", patientMspatientHandler.DeletePatient) // patientMspatientGroup.POST("/", patientMspatientHandler.CreateMs_patient)
// patientMspatientGroup.PUT("/:medical_record_number", patientMspatientHandler.UpdateMs_patient)
// patientMspatientGroup.DELETE("/:medical_record_number", patientMspatientHandler.DeleteMs_patient)
patientMspatientGroup.GET("/", patientMspatientHandler.GetPatient) patientMspatientGroup.GET("/", patientMspatientHandler.GetPatient)
patientMspatientGroup.POST("/detail", patientMspatientHandler.GetPatientByMedicalRecordNumberPost) patientMspatientGroup.POST("/detail", patientMspatientHandler.GetPatientByIDPost)
patientMspatientGroup.POST("/", patientMspatientHandler.CreatePatient)
} }
// ============================================================================= // =============================================================================