jsk 健康
This commit is contained in:
parent
9ec6670a51
commit
a667b8ef68
|
|
@ -2,18 +2,22 @@ package com.bonus.canteen.core.nutrition.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
||||||
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
||||||
|
import com.bonus.canteen.core.nutrition.domain.HealthPopularScience;
|
||||||
import com.bonus.canteen.core.nutrition.service.HealthInfoService;
|
import com.bonus.canteen.core.nutrition.service.HealthInfoService;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
|
import com.bonus.common.core.web.controller.BaseController;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.bonus.common.core.web.domain.AjaxResult.success;
|
import static com.bonus.common.core.web.domain.AjaxResult.success;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -21,18 +25,30 @@ import static com.bonus.common.core.web.domain.AjaxResult.success;
|
||||||
tags = {"健康档案"}
|
tags = {"健康档案"}
|
||||||
)
|
)
|
||||||
@RequestMapping({"/health/info"})
|
@RequestMapping({"/health/info"})
|
||||||
public class HealthInfoController {
|
public class HealthInfoController extends BaseController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(HealthInfoController.class);
|
private static final Logger log = LoggerFactory.getLogger(HealthInfoController.class);
|
||||||
@Resource
|
@Resource
|
||||||
private HealthInfoService healthInfoService;
|
private HealthInfoService healthInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询营养科普列表
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询健康档案列表")
|
||||||
|
//@RequiresPermissions("nutrition:science:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(HealthInfoSimpleVo healthInfoSimpleVo) {
|
||||||
|
startPage();
|
||||||
|
List<HealthInfoSimpleVo> list = healthInfoService.selectHealthInfoList(healthInfoSimpleVo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("获取人员档案详情")
|
@ApiOperation("获取人员档案详情")
|
||||||
@PostMapping({"/detail-health-info"})
|
@PostMapping({"/detail-health-info"})
|
||||||
public AjaxResult detailHealthInfo(@RequestBody HealthInfoFullDto dto) {
|
public AjaxResult detailHealthInfo(@RequestBody HealthInfoFullDto dto) {
|
||||||
if (ObjectUtil.isNull(dto.getUserId())) {
|
if (ObjectUtil.isNull(dto.getUserId())) {
|
||||||
throw new ServiceException("用户id不能为空");
|
throw new ServiceException("用户id不能为空");
|
||||||
} else {
|
} else {
|
||||||
return success(this.healthInfoService.detailHealthInfo(dto.getUserId()));
|
return success(healthInfoService.detailHealthInfo(dto.getUserId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +58,7 @@ public class HealthInfoController {
|
||||||
if (ObjectUtil.isNull(healthInfoFullDto.getUserId())) {
|
if (ObjectUtil.isNull(healthInfoFullDto.getUserId())) {
|
||||||
throw new ServiceException("用户id不能为空");
|
throw new ServiceException("用户id不能为空");
|
||||||
} else {
|
} else {
|
||||||
return success(this.healthInfoService.editHealthInfo(healthInfoFullDto));
|
return success(healthInfoService.editHealthInfo(healthInfoFullDto));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,22 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.bonus.canteen.core.nutrition.common.model.HealthInfo;
|
import com.bonus.canteen.core.nutrition.common.model.HealthInfo;
|
||||||
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo;
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo;
|
||||||
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
||||||
|
import com.bonus.canteen.core.nutrition.domain.HealthPopularScience;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface HealthInfoMapper extends BaseMapper<HealthInfo> {
|
public interface HealthInfoMapper extends BaseMapper<HealthInfo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询健康档案列表
|
||||||
|
*
|
||||||
|
* @param healthInfoSimpleVo 健康档案
|
||||||
|
* @return 健康档案集合
|
||||||
|
*/
|
||||||
|
public List<HealthInfoSimpleVo> selectHealthInfoList(HealthInfoSimpleVo healthInfoSimpleVo);
|
||||||
|
|
||||||
HealthInfoSimpleVo getSimpleInfo(Long userId);
|
HealthInfoSimpleVo getSimpleInfo(Long userId);
|
||||||
|
|
||||||
HealthInfoFullVo fullHealthInfo(Long userId);
|
HealthInfoFullVo fullHealthInfo(Long userId);
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,20 @@ package com.bonus.canteen.core.nutrition.service;
|
||||||
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
||||||
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo;
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo;
|
||||||
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
||||||
|
import com.bonus.canteen.core.nutrition.domain.HealthPopularScience;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface HealthInfoService {
|
public interface HealthInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询健康档案列表
|
||||||
|
*
|
||||||
|
* @param healthInfoSimpleVo 健康档案
|
||||||
|
* @return 健康档案集合
|
||||||
|
*/
|
||||||
|
public List<HealthInfoSimpleVo> selectHealthInfoList(HealthInfoSimpleVo healthInfoSimpleVo);
|
||||||
|
|
||||||
HealthInfoSimpleVo simplifyHealthInfo(Long userId);
|
HealthInfoSimpleVo simplifyHealthInfo(Long userId);
|
||||||
|
|
||||||
HealthInfoFullVo detailHealthInfo(Long userId);
|
HealthInfoFullVo detailHealthInfo(Long userId);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
||||||
import com.bonus.canteen.core.nutrition.common.enums.CustAgeEnum;
|
import com.bonus.canteen.core.nutrition.common.enums.CustAgeEnum;
|
||||||
import com.bonus.canteen.core.nutrition.common.enums.HealthInfoSourceEnum;
|
import com.bonus.canteen.core.nutrition.common.enums.HealthInfoSourceEnum;
|
||||||
|
import com.bonus.canteen.core.nutrition.domain.HealthPopularScience;
|
||||||
import com.bonus.canteen.core.nutrition.mapper.HealthInfoMapper;
|
import com.bonus.canteen.core.nutrition.mapper.HealthInfoMapper;
|
||||||
import com.bonus.canteen.core.nutrition.common.model.HealthBodyRecord;
|
import com.bonus.canteen.core.nutrition.common.model.HealthBodyRecord;
|
||||||
import com.bonus.canteen.core.nutrition.common.model.HealthInfo;
|
import com.bonus.canteen.core.nutrition.common.model.HealthInfo;
|
||||||
|
|
@ -18,6 +19,7 @@ import com.bonus.canteen.core.nutrition.service.HealthInfoService;
|
||||||
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo;
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo;
|
||||||
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
import com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo;
|
||||||
import com.bonus.canteen.core.nutrition.common.utils.NuConvertUtil;
|
import com.bonus.canteen.core.nutrition.common.utils.NuConvertUtil;
|
||||||
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.houqin.utils.LeBeanUtil;
|
import com.bonus.common.houqin.utils.LeBeanUtil;
|
||||||
import com.bonus.common.houqin.utils.id.Id;
|
import com.bonus.common.houqin.utils.id.Id;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -43,11 +45,28 @@ public class HealthInfoServiceImpl extends ServiceImpl<HealthInfoMapper, HealthI
|
||||||
@Autowired
|
@Autowired
|
||||||
private HealthInfoMapper healthInfoMapper;
|
private HealthInfoMapper healthInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询健康档案列表
|
||||||
|
*
|
||||||
|
* @param healthInfoSimpleVo 健康档案
|
||||||
|
* @return 健康档案
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HealthInfoSimpleVo> selectHealthInfoList(HealthInfoSimpleVo healthInfoSimpleVo) {
|
||||||
|
// String chronicIds = healthPopularScience.getChronicIds();
|
||||||
|
// if (StringUtils.isNotEmpty(chronicIds)) {
|
||||||
|
// String[] chronicIdArray = chronicIds.split(",");
|
||||||
|
// healthPopularScience.setChronicIdArray(chronicIdArray);
|
||||||
|
// }
|
||||||
|
return healthInfoMapper.selectHealthInfoList(healthInfoSimpleVo);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HealthInfoSimpleVo simplifyHealthInfo(Long userId) {
|
public HealthInfoSimpleVo simplifyHealthInfo(Long userId) {
|
||||||
return healthInfoMapper.getSimpleInfo(userId);
|
return healthInfoMapper.getSimpleInfo(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HealthInfoFullVo detailHealthInfo(Long userId) {
|
public HealthInfoFullVo detailHealthInfo(Long userId) {
|
||||||
HealthInfoFullVo healthInfoFullVo = ((HealthInfoMapper)this.baseMapper).fullHealthInfo(userId);
|
HealthInfoFullVo healthInfoFullVo = ((HealthInfoMapper)this.baseMapper).fullHealthInfo(userId);
|
||||||
healthInfoFullVo.setAge(CustAgeEnum.getAge(healthInfoFullVo.getBirthday()));
|
healthInfoFullVo.setAge(CustAgeEnum.getAge(healthInfoFullVo.getBirthday()));
|
||||||
|
|
@ -57,6 +76,7 @@ public class HealthInfoServiceImpl extends ServiceImpl<HealthInfoMapper, HealthI
|
||||||
@Transactional(
|
@Transactional(
|
||||||
rollbackFor = {Exception.class}
|
rollbackFor = {Exception.class}
|
||||||
)
|
)
|
||||||
|
@Override
|
||||||
public Integer editHealthInfo(HealthInfoFullDto content) {
|
public Integer editHealthInfo(HealthInfoFullDto content) {
|
||||||
Long userId = content.getUserId();
|
Long userId = content.getUserId();
|
||||||
BigDecimal bmi = NuConvertUtil.getBMI(content.getWeight(), content.getHeight());
|
BigDecimal bmi = NuConvertUtil.getBMI(content.getWeight(), content.getHeight());
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,40 @@
|
||||||
|
|
||||||
<mapper namespace="com.bonus.canteen.core.nutrition.mapper.HealthInfoMapper">
|
<mapper namespace="com.bonus.canteen.core.nutrition.mapper.HealthInfoMapper">
|
||||||
|
|
||||||
|
<select id="selectHealthInfoList" resultType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo">
|
||||||
|
SELECT a.user_id,
|
||||||
|
a.nick_name,
|
||||||
|
a.phonenumber as mobile,
|
||||||
|
a.photo_url as custPhotoUrl,
|
||||||
|
a.sex,
|
||||||
|
d.height,
|
||||||
|
d.weight,
|
||||||
|
d.bmi,
|
||||||
|
b.doctor_advice,
|
||||||
|
b.allergen,
|
||||||
|
b.labour_intensity,
|
||||||
|
b.pregnant_status,
|
||||||
|
GROUP_CONCAT(c.chronic_name ORDER BY c.chronic_id desc) AS chronic_names,
|
||||||
|
GROUP_CONCAT(c.chronic_id ORDER BY c.chronic_id desc) AS chronic_ids
|
||||||
|
from sys_user a
|
||||||
|
left join health_info b on a.user_id = b.user_id
|
||||||
|
left join health_info_chronic c on a.user_id = c.user_id
|
||||||
|
left join health_body_record d on a.user_id = d.user_id and d.if_latest = 1
|
||||||
|
where 1 = 1
|
||||||
|
group by a.user_id,
|
||||||
|
a.nick_name,
|
||||||
|
a.dept_id,
|
||||||
|
a.phonenumber,
|
||||||
|
a.photo_url,
|
||||||
|
a.sex,
|
||||||
|
d.height,
|
||||||
|
d.weight,
|
||||||
|
d.bmi,
|
||||||
|
b.doctor_advice,
|
||||||
|
b.allergen,
|
||||||
|
b.labour_intensity,
|
||||||
|
b.pregnant_status
|
||||||
|
</select>
|
||||||
<select id="getSimpleInfo" resultType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo">
|
<select id="getSimpleInfo" resultType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo">
|
||||||
SELECT a.user_id,
|
SELECT a.user_id,
|
||||||
a.nick_name,
|
a.nick_name,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectWarehouseInfoList" parameterType="com.bonus.canteen.core.warehouse.domain.WarehouseInfo" resultMap="WarehouseInfoResult">
|
<select id="selectWarehouseInfoList" parameterType="com.bonus.canteen.core.warehouse.domain.WarehouseInfo" resultMap="WarehouseInfoResult">
|
||||||
<include refid="selectWarehouseInfoVo"/>
|
<include refid="selectWarehouseInfoVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="warehouseNum != null and warehouseNum != ''"> and warehouse_num = #{warehouseNum}</if>
|
<if test="warehouseNum != null and warehouseNum != ''"> and warehouse_num = #{warehouseNum}</if>
|
||||||
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
|
||||||
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
|
@ -55,12 +55,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="fetchUserId != null "> and fetch_user_id = #{fetchUserId}</if>
|
<if test="fetchUserId != null "> and fetch_user_id = #{fetchUserId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectWarehouseInfoByWarehouseId" parameterType="Long" resultMap="WarehouseInfoResult">
|
<select id="selectWarehouseInfoByWarehouseId" parameterType="Long" resultMap="WarehouseInfoResult">
|
||||||
<include refid="selectWarehouseInfoVo"/>
|
<include refid="selectWarehouseInfoVo"/>
|
||||||
where warehouse_id = #{warehouseId}
|
where warehouse_id = #{warehouseId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertWarehouseInfo" parameterType="com.bonus.canteen.core.warehouse.domain.WarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
|
<insert id="insertWarehouseInfo" parameterType="com.bonus.canteen.core.warehouse.domain.WarehouseInfo" useGeneratedKeys="true" keyProperty="warehouseId">
|
||||||
insert into warehouse_info
|
insert into warehouse_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
@ -147,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteWarehouseInfoByWarehouseIds" parameterType="String">
|
<delete id="deleteWarehouseInfoByWarehouseIds" parameterType="String">
|
||||||
delete from warehouse_info where warehouse_id in
|
delete from warehouse_info where warehouse_id in
|
||||||
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
|
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
|
||||||
#{warehouseId}
|
#{warehouseId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
@ -161,4 +161,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{areaId}
|
#{areaId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue