Browse Source

打卡 健康列表

master
zhizhi wu 6 years ago
parent
commit
298601d220
  1. 15
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  2. 9
      health/src/main/java/com/ccsens/health/api/HealthController.java
  3. 24
      health/src/main/java/com/ccsens/health/bean/dto/HealthDto.java
  4. 34
      health/src/main/java/com/ccsens/health/bean/vo/HealthVo.java
  5. 8
      health/src/main/java/com/ccsens/health/persist/dao/HealthRecordsDao.java
  6. 11
      health/src/main/java/com/ccsens/health/service/HealthService.java
  7. 8
      health/src/main/java/com/ccsens/health/service/IHealthService.java
  8. 9
      health/src/main/java/com/ccsens/health/service/UserService.java
  9. 24
      health/src/main/resources/mapper_dao/HealthRecordDao.xml
  10. 3
      util/src/main/java/com/ccsens/util/WebConstant.java

15
cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java

@ -30,6 +30,16 @@ import java.util.Map;
@FeignClient(name = "tall", path = "v1.0", fallbackFactory = TallFeignClientFallBack.class)
public interface TallFeignClient {
/**
* 输入两个userid将两个账号合并保留企业用户的id
* @param userId 需要保存的userid
* @param uselessId 不需要保存的userid
* @return
*/
@GetMapping("/users/mergeUserId")
JsonResponse mergeUserId(@RequestParam(required = true, name = "userId") Long userId,@RequestParam(required = true, name = "uselessId") Long uselessId);
/**
* 获取
*
@ -159,6 +169,11 @@ class TallFeignClientFallBack implements FallbackFactory<TallFeignClient> {
log.error(msg);
}
return new TallFeignClient() {
@Override
public JsonResponse mergeUserId(Long userId, Long uselessId) {
return JsonResponse.newInstance().fail();
}
@Override
public String get(QueryParam map) {
return "hello world";

9
health/src/main/java/com/ccsens/health/api/HealthController.java

@ -10,6 +10,7 @@ import com.ccsens.health.service.IHealthService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.dto.QueryDto;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -68,4 +69,12 @@ public class HealthController {
return JsonResponse.newInstance().ok(healthTypeStatisticsList);
}
@MustLogin
@ApiOperation(value = "健康类型统计", notes = "")
@PostMapping("list")
public JsonResponse<PageInfo<HealthVo.HealthList>> list(@RequestBody QueryDto<HealthDto.QueryList> params){
PageInfo<HealthVo.HealthList> pageInfo = healthService.list(params);
return JsonResponse.newInstance().ok(pageInfo);
}
}

24
health/src/main/java/com/ccsens/health/bean/dto/HealthDto.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.math.BigDecimal;
@Data
@ -30,4 +32,26 @@ public class HealthDto {
@ApiModelProperty("体温")
private BigDecimal animalHeat;
}
@ApiModel("查询健康上报列表参数")
@Data
public static class QueryList{
@ApiModelProperty("学号")
private String no;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("班级")
private String department;
@ApiModelProperty("开始时间")
private Long startTime ;
@ApiModelProperty("开始时间")
private Long endTime ;
@ApiModelProperty("第几页")
@Min(value = 1)
private int pageNum = 1;
@ApiModelProperty("每页多少条")
@Min(value = 1)
@Max(value=100)
private int pageSize = 10;
}
}

34
health/src/main/java/com/ccsens/health/bean/vo/HealthVo.java

@ -95,4 +95,38 @@ public class HealthVo {
private String quarantine;
private String independent;
}
@Data
public static class HealthList{
@ApiModelProperty("打卡记录的id")
private Long id;
@ApiModelProperty("成员id")
private Long userId;
@ApiModelProperty("日期")
private Long time;
@ApiModelProperty("当前所在地区")
private String district;
@ApiModelProperty("当前所在详细地址")
private String address;
@ApiModelProperty("当前身体状态")
private Long healthTypeId;
@ApiModelProperty("就诊医院")
private String hospital;
@ApiModelProperty("有无湖北武汉接触史 0没有 1有")
private int touchHubei;
@ApiModelProperty("有无接触患者 0无 1有")
private int touchSick;
@ApiModelProperty("体温")
private BigDecimal animalHeat;
@ApiModelProperty("健康状态code")
private Byte code;
@ApiModelProperty("健康状态名字")
private String codeName;
@ApiModelProperty("工号")
private String no;
@ApiModelProperty("学生名字")
private String name;
@ApiModelProperty("部门")
private String department;
}
}

8
health/src/main/java/com/ccsens/health/persist/dao/HealthRecordsDao.java

@ -1,5 +1,6 @@
package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.dto.HealthDto;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.bean.vo.UserVo;
import com.ccsens.health.persist.mapper.HealthRecordsMapper;
@ -25,4 +26,11 @@ public interface HealthRecordsDao extends HealthRecordsMapper {
* @return
*/
HealthVo.HealthDetail queryDetail(@Param("userId")Long userId, @Param("endTime") Long endTime);
/**
* 查询健康信息
* @param param
* @return
*/
List<HealthVo.HealthList> list(HealthDto.QueryList param);
}

11
health/src/main/java/com/ccsens/health/service/HealthService.java

@ -20,6 +20,8 @@ import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import com.ccsens.util.wx.WxXcxUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.micrometer.shaded.org.pcollections.PCollection;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,6 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.Valid;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
@ -233,4 +236,12 @@ public class HealthService implements IHealthService{
}
return healthTypeStatisticsList;
}
@Override
public PageInfo<HealthVo.HealthList> list(QueryDto<HealthDto.QueryList> params) {
HealthDto.QueryList param = params.getParam();
PageHelper.startPage(param.getPageNum(), param.getPageSize());
List<HealthVo.HealthList> vos = healthRecordsDao.list(param);
return new PageInfo<>(vos);
}
}

8
health/src/main/java/com/ccsens/health/service/IHealthService.java

@ -4,6 +4,7 @@ import com.ccsens.health.bean.dto.HealthDto;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.util.bean.dto.QueryDto;
import com.github.pagehelper.PageInfo;
import java.io.IOException;
import java.util.List;
@ -16,4 +17,11 @@ public interface IHealthService {
List<HealthVo.HealthTypeVo> getHealthType();
List<HealthVo.HealthTypeStatistics> getHealthTypeStatistics(QueryDto<JourneyDto.StatisticsDate> params) throws Exception;
/**
* 健康列表
* @param params
* @return
*/
PageInfo<HealthVo.HealthList> list(QueryDto<HealthDto.QueryList> params);
}

9
health/src/main/java/com/ccsens/health/service/UserService.java

@ -15,6 +15,7 @@ import com.ccsens.health.persist.dao.*;
import com.ccsens.health.util.HealthConstant;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.DateUtil;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
@ -183,8 +184,14 @@ public class UserService implements IUserService{
* @return
*/
private void bindUser(Long sourceUserId, Long targetUserId) {
log.info("sourceUserId:{}, targetUserId:{}", sourceUserId, targetUserId);
//TODO 帐号绑定
JsonResponse jsonResponse = tallFeignClient.mergeUserId(targetUserId, sourceUserId);
log.info("绑定帐号结果:{}", jsonResponse);
if (jsonResponse.getCode().intValue() != CodeEnum.SUCCESS.getCode().intValue()) {
log.info("绑定帐号失败:{}", jsonResponse);
throw new BaseException(jsonResponse.getCode(), jsonResponse.getMsg());
}
// 绑定实名认证
RealNameAuth auth = new RealNameAuth();
auth.setUserId(targetUserId);

24
health/src/main/resources/mapper_dao/HealthRecordDao.xml

@ -119,4 +119,28 @@
and r.rec_status = 0
order by r.time desc limit 1
</select>
<select id="list" resultType="com.ccsens.health.bean.vo.HealthVo$HealthList">
select r.id, r.user_id as userId, r.time, r.district, r.address,
r.health_type_id as healthTypeId, r.touch_hubei as touchHubei,
r.touch_sick as touchSick, r.animal_heat as animalHeat,
t.code,t.name as codeName, a.no, a.name, m.department
from t_health_records r , t_health_type t, t_real_name_auth a, t_member m
where r.health_type_id = t.id and r.user_id = a.user_id and a.no = m.wkno
<if test="no != null and no != ''">
and m.wkno = #{no}
</if>
<if test="name != null and name != ''">
and m.name = #{name}
</if>
<if test="department != null and department != ''">
and m.department = #{department}
</if>
<if test="startTime != null">
and r.time &gt;=#{startTime}
</if>
<if test="endTime != null">
and r.time &lt;=#{endTime}
</if>
and r.rec_status = 0
</select>
</mapper>

3
util/src/main/java/com/ccsens/util/WebConstant.java

@ -1,9 +1,6 @@
package com.ccsens.util;
import cn.hutool.core.codec.Base64;
import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.RandomStringUtils;
import java.io.File;

Loading…
Cancel
Save