-num lines-num-old">
+ TEMPERATURE_MEASURE_TYPE_TUPLE = (
+ (CONTINUOUS, '连续型'),
+ (SINGLE, '单次')
+ )
+
point_id = ShortUUIDField(_('point_id'), max_length=32, blank=True, null=True, help_text='隔离点唯一标识', db_index=True, unique=True)
point_name = models.CharField(_('point_name'), max_length=255, blank=True, null=True, help_text='隔离点名称')
@@ -69,6 +77,7 @@ class IsolationPointInfo(BaseModelMixin):
# }
# ]
point_upload_period = JSONField(_('point_upload_period'), default=[], blank=True, null=True, help_text='隔离点上传时段')
+ temperature_measure_type = models.IntegerField(_('temperature_measure_type'), choices=TEMPERATURE_MEASURE_TYPE_TUPLE, default=SINGLE, help_text='测温类型')
limit_scene_qrcode_url = models.CharField(_('limit_scene_qrcode_url'), max_length=255, blank=True, null=True, help_text='字段二维码')
@@ -81,15 +90,13 @@ class IsolationPointInfo(BaseModelMixin):
@property
def match_upload_period(self):
- if not self.point_upload_period:
- return True
for period in self.point_upload_period:
local_date_string = tc.local_date_string()
start_dt = tc.string_to_datetime(f'{local_date_string} {period["start"]}', format='%Y-%m-%d %H:%M')
end_dt = tc.string_to_datetime(f'{local_date_string} {period["end"]}', format='%Y-%m-%d %H:%M')
- current_dt = tc.make_naive(tc.local_datetime())
- if start_dt < current_dt < end_dt:
- return True
+ current_at = tc.make_naive(tc.local_datetime())
+ if start_dt < current_at < end_dt:
+ return start_dt, end_dt
return False
@property
@@ -174,6 +181,7 @@ class IsolationPointUserInfo(BaseModelMixin):
'temperature_has_upload': self.temperature_has_upload,
'user_status': self.user_status,
'temperature': self.temperature,
+ 'last_submit_at': self.last_submit_at,
'last_report_time': tc.local_string(utc_dt=self.last_submit_at, format='%m-%d %H:%M') if self.last_submit_at else '',
'remark': self.remark or '',
}