From e3085e9b7842a342e8de30ace6a246a1afe43364 Mon Sep 17 00:00:00 2001 From: haown <454902499@qq.com> Date: Thu, 28 Dec 2023 13:30:56 +0800 Subject: [PATCH] =?UTF-8?q?update=3D=3D=3D>:=E5=A2=9E=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=BD=93=E5=BE=81=E6=A3=80=E6=B5=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../familydoctor/PhysicalSignController.java | 28 +++++ .../mapper/DeviceBfRecordMapper.java | 5 + .../mapper/DeviceBgRecordMapper.java | 12 +- .../mapper/DeviceBmiRecordMapper.java | 5 + .../mapper/DeviceBoRecordMapper.java | 10 +- .../mapper/DeviceBpRecordMapper.java | 9 +- .../mapper/DeviceHrRecordMapper.java | 5 + .../mapper/DeviceTempRecordMapper.java | 10 +- .../service/PhysicalSignService.java | 7 ++ .../service/impl/PhysicalSignServiceImpl.java | 109 +++++++++++++++++- .../resources/mapper/DeviceBfRecordMapper.xml | 13 +++ .../resources/mapper/DeviceBgRecordMapper.xml | 18 +++ .../mapper/DeviceBmiRecordMapper.xml | 13 +++ .../resources/mapper/DeviceBoRecordMapper.xml | 13 +++ .../resources/mapper/DeviceBpRecordMapper.xml | 22 ++++ .../resources/mapper/DeviceHrRecordMapper.xml | 13 +++ .../mapper/DeviceTempRecordMapper.xml | 13 +++ 17 files changed, 291 insertions(+), 14 deletions(-) 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 index 55685e2..7b9d6b3 100644 --- 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 @@ -2,6 +2,8 @@ package com.xinelu.web.controller.familydoctor; import com.xinelu.common.core.controller.BaseController; import com.xinelu.common.core.domain.R; +import com.xinelu.common.core.domain.SelectVo; +import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.familydoctor.entity.*; import com.xinelu.familydoctor.service.PhysicalSignService; import com.xinelu.familydoctor.vo.PhysicalLastRecordVO; @@ -92,4 +94,30 @@ public class PhysicalSignController extends BaseController { public R> lastRecord(@PathVariable String identity) { return R.ok(physicalSignService.getLastRecord(identity)); } + + @GetMapping("/timelineList") + @ApiOperation(value = "获取体征检测记录时间轴", response = TimelineVo.class, notes = "获取体征检测记录时间轴", httpMethod = "GET") + @ApiImplicitParams({@ApiImplicitParam(name = "identity", value = "身份证号", required = true), + @ApiImplicitParam(name = "label", value = "查询标识1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温", required = true)}) + public R> TimelineList(String identity, String label) { + return R.ok(physicalSignService.getTimelineList(identity, label)); + } + + @ApiOperation("根据体征主键获取体征对象") + @GetMapping("getById") + @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "体征检测主键", required = true), + @ApiImplicitParam(name = "label", value = "查询标识1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温", required = true)}) + public R getById(Integer id, String label) { + Map map = physicalSignService.getById(id, label); + return R.ok(map); + } + + @GetMapping("/getList") + @ApiOperation(value = "获取体征检测记录列表", response = TimelineVo.class, notes = "获取体征检测记录列表", httpMethod = "GET") + @ApiImplicitParams({@ApiImplicitParam(name = "identity", value = "身份证号", required = true), + @ApiImplicitParam(name = "label", value = "查询标识1:血糖2:血压、心率", required = true)}) + public R getList(String identity, String label) { + Map map = physicalSignService.getList(identity, label); + return R.ok(map); + } } 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 index 8f53787..e578e75 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBfRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBfRecordMapper.java @@ -1,5 +1,6 @@ package com.xinelu.familydoctor.mapper; +import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.familydoctor.entity.DeviceBfRecord; import org.apache.ibatis.annotations.Param; @@ -27,4 +28,8 @@ public interface DeviceBfRecordMapper { int update(DeviceBfRecord record); + List selectTimeLineList(@Param("identity") String identity); + + DeviceBfRecord selectById(Integer id); + } 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 index f0665ac..d656022 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBgRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBgRecordMapper.java @@ -1,11 +1,11 @@ package com.xinelu.familydoctor.mapper; +import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.familydoctor.entity.DeviceBgRecord; import com.xinelu.familydoctor.vo.BgCalcVO; import com.xinelu.familydoctor.vo.PhysicalLastRecordVO; -import org.apache.ibatis.annotations.Param; - import java.util.List; +import org.apache.ibatis.annotations.Param; /** * @author gaoyu @@ -39,5 +39,11 @@ public interface DeviceBgRecordMapper { int update(DeviceBgRecord record); - List getLastRecord(String identity); + List getLastRecord(String identity); + + List selectTimeLineList(@Param("identity") String identity); + + DeviceBgRecord selectById(Integer id); + + List getBgList(@Param("identity") String identity); } 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 index 3640a79..0601c16 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBmiRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBmiRecordMapper.java @@ -1,5 +1,6 @@ package com.xinelu.familydoctor.mapper; +import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.familydoctor.entity.DeviceBmiRecord; import com.xinelu.familydoctor.vo.BmiCalcVO; import org.apache.ibatis.annotations.Param; @@ -38,4 +39,8 @@ public interface DeviceBmiRecordMapper { int update(DeviceBmiRecord record); + List selectTimeLineList(@Param("identity") String identity); + + DeviceBmiRecord selectById(Integer id); + } 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 index 2576a78..e7afc0b 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBoRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBoRecordMapper.java @@ -1,12 +1,10 @@ package com.xinelu.familydoctor.mapper; -import com.xinelu.familydoctor.entity.DeviceBmiRecord; +import com.xinelu.common.core.domain.TimelineVo; 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; +import org.apache.ibatis.annotations.Param; /** * @author gaoyu @@ -40,4 +38,8 @@ public interface DeviceBoRecordMapper { int update(DeviceBoRecord record); + List selectTimeLineList(@Param("identity") String identity); + + DeviceBoRecord selectById(Integer id); + } 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 index ff3cce9..326b4c4 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBpRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceBpRecordMapper.java @@ -1,10 +1,10 @@ package com.xinelu.familydoctor.mapper; +import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.familydoctor.entity.DeviceBpRecord; import com.xinelu.familydoctor.vo.BpCalcVO; -import org.apache.ibatis.annotations.Param; - import java.util.List; +import org.apache.ibatis.annotations.Param; /** * @author gaoyu @@ -38,4 +38,9 @@ public interface DeviceBpRecordMapper { int update(DeviceBpRecord record); + List selectTimeLineList(@Param("identity") String identity); + + DeviceBpRecord selectById(Integer id); + + List getBpList(@Param("identity") String identity); } 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 index 752d31b..eb597f9 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceHrRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceHrRecordMapper.java @@ -1,5 +1,6 @@ package com.xinelu.familydoctor.mapper; +import com.xinelu.common.core.domain.TimelineVo; import com.xinelu.familydoctor.entity.DeviceHrRecord; import com.xinelu.familydoctor.vo.HrCalcVO; import org.apache.ibatis.annotations.Param; @@ -38,4 +39,8 @@ public interface DeviceHrRecordMapper { int update(DeviceHrRecord record); + List selectTimeLineList(@Param("identity") String identity); + + DeviceHrRecord selectById(Integer id); + } 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 index 8523163..6ad4f16 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceTempRecordMapper.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/mapper/DeviceTempRecordMapper.java @@ -1,12 +1,10 @@ package com.xinelu.familydoctor.mapper; -import com.xinelu.familydoctor.entity.DeviceBoRecord; +import com.xinelu.common.core.domain.TimelineVo; 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; +import org.apache.ibatis.annotations.Param; /** * @author gaoyu @@ -40,4 +38,8 @@ public interface DeviceTempRecordMapper { int update(DeviceTempRecord record); + List selectTimeLineList(@Param("identity") String identity); + + DeviceTempRecord selectById(Integer id); + } 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 index 8aae3f9..4107571 100644 --- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/PhysicalSignService.java +++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/service/PhysicalSignService.java @@ -1,5 +1,6 @@ package com.xinelu.familydoctor.service; +import com.xinelu.common.core.domain.SelectVo; import com.xinelu.familydoctor.entity.*; import com.xinelu.familydoctor.vo.PhysicalLastRecordVO; @@ -33,4 +34,10 @@ public interface PhysicalSignService { * @date 2023-10-20 14:56 */ List getLastRecord(String identity); + + List getTimelineList(String identity, String label); + + Map getById(Integer id, String label); + + Map getList(String identity, String label); } 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 index 5ed14e8..f062c8b 100644 --- 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 @@ -1,9 +1,14 @@ package com.xinelu.familydoctor.service.impl; +import com.xinelu.common.core.domain.SelectVo; +import com.xinelu.common.core.domain.TimelineVo; +import com.xinelu.common.utils.DateUtils; import com.xinelu.familydoctor.entity.*; import com.xinelu.familydoctor.mapper.*; import com.xinelu.familydoctor.service.PhysicalSignService; import com.xinelu.familydoctor.vo.*; +import java.util.ArrayList; +import java.util.stream.Collectors; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -104,7 +109,109 @@ public class PhysicalSignServiceImpl implements PhysicalSignService { return deviceBgRecordMapper.getLastRecord(identity); } - private Map bgRecord(String identity, String type) { + @Override public List getTimelineList(String identity, String label) { + List timelineVos = new ArrayList<>(); + switch (label) { + case "1": + timelineVos = deviceBgRecordMapper.selectTimeLineList(identity); + break; + case "2": + timelineVos = deviceBpRecordMapper.selectTimeLineList(identity); + break; + case "3": + timelineVos = deviceBfRecordMapper.selectTimeLineList(identity); + break; + case "4": + timelineVos = deviceBmiRecordMapper.selectTimeLineList(identity); + break; + case "5": + timelineVos = deviceBoRecordMapper.selectTimeLineList(identity); + break; + case "6": + timelineVos = deviceHrRecordMapper.selectTimeLineList(identity); + break; + case "7": + timelineVos = deviceTempRecordMapper.selectTimeLineList(identity); + break; + default: + break; + } + // 按照年份进行分组 + Map> groupByTime = timelineVos.stream().collect(Collectors.groupingBy(item-> DateUtils.formatDate(item.getCreateTime(), "yyyy"))); + List timeList = new ArrayList<>(); + + for (String time : groupByTime.keySet()) { + List timelineVoList = groupByTime.get(time); + List children = timelineVoList.stream().map(child -> { + SelectVo result = new SelectVo(); + result.setLabel(DateUtils.formatDate(child.getCreateTime(), "yyyy-MM-dd")); + result.setValue(child.getId()); + return result; + }).collect(Collectors.toList()); + + timeList.add(SelectVo.builder() + .label(time) + .value(time) + .children(children).build()); + } + return timeList; + } + + @Override public Map getById(Integer id, String label) { + Map map = new HashMap<>(); + switch (label) { + case "1": + DeviceBgRecord bg = deviceBgRecordMapper.selectById(id); + map.put("record", bg); + break; + case "2": + DeviceBpRecord bp = deviceBpRecordMapper.selectById(id); + map.put("record", bp); + break; + case "3": + DeviceBfRecord bf = deviceBfRecordMapper.selectById(id); + map.put("record", bf); + break; + case "4": + DeviceBmiRecord bmi = deviceBmiRecordMapper.selectById(id); + map.put("record", bmi); + break; + case "5": + DeviceBoRecord bo = deviceBoRecordMapper.selectById(id); + map.put("record", bo); + break; + case "6": + DeviceHrRecord hr = deviceHrRecordMapper.selectById(id); + map.put("record", hr); + break; + case "7": + DeviceTempRecord temp = deviceTempRecordMapper.selectById(id); + map.put("record", temp); + break; + default: + break; + } + return map; + } + + @Override public Map getList(String identity, String label) { + Map map = new HashMap<>(); + switch (label) { + case "1": + List bgList = deviceBgRecordMapper.getBgList(identity); + map.put("list", bgList); + break; + case "2": + List bpList = deviceBpRecordMapper.getBpList(identity); + map.put("list", bpList); + 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); diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml index 523bfa5..9c91d15 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBfRecordMapper.xml @@ -82,4 +82,17 @@ 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 index 2ff4165..b1b3a6d 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceBgRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBgRecordMapper.xml @@ -128,4 +128,22 @@ (select '7' AS "type", measure_time "date", null "bucket", temp "val" from device_temp_record where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1) + + + diff --git a/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml b/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml index 74efbf5..d55b647 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBmiRecordMapper.xml @@ -105,4 +105,17 @@ 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 index 2cf2902..abf3e9b 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceBoRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBoRecordMapper.xml @@ -100,4 +100,17 @@ 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 index e1f307e..880f8dd 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceBpRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceBpRecordMapper.xml @@ -310,4 +310,26 @@ 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 index 8f17839..32aea8e 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceHrRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceHrRecordMapper.xml @@ -100,4 +100,17 @@ 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 index fc95d0f..98c46e1 100644 --- a/xinelu-familydoctor/src/main/resources/mapper/DeviceTempRecordMapper.xml +++ b/xinelu-familydoctor/src/main/resources/mapper/DeviceTempRecordMapper.xml @@ -96,4 +96,17 @@ where id = #{id,jdbcType=BIGINT} + +