jsk 健康
This commit is contained in:
parent
a667b8ef68
commit
a77562526b
|
|
@ -1,11 +1,13 @@
|
||||||
package com.bonus.canteen.core.nutrition.mapper;
|
package com.bonus.canteen.core.nutrition.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bonus.canteen.core.nutrition.common.dto.HealthInfoFullDto;
|
||||||
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 com.bonus.canteen.core.nutrition.domain.HealthPopularScience;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -19,9 +21,17 @@ public interface HealthInfoMapper extends BaseMapper<HealthInfo> {
|
||||||
* @return 健康档案集合
|
* @return 健康档案集合
|
||||||
*/
|
*/
|
||||||
public List<HealthInfoSimpleVo> selectHealthInfoList(HealthInfoSimpleVo healthInfoSimpleVo);
|
public List<HealthInfoSimpleVo> selectHealthInfoList(HealthInfoSimpleVo healthInfoSimpleVo);
|
||||||
|
List<HealthInfoSimpleVo> selectHealthChronicList(HealthInfoSimpleVo healthInfoSimpleVo);
|
||||||
HealthInfoSimpleVo getSimpleInfo(Long userId);
|
HealthInfoSimpleVo getSimpleInfo(Long userId);
|
||||||
|
|
||||||
HealthInfoFullVo fullHealthInfo(Long userId);
|
HealthInfoFullVo fullHealthInfo(Long userId);
|
||||||
|
|
||||||
|
int updateHealthInfo(HealthInfoFullDto entitie);
|
||||||
|
|
||||||
|
int updateHealthBodyRecord(HealthInfoFullDto entitie);
|
||||||
|
|
||||||
|
int deleteHealthInfoChronic(HealthInfoFullDto entitie);
|
||||||
|
|
||||||
|
int insertHealthInfoChronic(@Param("entities") List<HealthInfoFullDto> entities);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -79,25 +80,35 @@ public class HealthInfoServiceImpl extends ServiceImpl<HealthInfoMapper, HealthI
|
||||||
@Override
|
@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());
|
HealthInfoSimpleVo chronicVo=new HealthInfoSimpleVo();
|
||||||
content.setBmi(bmi);
|
chronicVo.setChronicIds(content.getChronicIds());
|
||||||
this.remove((Wrapper) Wrappers.lambdaQuery(HealthInfo.class).eq(HealthInfo::getUserId, userId));
|
List<HealthInfoSimpleVo> chronicVos=baseMapper.selectHealthChronicList(chronicVo);
|
||||||
this.healthInfoChronicService.remove((Wrapper)Wrappers.lambdaQuery(HealthInfoChronic.class).eq(HealthInfoChronic::getUserId, userId));
|
if(chronicVos!=null&&chronicVos.size()>0){
|
||||||
HealthInfo healthInfo = (HealthInfo)LeBeanUtil.copyCreateProperties(content, HealthInfo.class);
|
/**
|
||||||
healthInfo.setId(Id.next());
|
* 清空疾病信息
|
||||||
this.save(healthInfo);
|
*/
|
||||||
List<Long> chronicIds = StrUtil.isNotBlank(content.getChronicIds()) ? Arrays.stream(content.getChronicIds().split(",")).map((s) -> {
|
baseMapper.deleteHealthInfoChronic(content);
|
||||||
return Long.parseLong(s);
|
List<HealthInfoFullDto> chronicfVos=new ArrayList<>();
|
||||||
}).collect(Collectors.toList()) : CollUtil.newArrayList(new Long[0]);
|
for(HealthInfoSimpleVo vo:chronicVos){
|
||||||
if (CollUtil.isNotEmpty((Collection)chronicIds)) {
|
HealthInfoFullDto hfd=new HealthInfoFullDto();
|
||||||
this.healthInfoChronicService.insertAssociateBatch(userId, (List)chronicIds);
|
hfd.setUserId(content.getUserId());
|
||||||
|
hfd.setChronicIds(vo.getChronicIds());
|
||||||
|
hfd.setChronicNames(vo.getChronicNames());
|
||||||
|
chronicfVos.add(hfd);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重新录入疾病信息
|
||||||
|
*/
|
||||||
|
baseMapper.insertHealthInfoChronic(chronicfVos);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
HealthBodyRecord healthBodyRecord = (HealthBodyRecord)LeBeanUtil.copyCreateProperties(content, HealthBodyRecord.class);
|
* 重新录入健康信息
|
||||||
healthBodyRecord.setId(Id.next());
|
*/
|
||||||
healthBodyRecord.setHealthInfoSource(HealthInfoSourceEnum.WEB.key());
|
baseMapper.updateHealthInfo(content);
|
||||||
this.healthBodyRecordService.insertLatestRecord(healthBodyRecord);
|
/**
|
||||||
|
* 重新录入身体信息
|
||||||
|
*/
|
||||||
|
baseMapper.updateHealthBodyRecord(content);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import com.bonus.common.houqin.encrypt.RequiresGuest;
|
||||||
import com.bonus.common.houqin.i18n.I18n;
|
import com.bonus.common.houqin.i18n.I18n;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.bonus.system.api.domain.SysUserFace;
|
//import com.bonus.system.api.domain.SysUserFace;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -42,14 +42,14 @@ public class UserFaceController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUserFaceService UserFaceService;
|
private IUserFaceService UserFaceService;
|
||||||
|
|
||||||
@ApiOperation("保存人脸图片")
|
// @ApiOperation("保存人脸图片")
|
||||||
@PostMapping({"/uploadUserFace"})
|
// @PostMapping({"/uploadUserFace"})
|
||||||
@RequiresGuest
|
// @RequiresGuest
|
||||||
public AjaxResult uploadUserFace(@RequestBody @Valid SysUserFace sysUserFace) {
|
// public AjaxResult uploadUserFace(@RequestBody @Valid SysUserFace sysUserFace) {
|
||||||
UserFace dto = new UserFace();
|
// UserFace dto = new UserFace();
|
||||||
dto.setUserId(sysUserFace.getUserId());
|
// dto.setUserId(sysUserFace.getUserId());
|
||||||
dto.setPhotoUrl(sysUserFace.getPhotoUrl());
|
// dto.setPhotoUrl(sysUserFace.getPhotoUrl());
|
||||||
return UserFaceService.uploadUserFace(dto);
|
// return UserFaceService.uploadUserFace(dto);
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@
|
||||||
b.labour_intensity,
|
b.labour_intensity,
|
||||||
b.pregnant_status
|
b.pregnant_status
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHealthChronicList" resultType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoSimpleVo">
|
||||||
|
SELECT distinct chronic_id as chronic_ids,chronic_name as chronic_names from health_chronic where chronic_id in (${chronicIds})
|
||||||
|
</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,
|
||||||
|
|
@ -150,4 +155,72 @@
|
||||||
c.uric_acid,
|
c.uric_acid,
|
||||||
c.blood_pressure
|
c.blood_pressure
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateHealthInfo" parameterType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo">
|
||||||
|
update health_info
|
||||||
|
<set>
|
||||||
|
<if test="bloodType != null and bloodType != ''">
|
||||||
|
blood_type = #{bloodType},
|
||||||
|
</if>
|
||||||
|
<if test="maritalStatus != null and maritalStatus != ''">
|
||||||
|
marital_status = #{maritalStatus},
|
||||||
|
</if>
|
||||||
|
<if test="pregnantStatus != null and pregnantStatus != ''">
|
||||||
|
pregnant_status = #{pregnantStatus},
|
||||||
|
</if>
|
||||||
|
<if test="pregnancyDate != null and pregnancyDate != ''">
|
||||||
|
pregnancy_date = #{pregnancyDate},
|
||||||
|
</if>
|
||||||
|
<if test="doctorAdvice != null and doctorAdvice != ''">
|
||||||
|
doctor_advice = #{doctorAdvice},
|
||||||
|
</if>
|
||||||
|
<if test="ifHospitalized != null and ifHospitalized != ''">
|
||||||
|
if_hospitalized = #{ifHospitalized},
|
||||||
|
</if>
|
||||||
|
<if test="doctorNum != null and doctorNum != ''">
|
||||||
|
doctor_num = #{doctorNum},
|
||||||
|
</if>
|
||||||
|
<if test="hospitalNum != null and hospitalNum != ''">
|
||||||
|
hospital_num = #{hospitalNum},
|
||||||
|
</if>
|
||||||
|
<if test="inpatientDate != null and inpatientDate != ''">
|
||||||
|
inpatient_date = #{inpatientDate},
|
||||||
|
</if>
|
||||||
|
<if test="weightControl != null and weightControl != ''">
|
||||||
|
weight_control = #{weightControl},
|
||||||
|
</if>
|
||||||
|
<if test="allergen != null and allergen != ''">
|
||||||
|
allergen = #{allergen},
|
||||||
|
</if>
|
||||||
|
<if test="labourIntensity != null and labourIntensity != ''">
|
||||||
|
labour_intensity = #{labourIntensity},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where user_id = #{userId} and del_flag='0'
|
||||||
|
</update>
|
||||||
|
<update id="updateHealthBodyRecord" parameterType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo">
|
||||||
|
update health_body_record
|
||||||
|
<set>
|
||||||
|
<if test="height != null and height != ''">
|
||||||
|
height = #{height},
|
||||||
|
</if>
|
||||||
|
<if test="weight != null and weight != ''">
|
||||||
|
weight = #{weight},
|
||||||
|
</if>
|
||||||
|
<if test="bmi != null and bmi != ''">
|
||||||
|
bmi = #{bmi},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where user_id = #{userId} and del_flag='0'
|
||||||
|
</update>
|
||||||
|
<update id="deleteHealthInfoChronic" parameterType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo">
|
||||||
|
delete from health_info_chronic
|
||||||
|
where user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
<insert id="insertHealthInfoChronic" parameterType="com.bonus.canteen.core.nutrition.common.vo.HealthInfoFullVo">
|
||||||
|
insert into health_info_chronic(user_id, chronic_id, chronic_name)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.userId}, #{entity.chronicIds}, #{entity.chronicNames})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue