update===>:增加获取体征检测列表接口。

This commit is contained in:
haown 2023-12-28 13:30:56 +08:00
parent 602bd03bd4
commit e3085e9b78
17 changed files with 291 additions and 14 deletions

View File

@ -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<List<PhysicalLastRecordVO>> 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血脂4bmi5血氧6心率7体温", required = true)})
public R<List<SelectVo>> 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血脂4bmi5血氧6心率7体温", required = true)})
public R<?> getById(Integer id, String label) {
Map<String, Object> 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<String, Object> map = physicalSignService.getList(identity, label);
return R.ok(map);
}
}

View File

@ -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<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceBfRecord selectById(Integer id);
}

View File

@ -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<PhysicalLastRecordVO> getLastRecord(String identity);
List<PhysicalLastRecordVO> getLastRecord(String identity);
List<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceBgRecord selectById(Integer id);
List<DeviceBgRecord> getBgList(@Param("identity") String identity);
}

View File

@ -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<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceBmiRecord selectById(Integer id);
}

View File

@ -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<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceBoRecord selectById(Integer id);
}

View File

@ -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<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceBpRecord selectById(Integer id);
List<DeviceBpRecord> getBpList(@Param("identity") String identity);
}

View File

@ -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<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceHrRecord selectById(Integer id);
}

View File

@ -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<TimelineVo> selectTimeLineList(@Param("identity") String identity);
DeviceTempRecord selectById(Integer id);
}

View File

@ -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<PhysicalLastRecordVO> getLastRecord(String identity);
List<SelectVo> getTimelineList(String identity, String label);
Map<String, Object> getById(Integer id, String label);
Map<String, Object> getList(String identity, String label);
}

View File

@ -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<String, Object> bgRecord(String identity, String type) {
@Override public List<SelectVo> getTimelineList(String identity, String label) {
List<TimelineVo> 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<String, List<TimelineVo>> groupByTime = timelineVos.stream().collect(Collectors.groupingBy(item-> DateUtils.formatDate(item.getCreateTime(), "yyyy")));
List<SelectVo> timeList = new ArrayList<>();
for (String time : groupByTime.keySet()) {
List<TimelineVo> timelineVoList = groupByTime.get(time);
List<SelectVo> 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<String, Object> getById(Integer id, String label) {
Map<String, Object> 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<String, Object> getList(String identity, String label) {
Map<String, Object> map = new HashMap<>();
switch (label) {
case "1":
List<DeviceBgRecord> bgList = deviceBgRecordMapper.getBgList(identity);
map.put("list", bgList);
break;
case "2":
List<DeviceBpRecord> bpList = deviceBpRecordMapper.getBpList(identity);
map.put("list", bpList);
break;
default:
break;
}
return map;
}
private Map<String, Object> bgRecord(String identity, String type) {
Map<String, Object> map = new HashMap<>();
List<DeviceBgRecord> list = deviceBgRecordMapper.getBgRecord(identity, type);
BgCalcVO calc = deviceBgRecordMapper.getBgCalc(identity, type);

View File

@ -82,4 +82,17 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_bf_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_bf_record
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>

View File

@ -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 &gt;= date_add(now(), interval -30 day) order by id desc limit 1)
</select>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_bg_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from device_bg_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getBgList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from device_bg_record
where identity = #{identity}
order by measure_time desc
</select>
</mapper>

View File

@ -105,4 +105,17 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_bmi_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_bmi_record
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>

View File

@ -100,4 +100,17 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_bo_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_bo_record
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>

View File

@ -310,4 +310,26 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_bp_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_bp_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getBpList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_bp_record
where identity = #{identity}
order by measure_time desc
</select>
</mapper>

View File

@ -100,4 +100,17 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_hr_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_hr_record
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>

View File

@ -96,4 +96,17 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
id, date_format(measure_time,'%Y-%m-%d') as createTime
from device_temp_record
where identity = #{identity}
order by measure_time desc
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from device_temp_record
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>