forked from ebhomengo/niki
69 lines
2.0 KiB
Go
69 lines
2.0 KiB
Go
package analytic
|
|
|
|
import (
|
|
"git.gocasts.ir/ebhomengo/niki/patientapp/service/entity"
|
|
)
|
|
|
|
type ListPatientAnalyticRequest struct {
|
|
// All fields are optional
|
|
MinAge *int `json:"minAge,omitempty"`
|
|
MaxAge *int `json:"maxAge,omitempty"`
|
|
Sex *entity.Sex `json:"sex,omitempty"`
|
|
|
|
City *int64 `json:"city,omitempty"`
|
|
Province *int64 `json:"province,omitempty"`
|
|
|
|
Search *string `json:"search,omitempty"`
|
|
|
|
Limit int `json:"limit,omitempty"`
|
|
Offset int `json:"offset,omitempty"`
|
|
}
|
|
|
|
type PatientAnalyticItem struct {
|
|
ID int64 `json:"id"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"Last_name"`
|
|
DateOfBirth string `json:"dob,omitempty"`
|
|
Sex entity.Sex `json:"sex"`
|
|
Phone string `json:"phone"`
|
|
Address entity.Address `json:"address"`
|
|
}
|
|
type PatientAnalyticResponse struct {
|
|
Items []PatientAnalyticItem `json:"items"`
|
|
Limit int `json:"limit"`
|
|
Offset int `json:"offset"`
|
|
Total int `json:"total"`
|
|
}
|
|
|
|
func ToPatientResponse(patient entity.Patient) PatientAnalyticItem {
|
|
return PatientAnalyticItem{
|
|
ID: patient.ID,
|
|
FirstName: patient.FirstName,
|
|
LastName: patient.LastName,
|
|
DateOfBirth: patient.DateOfBirth,
|
|
Sex: patient.Sex,
|
|
Phone: patient.Phone,
|
|
Address: entity.Address{
|
|
ProvinceID: patient.Address.ProvinceID,
|
|
CityID: patient.Address.CityID,
|
|
},
|
|
}
|
|
}
|
|
|
|
// =========================== Map ==================================
|
|
|
|
type GetPatientMapSummaryRequest struct {
|
|
Level entity.MapLevel `json:"level"`
|
|
ParentID *int `json:"parentID"`
|
|
|
|
MinAge *int `json:"minAge,omitempty"`
|
|
MaxAge *int `json:"maxAge,omitempty"`
|
|
Sex *entity.Sex `json:"sex,omitempty"`
|
|
Search *string `json:"search,omitempty"`
|
|
}
|
|
|
|
type GetPatientMapSummaryResponse struct {
|
|
Level entity.MapLevel `json:"level"`
|
|
Items []entity.MapSummaryItem `json:"items"`
|
|
}
|