types

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "admin"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// Prefix of types
	Prefix_Doctor       = "do-"
	Prefix_Patient      = "pa-"
	Prefix_DrugStore    = "ds-"
	Prefix_CaseHistory  = "ch-"
	Prefix_RxPermission = "rp-"
)
View Source
const (
	Rx_ACTIVE  = 1 //有效状态
	Rx_LOCKING = 2 //药店锁定
	Rx_USED    = 3 //完成购买
)
View Source
const RouterKey = ModuleName // this was defined in your key.go file

RouterKey is the module name router key

Variables

View Source
var (
	// ErrWithdrawTooOften withdraw too often
	ErrInputInvalid        = sdkerrors.Register(ModuleName, 1, "Your input is not valid")
	ErrPatientExisted      = sdkerrors.Register(ModuleName, 2, "Patient already exists")
	ErrDoctorExisted       = sdkerrors.Register(ModuleName, 3, "Doctor already exists")
	ErrDrugStoreExisted    = sdkerrors.Register(ModuleName, 4, "Drugstore already exists")
	ErrDontHaveRx          = sdkerrors.Register(ModuleName, 5, "Don't have any rx in this address")
	ErrDrugstoreNotExisted = sdkerrors.Register(ModuleName, 6, "Drugstore does not existed")
	ErrIllegalAccess       = sdkerrors.Register(ModuleName, 7, "Illegal Rx Access")
	ErrDuplicatedUse       = sdkerrors.Register(ModuleName, 8, "Rx can be used only once.")
	ErrRxDoesNotExists     = sdkerrors.Register(ModuleName, 9, "Rx does not exists.")
)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) exported.Account
}

AccountKeeper is required for getting Account

type CaseHistory

type CaseHistory struct {
	Patient string                 `json:"patient"`
	Rxs     map[string]exported.Rx `json:"rxs"`
}

Rx is a struct that contains all the metadata of a Rx

func NewCaseHistory

func NewCaseHistory(patient string) CaseHistory

func (CaseHistory) AddRx

func (ch CaseHistory) AddRx(rx exported.Rx)

func (CaseHistory) GetRx

func (ch CaseHistory) GetRx(id string) (exported.Rx, bool)

func (CaseHistory) SetRx

func (ch CaseHistory) SetRx(id string, rx exported.Rx)

func (CaseHistory) UpdateStatus

func (ch CaseHistory) UpdateStatus(id string, status sdk.Int)

type Doctor

type Doctor struct {
	Pubkey       string `json:"pubkey"`
	Name         string `json:"name"`
	Gender       string `json:"gender"`
	Hospital     string `json:"hospital"`     //就职医院
	Department   string `json:"department"`   //所在科室
	Title        string `json:"title"`        //职称
	Introduction string `json:"introduction"` //介绍
}

Doctor is a struct that contains all the metadata of a doctor

func NewDoctor

func NewDoctor(pubkey string, name string, gender string, hospital string, department string, title string, introduction string) Doctor

NewDoctor returns a new Doctor

func (Doctor) String

func (d Doctor) String() string

implement fmt.Stringer

type DrugStore

type DrugStore struct {
	Pubkey   string `json:"pubkey"`
	Name     string `json:"name"`
	Phone    string `json:"phone"`
	Group    string `json:"group"`    //所属连锁集团
	BizTime  string `json:"biz_time"` //营业时间
	Location string `json:"location"` //门店地址
}

DrugStore is a struct that contains all the metadata of a DrugStore

func NewDrugStore

func NewDrugStore(pubkey string, name string, phone string, group string, biztime string, location string) DrugStore

NewDrugStore returns a new DrugStore

func (DrugStore) String

func (d DrugStore) String() string

implement fmt.Stringer

type MsgRegisterDocter

type MsgRegisterDocter struct {
	From         sdk.AccAddress `json:"from"`
	PubKey       string         `json:"pubkey"`
	Name         string         `json:"name"`
	Gender       string         `json:"gender"`
	Hospital     string         `json:"hospital"`     //就职医院
	Department   string         `json:"department"`   //所在科室
	Title        string         `json:"title"`        //职称
	Introduction string         `json:"introduction"` //介绍
}

MsgRegisterDocter defines a register doctor message

func NewMsgRegisterDocter

func NewMsgRegisterDocter(from sdk.AccAddress, pubkey string, name string, gender string, hospital string, department string, title string, introduction string) MsgRegisterDocter

NewMsgRegisterDocter is a constructor function for MsgRegisterDocter

func (MsgRegisterDocter) GetSignBytes

func (msg MsgRegisterDocter) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgRegisterDocter) GetSigners

func (msg MsgRegisterDocter) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgRegisterDocter) Route

func (msg MsgRegisterDocter) Route() string

Route should return the name of the module

func (MsgRegisterDocter) Type

func (msg MsgRegisterDocter) Type() string

Type should return the action

func (MsgRegisterDocter) ValidateBasic

func (msg MsgRegisterDocter) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgRegisterDrugStore

type MsgRegisterDrugStore struct {
	From     sdk.AccAddress `json:"from"`
	Pubkey   string         `json:"pubkey"`
	Name     string         `json:"name"`
	Phone    string         `json:"phone"`
	Group    string         `json:"group"`    //所属连锁集团
	BizTime  string         `json:"biz_time"` //营业时间
	Location string         `json:"location"` //门店地址
}

MsgRegisterDrugStore defines a register drugstore message

func NewMsgRegisterDrugStore

func NewMsgRegisterDrugStore(from sdk.AccAddress, pubkey string, name string, phone string, group string, biztime string, location string) MsgRegisterDrugStore

NewMsgRegisterDrugStore is a constructor function for MsgRegisterDrugStore

func (MsgRegisterDrugStore) GetSignBytes

func (msg MsgRegisterDrugStore) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgRegisterDrugStore) GetSigners

func (msg MsgRegisterDrugStore) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgRegisterDrugStore) Route

func (msg MsgRegisterDrugStore) Route() string

Route should return the name of the module

func (MsgRegisterDrugStore) Type

func (msg MsgRegisterDrugStore) Type() string

Type should return the action

func (MsgRegisterDrugStore) ValidateBasic

func (msg MsgRegisterDrugStore) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type MsgRegisterPatient

type MsgRegisterPatient struct {
	From      sdk.AccAddress `json:"from"`
	Pubkey    string         `json:"address"`
	Name      string         `json:"name"`
	Gender    string         `json:"gender"`
	Birthday  time.Time      `json:"birthday"`
	Encrypted string         `json:"encrypted"` //加密信息,如,疾病史,家族史,过敏药物等等
	Envelope  string         `json:"envelope"`  //密码信封
}

MsgRegisterPatient defines a register patient message

func NewMsgRegisterPatient

func NewMsgRegisterPatient(from sdk.AccAddress, pubkey string, name string, gender string, birthday time.Time, encrypted string, envelope string) MsgRegisterPatient

NewMsgRegisterPatient is a constructor function for MsgRegisterPatient

func (MsgRegisterPatient) GetSignBytes

func (msg MsgRegisterPatient) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgRegisterPatient) GetSigners

func (msg MsgRegisterPatient) GetSigners() []sdk.AccAddress

GetSigners defines whose signature is required

func (MsgRegisterPatient) Route

func (msg MsgRegisterPatient) Route() string

Route should return the name of the module

func (MsgRegisterPatient) Type

func (msg MsgRegisterPatient) Type() string

Type should return the action

func (MsgRegisterPatient) ValidateBasic

func (msg MsgRegisterPatient) ValidateBasic() error

ValidateBasic runs stateless checks on the message

type Patient

type Patient struct {
	Pubkey    string    `json:"pubkey"`
	Name      string    `json:"name"`
	Gender    string    `json:"gender"`
	Birthday  time.Time `json:"birthday"`
	Encrypted string    `json:"encrypted"` //加密信息,如,疾病史,家族史,过敏药物等等
	Envelope  string    `json:"envelope"`  //密码信封
}

Patient is a struct that contains all the metadata of a patient

func NewPatient

func NewPatient(pubkey string, name string, gender string, birthday time.Time, encrypted string, envelope string) Patient

NewPatient returns a new Patient

func (Patient) String

func (p Patient) String() string

implement fmt.Stringer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL