equipment.go 570 B

123456789101112131415161718192021222324
  1. package service
  2. import (
  3. "context"
  4. "lims_zju/common"
  5. "lims_zju/model"
  6. )
  7. type DeviceStatistics struct{}
  8. // GetDeviceStatistics 获取实验设备数据使用信息
  9. func (d *DeviceStatistics) GetDeviceStatistics(ctx context.Context, req *model.BaseModel) (*model.DeviceStatistics, error) {
  10. list := make([]model.DeviceStatistics, 0)
  11. err := common.ReadJson(&list, "/home/desdemo/wp/code/lims_zju/common/data1.json")
  12. if err != nil {
  13. return nil, err
  14. }
  15. for _, v := range list {
  16. if v.LaboratoryId == req.LaboratoryId {
  17. return &v, nil
  18. }
  19. }
  20. return nil, nil
  21. }