体征检测接口调整
This commit is contained in:
parent
962c4f0715
commit
f8a08aaa80
@ -4,6 +4,7 @@ import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.familydoctor.entity.*;
|
||||
import com.xinelu.familydoctor.service.PhysicalSignService;
|
||||
import com.xinelu.familydoctor.vo.PhysicalLastRecordVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@ -11,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -83,4 +85,11 @@ public class PhysicalSignController extends BaseController {
|
||||
Map<String, Object> map = physicalSignService.record(identity, type, label);
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
@ApiOperation("获取最后一次体征记录")
|
||||
@GetMapping("record/last/{identity}")
|
||||
@ApiImplicitParam(name = "identity", value = "身份证号", required = true)
|
||||
public R<List<PhysicalLastRecordVO>> lastRecord(@PathVariable String identity) {
|
||||
return R.ok(physicalSignService.getLastRecord(identity));
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class DeviceBfRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ public class DeviceBgRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -28,6 +28,18 @@ public class DeviceBmiRecord implements Serializable {
|
||||
@ApiModelProperty("居民身份证号")
|
||||
private String identity;
|
||||
|
||||
/**
|
||||
* 身高(cm)
|
||||
*/
|
||||
@ApiModelProperty("身高(cm)")
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* 体重(kg)
|
||||
*/
|
||||
@ApiModelProperty("体重(kg)")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* BMI(单位:kg/m^2)
|
||||
*/
|
||||
@ -37,7 +49,7 @@ public class DeviceBmiRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ public class DeviceBoRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public class DeviceBpRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ public class DeviceHrRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class DeviceTempRecord implements Serializable {
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
|
||||
@ApiModelProperty("测量时间")
|
||||
private Date measureTime;
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.familydoctor.mapper;
|
||||
|
||||
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;
|
||||
@ -38,4 +39,5 @@ public interface DeviceBgRecordMapper {
|
||||
|
||||
int update(DeviceBgRecord record);
|
||||
|
||||
List<PhysicalLastRecordVO> getLastRecord(String identity);
|
||||
}
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.xinelu.familydoctor.service;
|
||||
|
||||
import com.xinelu.familydoctor.entity.*;
|
||||
import com.xinelu.familydoctor.vo.PhysicalLastRecordVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PhysicalSignService {
|
||||
@ -22,4 +24,13 @@ public interface PhysicalSignService {
|
||||
* @date 2023-10-9 10:10
|
||||
*/
|
||||
Map<String, Object> record(String identity, String type, String label);
|
||||
|
||||
/**
|
||||
* 获取最后一次记录
|
||||
* @param identity 身份证号
|
||||
* @return {@link java.util.List<com.xinelu.familydoctor.vo.PhysicalLastRecordVO>}
|
||||
* @author gaoyu
|
||||
* @date 2023-10-20 14:56
|
||||
*/
|
||||
List<PhysicalLastRecordVO> getLastRecord(String identity);
|
||||
}
|
||||
|
||||
@ -99,6 +99,11 @@ public class PhysicalSignServiceImpl implements PhysicalSignService {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PhysicalLastRecordVO> getLastRecord(String identity) {
|
||||
return deviceBgRecordMapper.getLastRecord(identity);
|
||||
}
|
||||
|
||||
private Map<String, Object> bgRecord(String identity, String type) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<DeviceBgRecord> list = deviceBgRecordMapper.getBgRecord(identity, type);
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package com.xinelu.familydoctor.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author gaoyu
|
||||
* @description 体征检测最后一次记录
|
||||
* @date 2023-10-20 14:28
|
||||
*/
|
||||
@ApiModel("体征检测最后一次记录")
|
||||
@Data
|
||||
public class PhysicalLastRecordVO {
|
||||
@ApiModelProperty("类型1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温")
|
||||
private String type;
|
||||
@ApiModelProperty("日期")
|
||||
@JsonFormat(pattern = "yyyy/MM/dd", timezone = "GMT+8")
|
||||
private Date date;
|
||||
@ApiModelProperty("时间段1:凌晨2:早餐前3:早晨后4:午餐前5:午餐后6:晚餐前7:晚餐后8:睡前")
|
||||
private String bucket;
|
||||
@ApiModelProperty("值")
|
||||
private String val;
|
||||
}
|
||||
@ -105,4 +105,27 @@
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="getLastRecord" resultType="com.xinelu.familydoctor.vo.PhysicalLastRecordVO">
|
||||
(select '1' AS "type", measure_time "date", bucket, bg "val" from device_bg_record
|
||||
where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1)
|
||||
union all
|
||||
(select '2' AS "type", measure_time "date", null "bucket", concat(sbp, '/', dbp) "val" from device_bp_record
|
||||
where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1)
|
||||
union all
|
||||
(select '3' AS "type", measure_time "date", null "bucket", concat(tc, '/', tg, '/', hdl, '/', ldl) "val" from device_bf_record
|
||||
where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1)
|
||||
union all
|
||||
(select '4' AS "type", measure_time "date", null "bucket", bmi "val" from device_bmi_record
|
||||
where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1)
|
||||
union all
|
||||
(select '5' AS "type", measure_time "date", null "bucket", spo2 "val" from device_bo_record
|
||||
where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1)
|
||||
union all
|
||||
(select '6' AS "type", measure_time "date", null "bucket", hr "val" from device_hr_record
|
||||
where identity = #{identity} and measure_time >= date_add(now(), interval -30 day) order by id desc limit 1)
|
||||
union all
|
||||
(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)
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -7,13 +7,15 @@
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.familydoctor.entity.DeviceBmiRecord">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="identity" column="identity" jdbcType="VARCHAR"/>
|
||||
<result property="height" column="height" jdbcType="DECIMAL"/>
|
||||
<result property="weight" column="weight" jdbcType="DECIMAL"/>
|
||||
<result property="bmi" column="bmi" jdbcType="DECIMAL"/>
|
||||
<result property="measureTime" column="measure_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,identity,bmi,
|
||||
measure_time
|
||||
id,identity,height,
|
||||
weight,bmi,measure_time
|
||||
</sql>
|
||||
|
||||
<select id="getBmiRecord" resultMap="BaseResultMap">
|
||||
@ -73,13 +75,14 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.familydoctor.entity.DeviceBmiRecord" useGeneratedKeys="true">
|
||||
insert into device_bmi_record
|
||||
(identity,bmi
|
||||
,measure_time)
|
||||
values (#{identity,jdbcType=VARCHAR},#{bmi,jdbcType=DECIMAL}
|
||||
,#{measureTime,jdbcType=TIMESTAMP})
|
||||
(identity,height
|
||||
,weight,bmi,measure_time
|
||||
)
|
||||
values (#{identity,jdbcType=VARCHAR},#{height,jdbcType=DECIMAL}
|
||||
,#{weight,jdbcType=DECIMAL},#{bmi,jdbcType=DECIMAL},#{measureTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<update id="update" parameterType="com.xinelu.familydoctor.entity.DeviceBmiRecord">
|
||||
update device_bmi_record
|
||||
@ -87,6 +90,12 @@
|
||||
<if test="identity != null">
|
||||
identity = #{identity,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="height != null">
|
||||
height = #{height,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="weight != null">
|
||||
weight = #{weight,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="bmi != null">
|
||||
bmi = #{bmi,jdbcType=DECIMAL},
|
||||
</if>
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
<sql id="maxSbpSql">
|
||||
select concat(sbp, '/', dbp) "maxSbpVal" from device_bp_record
|
||||
where sbp = (select max(sbp) from device_bp_record
|
||||
and identity = #{identity}
|
||||
where identity = #{identity}
|
||||
<choose>
|
||||
<when test="type == '0'">
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
<sql id="maxDbpSql">
|
||||
select concat(sbp, '/', dbp) "maxDbpVal" from device_bp_record
|
||||
where dbp = (select max(dbp) from device_bp_record
|
||||
and identity = #{identity}
|
||||
where identity = #{identity}
|
||||
<choose>
|
||||
<when test="type == '0'">
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
<sql id="minSbpSql">
|
||||
select concat(sbp, '/', dbp) "minSbpVal" from device_bp_record
|
||||
where sbp = (select min(sbp) from device_bp_record
|
||||
and identity = #{identity}
|
||||
where identity = #{identity}
|
||||
<choose>
|
||||
<when test="type == '0'">
|
||||
|
||||
@ -195,7 +195,7 @@
|
||||
<sql id="minDbpSql">
|
||||
select concat(sbp, '/', dbp) "minDbpVal" from device_bp_record
|
||||
where dbp = (select min(dbp) from device_bp_record
|
||||
and identity = #{identity}
|
||||
where identity = #{identity}
|
||||
<choose>
|
||||
<when test="type == '0'">
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user