first commit
This commit is contained in:
No files matched your search
@@ -0,0 +1,125 @@
|
||||
package master
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TicketQueue struct {
|
||||
ID int64 `json:"id" db:"id"`
|
||||
HealthcareServiceCode sql.NullString `json:"healthcare_service_code" db:"healtcare_service_code"`
|
||||
Ticket string `json:"ticket" db:"ticket"`
|
||||
DatetimeStart time.Time `json:"datetime_start" db:"datetime_start"`
|
||||
VisitCode string `json:"visit_code" db:"visit_code"`
|
||||
HealthcareServiceName sql.NullString `json:"healthcare_service_name" db:"name"`
|
||||
HealthcareServiceCodeMS sql.NullString `json:"healthcare_service_code_ms" db:"code"`
|
||||
ShiftNumber sql.NullInt64 `json:"shift_number" db:"shift_number"`
|
||||
PaymentTypeName sql.NullString `json:"payment_type_name" db:"payment"`
|
||||
Posisi sql.NullString `json:"-" db:"posisi"`
|
||||
Deskripsi sql.NullString `json:"-" db:"deskripsi"`
|
||||
WaktuPosisi sql.NullTime `json:"-" db:"waktuposisi"`
|
||||
}
|
||||
|
||||
type TicketQueueResponse struct {
|
||||
Message string `json:"message"`
|
||||
KuotaLoket int `json:"kuotaloket"`
|
||||
Data []*LoketTiketResponse `json:"data"`
|
||||
Meta map[string]interface{} `json:"meta"`
|
||||
}
|
||||
|
||||
func (t TicketQueue) MarshalJSON() ([]byte, error) {
|
||||
type Alias TicketQueue
|
||||
aux := &struct {
|
||||
HealthcareServiceCode *string `json:"healthcare_service_code,omitempty"`
|
||||
DateStart *string `json:"date_start,omitempty"`
|
||||
TimeStart *string `json:"time_start,omitempty"`
|
||||
DatetimeStartFormatted *string `json:"datetime_start_formatted,omitempty"`
|
||||
HealthcareServiceName *string `json:"healthcare_service_name,omitempty"`
|
||||
HealthcareServiceCodeMS *string `json:"healthcare_service_code_ms,omitempty"`
|
||||
ShiftNumber *int `json:"shift_number,omitempty"`
|
||||
PaymentTypeName *string `json:"payment_type_name,omitempty"`
|
||||
WaktuPosisi1 *string `json:"waktu_posisi,omitempty"`
|
||||
TanggalPosisi *string `json:"tanggal_posisi,omitempty"`
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(&t),
|
||||
}
|
||||
|
||||
if t.HealthcareServiceCode.Valid {
|
||||
aux.HealthcareServiceCode = &t.HealthcareServiceCode.String
|
||||
}
|
||||
|
||||
if !t.DatetimeStart.IsZero() {
|
||||
|
||||
dateStr := t.DatetimeStart.Format("02 Jan 2006")
|
||||
aux.DateStart = &dateStr
|
||||
|
||||
timeStr := t.DatetimeStart.Format("15:04:05")
|
||||
aux.TimeStart = &timeStr
|
||||
|
||||
formattedStr := t.DatetimeStart.Format("02 Jan 2006, 15:04")
|
||||
aux.DatetimeStartFormatted = &formattedStr
|
||||
}
|
||||
|
||||
if t.HealthcareServiceName.Valid {
|
||||
aux.HealthcareServiceName = &t.HealthcareServiceName.String
|
||||
}
|
||||
|
||||
if t.HealthcareServiceCodeMS.Valid {
|
||||
aux.HealthcareServiceCodeMS = &t.HealthcareServiceCodeMS.String
|
||||
}
|
||||
|
||||
if t.ShiftNumber.Valid {
|
||||
shift := int(t.ShiftNumber.Int64)
|
||||
aux.ShiftNumber = &shift
|
||||
}
|
||||
|
||||
if t.PaymentTypeName.Valid {
|
||||
aux.PaymentTypeName = &t.PaymentTypeName.String
|
||||
}
|
||||
|
||||
return json.Marshal(aux)
|
||||
}
|
||||
|
||||
type LoketTiketResponse struct {
|
||||
IdLoketTiket string `json:"idtiket"`
|
||||
TiketLoket string `json:"ticket"`
|
||||
KlinikTiketLoket string `json:"klinik"`
|
||||
BarcodeTiketLoket string `json:"barcode"`
|
||||
TanggalTiketLoket string `json:"tanggal"`
|
||||
WaktuTiketLoket string `json:"waktu"`
|
||||
ShiftTiketLoket int `json:"shift"`
|
||||
Pembayaran string `json:"pembayaran"`
|
||||
Posisi []Posisi `json:"posisi"`
|
||||
}
|
||||
type Posisi struct {
|
||||
Posisi string `json:"posisi,omitempty"`
|
||||
Deskripsi string `json:"deskripsi,omitempty"`
|
||||
WaktuPosisi string `json:"waktuposisi,omitempty"`
|
||||
TanggalPosisi string `json:"tanggalposisi,omitempty"`
|
||||
}
|
||||
|
||||
type KlinikRuangan struct {
|
||||
IDKlinik sql.NullString `json:"idklinik" db:"idklinik"`
|
||||
NamaKlinik sql.NullString `json:"namaklinik" db:"namaklinik"`
|
||||
IDRuangan sql.NullString `json:"idruangan" db:"idruangan"`
|
||||
NamaRuangan sql.NullString `json:"namaruangan" db:"namaruangan"`
|
||||
}
|
||||
|
||||
type RuanganDetail struct {
|
||||
IDRuangan string `json:"idruangan"`
|
||||
NamaRuangan string `json:"namaruangan"`
|
||||
}
|
||||
|
||||
type KlinikRuanganGrouped struct {
|
||||
IDKlinik string `json:"idklinik"`
|
||||
NamaKlinik string `json:"namaklinik"`
|
||||
Ruangan []RuanganDetail `json:"ruangan"`
|
||||
}
|
||||
|
||||
type KlinikRuanganResponse struct {
|
||||
Message string `json:"message"`
|
||||
Data []*KlinikRuanganGrouped `json:"data"`
|
||||
Meta map[string]interface{} `json:"meta"`
|
||||
}
|
||||
Reference in New Issue
Block a user