diff --git a/xinelu-admin/pom.xml b/xinelu-admin/pom.xml
index f210cd8..605eede 100644
--- a/xinelu-admin/pom.xml
+++ b/xinelu-admin/pom.xml
@@ -83,6 +83,13 @@
com.xinelu
xinelu-familydoctor
+
+
+
+ com.xinelu
+ xinelu-familydoctor
+
+
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java
new file mode 100644
index 0000000..d230d62
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java
@@ -0,0 +1,63 @@
+package com.xinelu.web.controller.familydoctor;
+
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.familydoctor.entity.DeviceBindResident;
+import com.xinelu.familydoctor.service.DeviceBindResidentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author gaoyu
+ * @description 设备绑定控制器
+ * @date 2023-9-25 16:54
+ */
+@Api(tags = {"设备绑定控制器"})
+@RestController
+@RequestMapping("/fd/device")
+public class DeviceBindResidentController extends BaseController {
+ @Resource
+ private DeviceBindResidentService deviceBindResidentService;
+
+ @ApiOperation("绑定设备")
+ @PostMapping("binding")
+ public AjaxResult bind(@RequestBody DeviceBindResident entity) {
+ if (deviceBindResidentService.repeatBind(entity)) {
+ return AjaxResult.error("设备【" + entity.getSn() + "】已绑定");
+ }
+ AjaxResult ajaxResult;
+ int row = deviceBindResidentService.bindDevice(entity);
+ if (row > 0) {
+ ajaxResult = AjaxResult.success();
+ } else {
+ ajaxResult = AjaxResult.error("绑定失败");
+ }
+ return ajaxResult;
+ }
+
+ @ApiOperation("已绑定的设备")
+ @GetMapping("bound/{identity}")
+ @ApiImplicitParam(name = "identity", value = "身份证号", required = true)
+ public AjaxResult boundDevice(@PathVariable String identity) {
+ List list = deviceBindResidentService.boundDevice(identity);
+ return AjaxResult.success(list);
+ }
+
+ @ApiOperation("解绑设备")
+ @PostMapping("unbind")
+ public AjaxResult unbindDevice(@RequestBody DeviceBindResident entity) {
+ AjaxResult ajaxResult;
+ int row = deviceBindResidentService.unbindDevice(entity);
+ if (row > 0) {
+ ajaxResult = AjaxResult.success();
+ } else {
+ ajaxResult = AjaxResult.error("解绑失败");
+ }
+ return ajaxResult;
+ }
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java
new file mode 100644
index 0000000..f4dad3f
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java
@@ -0,0 +1,86 @@
+package com.xinelu.web.controller.familydoctor;
+
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.familydoctor.entity.*;
+import com.xinelu.familydoctor.service.PhysicalSignService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+/**
+ * @author gaoyu
+ * @description 体征检测控制器
+ * @date 2023-9-26 11:21
+ */
+@Api(tags = {"体征检测控制器"})
+@RestController
+@RequestMapping("/fd/ps")
+public class PhysicalSignController extends BaseController {
+ @Resource
+ private PhysicalSignService physicalSignService;
+
+ @ApiOperation("上传血糖")
+ @PostMapping("bg/save")
+ public AjaxResult saveBg(@RequestBody DeviceBgRecord record) {
+ physicalSignService.saveBg(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("上传血压")
+ @PostMapping("bp/save")
+ public AjaxResult saveBp(@RequestBody DeviceBpRecord record) {
+ physicalSignService.saveBp(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("上传血脂")
+ @PostMapping("bf/save")
+ public AjaxResult saveBf(@RequestBody DeviceBfRecord record) {
+ physicalSignService.saveBf(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("上传BMI")
+ @PostMapping("bmi/save")
+ public AjaxResult saveBmi(@RequestBody DeviceBmiRecord record) {
+ physicalSignService.saveBmi(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("上传血氧")
+ @PostMapping("bo/save")
+ public AjaxResult saveBo(@RequestBody DeviceBoRecord record) {
+ physicalSignService.saveBo(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("上传心率")
+ @PostMapping("hr/save")
+ public AjaxResult saveHr(@RequestBody DeviceHrRecord record) {
+ physicalSignService.saveHr(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("上传体温")
+ @PostMapping("temp/save")
+ public AjaxResult saveTemp(@RequestBody DeviceTempRecord record) {
+ physicalSignService.saveTemp(record);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("获取体征记录")
+ @GetMapping("record")
+ @ApiImplicitParams({@ApiImplicitParam(name = "identity", value = "身份证号", required = true),
+ @ApiImplicitParam(name = "type", value = "时间类型0:全部1:周2:月3:年", required = true),
+ @ApiImplicitParam(name = "label", value = "查询标识1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温", required = true)})
+ public AjaxResult record(String identity, String type, String label) {
+ Map map = physicalSignService.record(identity, type, label);
+ return AjaxResult.success(map);
+ }
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBfRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBfRecord.java
new file mode 100644
index 0000000..89bbe02
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBfRecord.java
@@ -0,0 +1,50 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 血脂记录表
+ * @TableName device_bf_record
+ */
+@Data
+public class DeviceBfRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * 血清总胆固醇(单位:mmol/L)
+ */
+ private BigDecimal tc;
+
+ /**
+ * 甘油三酯(单位:mmol/L)
+ */
+ private BigDecimal tg;
+
+ /**
+ * 高密度脂蛋白胆固醇(单位:mmol/L)
+ */
+ private BigDecimal hdl;
+
+ /**
+ * 低密度脂蛋白胆固醇(单位:mmol/L)
+ */
+ private BigDecimal ldl;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBgRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBgRecord.java
new file mode 100644
index 0000000..ddfd25d
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBgRecord.java
@@ -0,0 +1,45 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 血糖记录表
+ * @TableName device_bg_record
+ */
+@Data
+public class DeviceBgRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * 血糖值(单位:mmol/L)
+ */
+ private BigDecimal bg;
+
+ /**
+ * 时间段1:凌晨2:早餐前3:早晨后4:午餐前5:午餐后6:晚餐前7:晚餐后8:睡前
+ */
+ private String bucket;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ /**
+ * 上传方式1:手动2:自动
+ */
+ private String uploadType;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBindResident.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBindResident.java
new file mode 100644
index 0000000..a805ad2
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBindResident.java
@@ -0,0 +1,69 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 居民设备绑定记录表
+ * @TableName device_bind_resident
+ */
+@ApiModel("居民设备绑定记录表")
+@Data
+public class DeviceBindResident implements Serializable {
+ /**
+ * 主键
+ */
+ @ApiModelProperty("主键")
+ private Long id;
+
+ /**
+ * 身份证号
+ */
+ @ApiModelProperty("身份证号")
+ private String identity;
+
+ /**
+ * 设备SN码
+ */
+ @ApiModelProperty("设备SN码")
+ private String sn;
+
+ /**
+ * 设备类型(0: 其他 1:血压计 2:血糖仪 3:血脂仪 4:血氧仪 5:体重秤 6:体温计)
+ */
+ @ApiModelProperty("设备类型(0: 其他 1:血压计 2:血糖仪 3:血脂仪 4:血氧仪 5:体重秤 6:体温计)")
+ private String deviceType;
+
+ /**
+ * 状态(0:解绑 1:绑定)
+ */
+ @ApiModelProperty("状态(0:解绑 1:绑定)")
+ private String state;
+
+ /**
+ * 备注
+ */
+ @ApiModelProperty("备注")
+ private String remark;
+
+ /**
+ * 绑定时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @ApiModelProperty("绑定时间")
+ private Date bindTime;
+
+ /**
+ * 解绑时间
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @ApiModelProperty("解绑时间")
+ private Date unbindTime;
+
+ private static final long serialVersionUID = 1L;
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBmiRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBmiRecord.java
new file mode 100644
index 0000000..6b382a9
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBmiRecord.java
@@ -0,0 +1,35 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * BMI记录表
+ * @TableName device_bmi_record
+ */
+@Data
+public class DeviceBmiRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * BMI(单位:kg/m^2)
+ */
+ private BigDecimal bmi;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBoRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBoRecord.java
new file mode 100644
index 0000000..879080f
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBoRecord.java
@@ -0,0 +1,39 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 血氧记录表
+ * @TableName device_bo_record
+ */
+@Data
+public class DeviceBoRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * 血氧(单位:%)
+ */
+ private Integer spo2;
+
+ /**
+ * 脉搏(单位:次/分)
+ */
+ private Integer pulse;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBpRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBpRecord.java
new file mode 100644
index 0000000..c12925b
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceBpRecord.java
@@ -0,0 +1,49 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 血压记录表
+ * @TableName device_bp_record
+ */
+@Data
+public class DeviceBpRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * 收缩压(单位:mmHg)
+ */
+ private Integer sbp;
+
+ /**
+ * 舒张压(单位:mmHg)
+ */
+ private Integer dbp;
+
+ /**
+ * 心率(单位:次/分)
+ */
+ private Integer hr;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ /**
+ * 上传方式1:手动2:自动
+ */
+ private String uploadType;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceHrRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceHrRecord.java
new file mode 100644
index 0000000..392635a
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceHrRecord.java
@@ -0,0 +1,39 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 心率记录表
+ * @TableName device_hr_record
+ */
+@Data
+public class DeviceHrRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * 心率(单位:次/分)
+ */
+ private Integer hr;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ /**
+ * 上传方式1:手动2:自动
+ */
+ private String uploadType;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceTempRecord.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceTempRecord.java
new file mode 100644
index 0000000..32c4f35
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/entity/DeviceTempRecord.java
@@ -0,0 +1,35 @@
+package com.xinelu.familydoctor.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 体温记录表
+ * @TableName device_temp_record
+ */
+@Data
+public class DeviceTempRecord implements Serializable {
+ /**
+ * 自增主键
+ */
+ private Long id;
+
+ /**
+ * 居民身份证号
+ */
+ private String identity;
+
+ /**
+ * 体温(单位:℃)
+ */
+ private BigDecimal temp;
+
+ /**
+ * 测量时间
+ */
+ private Date measureTime;
+
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBfRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBfRecordMapper.java
new file mode 100644
index 0000000..8f53787
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBfRecordMapper.java
@@ -0,0 +1,30 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBfRecord;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bf_record(血脂记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:04:52
+* @Entity com.xinelu.familydoctor.entity.DeviceBfRecord
+*/
+public interface DeviceBfRecordMapper {
+
+ /**
+ * 获取血脂记录
+ * @param identity 身份证号
+ * @param type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-9-27 16:17
+ */
+ List getBfRecord(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceBfRecord record);
+
+ int update(DeviceBfRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBgRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBgRecordMapper.java
new file mode 100644
index 0000000..e8ddbfe
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBgRecordMapper.java
@@ -0,0 +1,41 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBgRecord;
+import com.xinelu.familydoctor.vo.BgCalcVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bg_record(血糖记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:05:00
+* @Entity com.xinelu.familydoctor.entity.DeviceBgRecord
+*/
+public interface DeviceBgRecordMapper {
+
+ /**
+ * 获取血糖记录
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-9-27 16:24
+ */
+ List getBgRecord(@Param("identity") String identity, @Param("type") String type);
+
+ /**
+ * 获取血糖计算值
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link com.xinelu.familydoctor.vo.BgCalcVO}
+ * @author gaoyu
+ * @date 2023-9-28 9:10
+ */
+ BgCalcVO getBgCalc(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceBgRecord record);
+
+ int update(DeviceBgRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBindResidentMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBindResidentMapper.java
new file mode 100644
index 0000000..a97ae50
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBindResidentMapper.java
@@ -0,0 +1,38 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBindResident;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bind_resident(居民设备绑定记录表)】的数据库操作Mapper
+* @createDate 2023-09-25 16:01:01
+* @Entity com.xinelu.familydoctor.entity.DeviceBindResident
+*/
+public interface DeviceBindResidentMapper {
+
+ /**
+ * 已绑定设备
+ * @param identity 身份证号
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-9-26 9:58
+ */
+ List boundDevice(@Param("identity") String identity);
+
+ /**
+ * 设备是否多次绑定
+ * @param record 参数
+ * @return {@link java.lang.Integer}
+ * @author gaoyu
+ * @date 2023-9-25 17:16
+ */
+ Integer repeatBind(DeviceBindResident record);
+
+ int insert(DeviceBindResident record);
+
+ int update(DeviceBindResident record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBmiRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBmiRecordMapper.java
new file mode 100644
index 0000000..3640a79
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBmiRecordMapper.java
@@ -0,0 +1,41 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBmiRecord;
+import com.xinelu.familydoctor.vo.BmiCalcVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bmi_record(BMI记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:05:05
+* @Entity com.xinelu.familydoctor.entity.DeviceBmiRecord
+*/
+public interface DeviceBmiRecordMapper {
+
+ /**
+ * 获取bmi记录
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-10-8 9:21
+ */
+ List getBmiRecord(@Param("identity") String identity, @Param("type") String type);
+
+ /**
+ * 获取bmi计算值
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link com.xinelu.familydoctor.vo.BmiCalcVO}
+ * @author gaoyu
+ * @date 2023-10-8 9:22
+ */
+ BmiCalcVO getBmiCalc(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceBmiRecord record);
+
+ int update(DeviceBmiRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBoRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBoRecordMapper.java
new file mode 100644
index 0000000..2576a78
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBoRecordMapper.java
@@ -0,0 +1,43 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBmiRecord;
+import com.xinelu.familydoctor.entity.DeviceBoRecord;
+import com.xinelu.familydoctor.vo.BmiCalcVO;
+import com.xinelu.familydoctor.vo.BoCalcVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bo_record(血氧记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:05:09
+* @Entity com.xinelu.familydoctor.entity.DeviceBoRecord
+*/
+public interface DeviceBoRecordMapper {
+
+ /**
+ * 获取血氧记录
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-10-8 9:21
+ */
+ List getBoRecord(@Param("identity") String identity, @Param("type") String type);
+
+ /**
+ * 获取血氧计算值
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link com.xinelu.familydoctor.vo.BoCalcVO}
+ * @author gaoyu
+ * @date 2023-10-8 9:22
+ */
+ BoCalcVO getBoCalc(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceBoRecord record);
+
+ int update(DeviceBoRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBpRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBpRecordMapper.java
new file mode 100644
index 0000000..ff3cce9
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBpRecordMapper.java
@@ -0,0 +1,41 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBpRecord;
+import com.xinelu.familydoctor.vo.BpCalcVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bp_record(血压记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:05:12
+* @Entity com.xinelu.familydoctor.entity.DeviceBpRecord
+*/
+public interface DeviceBpRecordMapper {
+
+ /**
+ * 获取血压记录
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-10-8 14:33
+ */
+ List getBpRecord(@Param("identity") String identity, @Param("type") String type);
+
+ /**
+ * 获取血压计算值
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link com.xinelu.familydoctor.vo.BpCalcVO}
+ * @author gaoyu
+ * @date 2023-10-8 14:34
+ */
+ BpCalcVO getBpCalc(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceBpRecord record);
+
+ int update(DeviceBpRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceHrRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceHrRecordMapper.java
new file mode 100644
index 0000000..752d31b
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceHrRecordMapper.java
@@ -0,0 +1,41 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceHrRecord;
+import com.xinelu.familydoctor.vo.HrCalcVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_hr_record(心率记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:05:16
+* @Entity com.xinelu.familydoctor.entity.DeviceHrRecord
+*/
+public interface DeviceHrRecordMapper {
+
+ /**
+ * 获取心率记录
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-10-8 14:48
+ */
+ List getHrRecord(@Param("identity") String identity, @Param("type") String type);
+
+ /**
+ * 获取心率计算值
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link com.xinelu.familydoctor.vo.HrCalcVO}
+ * @author gaoyu
+ * @date 2023-10-8 14:49
+ */
+ HrCalcVO getHrCalc(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceHrRecord record);
+
+ int update(DeviceHrRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceTempRecordMapper.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceTempRecordMapper.java
new file mode 100644
index 0000000..8523163
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceTempRecordMapper.java
@@ -0,0 +1,43 @@
+package com.xinelu.familydoctor.mapper;
+
+import com.xinelu.familydoctor.entity.DeviceBoRecord;
+import com.xinelu.familydoctor.entity.DeviceTempRecord;
+import com.xinelu.familydoctor.vo.BoCalcVO;
+import com.xinelu.familydoctor.vo.TempCalcVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_temp_record(体温记录表)】的数据库操作Mapper
+* @createDate 2023-09-26 15:05:19
+* @Entity com.xinelu.familydoctor.entity.DeviceTempRecord
+*/
+public interface DeviceTempRecordMapper {
+
+ /**
+ * 获取体温记录
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-10-8 9:21
+ */
+ List getTempRecord(@Param("identity") String identity, @Param("type") String type);
+
+ /**
+ * 获取体温计算值
+ * @param identity 身份证号
+ * @param type type 类型0:全部1:周2:月3:年
+ * @return {@link com.xinelu.familydoctor.vo.TempCalcVO}
+ * @author gaoyu
+ * @date 2023-10-8 9:22
+ */
+ TempCalcVO getTempCalc(@Param("identity") String identity, @Param("type") String type);
+
+ int insert(DeviceTempRecord record);
+
+ int update(DeviceTempRecord record);
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/DeviceBindResidentService.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/DeviceBindResidentService.java
new file mode 100644
index 0000000..7b39326
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/DeviceBindResidentService.java
@@ -0,0 +1,48 @@
+package com.xinelu.familydoctor.service;
+
+import com.xinelu.familydoctor.entity.DeviceBindResident;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bind_resident(居民设备绑定记录表)】的数据库操作Service
+* @createDate 2023-09-25 16:00:00
+*/
+public interface DeviceBindResidentService {
+
+ /**
+ * 已绑定设备
+ * @param identity 身份证号
+ * @return {@link java.util.List}
+ * @author gaoyu
+ * @date 2023-9-26 9:58
+ */
+ List boundDevice(@Param("identity") String identity);
+ /**
+ * 设备是否重复绑定
+ * @param record 参数
+ * @return {@link boolean}
+ * @author gaoyu
+ * @date 2023-9-25 17:17
+ */
+ boolean repeatBind(DeviceBindResident record);
+ /**
+ * 绑定设备
+ * @param entity 参数
+ * @return {@link int}
+ * @author gaoyu
+ * @date 2023-9-25 16:49
+ */
+ int bindDevice(DeviceBindResident entity);
+
+ /**
+ * 解绑设备
+ * @param entity 参数
+ * @return {@link int}
+ * @author gaoyu
+ * @date 2023-9-26 10:14
+ */
+ int unbindDevice(DeviceBindResident entity);
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/PhysicalSignService.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/PhysicalSignService.java
new file mode 100644
index 0000000..e02cffc
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/PhysicalSignService.java
@@ -0,0 +1,25 @@
+package com.xinelu.familydoctor.service;
+
+import com.xinelu.familydoctor.entity.*;
+
+import java.util.Map;
+
+public interface PhysicalSignService {
+ void saveBg(DeviceBgRecord record);
+ void saveBp(DeviceBpRecord record);
+ void saveBf(DeviceBfRecord record);
+ void saveBmi(DeviceBmiRecord record);
+ void saveBo(DeviceBoRecord record);
+ void saveHr(DeviceHrRecord record);
+ void saveTemp(DeviceTempRecord record);
+ /**
+ * 获取体征记录
+ * @param identity 身份证号
+ * @param type 时间类型0:全部1:周2:月3:年
+ * @param label 查询标识1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温
+ * @return {@link java.util.Map}
+ * @author gaoyu
+ * @date 2023-10-9 10:10
+ */
+ Map record(String identity, String type, String label);
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/impl/DeviceBindResidentServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/impl/DeviceBindResidentServiceImpl.java
new file mode 100644
index 0000000..7abc215
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/impl/DeviceBindResidentServiceImpl.java
@@ -0,0 +1,45 @@
+package com.xinelu.familydoctor.service.impl;
+
+import com.xinelu.familydoctor.entity.DeviceBindResident;
+import com.xinelu.familydoctor.service.DeviceBindResidentService;
+import com.xinelu.familydoctor.mapper.DeviceBindResidentMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+/**
+* @author gaoyu
+* @description 针对表【device_bind_resident(居民设备绑定记录表)】的数据库操作Service实现
+* @createDate 2023-09-25 16:00:00
+*/
+@Service
+public class DeviceBindResidentServiceImpl implements DeviceBindResidentService{
+ @Resource
+ private DeviceBindResidentMapper deviceBindResidentMapper;
+
+ @Override
+ public List boundDevice(String identity) {
+ return deviceBindResidentMapper.boundDevice(identity);
+ }
+
+ @Override
+ public boolean repeatBind(DeviceBindResident record) {
+ return deviceBindResidentMapper.repeatBind(record) != null;
+ }
+
+ @Override
+ public int bindDevice(DeviceBindResident entity) {
+ entity.setBindTime(new Date());
+ entity.setState("1");
+ return deviceBindResidentMapper.insert(entity);
+ }
+
+ @Override
+ public int unbindDevice(DeviceBindResident entity) {
+ entity.setUnbindTime(new Date());
+ entity.setState("0");
+ return deviceBindResidentMapper.update(entity);
+ }
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/impl/PhysicalSignServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/impl/PhysicalSignServiceImpl.java
new file mode 100644
index 0000000..5b07dce
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/impl/PhysicalSignServiceImpl.java
@@ -0,0 +1,164 @@
+package com.xinelu.familydoctor.service.impl;
+
+import com.xinelu.familydoctor.entity.*;
+import com.xinelu.familydoctor.mapper.*;
+import com.xinelu.familydoctor.service.PhysicalSignService;
+import com.xinelu.familydoctor.vo.*;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author gaoyu
+ * @description 体征检测业务实现类
+ * @date 2023-10-8 15:59
+ */
+@Service
+public class PhysicalSignServiceImpl implements PhysicalSignService {
+ @Resource
+ private DeviceBfRecordMapper deviceBfRecordMapper;
+ @Resource
+ private DeviceBgRecordMapper deviceBgRecordMapper;
+ @Resource
+ private DeviceBmiRecordMapper deviceBmiRecordMapper;
+ @Resource
+ private DeviceBoRecordMapper deviceBoRecordMapper;
+ @Resource
+ private DeviceBpRecordMapper deviceBpRecordMapper;
+ @Resource
+ private DeviceHrRecordMapper deviceHrRecordMapper;
+ @Resource
+ private DeviceTempRecordMapper deviceTempRecordMapper;
+
+ @Override
+ public void saveBg(DeviceBgRecord record) {
+ deviceBgRecordMapper.insert(record);
+ }
+
+ @Override
+ public void saveBp(DeviceBpRecord record) {
+ deviceBpRecordMapper.insert(record);
+ }
+
+ @Override
+ public void saveBf(DeviceBfRecord record) {
+ deviceBfRecordMapper.insert(record);
+ }
+
+ @Override
+ public void saveBmi(DeviceBmiRecord record) {
+ deviceBmiRecordMapper.insert(record);
+ }
+
+ @Override
+ public void saveBo(DeviceBoRecord record) {
+ deviceBoRecordMapper.insert(record);
+ }
+
+ @Override
+ public void saveHr(DeviceHrRecord record) {
+ deviceHrRecordMapper.insert(record);
+ }
+
+ @Override
+ public void saveTemp(DeviceTempRecord record) {
+ deviceTempRecordMapper.insert(record);
+ }
+
+ @Override
+ public Map record(String identity, String type, String label) {
+ Map map = new HashMap<>();
+ switch (label) {
+ case "1":
+ map = bgRecord(identity, type);
+ break;
+ case "2":
+ map = bpRecord(identity, type);
+ break;
+ case "3":
+ map = bfRecord(identity, type);
+ break;
+ case "4":
+ map = bmiRecord(identity, type);
+ break;
+ case "5":
+ map = boRecord(identity, type);
+ break;
+ case "6":
+ map = hrRecord(identity, type);
+ break;
+ case "7":
+ map = tempRecord(identity, type);
+ break;
+ default:
+ break;
+ }
+ return map;
+ }
+
+ private Map bgRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceBgRecordMapper.getBgRecord(identity, type);
+ BgCalcVO calc = deviceBgRecordMapper.getBgCalc(identity, type);
+ map.put("list", list);
+ map.put("calc", calc);
+ return map;
+ }
+
+ private Map bpRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceBpRecordMapper.getBpRecord(identity, type);
+ BpCalcVO calc = deviceBpRecordMapper.getBpCalc(identity, type);
+ map.put("list", list);
+ map.put("calc", calc);
+ return map;
+ }
+
+ private Map bfRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceBfRecordMapper.getBfRecord(identity, type);
+// BfCalcVO calc = deviceBfRecordMapper.getBfCalc(identity, type);
+ map.put("list", list);
+// map.put("calc", calc);
+ return map;
+ }
+
+ private Map bmiRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceBmiRecordMapper.getBmiRecord(identity, type);
+ BmiCalcVO calc = deviceBmiRecordMapper.getBmiCalc(identity, type);
+ map.put("list", list);
+ map.put("calc", calc);
+ return map;
+ }
+
+ private Map boRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceBoRecordMapper.getBoRecord(identity, type);
+ BoCalcVO calc = deviceBoRecordMapper.getBoCalc(identity, type);
+ map.put("list", list);
+ map.put("calc", calc);
+ return map;
+ }
+
+ private Map hrRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceHrRecordMapper.getHrRecord(identity, type);
+ HrCalcVO calc = deviceHrRecordMapper.getHrCalc(identity, type);
+ map.put("list", list);
+ map.put("calc", calc);
+ return map;
+ }
+
+ private Map tempRecord(String identity, String type) {
+ Map map = new HashMap<>();
+ List list = deviceTempRecordMapper.getTempRecord(identity, type);
+ TempCalcVO calc = deviceTempRecordMapper.getTempCalc(identity, type);
+ map.put("list", list);
+ map.put("calc", calc);
+ return map;
+ }
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BgCalcVO.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BgCalcVO.java
new file mode 100644
index 0000000..b8576ac
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BgCalcVO.java
@@ -0,0 +1,27 @@
+package com.xinelu.familydoctor.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author gaoyu
+ * @description 血糖计算视图
+ * @date 2023-9-27 16:28
+ */
+@Data
+@ApiModel("血糖计算视图")
+public class BgCalcVO {
+ @ApiModelProperty("最大值")
+ private BigDecimal maxVal;
+ @ApiModelProperty("最小值")
+ private BigDecimal minVal;
+ @ApiModelProperty("偏低次数")
+ private Integer lowerNum;
+ @ApiModelProperty("正常次数")
+ private Integer normalNum;
+ @ApiModelProperty("偏高次数")
+ private Integer higherNum;
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BmiCalcVO.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BmiCalcVO.java
new file mode 100644
index 0000000..6d9766c
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BmiCalcVO.java
@@ -0,0 +1,27 @@
+package com.xinelu.familydoctor.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author gaoyu
+ * @description BMI计算视图
+ * @date 2023-10-8 9:00
+ */
+@ApiModel("BMI计算视图")
+@Data
+public class BmiCalcVO {
+ @ApiModelProperty("最大值")
+ private BigDecimal maxVal;
+ @ApiModelProperty("最小值")
+ private BigDecimal minVal;
+ @ApiModelProperty("平均值")
+ private BigDecimal avgVal;
+ @ApiModelProperty("正常次数")
+ private Integer normalNum;
+ @ApiModelProperty("超标次数")
+ private Integer overNum;
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BoCalcVO.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BoCalcVO.java
new file mode 100644
index 0000000..1745f69
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BoCalcVO.java
@@ -0,0 +1,27 @@
+package com.xinelu.familydoctor.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author gaoyu
+ * @description 血氧计算视图
+ * @date 2023-10-8 9:25
+ */
+@ApiModel("血氧计算视图")
+@Data
+public class BoCalcVO {
+ @ApiModelProperty("最大值")
+ private BigDecimal maxVal;
+ @ApiModelProperty("最小值")
+ private BigDecimal minVal;
+ @ApiModelProperty("平均值")
+ private BigDecimal avgVal;
+ @ApiModelProperty("正常次数")
+ private Integer normalNum;
+ @ApiModelProperty("超标次数")
+ private Integer overNum;
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BpCalcVO.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BpCalcVO.java
new file mode 100644
index 0000000..2bbeac0
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/BpCalcVO.java
@@ -0,0 +1,29 @@
+package com.xinelu.familydoctor.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author gaoyu
+ * @description 血压计算视图
+ * @date 2023-10-8 9:42
+ */
+@ApiModel("血压计算视图")
+@Data
+public class BpCalcVO {
+ @ApiModelProperty("收缩压最大值")
+ private String maxSbpVal;
+ @ApiModelProperty("舒张压最大值")
+ private String maxDbpVal;
+ @ApiModelProperty("收缩压最小值")
+ private String minSbpVal;
+ @ApiModelProperty("舒张压最小值")
+ private String minDbpVal;
+ @ApiModelProperty("平均值")
+ private String avgVal;
+ @ApiModelProperty("正常次数")
+ private Integer normalNum;
+ @ApiModelProperty("超标次数")
+ private Integer overNum;
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/HrCalcVO.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/HrCalcVO.java
new file mode 100644
index 0000000..6979736
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/HrCalcVO.java
@@ -0,0 +1,25 @@
+package com.xinelu.familydoctor.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author gaoyu
+ * @description 心率计算视图
+ * @date 2023-10-8 14:37
+ */
+@ApiModel("心率计算视图")
+@Data
+public class HrCalcVO {
+ @ApiModelProperty("最大值")
+ private Integer maxVal;
+ @ApiModelProperty("最小值")
+ private Integer minVal;
+ @ApiModelProperty("平均值")
+ private Integer avgVal;
+ @ApiModelProperty("正常次数")
+ private Integer normalNum;
+ @ApiModelProperty("超标次数")
+ private Integer overNum;
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/TempCalcVO.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/TempCalcVO.java
new file mode 100644
index 0000000..f0401d9
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/vo/TempCalcVO.java
@@ -0,0 +1,27 @@
+package com.xinelu.familydoctor.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author gaoyu
+ * @description 体温计算视图
+ * @date 2023-10-8 15:05
+ */
+@ApiModel("体温计算视图")
+@Data
+public class TempCalcVO {
+ @ApiModelProperty("最大值")
+ private BigDecimal maxVal;
+ @ApiModelProperty("最小值")
+ private BigDecimal minVal;
+ @ApiModelProperty("平均值")
+ private BigDecimal avgVal;
+ @ApiModelProperty("正常次数")
+ private Integer normalNum;
+ @ApiModelProperty("超标次数")
+ private Integer overNum;
+}
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml
new file mode 100644
index 0000000..523bfa5
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,tc,
+ tg,hdl,ldl,
+ measure_time
+
+
+
+
+
+ insert into device_bf_record
+ (identity,tc
+ ,tg,hdl,ldl
+ ,measure_time)
+ values (#{identity,jdbcType=VARCHAR},#{tc,jdbcType=DECIMAL}
+ ,#{tg,jdbcType=DECIMAL},#{hdl,jdbcType=DECIMAL},#{ldl,jdbcType=DECIMAL}
+ ,#{measureTime,jdbcType=TIMESTAMP})
+
+
+ update device_bf_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ tc = #{tc,jdbcType=DECIMAL},
+
+
+ tg = #{tg,jdbcType=DECIMAL},
+
+
+ hdl = #{hdl,jdbcType=DECIMAL},
+
+
+ ldl = #{ldl,jdbcType=DECIMAL},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBgRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBgRecordMapper.xml
new file mode 100644
index 0000000..65ff150
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBgRecordMapper.xml
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,bg,
+ bucket,measure_time,upload_type
+
+
+
+
+
+
+
+ insert into device_bg_record
+ (identity,bg
+ ,bucket,measure_time,upload_type
+ )
+ values (#{identity,jdbcType=VARCHAR},#{bg,jdbcType=DECIMAL}
+ ,#{bucket,jdbcType=VARCHAR},#{measureTime,jdbcType=TIMESTAMP},#{uploadType,jdbcType=VARCHAR}
+ )
+
+
+ update device_bg_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ bg = #{bg,jdbcType=DECIMAL},
+
+
+ bucket = #{bucket,jdbcType=VARCHAR},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ upload_type = #{uploadType,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBindResidentMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBindResidentMapper.xml
new file mode 100644
index 0000000..e3f9e02
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBindResidentMapper.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,sn,
+ device_type,state,remark,
+ bind_time,unbind_time
+
+
+
+
+
+
+
+ insert into device_bind_resident
+ (identity,sn
+ ,device_type,state,remark
+ ,bind_time,unbind_time)
+ values (#{identity,jdbcType=VARCHAR},#{sn,jdbcType=VARCHAR}
+ ,#{deviceType,jdbcType=VARCHAR},#{state,jdbcType=CHAR},#{remark,jdbcType=VARCHAR}
+ ,#{bindTime,jdbcType=TIMESTAMP},#{unbindTime,jdbcType=TIMESTAMP})
+
+
+
+ update device_bind_resident
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ sn = #{sn,jdbcType=VARCHAR},
+
+
+ device_type = #{deviceType,jdbcType=VARCHAR},
+
+
+ state = #{state,jdbcType=CHAR},
+
+
+ remark = #{remark,jdbcType=VARCHAR},
+
+
+ bind_time = #{bindTime,jdbcType=TIMESTAMP},
+
+
+ unbind_time = #{unbindTime,jdbcType=TIMESTAMP},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml
new file mode 100644
index 0000000..6ce7de4
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,bmi,
+ measure_time
+
+
+
+
+
+
+
+ insert into device_bmi_record
+ (identity,bmi
+ ,measure_time)
+ values (#{identity,jdbcType=VARCHAR},#{bmi,jdbcType=DECIMAL}
+ ,#{measureTime,jdbcType=TIMESTAMP})
+
+
+ update device_bmi_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ bmi = #{bmi,jdbcType=DECIMAL},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBoRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBoRecordMapper.xml
new file mode 100644
index 0000000..2cf2902
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBoRecordMapper.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,spo2,
+ pulse,measure_time
+
+
+
+
+
+
+
+ insert into device_bo_record
+ (identity,spo2
+ ,pulse,measure_time)
+ values (#{identity,jdbcType=VARCHAR},#{spo2,jdbcType=INTEGER}
+ ,#{pulse,jdbcType=INTEGER},#{measureTime,jdbcType=TIMESTAMP})
+
+
+ update device_bo_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ spo2 = #{spo2,jdbcType=INTEGER},
+
+
+ pulse = #{pulse,jdbcType=INTEGER},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBpRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBpRecordMapper.xml
new file mode 100644
index 0000000..e3271ba
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBpRecordMapper.xml
@@ -0,0 +1,313 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,sbp,
+ dbp,hr,measure_time,
+ upload_type
+
+
+
+
+
+ select concat(sbp, '/', dbp) "maxSbpVal" from device_bp_record
+ where sbp = (select max(sbp) from device_bp_record
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+ )
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+
+ order by id desc limit 1
+
+
+
+ select concat(sbp, '/', dbp) "maxDbpVal" from device_bp_record
+ where dbp = (select max(dbp) from device_bp_record
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+ )
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+
+ order by id desc limit 1
+
+
+
+ select concat(sbp, '/', dbp) "minSbpVal" from device_bp_record
+ where sbp = (select min(sbp) from device_bp_record
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+ )
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+
+ order by id desc limit 1
+
+
+
+ select concat(sbp, '/', dbp) "minDbpVal" from device_bp_record
+ where dbp = (select min(dbp) from device_bp_record
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+ )
+ and identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+
+ order by id desc limit 1
+
+
+
+ select concat(cast(avg(sbp) as signed), '/', cast(avg(dbp) as signed)) "avgVal",
+ count(case when sbp >= 90 and sbp <= 140 and dbp >= 60 and dbp <= 90 then 1 else null end) "normalNum",
+ count(case when sbp < 90 or sbp > 140 or dbp < 60 or dbp > 90 then 1 else null end) "overNum"
+ from device_bp_record
+ where identity = #{identity}
+
+
+
+
+
+
+ and measure_time between date_add(now(), interval -7 day) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 month) and now()
+
+
+
+ and measure_time between date_add(now(), interval -1 year) and now()
+
+
+
+
+
+
+
+
+
+
+ insert into device_bp_record
+ (identity,sbp
+ ,dbp,hr,measure_time
+ ,upload_type)
+ values (#{identity,jdbcType=VARCHAR},#{sbp,jdbcType=INTEGER}
+ ,#{dbp,jdbcType=INTEGER},#{hr,jdbcType=INTEGER},#{measureTime,jdbcType=TIMESTAMP}
+ ,#{uploadType,jdbcType=VARCHAR})
+
+
+ update device_bp_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ sbp = #{sbp,jdbcType=INTEGER},
+
+
+ dbp = #{dbp,jdbcType=INTEGER},
+
+
+ hr = #{hr,jdbcType=INTEGER},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ upload_type = #{uploadType,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceHrRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceHrRecordMapper.xml
new file mode 100644
index 0000000..8f17839
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceHrRecordMapper.xml
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,hr,
+ measure_time,upload_type
+
+
+
+
+
+
+
+ insert into device_hr_record
+ (identity,hr
+ ,measure_time,upload_type)
+ values (#{identity,jdbcType=VARCHAR},#{hr,jdbcType=INTEGER}
+ ,#{measureTime,jdbcType=TIMESTAMP},#{uploadType,jdbcType=VARCHAR})
+
+
+ update device_hr_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ hr = #{hr,jdbcType=INTEGER},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ upload_type = #{uploadType,jdbcType=VARCHAR},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+
diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceTempRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceTempRecordMapper.xml
new file mode 100644
index 0000000..fc95d0f
--- /dev/null
+++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceTempRecordMapper.xml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ id,identity,temp,
+ measure_time
+
+
+
+
+
+
+
+ insert into device_temp_record
+ (identity,temp
+ ,measure_time)
+ values (#{identity,jdbcType=VARCHAR},#{temp,jdbcType=DECIMAL}
+ ,#{measureTime,jdbcType=TIMESTAMP})
+
+
+ update device_temp_record
+
+
+ identity = #{identity,jdbcType=VARCHAR},
+
+
+ temp = #{temp,jdbcType=DECIMAL},
+
+
+ measure_time = #{measureTime,jdbcType=TIMESTAMP},
+
+
+ where id = #{id,jdbcType=BIGINT}
+
+