You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
3.0 KiB

2 years ago
  1. package entity
  2. import (
  3. "gitea.baoapi.com/root/stu_uuos/util"
  4. "github.com/jinzhu/gorm"
  5. "time"
  6. )
  7. // FmOrg 机构-管理设备
  8. type FmOrg struct {
  9. Id string `json:"id" gorm:"column:id;type:uuid;primaryKey"` //组织id
  10. Name string `json:"name" gorm:"column:name;type:varchar(200);not null"` //名称
  11. Alias string `json:"alias" gorm:"column:alias;type:varchar(200)"` //机构简称
  12. Contacts string `json:"contacts" gorm:"column:contacts;type:varchar(100)"` //设备负责联系人
  13. Mobile string `json:"mobile" gorm:"column:mobile;type:varchar(100)"` //手机号
  14. Summary string `json:"summary" gorm:"column:summary;type:varchar(200)"` //简介
  15. Type int `json:"type" gorm:"column:type;type:int;default:1"` //类型 1:商户 3 门诊 4 调剂中心
  16. Pid string `json:"pid" gorm:"column:pid;type:uuid"` //上级id 一级 0
  17. Level int `json:"level" gorm:"column:level;type:int"` //(商户 1、2、3 、4;其他类型填0或空)
  18. Province string `json:"province" gorm:"column:province;type:varchar(255)"` //省
  19. City string `json:"city" gorm:"column:city;type:varchar(255)"` //市
  20. District string `json:"district" gorm:"column:district;type:varchar(255)"` //区/县
  21. Addr string `json:"addr" gorm:"column:addr;type:varchar(255)"` //详细地址
  22. OrgRootId string `json:"org_root_id" gorm:"column:org_root_id;type:uuid"` //根id
  23. CreatedAt time.Time `json:"created_at" form:"created_at"`
  24. UpdatedAt time.Time `json:"updated_at" form:"updated_at"`
  25. DeletedAt *time.Time `json:"deleted_at" form:"deleted_at" sql:"index"`
  26. }
  27. type FmOrgReq struct {
  28. Id string `json:"id"` //组织id
  29. Name string `json:"name" binding:"required"` //名称
  30. Alias string `json:"alias"` //机构简称
  31. Contacts string `json:"contacts"` //设备负责联系人
  32. Mobile string `json:"mobile"` //手机号
  33. Summary string `json:"summary" ` //简介
  34. Type int `json:"type" binding:"required"` //类型 1:商户 3 门诊 4 调剂中心
  35. Pid string `json:"pid" binding:"required"` //上级id 一级 0
  36. Level int `json:"level"` //(商户 1、2、3 、4;其他类型填0或空)
  37. Province string `json:"province"` //省
  38. City string `json:"city"` //市
  39. District string `json:"district"` //区/县
  40. Addr string `json:"addr"` //详细地址
  41. OrgRootId string `json:"org_root_id"` //根id
  42. CreatedAt time.Time `json:"created_at"`
  43. UpdatedAt time.Time `json:"updated_at"`
  44. DeletedAt *time.Time `json:"deleted_at"`
  45. }
  46. func (deo *FmOrg) BeforeCreate(scope *gorm.Scope) error {
  47. deo.Id = util.GUUID.NewV1().String()
  48. if deo.Pid == util.EmptyUUID {
  49. deo.OrgRootId = deo.Id
  50. }
  51. return nil
  52. }