zhizhi wu 5 years ago
parent
commit
0db584f7d7
  1. 11
      health/src/main/java/com/ccsens/health/bean/dto/HealthDto.java
  2. 7
      health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java
  3. 4
      health/src/main/java/com/ccsens/health/bean/dto/UserDto.java
  4. 6
      health/src/main/java/com/ccsens/health/bean/vo/UserVo.java
  5. 5
      health/src/main/java/com/ccsens/health/persist/dao/HealthAbnormalDao.java
  6. 79
      health/src/main/java/com/ccsens/health/service/AbnormalService.java
  7. 28
      health/src/main/java/com/ccsens/health/service/HealthService.java
  8. 2
      health/src/main/java/com/ccsens/health/service/IAbnormalService.java
  9. 4
      health/src/main/resources/application.yml
  10. 29
      health/src/main/resources/mapper_dao/HealthAbnormalDao.xml
  11. 7
      tall/src/main/java/com/ccsens/tall/service/UserService.java

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

@ -4,9 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;
@ -19,15 +17,20 @@ public class HealthDto {
public static class healthInfo{
@ApiModelProperty("token")
private String token;
@Size(max = 128,min = 0,message = "信息格式错误")
@ApiModelProperty("当前所在地区")
private String district;
@Size(max = 128,min = 0,message = "信息格式错误")
@ApiModelProperty("当前所在详细地址")
private String address;
@NotNull
@ApiModelProperty("当前身体状态")
private Long healthTypeId;
@DecimalMax(value = "45",message = "体温输入异常")
@DecimalMin(value = "30",message = "体温输入异常")
@ApiModelProperty("体温")
private BigDecimal animalHeat;
@Size(max = 32,min = 0,message = "信息格式错误")
@ApiModelProperty("就诊医院")
private String hospital;
@ApiModelProperty("有无湖北武汉接触史 0没有 1有")
@ -38,10 +41,12 @@ public class HealthDto {
private int touchOverseas;
@ApiModelProperty("是否在学校所在地 0无 1有")
private int schoolLocation;
@Size(max = 6,min = 0,message = "信息格式错误")
@ApiModelProperty("紧急联系人姓名")
private String emergencyName;
@ApiModelProperty("紧急联系人电话")
private String emergencyPhone;
@Size(max = 144,min = 0,message = "信息格式错误")
@ApiModelProperty("备注信息")
private String remark;
@Min(value = 1)

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

@ -6,10 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.*;
import java.math.BigDecimal;
@Data
@ -20,6 +17,7 @@ public class JourneyDto {
public static class JourneyInfo{
@ApiModelProperty("出行方式 0铁路 1飞机 2客运车辆 3自驾 4船 5其他")
private int tripMode;
@Size(max = 12,min = 0,message = "信息格式错误")
@ApiModelProperty("车次号")
private String carNo;
@ApiModelProperty("行程类型 0未填写 1返校行程 2日常外出")
@ -28,6 +26,7 @@ public class JourneyDto {
private Long startTime;
@ApiModelProperty("到达时间")
private Long endTime;
@Size(max = 255,min = 0,message = "信息格式错误")
@ApiModelProperty("同行人员")
private String together;
@Min(value = 1)

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

@ -4,18 +4,22 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Size;
@Data
public class UserDto {
@Data
@ApiModel("保存的信息")
public static class UserInfo{
@Size(max = 6,min = 0,message = "信息格式错误")
@ApiModelProperty("姓名")
private String name;
// @ApiModelProperty("身份证号")
// private String idCard;
@ApiModelProperty("身份 0学生 1老师 2工作人员")
private int post;
@Size(max = 16,min = 0,message = "信息格式错误")
@ApiModelProperty("学号")
private String no;
@ApiModelProperty("手机号")

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

@ -33,6 +33,12 @@ public class UserVo {
private String phone;
@ApiModelProperty("健康码")
private List<HealthCode> healthCodeList;
public String getPhone(){
if(phone == null){
return null;
}
return phone.substring(0, 3) + "****" + phone.substring(7, phone.length());
}
}
@Data
@ApiModel("个人健康码信息")

5
health/src/main/java/com/ccsens/health/persist/dao/HealthAbnormalDao.java

@ -1,6 +1,7 @@
package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.po.HealthAbnormal;
import com.ccsens.health.bean.po.HealthRecords;
import com.ccsens.health.bean.vo.AbnormalVo;
import com.ccsens.health.persist.mapper.HealthAbnormalMapper;
import org.apache.ibatis.annotations.Param;
@ -16,4 +17,8 @@ public interface HealthAbnormalDao extends HealthAbnormalMapper {
List<AbnormalVo.AbnormalOverview> abnormalOverview(@Param("department")String department, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
int selectJourneyNumber(@Param("department")String department, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
HealthAbnormal selectByUserId(@Param("userId")Long userId);
HealthRecords selectHealthRecordByWkno(@Param("wkno")String wkno);
}

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

@ -7,32 +7,46 @@ 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.vo.AbnormalVo;
import com.ccsens.health.persist.dao.HealthAbnormalDao;
import com.ccsens.health.persist.dao.HealthQRCodeDao;
import com.ccsens.util.CodeEnum;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class AbnormalService implements IAbnormalService{
public class AbnormalService implements IAbnormalService {
@Autowired
private Snowflake snowflake;
@Autowired
private HealthAbnormalDao healthAbnormalDao;
@Autowired
private HealthQRCodeDao healthQRCodeDao;
@Autowired
private IAsyncService asyncService;
@Value("spring.profiles.active")
private String active;
/**
* 疫情概览
*
* @param params
* @return
*/
@ -42,14 +56,14 @@ public class AbnormalService implements IAbnormalService{
List<AbnormalVo.AbnormalOverview> abnormalOverviewList = new ArrayList<>();
//人员异常
abnormalOverviewList =
healthAbnormalDao.abnormalOverview(selectAbnormal.getDepartment(),selectAbnormal.getStartTime(),selectAbnormal.getEndTime());
if(CollectionUtil.isNotEmpty(abnormalOverviewList)){
for(AbnormalVo.AbnormalOverview abnormalOverview : abnormalOverviewList){
healthAbnormalDao.abnormalOverview(selectAbnormal.getDepartment(), selectAbnormal.getStartTime(), selectAbnormal.getEndTime());
if (CollectionUtil.isNotEmpty(abnormalOverviewList)) {
for (AbnormalVo.AbnormalOverview abnormalOverview : abnormalOverviewList) {
abnormalOverview.setAbnormalType(1);
}
}
//行程异常
int journeyNumber = healthAbnormalDao.selectJourneyNumber(selectAbnormal.getDepartment(),selectAbnormal.getStartTime(),selectAbnormal.getEndTime());
int journeyNumber = healthAbnormalDao.selectJourneyNumber(selectAbnormal.getDepartment(), selectAbnormal.getStartTime(), selectAbnormal.getEndTime());
AbnormalVo.AbnormalOverview abnormalOverview = new AbnormalVo.AbnormalOverview();
abnormalOverview.setAbnormalType(2);
abnormalOverview.setCode(5);
@ -64,16 +78,43 @@ public class AbnormalService implements IAbnormalService{
* @param params
*/
@Override
public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) {
public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) throws Exception {
AbnormalDto.AddAbnormal addAbnormal = params.getParam();
HealthAbnormal healthAbnormal = new HealthAbnormal();
healthAbnormal.setId(snowflake.nextId());
BeanUtil.copyProperties(addAbnormal,healthAbnormal);
BeanUtil.copyProperties(addAbnormal, healthAbnormal);
healthAbnormal.setHealthStatus((short) addAbnormal.getHealthType());
healthAbnormalDao.insertSelective(healthAbnormal);
//如果是确诊状态,检查该学生最新上报的健康信息,将二维码换成红色
Future<String> future = null;
if (addAbnormal.getHealthType() == 4) {
HealthRecords healthRecords = healthAbnormalDao.selectHealthRecordByWkno(addAbnormal.getWkno());
if (ObjectUtil.isNotNull(healthAbnormal)) {
if ("prod".equals(active)) {
WxXcxUtil.LineColor color = new WxXcxUtil.LineColor();
color.r = "226";
color.g = "32";
color.b = "24";
future = asyncService.generateQRCode("d=" + healthRecords.getUserId(), color);
log.info("调用微信生成二维码");
HealthQRCodeExample healthQRCodeExample = new HealthQRCodeExample();
healthQRCodeExample.createCriteria().andHealthRecordsIdEqualTo(healthRecords.getId());
List<HealthQRCode> healthQRCodeList = healthQRCodeDao.selectByExample(healthQRCodeExample);
if(CollectionUtil.isNotEmpty(healthQRCodeList)){
HealthQRCode healthQRCode = healthQRCodeList.get(0);
if(future != null){
healthQRCode.setQrcodePath(future.get());
healthQRCodeDao.updateByPrimaryKeySelective(healthQRCode);
}
}
} else {
log.info("测试环境,不调用生成二维码");
}
}
}
AbnormalVo.AbnormalStatisticsVo abnormalStatisticsVo = new AbnormalVo.AbnormalStatisticsVo();
BeanUtil.copyProperties(healthAbnormal,abnormalStatisticsVo);
BeanUtil.copyProperties(healthAbnormal, abnormalStatisticsVo);
abnormalStatisticsVo.setHealthType(healthAbnormal.getHealthStatus());
return abnormalStatisticsVo;
}
@ -94,38 +135,39 @@ public class AbnormalService implements IAbnormalService{
/**
* 修改异常人员信息
*
* @param params
*/
@Override
public void updateAbnormal(QueryDto<AbnormalDto.UpdateAbnormal> params) {
AbnormalDto.UpdateAbnormal updateAbnormal = params.getParam();
HealthAbnormal healthAbnormal = healthAbnormalDao.selectByPrimaryKey(updateAbnormal.getId());
if(ObjectUtil.isNull(healthAbnormal)){
if (ObjectUtil.isNull(healthAbnormal)) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//修改信息
if(StrUtil.isNotEmpty(updateAbnormal.getWkno())){
if (StrUtil.isNotEmpty(updateAbnormal.getWkno())) {
healthAbnormal.setWkno(updateAbnormal.getWkno());
}
if(StrUtil.isNotEmpty(updateAbnormal.getName())){
if (StrUtil.isNotEmpty(updateAbnormal.getName())) {
healthAbnormal.setName(updateAbnormal.getName());
}
if(StrUtil.isNotEmpty(updateAbnormal.getDepartment())){
if (StrUtil.isNotEmpty(updateAbnormal.getDepartment())) {
healthAbnormal.setDepartment(updateAbnormal.getDepartment());
}
if(ObjectUtil.isNotNull(updateAbnormal.getAnimalHeat())){
if (ObjectUtil.isNotNull(updateAbnormal.getAnimalHeat())) {
healthAbnormal.setAnimalHeat(updateAbnormal.getAnimalHeat());
}
if(StrUtil.isNotEmpty(updateAbnormal.getReason())){
if (StrUtil.isNotEmpty(updateAbnormal.getReason())) {
healthAbnormal.setReason(updateAbnormal.getReason());
}
if(ObjectUtil.isNotNull(updateAbnormal.getHealthType())){
if (ObjectUtil.isNotNull(updateAbnormal.getHealthType())) {
healthAbnormal.setHealthStatus((short) updateAbnormal.getHealthType());
}
if(ObjectUtil.isNotNull(updateAbnormal.getStartTime())){
if (ObjectUtil.isNotNull(updateAbnormal.getStartTime())) {
healthAbnormal.setStartTime(updateAbnormal.getStartTime());
}
if(ObjectUtil.isNotNull(updateAbnormal.getEndTime())){
if (ObjectUtil.isNotNull(updateAbnormal.getEndTime())) {
healthAbnormal.setEndTime(updateAbnormal.getEndTime());
}
healthAbnormalDao.updateByPrimaryKeySelective(healthAbnormal);
@ -133,12 +175,13 @@ public class AbnormalService implements IAbnormalService{
/**
* 删除异常人员信息
*
* @param params
*/
@Override
public void delAbnormal(QueryDto<AbnormalDto.DelAbnormal> params) {
HealthAbnormal healthAbnormal = healthAbnormalDao.selectByPrimaryKey(params.getParam().getId());
if(ObjectUtil.isNull(healthAbnormal)){
if (ObjectUtil.isNull(healthAbnormal)) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
healthAbnormal.setRecStatus((byte) 2);

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

@ -11,10 +11,7 @@ import com.ccsens.health.bean.dto.HealthDto;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.po.*;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.persist.dao.HealthQRCodeDao;
import com.ccsens.health.persist.dao.HealthRecordsDao;
import com.ccsens.health.persist.dao.HealthRemarkFileDao;
import com.ccsens.health.persist.dao.HealthTypeDao;
import com.ccsens.health.persist.dao.*;
import com.ccsens.health.util.HealthConstant;
import com.ccsens.util.*;
import com.ccsens.util.bean.dto.QueryDto;
@ -54,6 +51,8 @@ public class HealthService implements IHealthService {
@Autowired
private HealthRemarkFileDao healthRemarkFileDao;
@Autowired
private HealthAbnormalDao healthAbnormalDao;
@Autowired
private RedisUtil redisUtil;
@Autowired
private IAsyncService asyncService;
@ -100,7 +99,10 @@ public class HealthService implements IHealthService {
Future<String> future = null;
log.info("active:{}", active);
if ("prod".equals(active)) {
WxXcxUtil.LineColor color = getLineColor(healthType);
//检查上报人员是否是已确诊
Boolean flag = isAbnormal(userId);
WxXcxUtil.LineColor color = getLineColor(healthType,flag);
future = asyncService.generateQRCode("d=" + userId, color);
log.info("调用微信生成二维码");
} else {
@ -186,8 +188,22 @@ public class HealthService implements IHealthService {
return healthInfoVo;
}
private WxXcxUtil.LineColor getLineColor(HealthVo.HealthTypeRedis healthType) {
private Boolean isAbnormal(Long userId) {
HealthAbnormal healthAbnormal = healthAbnormalDao.selectByUserId(userId);
if(ObjectUtil.isNotNull(healthAbnormal) && healthAbnormal.getHealthStatus() == 4){
return true;
}
return false;
}
private WxXcxUtil.LineColor getLineColor(HealthVo.HealthTypeRedis healthType,Boolean flag) {
WxXcxUtil.LineColor color = new WxXcxUtil.LineColor();
if(flag){
color.r = "226";
color.g = "32";
color.b = "24";
return color;
}
if(healthType.getQuarantine() != 0) {
color.r = "243";
color.g = "139";

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

@ -9,7 +9,7 @@ import java.util.List;
public interface IAbnormalService {
List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params) throws Exception;
AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params);
AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) throws Exception;
List<AbnormalVo.AbnormalStatisticsVo> abnormalStatistics(QueryDto<AbnormalDto.AbnormalStatisticsDto> params);

4
health/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: dev
include: common, util-dev
active: test
include: common, util-test

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

@ -112,4 +112,33 @@
j.end_time &gt;= #{startTime}
</if>
</select>
<select id="selectByUserId" resultType="com.ccsens.health.bean.po.HealthAbnormal" parameterType="java.util.Map">
select
a.id as id,
a.wkno as wkno,
a.health_status as healthStatus
from
t_health_abnormal a join t_real_name_auth r on a.wkno = r.no
where
a.rec_status = 0
and
r.user_id = #{userId}
order by a.created_at DESC
limit 1
</select>
<select id="selectHealthRecordByWkno" resultType="com.ccsens.health.bean.po.HealthRecords" parameterType="java.util.Map">
select
hr.id as id,
hr.user_id as userId
from
t_real_name_auth r join t_health_records hr on hr.user_id = r.user_id
where
hr.rec_status = 0
and
r.no = #{wkno}
order by hr.time DESC
limit 1
</select>
</mapper>

7
tall/src/main/java/com/ccsens/tall/service/UserService.java

@ -291,7 +291,8 @@ public class UserService implements IUserService {
accountAuth.setUserId(user.getId());
accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value);
accountAuth.setIdentifier("USER_" + accountName);
accountAuth.setCredential("123456");
accountAuth.setSalt(ShiroKit.getRandomSalt(6));
accountAuth.setCredential(ShiroKit.md5("123456", accountAuth.getSalt()));
authDao.insertSelective(accountAuth);
}
}
@ -409,7 +410,6 @@ public class UserService implements IUserService {
* @return
*/
private UserVo.UserSign getUserSign(String openId, String unionId,
byte identifyType, String redirect) {
UserVo.UserSign userSignVo;//1.查找对应账户,不存在则注册
List<SysAuth> authList = null;
@ -460,7 +460,8 @@ public class UserService implements IUserService {
accountAuth.setUserId(user.getId());
accountAuth.setIdentifyType((byte) WebConstant.IDENTIFY_TYPE.Account.value);
accountAuth.setIdentifier("USER_" + accountName);
accountAuth.setCredential("123456");
accountAuth.setSalt(ShiroKit.getRandomSalt(6));
accountAuth.setCredential(ShiroKit.md5("123456", accountAuth.getSalt()));
authDao.insertSelective(accountAuth);
}
// theAuth = wxRegist(openid, unionId,WebConstant.IDENTIFY_TYPE.Wxmp);

Loading…
Cancel
Save