Browse Source

neck: 脖环数据和疾病处方推荐

Yi 4 months ago
parent
commit
c312da7cd7

+ 1 - 0
config/app.develop.yaml

@@ -42,6 +42,7 @@ cron:
   update_same_time: "0 20 1 * * ?"
   system_basic_crontab: "0 25 1 * * ?"
   cow_pregnant: "0 00 15 * * ?"
+  neck_ring: "0 30 * * * ?"
 mqtt:
   broker: "47.92.95.119"
   port: 1883

+ 1 - 0
config/app.go

@@ -56,6 +56,7 @@ type CronSetting struct {
 	UpdateSameTime     string `yaml:"update_same_time"`     //  更新同期
 	SystemBasicCrontab string `yaml:"system_basic_crontab"` //  系统基础定时任务
 	CowPregnant        string `yaml:"cow_pregnant"`         //  月度牛只怀孕清单
+	NeckRing           string `yaml:"neck_ring"`            //  脖环数据更新
 }
 
 type JwtTokenKeyConfig struct {

+ 1 - 1
config/app.test.yaml

@@ -41,7 +41,7 @@ cron:
   update_same_time: "0 20 1 * * ?"
   system_basic_crontab: "0 25 1 * * ?"
   cow_pregnant: "0 00 15 * * ?"
-
+  neck_ring: "0 30 * * * ?"
 mqtt:
   broker: "47.92.95.119"
   port: 1883

+ 5 - 0
dep/di_crontab.go

@@ -76,5 +76,10 @@ func EntryCrontab(dependency CrontabDependency) *cron.Crontab {
 	if err != nil {
 		panic(err)
 	}
+
+	err = newCrontab.Bind("NeckRing", cs.NeckRing, dependency.CrontabHub.NeckRingData)
+	if err != nil {
+		panic(err)
+	}
 	return newCrontab
 }

+ 19 - 0
http/handler/event/event_health.go

@@ -3,6 +3,7 @@ package event
 import (
 	"kpt-pasture/http/middleware"
 	"net/http"
+	"strconv"
 
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
 	operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
@@ -91,6 +92,24 @@ func CowDiseaseDiagnose(c *gin.Context) {
 	})
 }
 
+func DiseaseSuggestPrescription(c *gin.Context) {
+	diseaseIdStr := c.Param("id")
+	diseaseId, _ := strconv.Atoi(diseaseIdStr)
+
+	if err := valid.Validate(diseaseId, valid.Required, valid.Min(1)); err != nil {
+		apierr.ClassifiedAbort(c, err)
+		return
+	}
+
+	res, err := middleware.BackendOperation(c).OpsService.DiseaseSuggestPrescription(c, int64(diseaseId))
+	if err != nil {
+		apierr.ClassifiedAbort(c, err)
+		return
+	}
+
+	ginutil.JSONResp(c, res)
+}
+
 func CowDiseaseTreatment(c *gin.Context) {
 	var req pasturePb.CowTreatmentRequest
 	if err := ginutil.BindProto(c, &req); err != nil {

+ 6 - 1
http/route/event_api.go

@@ -54,9 +54,14 @@ func EventAPI(opts ...func(engine *gin.Engine)) func(s *gin.Engine) {
 		// 发病
 		eventRoute.POST("/disease/create", event.CowDiseaseCreate)
 		eventRoute.POST("/disease/list", event.CowDiseaseList)
+		// 疾病诊断
 		eventRoute.POST("/disease/diagnose", event.CowDiseaseDiagnose)
+		// 疾病治疗
 		eventRoute.POST("/disease/treatment", event.CowDiseaseTreatment)
+		eventRoute.GET("/disease/suggest/prescription/:id", event.DiseaseSuggestPrescription)
+		// 治疗详情
 		eventRoute.POST("/disease/treatment/details", event.CowDiseaseTreatmentDetail)
-		eventRoute.POST("/disease/curable", event.CowDiseaseCurable)
+		// 批量治愈
+		eventRoute.POST("/disease/curable/batch", event.CowDiseaseCurable)
 	}
 }

+ 2 - 0
model/event_mating.go

@@ -11,6 +11,7 @@ type EventMating struct {
 	CowId             int64                           `json:"cowId"`
 	DayAge            int32                           `json:"dayAge"`
 	Lact              int32                           `json:"lact"`
+	PenId             int32                           `json:"penId"`
 	CowType           pasturePb.CowType_Kind          `json:"cowType"`
 	CowKind           pasturePb.CowKind_Kind          `json:"cowKind"`
 	CalvingAge        int32                           `json:"calvingAge"`
@@ -41,6 +42,7 @@ func NewEventMating(cow *Cow, planDay int64) *EventMating {
 	return &EventMating{
 		CowId:            cow.Id,
 		Lact:             cow.Lact,
+		PenId:            cow.PenId,
 		CowType:          cow.CowType,
 		CowKind:          cow.CowKind,
 		CalvingAt:        cow.LastMatingAt,

+ 21 - 18
model/neck_ring_original_data.go

@@ -1,24 +1,27 @@
 package model
 
+import pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
+
 type NeckRingOriginalData struct {
-	Id         int64  `json:"id"`
-	SoftVer    int64  `json:"softVer"`
-	Uuid       string `json:"uuid"`
-	FrameId    int64  `json:"frameId"`
-	CowId      string `json:"cowId"`
-	Csq        int64  `json:"csq"`
-	Temp       int64  `json:"temp"`
-	Imei       string `json:"imei" `
-	Active     int32  `json:"active"`
-	InActive   int32  `json:"inactive"`
-	RuMina     int32  `json:"ruMina"`
-	Intake     int32  `json:"intake"`
-	Gasp       int32  `json:"gasp"`
-	Other      int32  `json:"other"`
-	ReMain     int32  `json:"remain"`
-	ActiveTime string `json:"activeTime"`
-	CreatedAt  int64  `json:"createdAt"`
-	UpdatedAt  int64  `json:"updatedAt"`
+	Id         int64                 `json:"id"`
+	SoftVer    int64                 `json:"softVer"`
+	Uuid       string                `json:"uuid"`
+	FrameId    int64                 `json:"frameId"`
+	CowId      string                `json:"cowId"`
+	Csq        int64                 `json:"csq"`
+	Temp       int64                 `json:"temp"`
+	Imei       string                `json:"imei" `
+	Active     int32                 `json:"active"`
+	InActive   int32                 `json:"inactive"`
+	RuMina     int32                 `json:"ruMina"`
+	Intake     int32                 `json:"intake"`
+	Gasp       int32                 `json:"gasp"`
+	Other      int32                 `json:"other"`
+	ReMain     int32                 `json:"remain"`
+	ActiveTime string                `json:"activeTime"`
+	IsShow     pasturePb.IsShow_Kind `json:"isShow"`
+	CreatedAt  int64                 `json:"createdAt"`
+	UpdatedAt  int64                 `json:"updatedAt"`
 }
 
 func (s *NeckRingOriginalData) TableName() string {

+ 21 - 29
model/prescription.go

@@ -1,11 +1,10 @@
 package model
 
 import (
-	"encoding/json"
+	"strconv"
+	"strings"
 
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
-	"gitee.com/xuyiping_admin/pkg/logger/zaplog"
-	"go.uber.org/zap"
 )
 
 type Prescription struct {
@@ -28,11 +27,6 @@ func (p *Prescription) TableName() string {
 	return "prescription"
 }
 
-type ApplicableDisease struct {
-	DiseaseId   int64  `json:"disease_id"`
-	DiseaseName string `json:"disease_name"`
-}
-
 func NewPrescription(req *pasturePb.PrescriptionRequest, applicableDisease string, useDays,
 	meatExpiredDays, milkExpiredDays int32, systemUser *SystemUser) *Prescription {
 	return &Prescription{
@@ -51,38 +45,36 @@ func NewPrescription(req *pasturePb.PrescriptionRequest, applicableDisease strin
 
 type PrescriptionSlice []*Prescription
 
-func (p PrescriptionSlice) ToPB(prescriptionDrugsList []*PrescriptionDrugs) []*pasturePb.SearchPrescriptionList {
+func (p PrescriptionSlice) ToPB(prescriptionDrugsList []*PrescriptionDrugs, diseaseMap map[int64]*Disease) []*pasturePb.SearchPrescriptionList {
 	res := make([]*pasturePb.SearchPrescriptionList, len(p))
 	for i, v := range p {
 		drugsList := make([]*pasturePb.PrescriptionDrugsList, 0)
-		for _, d := range prescriptionDrugsList {
-			if d.PrescriptionId != v.Id {
+		for _, pl := range prescriptionDrugsList {
+			if pl.PrescriptionId != v.Id {
 				continue
 			}
 			drugsList = append(drugsList, &pasturePb.PrescriptionDrugsList{
-				Id:        int32(d.Id),
-				DrugsId:   int32(d.DrugsId),
-				DrugsName: d.DrugsName,
-				Unit:      d.Unit,
-				UnitName:  d.UnitName,
-				Dosages:   d.Dosages,
-				UseDays:   d.UseDays,
-				Specs:     d.Specs,
+				Id:        pl.Id,
+				DrugsId:   int32(pl.DrugsId),
+				DrugsName: pl.DrugsName,
+				Unit:      pl.Unit,
+				UnitName:  pl.UnitName,
+				Dosages:   pl.Dosages,
+				UseDays:   pl.UseDays,
+				Specs:     pl.Specs,
 			})
 		}
-		applicableDiseaseList := make([]*ApplicableDisease, 0)
-		if v.ApplicableDisease != "" {
-			err := json.Unmarshal([]byte(v.ApplicableDisease), &applicableDiseaseList)
-			if err != nil {
-				zaplog.Error("PrescriptionSliceToPB", zap.Any("err", err))
-			}
-		}
+		applicableDiseaseList := strings.Split(v.ApplicableDisease, ",")
 		applicableDiseaseNames := make([]string, 0)
 		applicableDiseaseIds := make([]int32, 0)
-		for _, a := range applicableDiseaseList {
-			applicableDiseaseNames = append(applicableDiseaseNames, a.DiseaseName)
-			applicableDiseaseIds = append(applicableDiseaseIds, int32(a.DiseaseId))
+		for _, ad := range applicableDiseaseList {
+			diseaseId, _ := strconv.ParseInt(ad, 10, 64)
+			applicableDiseaseIds = append(applicableDiseaseIds, int32(diseaseId))
+			if dis, ok := diseaseMap[diseaseId]; ok {
+				applicableDiseaseNames = append(applicableDiseaseNames, dis.Name)
+			}
 		}
+
 		res[i] = &pasturePb.SearchPrescriptionList{
 			Id:                     int32(v.Id),
 			Name:                   v.Name,

+ 17 - 8
module/backend/calendar.go

@@ -144,7 +144,8 @@ func (s *StoreEntry) getCalendarCowList(
 func (s *StoreEntry) ImmunisationCowList(ctx context.Context, req *pasturePb.ItemsRequest, pagination *pasturePb.PaginationModel) (*pasturePb.ImmunizationItemsResponse, error) {
 	eventImmunizationPlanList := make([]*model.EventImmunizationPlan, 0)
 	count := int64(0)
-	pref := s.DB.Model(&model.EventImmunizationPlan{})
+	pref := s.DB.Model(&model.EventImmunizationPlan{}).
+		Where("status = ?", pasturePb.IsShow_No)
 	if req.StartDay != "" {
 		dateTime := util.TimeParseLocalUnix(req.StartDay)
 		pref.Where("plan_day >= ?", dateTime)
@@ -212,7 +213,8 @@ func (s *StoreEntry) SameTimeCowList(ctx context.Context, req *pasturePb.ItemsRe
 	pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventCowSameTime).TableName())).
 		Select("a.id,a.cow_id,a.pen_name,a.status,b.breed_status,b.cow_type,b.day_age,b.calving_age,b.abortion_age").
 		Joins("left join cow as b on a.cow_id = b.id").
-		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission)
+		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
+		Where("a.status = ?", pasturePb.IsShow_No)
 
 	if req.EndDay != "" {
 		dateTime := util.TimeParseLocalEndUnix(req.EndDay)
@@ -270,7 +272,8 @@ func (s *StoreEntry) PregnancyCheckCowList(ctx context.Context, req *pasturePb.I
 	pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventPregnantCheck).TableName())).
 		Select("a.id,a.cow_id,a.pen_id,a.status,b.breed_status,b.cow_type,b.day_age,b.calving_age,b.abortion_age,a.bull_id").
 		Joins("left join cow as b on a.cow_id = b.id").
-		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission)
+		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
+		Where("a.status = ?", pasturePb.IsShow_No)
 
 	if req.EndDay != "" {
 		dateTime := util.TimeParseLocalEndUnix(req.EndDay)
@@ -331,9 +334,11 @@ func (s *StoreEntry) WeaningCowList(ctx context.Context, req *pasturePb.ItemsReq
 	count := int64(0)
 
 	pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventWeaning).TableName())).
-		Select("a.*,b.day_age").
+		Select("a.*,b.day_age,c.name as pen_name").
 		Joins("left join cow as b on a.cow_id = b.id").
-		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission)
+		Joins("left join pen as c on a.before_pen_id = c.id").
+		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission).
+		Where("a.status = ?", pasturePb.IsShow_No)
 
 	if req.EndDay != "" {
 		dateTime := util.TimeParseLocalEndUnix(req.EndDay)
@@ -375,15 +380,19 @@ func (s *StoreEntry) MatingCowList(ctx context.Context, req *pasturePb.ItemsRequ
 	matingItems := make([]*pasturePb.MatingItems, 0)
 	count := int64(0)
 	pref := s.DB.Table(fmt.Sprintf("%s as a", new(model.EventMating).TableName())).
-		Select("a.id,a.cow_id,a.status,b.breed_status,b.cow_type,b.pen_id,b.day_age,b.calving_age,b.abortion_age").
-		Joins("left join cow as b on a.cow_id = b.id").
-		Where("b.admission_status = ?", pasturePb.AdmissionStatus_Admission)
+		Select("a.id,a.cow_id,a.status,b.breed_status,b.cow_type,b.pen_id,b.day_age,b.calving_age,b.abortion_age,c.name as pen_name").
+		Joins("left join pen as c on a.pen_id = c.id").
+		Where("a.status = ?", pasturePb.IsShow_No)
 
 	if req.EndDay != "" {
 		dateTime := util.TimeParseLocalEndUnix(req.EndDay)
 		pref.Where("a.plan_day <= ?", dateTime)
 	}
 
+	if req.PenId > 0 {
+		pref.Where("a.pen_id = ?", req.PenId)
+	}
+
 	if req.Status > 0 {
 		pref.Where("a.status = ?", req.Status)
 	}

+ 29 - 0
module/backend/event_health.go

@@ -2,8 +2,10 @@ package backend
 
 import (
 	"context"
+	"fmt"
 	"kpt-pasture/model"
 	"net/http"
+	"strings"
 	"time"
 
 	"gorm.io/gorm"
@@ -325,6 +327,33 @@ func (s *StoreEntry) CowDiseaseTreatment(ctx context.Context, req *pasturePb.Cow
 	return nil
 }
 
+func (s *StoreEntry) DiseaseSuggestPrescription(ctx context.Context, diseaseId int64) (*pasturePb.ConfigOptionsListResponse, error) {
+	res := make([]*pasturePb.ConfigOptionsList, 0)
+	prescriptionList := make([]*model.Prescription, 0)
+	if err := s.DB.Model(new(model.Prescription)).Where("is_show = ?", pasturePb.IsShow_Ok).Find(&prescriptionList).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+
+	for _, v := range prescriptionList {
+		disabled := false
+		if strings.Contains(v.ApplicableDisease, fmt.Sprintf("%d", diseaseId)) {
+			disabled = true
+		}
+		res = append(res, &pasturePb.ConfigOptionsList{
+			Value:    v.Id,
+			Label:    v.Name,
+			Disabled: disabled,
+		})
+	}
+
+	return &pasturePb.ConfigOptionsListResponse{
+		Code:    http.StatusOK,
+		Message: "ok",
+		Data:    res,
+	}, nil
+
+}
+
 // CowDiseaseTreatmentDetail 发病牛只治疗详情列表
 func (s *StoreEntry) CowDiseaseTreatmentDetail(
 	ctx context.Context,

+ 2 - 0
module/backend/interface.go

@@ -190,6 +190,8 @@ type EventService interface {
 	CowDiseaseDiagnose(ctx context.Context, req *pasturePb.CowDiagnosedRequest) error
 	// CowDiseaseTreatment 治疗
 	CowDiseaseTreatment(ctx context.Context, req *pasturePb.CowTreatmentRequest) error
+	// DiseaseSuggestPrescription 疾病推荐处方
+	DiseaseSuggestPrescription(ctx context.Context, diseaseId int64) (*pasturePb.ConfigOptionsListResponse, error)
 	// CowDiseaseTreatmentDetail 治疗详情
 	CowDiseaseTreatmentDetail(ctx context.Context, req *pasturePb.EventCowTreatmentDetailRequest, pagination *pasturePb.PaginationModel) (*pasturePb.EventCowTreatmentDetailResponse, error)
 	// CowDiseaseCurable 治愈

+ 10 - 17
module/backend/prescription.go

@@ -2,11 +2,11 @@ package backend
 
 import (
 	"context"
-	"encoding/json"
 	"errors"
 	"fmt"
 	"kpt-pasture/model"
 	"net/http"
+	"strconv"
 	"strings"
 
 	pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
@@ -197,7 +197,7 @@ func (s *StoreEntry) SearchPrescriptionList(ctx context.Context, req *pasturePb.
 	prescriptionList := make([]*model.Prescription, 0)
 	var count int64 = 0
 
-	pref := s.DB.Model(new(model.Prescription))
+	pref := s.DB.Model(new(model.Prescription)).Where("is_show = ?", pasturePb.IsShow_Ok)
 	if req.Name != "" {
 		pref.Where("name like ?", fmt.Sprintf("%s%s%s", "%", req.Name, "%"))
 	}
@@ -221,11 +221,12 @@ func (s *StoreEntry) SearchPrescriptionList(ctx context.Context, req *pasturePb.
 		}
 	}
 
+	diseaseMaps, _ := s.DiseaseMaps(ctx)
 	return &pasturePb.SearchPrescriptionResponse{
 		Code:    http.StatusOK,
 		Message: "ok",
 		Data: &pasturePb.SearchPrescriptionData{
-			List:     model.PrescriptionSlice(prescriptionList).ToPB(prescriptionDrugs),
+			List:     model.PrescriptionSlice(prescriptionList).ToPB(prescriptionDrugs, diseaseMaps),
 			Total:    int32(count),
 			PageSize: pagination.PageSize,
 			Page:     pagination.Page,
@@ -263,22 +264,13 @@ func (s *StoreEntry) CreateOrUpdatePrescription(ctx context.Context, req *pastur
 
 	applicableDisease := ""
 	if len(req.ApplicableDiseaseIds) > 0 {
-		diseaseList, err := s.DiseaseListByIds(ctx, req.ApplicableDiseaseIds)
-		if err != nil {
-			return xerr.WithStack(err)
+		applicableDiseaseIds := make([]string, 0)
+		for _, v := range req.ApplicableDiseaseIds {
+			applicableDiseaseIds = append(applicableDiseaseIds, strconv.Itoa(int(v)))
 		}
-		applicableDiseaseList := make([]*model.ApplicableDisease, 0)
-		for _, v := range diseaseList {
-			applicableDiseaseList = append(applicableDiseaseList, &model.ApplicableDisease{
-				DiseaseId:   v.Id,
-				DiseaseName: v.Name,
-			})
-		}
-		b, _ := json.Marshal(applicableDiseaseList)
-		applicableDisease = string(b)
+		applicableDisease = strings.Join(applicableDiseaseIds, ",")
 	}
 	newPrescription := model.NewPrescription(req, applicableDisease, maxUseDays, maxMeatExpiredDays, maxMilkExpiredDays, currUser)
-
 	if req.Id > 0 {
 		prescription := &model.Prescription{Id: req.Id}
 		if err := s.DB.Model(&model.Prescription{}).First(prescription).Error; err != nil {
@@ -300,7 +292,8 @@ func (s *StoreEntry) CreateOrUpdatePrescription(ctx context.Context, req *pastur
 				return xerr.WithStack(err)
 			}
 
-			if err := tx.Model(&model.PrescriptionDrugs{}).Where("prescription_id", req.Id).Delete(&model.PrescriptionDrugs{}).Error; err != nil {
+			if err := tx.Model(new(model.PrescriptionDrugs)).Where("prescription_id", req.Id).
+				Update("is_show", pasturePb.IsShow_No).Error; err != nil {
 				return xerr.WithStack(err)
 			}
 			// 创建处方药品

+ 12 - 0
module/backend/sql.go

@@ -347,3 +347,15 @@ func (s *StoreEntry) GetEventPregnantCheckIsExIstByCowId(
 	}
 	return newEventPregnantCheck, nil
 }
+
+func (s *StoreEntry) DiseaseMaps(ctx context.Context) (map[int64]*model.Disease, error) {
+	res := make(map[int64]*model.Disease)
+	list := make([]*model.Disease, 0)
+	if err := s.DB.Model(new(model.Disease)).Where("is_show = ?", pasturePb.IsShow_Ok).Find(&list).Error; err != nil {
+		return nil, xerr.WithStack(err)
+	}
+	for _, v := range list {
+		res[v.Id] = v
+	}
+	return res, nil
+}

+ 1 - 0
module/crontab/interface.go

@@ -34,4 +34,5 @@ type Crontab interface {
 	UpdateSameTime() error
 	SystemBasicCrontab() error
 	CowPregnant() error
+	NeckRingData() error
 }

+ 29 - 0
module/crontab/work_cron.go

@@ -154,3 +154,32 @@ func (e *Entry) CowPregnant() error {
 	}
 	return nil
 }
+
+func (e *Entry) NeckRingData() error {
+	neckRingList := make([]*model.NeckRingOriginalData, 0)
+	if err := e.DB.Model(new(model.NeckRingOriginalData)).
+		Where("is_show = ?", pasturePb.IsShow_No).
+		Find(&neckRingList).Error; err != nil {
+		return xerr.WithStack(err)
+	}
+
+	if len(neckRingList) <= 0 {
+		return nil
+	}
+
+	neckRingIds := make([]int64, len(neckRingList))
+	// 更新已处理过的id
+	defer func() {
+		if len(neckRingIds) > 0 {
+			e.DB.Model(new(model.NeckRingOriginalData)).Where("id IN ?", neckRingIds).Update("is_show", pasturePb.IsShow_Ok)
+		}
+	}()
+	for i, v := range neckRingList {
+		neckRingIds[i] = v.Id
+		if v.Imei == "" {
+			continue
+		}
+
+	}
+	return nil
+}

+ 1 - 0
service/mqtt/sub.go

@@ -254,6 +254,7 @@ func (d *DataEventEntry) MsgDataFormat(msg []byte) (*model.NeckRingOriginalData,
 		Gasp:     int32(gasp),
 		Other:    int32(other),
 		ReMain:   int32(reMain),
+		IsShow:   pasturePb.IsShow_No,
 	}, nil
 
 }

+ 11 - 13
util/util_test.go

@@ -3,7 +3,6 @@ package util
 import (
 	"fmt"
 	"testing"
-	"time"
 
 	"github.com/stretchr/testify/assert"
 )
@@ -415,16 +414,15 @@ func TestDaysBetween(t *testing.T) {
 }
 
 func Test_demo(t *testing.T) {
-	fmt.Println(time.Now().AddDate(-2, 0, 0).Format("2006-01-02"))
-	fmt.Println(fmt.Sprintf("%02d", 0))
-	fmt.Println(fmt.Sprintf("%02d", 1))
-	fmt.Println(fmt.Sprintf("%02d", 2))
-	fmt.Println(fmt.Sprintf("%02d", 3))
-	fmt.Println(fmt.Sprintf("%02d", 4))
-	fmt.Println(fmt.Sprintf("%02d", 5))
-	fmt.Println(fmt.Sprintf("%02d", 9))
-	fmt.Println(fmt.Sprintf("%02d", 10))
-	fmt.Println(fmt.Sprintf("%02d", 12))
-	fmt.Println(fmt.Sprintf("%02d", 22))
-	fmt.Println(fmt.Sprintf("%02d", 23))
+	ids := make([]int64, 0)
+	defer func() {
+		fmt.Println(ids)
+	}()
+	for i := 0; i < 10; i++ {
+		ids = append(ids, int64(i))
+	}
+
+	for _, v := range ids {
+		fmt.Println("===v==", v)
+	}
 }