|
|
@@ -1,6 +1,5 @@
|
1
|
1
|
# -*- coding: utf-8 -*-
|
2
|
2
|
|
3
|
|
-from django.conf import settings
|
4
|
3
|
from django.db import models
|
5
|
4
|
from django.utils.translation import ugettext_lazy as _
|
6
|
5
|
from django_models_ext import BaseModelMixin, SexModelMixin
|
|
|
@@ -143,14 +142,6 @@ class ThermometerEquipmentInfo(BaseModelMixin):
|
143
|
142
|
(OFFLINE, '已离线'),
|
144
|
143
|
)
|
145
|
144
|
|
146
|
|
- SUCCESS = 1
|
147
|
|
- FAIL = 0
|
148
|
|
-
|
149
|
|
- REGISTER_STATUE_TUPLE = (
|
150
|
|
- (SUCCESS, '注册成功'),
|
151
|
|
- (FAIL, '注册失败'),
|
152
|
|
- )
|
153
|
|
-
|
154
|
145
|
eqpt_id = ShortUUIDField(_('eqpt_id'), max_length=32, blank=True, null=True, help_text='设备唯一标识', db_index=True, unique=True)
|
155
|
146
|
|
156
|
147
|
point_id = models.CharField(_('point_id'), max_length=32, blank=True, null=True, help_text='隔离点唯一标识', db_index=True)
|
|
|
@@ -164,19 +155,6 @@ class ThermometerEquipmentInfo(BaseModelMixin):
|
164
|
155
|
# 用户基本信息
|
165
|
156
|
ipui_pk = models.IntegerField(_('ipui_pk'), default=0, help_text='隔离点用户录入PK')
|
166
|
157
|
|
167
|
|
- name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='用户姓名')
|
168
|
|
- sex = models.IntegerField(_('sex'), choices=SexModelMixin.SEX_TUPLE, default=SexModelMixin.UNKNOWN, help_text='用户性别')
|
169
|
|
- birth_stamp = models.BigIntegerField(_('birth_stamp'), default=0, help_text='生日时间戳')
|
170
|
|
- age = models.IntegerField(_('age'), default=0, help_text='用户年龄')
|
171
|
|
- phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='用户电话', db_index=True)
|
172
|
|
-
|
173
|
|
- remark = models.CharField(_('remark'), max_length=255, blank=True, null=True, help_text='备注')
|
174
|
|
-
|
175
|
|
- last_submit_at = models.DateTimeField(_('last_submit_at'), blank=True, null=True, help_text='上一次上报时间')
|
176
|
|
-
|
177
|
|
- eqpt_register_status = models.IntegerField(_('eqpt_register_status'), choices=REGISTER_STATUE_TUPLE, default=FAIL, help_text='设备注册状态')
|
178
|
|
- eqpt_register_result = models.TextField(_('eqpt_register_result'), blank=True, null=True, help_text='设备注册结果')
|
179
|
|
-
|
180
|
158
|
class Meta:
|
181
|
159
|
verbose_name = _('测温设备信息')
|
182
|
160
|
verbose_name_plural = _('测温设备信息')
|
|
|
@@ -184,13 +162,6 @@ class ThermometerEquipmentInfo(BaseModelMixin):
|
184
|
162
|
def __unicode__(self):
|
185
|
163
|
return self.pk
|
186
|
164
|
|
187
|
|
- def final_temperature_status(temperature):
|
188
|
|
- if not temperature:
|
189
|
|
- return '-'
|
190
|
|
- if temperature > settings.FEVER_TEMPERATURE:
|
191
|
|
- return '异常'
|
192
|
|
- return '正常'
|
193
|
|
-
|
194
|
165
|
@property
|
195
|
166
|
def data(self):
|
196
|
167
|
return {
|
|
|
@@ -202,16 +173,6 @@ class ThermometerEquipmentInfo(BaseModelMixin):
|
202
|
173
|
'active_status_str': dict(self.ACTIVE_STATUE_TUPLE).get(self.active_status, ''),
|
203
|
174
|
'active_at': tc.local_string(utc_dt=self.active_at),
|
204
|
175
|
'ipui_pk': self.ipui_pk,
|
205
|
|
- # 'name': self.name or '',
|
206
|
|
- # 'sex': self.sex,
|
207
|
|
- # 'sex_str': dict(SexModelMixin.SEX_TUPLE).get(self.sex, ''),
|
208
|
|
- # 'age': self.age or '',
|
209
|
|
- # 'phone': self.phone or '',
|
210
|
|
- # 'remark': self.remark or '',
|
211
|
|
- # 'last_submit_at': tc.local_string(utc_dt=self.last_submit_at) if self.last_submit_at else '',
|
212
|
|
- # 'eqpt_register_status': self.eqpt_register_status,
|
213
|
|
- # 'eqpt_register_status_str': dict(self.REGISTER_STATUE_TUPLE).get(self.eqpt_register_status, ''),
|
214
|
|
- # 'eqpt_register_result': self.eqpt_register_result,
|
215
|
176
|
'created_at': tc.local_string(utc_dt=self.created_at),
|
216
|
177
|
}
|
217
|
178
|
|