Browse Source

0407.1

master
zhangye 5 years ago
parent
commit
57249c3757
  1. 10
      health/src/main/java/com/ccsens/health/api/AbnormalController.java
  2. 2
      health/src/main/java/com/ccsens/health/api/HealthController.java
  3. 6
      health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java
  4. 4
      health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java
  5. 6
      health/src/main/java/com/ccsens/health/bean/po/HealthAbnormal.java
  6. 20
      health/src/main/java/com/ccsens/health/bean/po/HealthAbnormalExample.java
  7. 6
      health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java
  8. 34
      health/src/main/java/com/ccsens/health/service/AbnormalService.java
  9. 3
      health/src/main/java/com/ccsens/health/service/IAbnormalService.java
  10. 22
      health/src/main/java/com/ccsens/health/service/UserService.java
  11. 6
      health/src/main/resources/application-prod.yml
  12. 4
      health/src/main/resources/mapper_dao/HealthAbnormalDao.xml
  13. 6
      health/src/main/resources/mapper_dao/MemberDao.xml
  14. 14
      health/src/main/resources/mapper_raw/HealthAbnormalMapper.xml

10
health/src/main/java/com/ccsens/health/api/AbnormalController.java

@ -4,6 +4,7 @@ import com.ccsens.cloudutil.annotation.MustLogin;
import com.ccsens.health.bean.dto.AbnormalDto;
import com.ccsens.health.bean.dto.ClockDto;
import com.ccsens.health.bean.vo.AbnormalVo;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.service.IAbnormalService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
@ -74,4 +75,13 @@ public class AbnormalController {
abnormalService.delAbnormal(params);
return JsonResponse.newInstance().ok();
}
@MustLogin
@ApiOperation(value = "后台查询异常人员类型", notes = "")
@RequestMapping(value = "type", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<HealthVo.HealthTypeVo>> getAbnormalHealthType() throws Exception {
log.info("后台查询异常人员类型");
List<HealthVo.HealthTypeVo> healthTypeList = abnormalService.getAbnormalHealthType();
return JsonResponse.newInstance().ok(healthTypeList);
}
}

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

@ -65,6 +65,8 @@ public class HealthController {
return JsonResponse.newInstance().ok(healthTypeList);
}
@MustLogin
@ApiOperation(value = "健康类型统计", notes = "")
@RequestMapping(value = "statistics", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})

6
health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java

@ -57,8 +57,8 @@ public class AbnormalDto {
@ApiModelProperty("原因")
private String reason;
@NotNull
@ApiModelProperty("状态 0:健康 1:治愈 2:隔离 3:疑似 4:确诊")
private int healthType;
@ApiModelProperty("状态id ")
private Long healthType;
@NotNull
@ApiModelProperty("开始确诊时间")
private Long startTime;
@ -82,7 +82,7 @@ public class AbnormalDto {
@ApiModelProperty("原因")
private String reason;
@ApiModelProperty("状态 0:健康 1:治愈 2:隔离 3:疑似 4:确诊")
private int healthType;
private Long healthType;
@ApiModelProperty("开始确诊时间")
private Long startTime;
@ApiModelProperty("结束时间")

4
health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java

@ -42,8 +42,8 @@ public class JourneyDto {
@Data
@ApiModel("查询的时间范围")
public static class SelectDate{
@ApiModelProperty("token")
private String token;
// @ApiModelProperty("token")
// private String token;
@ApiModelProperty("开始时间 默认今天零点")
private Long startTime;
@ApiModelProperty("结束时间 默认当前时间")

6
health/src/main/java/com/ccsens/health/bean/po/HealthAbnormal.java

@ -17,7 +17,7 @@ public class HealthAbnormal implements Serializable {
private String reason;
private Short healthStatus;
private Long healthStatus;
private Long startTime;
@ -79,11 +79,11 @@ public class HealthAbnormal implements Serializable {
this.reason = reason == null ? null : reason.trim();
}
public Short getHealthStatus() {
public Long getHealthStatus() {
return healthStatus;
}
public void setHealthStatus(Short healthStatus) {
public void setHealthStatus(Long healthStatus) {
this.healthStatus = healthStatus;
}

20
health/src/main/java/com/ccsens/health/bean/po/HealthAbnormalExample.java

@ -516,52 +516,52 @@ public class HealthAbnormalExample {
return (Criteria) this;
}
public Criteria andHealthStatusEqualTo(Short value) {
public Criteria andHealthStatusEqualTo(Long value) {
addCriterion("health_status =", value, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusNotEqualTo(Short value) {
public Criteria andHealthStatusNotEqualTo(Long value) {
addCriterion("health_status <>", value, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusGreaterThan(Short value) {
public Criteria andHealthStatusGreaterThan(Long value) {
addCriterion("health_status >", value, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusGreaterThanOrEqualTo(Short value) {
public Criteria andHealthStatusGreaterThanOrEqualTo(Long value) {
addCriterion("health_status >=", value, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusLessThan(Short value) {
public Criteria andHealthStatusLessThan(Long value) {
addCriterion("health_status <", value, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusLessThanOrEqualTo(Short value) {
public Criteria andHealthStatusLessThanOrEqualTo(Long value) {
addCriterion("health_status <=", value, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusIn(List<Short> values) {
public Criteria andHealthStatusIn(List<Long> values) {
addCriterion("health_status in", values, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusNotIn(List<Short> values) {
public Criteria andHealthStatusNotIn(List<Long> values) {
addCriterion("health_status not in", values, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusBetween(Short value1, Short value2) {
public Criteria andHealthStatusBetween(Long value1, Long value2) {
addCriterion("health_status between", value1, value2, "healthStatus");
return (Criteria) this;
}
public Criteria andHealthStatusNotBetween(Short value1, Short value2) {
public Criteria andHealthStatusNotBetween(Long value1, Long value2) {
addCriterion("health_status not between", value1, value2, "healthStatus");
return (Criteria) this;
}

6
health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java

@ -55,8 +55,10 @@ public class AbnormalVo {
private BigDecimal animalHeat;
@ApiModelProperty("原因")
private String reason;
@ApiModelProperty("状态 0:健康 1:治愈 2:隔离 3:疑似 4:确诊")
private int healthType;
@ApiModelProperty("状态id")
private Long healthType;
@ApiModelProperty("状态名")
private String healthName;
@ApiModelProperty("开始确诊时间")
private Long startTime;
@ApiModelProperty("结束时间")

34
health/src/main/java/com/ccsens/health/service/AbnormalService.java

@ -6,15 +6,13 @@ import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.health.bean.dto.AbnormalDto;
import com.ccsens.health.bean.po.HealthAbnormal;
import com.ccsens.health.bean.po.HealthQRCode;
import com.ccsens.health.bean.po.HealthQRCodeExample;
import com.ccsens.health.bean.po.HealthRecords;
import com.ccsens.health.bean.po.*;
import com.ccsens.health.bean.vo.AbnormalVo;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.persist.dao.HealthAbnormalDao;
import com.ccsens.health.persist.dao.HealthQRCodeDao;
import com.ccsens.health.persist.dao.HealthRecordsDao;
import com.ccsens.health.persist.dao.HealthTypeDao;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
@ -44,6 +42,8 @@ public class AbnormalService implements IAbnormalService {
@Autowired
private HealthQRCodeDao healthQRCodeDao;
@Autowired
private HealthTypeDao healthTypeDao;
@Autowired
private IAsyncService asyncService;
@Value("spring.profiles.active")
private String active;
@ -113,7 +113,7 @@ public class AbnormalService implements IAbnormalService {
HealthAbnormal healthAbnormal = new HealthAbnormal();
healthAbnormal.setId(snowflake.nextId());
BeanUtil.copyProperties(addAbnormal, healthAbnormal);
healthAbnormal.setHealthStatus((short) addAbnormal.getHealthType());
healthAbnormal.setHealthStatus(addAbnormal.getHealthType());
healthAbnormalDao.insertSelective(healthAbnormal);
//如果是确诊状态,检查该学生最新上报的健康信息,将二维码换成红色
@ -192,7 +192,7 @@ public class AbnormalService implements IAbnormalService {
healthAbnormal.setReason(updateAbnormal.getReason());
}
if (ObjectUtil.isNotNull(updateAbnormal.getHealthType())) {
healthAbnormal.setHealthStatus((short) updateAbnormal.getHealthType());
healthAbnormal.setHealthStatus(updateAbnormal.getHealthType());
}
if (ObjectUtil.isNotNull(updateAbnormal.getStartTime())) {
healthAbnormal.setStartTime(updateAbnormal.getStartTime());
@ -217,4 +217,26 @@ public class AbnormalService implements IAbnormalService {
healthAbnormal.setRecStatus((byte) 2);
healthAbnormalDao.updateByPrimaryKeySelective(healthAbnormal);
}
/**
* 后台查询异常人员类型
* @return
*/
@Override
public List<HealthVo.HealthTypeVo> getAbnormalHealthType() {
List<HealthVo.HealthTypeVo> healthTypeVoList = new ArrayList<>();
HealthTypeExample healthTypeExample = new HealthTypeExample();
healthTypeExample.createCriteria().andSceneEqualTo((byte) 1);
List<HealthType> healthTypeList = healthTypeDao.selectByExample(healthTypeExample);
if (CollectionUtil.isNotEmpty(healthTypeList)) {
for (HealthType healthType : healthTypeList) {
HealthVo.HealthTypeVo healthTypeVo = new HealthVo.HealthTypeVo();
healthTypeVo.setId(healthType.getId());
healthTypeVo.setName(healthType.getName());
healthTypeVoList.add(healthTypeVo);
}
}
return healthTypeVoList;
}
}

3
health/src/main/java/com/ccsens/health/service/IAbnormalService.java

@ -2,6 +2,7 @@ package com.ccsens.health.service;
import com.ccsens.health.bean.dto.AbnormalDto;
import com.ccsens.health.bean.vo.AbnormalVo;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.util.bean.dto.QueryDto;
import java.util.List;
@ -16,4 +17,6 @@ public interface IAbnormalService {
void updateAbnormal(QueryDto<AbnormalDto.UpdateAbnormal> params);
void delAbnormal(QueryDto<AbnormalDto.DelAbnormal> params);
List<HealthVo.HealthTypeVo> getAbnormalHealthType();
}

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

@ -260,16 +260,20 @@ public class UserService implements IUserService {
//判断是全局概览,还是搜索页面
if (selectTrack.getSearch() == 1) {
//全局橄榄,根据时间随机显示一个学生的轨迹
//随机获取一个学生的信息
MemberExample memberExample = new MemberExample();
memberExample.clear();
Long number = memberDao.countByExample(memberExample);
Random rand = new Random();
int randomNumber = rand.nextInt(number.intValue()) + 1;
Member member = memberDao.selectByRandom(randomNumber);
// //全局橄榄,根据时间随机显示一个学生的轨迹
// //随机获取一个学生的信息
// MemberExample memberExample = new MemberExample();
// memberExample.clear();
// Long number = memberDao.countByExample(memberExample);
// Random rand = new Random();
// int randomNumber = rand.nextInt(number.intValue()) + 1;
// Member member = memberDao.selectByRandom(randomNumber);
//获取个人轨迹
trackInfoList = realNameAuthDao.selectTrackInfoByWkno(member.getName(), member.getWkno(), startTime, endTime);
List<UserVo.TrackInfo> trackInfo = new ArrayList<>();
trackInfo = realNameAuthDao.selectTrackInfoByWkno(null, null, startTime, endTime);
if(CollectionUtil.isNotEmpty(trackInfo)) {
trackInfoList.add(trackInfo.get(0));
}
} else {
//搜索页面,若没有参数,返回空
if (StrUtil.isEmpty(selectTrack.getName()) && StrUtil.isEmpty(selectTrack.getWkno())) {

6
health/src/main/resources/application-prod.yml

@ -1,11 +1,11 @@
server:
port: 7080
port: 7081
servlet:
context-path:
spring:
snowflake:
datacenterId: 1
workerId: 1
datacenterId: 2
workerId: 2
application:
name: health
datasource:

4
health/src/main/resources/mapper_dao/HealthAbnormalDao.xml

@ -10,6 +10,7 @@
<result column="animalHeat" property="animalHeat"/>
<result column="reason" property="reason"/>
<result column="healthType" property="healthType"/>
<result column="healthName" property="healthName"/>
<result column="startTime" property="startTime"/>
<result column="endTime" property="endTime"/>
</resultMap>
@ -29,10 +30,11 @@
a.animal_heat as animalHeat,
a.reason as reason,
a.health_status as healthType,
t.`name` as healthName,
a.start_time as startTime,
a.end_time as endTime
from
t_health_abnormal a left join t_member m on a.wkno = m.wkno
t_health_abnormal a left join t_member m on a.wkno = m.wkno join t_health_type t on a.health_status = t.id
where
a.rec_status = 0
<if test="post != null and post !='' and post == 0">

6
health/src/main/resources/mapper_dao/MemberDao.xml

@ -60,15 +60,15 @@
LEFT join t_health_records hr on rn.user_id = hr.user_id
where
m.rec_status = 0
<if test="name != null">
<if test="name != null and name != ''">
and
m.name = #{name}
</if>
<if test="wkno != null">
<if test="wkno != null and wkno != ''">
and
m.wkno = #{wkno}
</if>
<if test="department != null">
<if test="department != null and department != ''">
and
m.department = #{department}
</if>

14
health/src/main/resources/mapper_raw/HealthAbnormalMapper.xml

@ -8,7 +8,7 @@
<result column="department" jdbcType="VARCHAR" property="department" />
<result column="animal_heat" jdbcType="DECIMAL" property="animalHeat" />
<result column="reason" jdbcType="VARCHAR" property="reason" />
<result column="health_status" jdbcType="SMALLINT" property="healthStatus" />
<result column="health_status" jdbcType="BIGINT" property="healthStatus" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
@ -115,7 +115,7 @@
)
values (#{id,jdbcType=BIGINT}, #{wkno,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{department,jdbcType=VARCHAR}, #{animalHeat,jdbcType=DECIMAL}, #{reason,jdbcType=VARCHAR},
#{healthStatus,jdbcType=SMALLINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
#{healthStatus,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
</insert>
@ -179,7 +179,7 @@
#{reason,jdbcType=VARCHAR},
</if>
<if test="healthStatus != null">
#{healthStatus,jdbcType=SMALLINT},
#{healthStatus,jdbcType=BIGINT},
</if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
@ -226,7 +226,7 @@
reason = #{record.reason,jdbcType=VARCHAR},
</if>
<if test="record.healthStatus != null">
health_status = #{record.healthStatus,jdbcType=SMALLINT},
health_status = #{record.healthStatus,jdbcType=BIGINT},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=BIGINT},
@ -256,7 +256,7 @@
department = #{record.department,jdbcType=VARCHAR},
animal_heat = #{record.animalHeat,jdbcType=DECIMAL},
reason = #{record.reason,jdbcType=VARCHAR},
health_status = #{record.healthStatus,jdbcType=SMALLINT},
health_status = #{record.healthStatus,jdbcType=BIGINT},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
@ -285,7 +285,7 @@
reason = #{reason,jdbcType=VARCHAR},
</if>
<if test="healthStatus != null">
health_status = #{healthStatus,jdbcType=SMALLINT},
health_status = #{healthStatus,jdbcType=BIGINT},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=BIGINT},
@ -312,7 +312,7 @@
department = #{department,jdbcType=VARCHAR},
animal_heat = #{animalHeat,jdbcType=DECIMAL},
reason = #{reason,jdbcType=VARCHAR},
health_status = #{healthStatus,jdbcType=SMALLINT},
health_status = #{healthStatus,jdbcType=BIGINT},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},

Loading…
Cancel
Save