models.py 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. from django.db import models
  2. # Create your models here.
  3. class BabyUser(models.Model):
  4. id = models.AutoField(primary_key=True, verbose_name='自增id')
  5. user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id')
  6. nick_name = models.CharField(default='', max_length=20, verbose_name='昵称')
  7. sex = models.SmallIntegerField(default=0, verbose_name='性别') # 0:女 1:男
  8. birthday = models.IntegerField(default=0, verbose_name='生日')
  9. icon_url = models.TextField(default='', verbose_name='头像地址')
  10. device_id = models.CharField(default='', max_length=32, verbose_name='关联设备')
  11. serial_no = models.CharField(default='', max_length=32, verbose_name='关联序列号')
  12. is_default = models.BooleanField(default=False, verbose_name='是否默认')
  13. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  14. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  15. class Meta:
  16. db_table = 'baby_user'
  17. verbose_name = '宝宝用户表'
  18. verbose_name_plural = verbose_name
  19. app_label = 'Roomumy'
  20. class FeedType(models.Model):
  21. id = models.AutoField(primary_key=True, verbose_name='自增id')
  22. name = models.CharField(default='', max_length=10, verbose_name='名称')
  23. # 1:母乳亲喂 2:母乳瓶喂 3:奶粉 4:辅食 5:换尿布 6:身高体重 7:户外活动 8:育儿日记 9:自定义 10:体温
  24. sort = models.IntegerField(default=0, verbose_name='排序')
  25. icon_url = models.TextField(default='', verbose_name='图标地址')
  26. is_show = models.BooleanField(default=True, verbose_name='是否展示')
  27. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  28. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  29. class Meta:
  30. db_table = 'feed_type'
  31. verbose_name = '喂养类型表'
  32. verbose_name_plural = verbose_name
  33. app_label = 'Roomumy'
  34. class FeedDiary(models.Model):
  35. id = models.AutoField(primary_key=True, verbose_name='自增id')
  36. baby_id = models.IntegerField(default=0, verbose_name='关联宝宝id')
  37. feed_type = models.ForeignKey(FeedType, to_field='id', on_delete=models.CASCADE, default='', verbose_name='喂养类型')
  38. # 1:母乳亲喂 2:母乳瓶喂 3:奶粉 4:辅食 5:换尿布 6:身高体重 7:户外活动 8:育儿日记 9:自定义
  39. feed_content = models.JSONField(null=True, verbose_name='事件内容')
  40. # 当类型为5时,sub_event_type为 1:嘘嘘 2:臭臭 3:嘘嘘+臭臭 4:干爽
  41. date_time = models.IntegerField(default=0, verbose_name='事件时间')
  42. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  43. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  44. class Meta:
  45. db_table = 'feed_diary'
  46. verbose_name = '喂养日记表'
  47. verbose_name_plural = verbose_name
  48. app_label = 'Roomumy'
  49. class AlbumTitle(models.Model):
  50. id = models.AutoField(primary_key=True)
  51. album_title = models.TextField(blank=True, default='', verbose_name='相册标题')
  52. lang = models.CharField(default='', max_length=10, verbose_name='语言')
  53. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  54. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  55. class Meta:
  56. db_table = 'album_title'
  57. verbose_name = '时光相册默认标题表'
  58. verbose_name_plural = verbose_name
  59. app_label = 'Roomumy'
  60. class TimeAlbum(models.Model):
  61. id = models.AutoField(primary_key=True)
  62. device_id = models.CharField(default='', max_length=32, verbose_name='关联设备', db_index=True)
  63. album_date = models.IntegerField(default=0, verbose_name='相册日期', db_index=True)
  64. album_title = models.TextField(default=0, verbose_name='相册标题')
  65. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  66. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  67. class Meta:
  68. db_table = 'time_album'
  69. verbose_name = '设备时光相册表'
  70. verbose_name_plural = verbose_name
  71. app_label = 'Roomumy'
  72. class AlbumMedia(models.Model):
  73. id = models.AutoField(primary_key=True)
  74. time_album_id = models.IntegerField(default=0, verbose_name=u'时光相册表id', db_index=True)
  75. # 这三个字段组成存储桶的访问链接
  76. device_id = models.CharField(default='', max_length=32, verbose_name='关联设备', db_index=True)
  77. channel = models.IntegerField(default=1, verbose_name='通道')
  78. event_time = models.IntegerField(default=0, verbose_name='事件时间')
  79. # 0表示隐藏 1表示显示 2表示被添加为日记
  80. status = models.SmallIntegerField(default=1, verbose_name='状态')
  81. # 1: 阿里云, 2: AWS, 3: oci美国凤凰城, 4: oci英国伦敦, 5: 华为云
  82. storage_location = models.SmallIntegerField(default=0, verbose_name='存储位置')
  83. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  84. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  85. class Meta:
  86. db_table = "album_media"
  87. verbose_name = "相册媒体表"
  88. verbose_name_plural = verbose_name
  89. app_label = 'Roomumy'
  90. class TimeDiary(models.Model):
  91. id = models.AutoField(primary_key=True)
  92. user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id', db_index=True)
  93. diary_date = models.IntegerField(default=0, verbose_name='日记日期', db_index=True)
  94. album_media = models.ForeignKey(AlbumMedia, to_field='id', on_delete=models.CASCADE, default=None,
  95. verbose_name='相册媒体表', db_constraint=False, null=True)
  96. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  97. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  98. class Meta:
  99. db_table = "time_diary"
  100. verbose_name = "用户时光日记表"
  101. verbose_name_plural = verbose_name
  102. app_label = 'Roomumy'
  103. class BabyGrowthStandard(models.Model):
  104. age_min = models.IntegerField(verbose_name="最小年龄(天)", help_text="单位:天")
  105. age_max = models.IntegerField(verbose_name="最大年龄(天)", help_text="单位:天")
  106. gender = models.IntegerField(default=0, verbose_name="性别")
  107. height_min = models.FloatField(verbose_name="最小身高 (cm)")
  108. height_max = models.FloatField(verbose_name="最大身高 (cm)")
  109. weight_min = models.FloatField(verbose_name="最小体重 (kg)")
  110. weight_max = models.FloatField(verbose_name="最大体重 (kg)")
  111. head_circumference_min = models.FloatField(verbose_name="最小头围 (cm)")
  112. head_circumference_max = models.FloatField(verbose_name="最大头围 (cm)")
  113. created_time = models.IntegerField(default=0, verbose_name='创建时间')
  114. updated_time = models.IntegerField(default=0, verbose_name='更新时间')
  115. class Meta:
  116. db_table = "baby_growth_standard"
  117. verbose_name = "婴儿成长标准表"
  118. verbose_name_plural = verbose_name
  119. app_label = 'Roomumy'
  120. class DevelopmentalPoints(models.Model):
  121. id = models.AutoField(primary_key=True, verbose_name='自增id')
  122. month = models.CharField(default='', max_length=32, verbose_name='月龄')
  123. title = models.CharField(default='', max_length=32, verbose_name='标题')
  124. weight = models.CharField(default='', max_length=32, verbose_name='体重')
  125. height = models.CharField(default='', max_length=32, verbose_name='身高')
  126. head_circumference = models.CharField(default='', max_length=32, verbose_name='头围')
  127. content = models.TextField(default='', verbose_name='内容')
  128. class Meta:
  129. db_table = "developmental_points"
  130. verbose_name = "发育要点"
  131. verbose_name_plural = verbose_name
  132. app_label = 'Roomumy'