| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- package service
- import (
- "context"
- "lims_zju/common"
- "lims_zju/model"
- )
- type DeviceStatistics struct{}
- type ReadData struct {
- Data interface{} `json:"data"`
- }
- // GetDeviceStatistics 获取实验设备数据使用信息
- func (d *DeviceStatistics) GetDeviceStatistics(ctx context.Context, req *model.BaseModel) (
- *model.DeviceStatistics, error) {
- list := make([]model.DeviceStatistics, 0)
- err := common.ReadJson(&list, "data", "common/data1.json")
- if err != nil {
- return nil, err
- }
- for _, v := range list {
- if v.LaboratoryId == req.LaboratoryId {
- return &v, nil
- }
- }
- return nil, nil
- }
- // GetExperimentalData 获取实验数据
- func (d *DeviceStatistics) GetExperimentalData(ctx context.Context, req *model.BaseModel) (
- *model.ExperimentalDatas, error) {
- list := make([]model.ExperimentalDatas, 0)
- err := common.ReadJson(&list, "data", "common/data1.json")
- if err != nil {
- return nil, err
- }
- for _, v := range list {
- if v.LaboratoryId == req.LaboratoryId {
- return &v, nil
- }
- }
- return nil, nil
- }
- // GetAppointment 获取预约信息
- func (d *DeviceStatistics) GetAppointment(ctx context.Context, req *model.BaseModel) (
- *model.Appointment, error) {
- list := make([]model.Appointment, 0)
- err := common.ReadJson(&list, "data", "common/data1.json")
- if err != nil {
- return nil, err
- }
- for _, v := range list {
- if v.LaboratoryId == req.LaboratoryId {
- return &v, nil
- }
- }
- return nil, nil
- }
- // GetPeakHours 获取高峰时段
- func (d *DeviceStatistics) GetPeakHours(ctx context.Context, req *model.BaseModel) (
- *model.PeakHours, error) {
- list := make([]model.PeakHours, 0)
- err := common.ReadJson(&list, "data", "common/data1.json")
- if err != nil {
- return nil, err
- }
- for _, v := range list {
- if v.LaboratoryId == req.LaboratoryId {
- return &v, nil
- }
- }
- return nil, nil
- }
- // GetHighEquipment 获取高频使用设备
- func (d *DeviceStatistics) GetHighEquipment(ctx context.Context, req *model.BaseModel) (
- *model.HighEquipment, error) {
- list := make([]model.HighEquipment, 0)
- err := common.ReadJson(&list, "data", "common/data1.json")
- if err != nil {
- return nil, err
- }
- for _, v := range list {
- if v.LaboratoryId == req.LaboratoryId {
- return &v, nil
- }
- }
- return nil, nil
- }
|