domain.go


```go
package service
/*
 *@Author:邓林峰
 *@Date:21-5-4 下午2:49
 */
import (
	"fmt"
	"github.com/hyperledger/fabric-sdk-go/pkg/client/channel"
	"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
	"time"
)

type Health struct {
	ObjectType string `json:"docType"`
	EntityID string `json:"EntityID"`//身份证号
	Name string `json:"Name"`//姓名
	Sex string `json:"Sex"`//性别
	
	Stunumber string `json:"Stunumber"`//学号
	EnrollDate string `json:"EnrollDate"`//入学日期
	GraduationDate string `json:"GraduationDate"`//毕(结)业日期
	SchoolName string `json:"SchoolName"`//学校名称
	College string `json:"College"`//学院名称
	Major string `json:"Major"`//专业
	QuaType string `json:"QuaType"`//学历类别
	Length string `json:"Length"`//学制
	Photo string `json:"Photo"`//照片

	Height float64 `json:"Height"`//身高
	Weight float64 `json:"Weight"`//体重
	Vol float64 `json:"Vol"`//左眼视力
	Vor float64 `json:"Vor"`//右眼视力
	Colorblindness string `json:"Colorblindness"`//色盲情况
	Earsick string `json:"Earsick"`//耳疾情况
	Nose string `json:"Nose"`//鼻及鼻窦疾病情况
	Stutter bool `json:"Stutter"`//是否口吃
	Teeth string `json:"Teeth"`//牙齿情况(缺齿、齿槽)
	Waistline float64 `json:"Waistline"`//腰围
	Skin string `json:"Skin"`//皮肤情况
	Thyroid string `json:"Thyroid"`//甲状腺情况
	Spine string `json:"Spine"`//脊柱情况
	Joints string `json:"Joints"`//关节情况
	Flatfoot bool `json:"Flatfoot"`//是否为扁平足
	Pulse float64 `json:"Pulse"`//脉搏(次/秒)
	Mental string `json:"Mental"`//神经及精神情况
	Lungsrespiratory string `json:"Lungsrespiratory"`//肺部及呼吸道情况
	Heartbloodvessel string `json:"Heartbloodvessel"`//心脏及血管情况
	Liver string `json:"Liver"`//肝脏情况
	Spleen string `json:"Spleen"`//脾脏情况
	Other string `json:"Other"`//其他情况
	Persion string `json:"Persion"`//录入者/更新者
	Date time.Time `json:"Date"`//日期

	Historys []HistoryItem//当前Health的历史记录
}

type HistoryItem struct {
	Txid string
	Health Health
}

type ServiceSetup struct {
	ChaincodeID	string
	Client	*channel.Client
}

func regitserEvent(client *channel.Client, chaincodeID, eventID string) (fab.Registration, <-chan *fab.CCEvent) {
	reg, notifier, err := client.RegisterChaincodeEvent(chaincodeID, eventID)
	if err != nil {
		fmt.Println("注册链码事件失败: %s", err)
	}
	return reg, notifier
}

func eventResult(notifier <-chan *fab.CCEvent, eventID string) error {
	select {
	case ccEvent := <-notifier:
		fmt.Printf("接收到链码事件: %v\n", ccEvent)
	case <-time.After(time.Second * 20):
		return fmt.Errorf("不能根据指定的事件ID接收到相应的链码事件(%s)", eventID)
	}
	return nil
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值