package models

type Org struct {
	Id              int64  `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"` // 机构 ID
	Creator         int64  `json:"creator"`                              // 创建者,即管理员用户的 id
	OrgName         string `gorm:"column:org_name" json:"org_name"`
	OrgShortName    string `gorm:"column:org_short_name" json:"org_short_name"` // 简称
	OrgLogo         string `gorm:"column:org_logo" json:"org_logo"`
	OrgIntroduction string `gorm:"column:org_introduction" json:"org_introduction"`
	Province        int64  `json:"province"` // 省,代号,下面的市、区也一样
	City            int64  `json:"city"`
	District        int64  `json:"district"`
	Address         string `json:"address"`                   // 详细地址
	Illness         string `json:"illness"`                   // 服务病种 多个并用“,”隔开
	Status          int8   `json:"status"`                    // 状态 0.无效 1.有效 2.禁用
	CreateTime      int64  `gorm:"column:ctime" json:"ctime"` // 创建时间
	ModifyTime      int64  `gorm:"column:mtime" json:"mtime"` // 修改时间

	OrgType        int64         `gorm:"column:org_type" json:"org_type"`
	Evaluate       float64       `gorm:"column:evaluate" json:"evaluate"`
	Comments       int64         `gorm:"column:comments" json:"comments"`
	OperatingState int64         `gorm:"column:operating_state" json:"operating_state"`
	Claim          int64         `gorm:"column:claim" json:"claim"`
	Telephone      string        `gorm:"column:telephone" json:"telephone"`
	BusinessWeek   string        `gorm:"column:business_week" json:"business_week"`
	BusinessTime   string        `gorm:"column:business_time" json:"business_time"`
	Gallery        string        `gorm:"column:gallery" json:"gallery"`
	ContactName    string        `gorm:"column:contact_name" json:"contact_name"`
	OrgGallery     []*OrgGallery `gorm:"ForeignKey:OrgId" json:"org_gallery"`
}

func (Org) TableName() string {
	return "sgj_user_org"
}

type OrgGallery struct {
	ID     int64  `gorm:"column:id" json:"id" form:"id"`
	Url    string `gorm:"column:url" json:"url" form:"url"`
	Type   int64  `gorm:"column:type" json:"type" form:"type"`
	OrgId  int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
	UserId int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
	Status int64  `gorm:"column:status" json:"status" form:"status"`
	Ctime  int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime  int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
}

func (OrgGallery) TableName() string {
	return "sgj_user_org_gallery"
}

type OrgApp struct {
	Id         int64  `gorm:"PRIMARY_KEY;AUTO_INCREMENT" json:"id"` // ID
	AppType    int    `gorm:"column:app_type" json:"app_type"`      // 应用类型 1.病友经营;2.科普号;3.血透经营;4.慢病管理
	Creator    int    `json:"creator"`                              // 创建者,即管理员用户的 id
	OrgId      int    `gorm:"column:org_id" json:"org_id"`
	OpenStatus int    `gorm:"column:open_status" json:"open_status"`
	Status     int8   `json:"status"`                    // 状态 0.无效 1.有效 2.禁用
	CreateTime int64  `gorm:"column:ctime" json:"ctime"` // 创建时间
	ModifyTime int64  `gorm:"column:mtime" json:"mtime"` // 修改时间
	Name       string `gorm:"column:name" json:"name" form:"name"`
	Url        string `gorm:"column:url" json:"url" form:"url"`
	Pid        int64  `gorm:"column:pid" json:"pid" form:"pid"`
	Number     int64  `gorm:"column:number" json:"number" form:"number"`
}

func (OrgApp) TableName() string {
	return "sgj_user_org_app"
}

type OrgBan struct {
	ID      int64  `gorm:"column:id" json:"id"`
	OrgId   int64  `gorm:"column:org_id" json:"org_id"`
	Reason  string `gorm:"column:reason" json:"reason"`
	Ctime   int64  `gorm:"column:ctime" json:"ctime"`
	BanTime int64  `gorm:"column:ban_time" json:"ban_time"`
	Status  int64  `gorm:"column:status" json:"status"`
	Mtime   int64  `gorm:"column:mtime" json:"mtime"`
}

func (OrgBan) TableName() string {
	return "sgj_user_admin_org_ban"
}

type OrgType struct {
	ID          int64  `gorm:"column:id" json:"id" form:"id"`
	Name        string `gorm:"column:name" json:"name" form:"name"`
	ShortName   string `gorm:"column:short_name" json:"short_name" form:"short_name"`
	Pid         int64  `gorm:"column:pid" json:"pid" form:"pid"`
	Status      int64  `gorm:"column:status" json:"status" form:"status"`
	CreatedTime int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	SortNo      int64  `gorm:"column:sort_no" json:"sort_no" form:"sort_no"`
}

func (OrgType) TableName() string {
	return "sgj_user_org_type"
}

type Illness struct {
	ID          int64  `gorm:"column:id" json:"id"`
	IllnessName string `gorm:"column:illness_name" json:"illness_name"`
	Status      int64  `gorm:"column:status" json:"status"`
	CreatedTime int64  `gorm:"column:created_time" json:"created_time"`
	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time"`
}

func (Illness) TableName() string {
	return "sgj_user_illness"
}

type SgjUserOrg struct {
	ID              int64   `gorm:"column:id" json:"id" form:"id"`
	Creator         int64   `gorm:"column:creator" json:"creator" form:"creator"`
	OrgName         string  `gorm:"column:org_name" json:"org_name" form:"org_name"`
	OrgShortName    string  `gorm:"column:org_short_name" json:"org_short_name" form:"org_short_name"`
	OrgLogo         string  `gorm:"column:org_logo" json:"org_logo" form:"org_logo"`
	OrgIntroduction string  `gorm:"column:org_introduction" json:"org_introduction" form:"org_introduction"`
	Illness         string  `gorm:"column:illness" json:"illness" form:"illness"`
	Province        int64   `gorm:"column:province" json:"province" form:"province"`
	City            int64   `gorm:"column:city" json:"city" form:"city"`
	District        int64   `gorm:"column:district" json:"district" form:"district"`
	Address         string  `gorm:"column:address" json:"address" form:"address"`
	Longitude       string  `gorm:"column:longitude" json:"longitude" form:"longitude"`
	Latitude        string  `gorm:"column:latitude" json:"latitude" form:"latitude"`
	OrgType         int64   `gorm:"column:org_type" json:"org_type" form:"org_type"`
	Comments        int64   `gorm:"column:comments" json:"comments" form:"comments"`
	Evaluate        float64 `gorm:"column:evaluate" json:"evaluate" form:"evaluate"`
	Gallery         string  `gorm:"column:gallery" json:"gallery" form:"gallery"`
	BusinessWeek    string  `gorm:"column:business_week" json:"business_week" form:"business_week"`
	BusinessTime    string  `gorm:"column:business_time" json:"business_time" form:"business_time"`
	ContactName     string  `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
	Telephone       string  `gorm:"column:telephone" json:"telephone" form:"telephone"`
	Claim           int64   `gorm:"column:claim" json:"claim" form:"claim"`
	OperatingState  int64   `gorm:"column:operating_state" json:"operating_state" form:"operating_state"`
	Status          int64   `gorm:"column:status" json:"status" form:"status"`
	Ctime           int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
	Mtime           int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
	Source          int64   `gorm:"column:source" json:"source" form:"source"`
	Ttype           int64   `gorm:"column:ttype" json:"ttype" form:"ttype"`
	Ttid            int64   `gorm:"column:ttid" json:"ttid" form:"ttid"`
	Tuid            int64   `gorm:"column:tuid" json:"tuid" form:"tuid"`
	Reason          string  `gorm:"column:reason" json:"reason" form:"reason"`
	Level           int64   `gorm:"column:level" json:"level" form:"level"`
	Website         string  `gorm:"column:website" json:"website" form:"website"`
	Import          int64   `gorm:"column:import" json:"import" form:"import"`
	Sortno          int64   `gorm:"column:sortno" json:"sortno" form:"sortno"`
	IsSuperAdmin    int64   `gorm:"column:is_super_admin" json:"is_super_admin" form:"is_super_admin"`
}

func (SgjUserOrg) TableName() string {
	return "sgj_user_org"
}

type SgjUserDistrict struct {
	ID        int64  `gorm:"column:id" json:"id" form:"id"`
	Name      string `gorm:"column:name" json:"name" form:"name"`
	Level     int64  `gorm:"column:level" json:"level" form:"level"`
	Upid      int64  `gorm:"column:upid" json:"upid" form:"upid"`
	Path      string `gorm:"column:path" json:"path" form:"path"`
	Namepath  string `gorm:"column:namepath" json:"namepath" form:"namepath"`
	Initial   string `gorm:"column:initial" json:"initial" form:"initial"`
	Longitude string `gorm:"column:longitude" json:"longitude" form:"longitude"`
	Latitude  string `gorm:"column:latitude" json:"latitude" form:"latitude"`
	Adcode    int64  `gorm:"column:adcode" json:"adcode" form:"adcode"`
}

func (SgjUserDistrict) TableName() string {
	return "sgj_user_district"
}

type SgjUserOrgType struct {
	ID          int64  `gorm:"column:id" json:"id" form:"id"`
	Name        string `gorm:"column:name" json:"name" form:"name"`
	ShortName   string `gorm:"column:short_name" json:"short_name" form:"short_name"`
	Pid         int64  `gorm:"column:pid" json:"pid" form:"pid"`
	Status      int64  `gorm:"column:status" json:"status" form:"status"`
	CreatedTime int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	SortNo      int64  `gorm:"column:sort_no" json:"sort_no" form:"sort_no"`
}

func (SgjUserOrgType) TableName() string {
	return "sgj_user_org_type"
}