|
|
@ -9,15 +9,14 @@ import com.ccsens.health.bean.dto.AbnormalDto; |
|
|
import com.ccsens.health.bean.po.*; |
|
|
import com.ccsens.health.bean.po.*; |
|
|
import com.ccsens.health.bean.vo.AbnormalVo; |
|
|
import com.ccsens.health.bean.vo.AbnormalVo; |
|
|
import com.ccsens.health.bean.vo.HealthVo; |
|
|
import com.ccsens.health.bean.vo.HealthVo; |
|
|
import com.ccsens.health.persist.dao.HealthAbnormalDao; |
|
|
import com.ccsens.health.persist.dao.*; |
|
|
import com.ccsens.health.persist.dao.HealthQRCodeDao; |
|
|
import com.ccsens.health.util.HealthConstant; |
|
|
import com.ccsens.health.persist.dao.HealthRecordsDao; |
|
|
|
|
|
import com.ccsens.health.persist.dao.HealthTypeDao; |
|
|
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
import com.ccsens.util.CodeEnum; |
|
|
import com.ccsens.util.bean.dto.QueryDto; |
|
|
import com.ccsens.util.bean.dto.QueryDto; |
|
|
import com.ccsens.util.exception.BaseException; |
|
|
import com.ccsens.util.exception.BaseException; |
|
|
import com.ccsens.util.wx.WxXcxUtil; |
|
|
import com.ccsens.util.wx.WxXcxUtil; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -42,6 +41,8 @@ public class AbnormalService implements IAbnormalService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private HealthQRCodeDao healthQRCodeDao; |
|
|
private HealthQRCodeDao healthQRCodeDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
private MemberDao memberDao; |
|
|
|
|
|
@Autowired |
|
|
private HealthTypeDao healthTypeDao; |
|
|
private HealthTypeDao healthTypeDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IAsyncService asyncService; |
|
|
private IAsyncService asyncService; |
|
|
@ -66,30 +67,30 @@ public class AbnormalService implements IAbnormalService { |
|
|
abnormalOverview.setAbnormalType(1); |
|
|
abnormalOverview.setAbnormalType(1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//健康打卡
|
|
|
// //健康打卡
|
|
|
List<HealthVo.HealthTypeNumber> healthTypeNumberList = healthRecordsDao.selectHealthTypeNumber(selectAbnormal.getStartTime(), selectAbnormal.getEndTime()); |
|
|
// List<HealthVo.HealthTypeNumber> healthTypeNumberList = healthRecordsDao.selectHealthTypeNumber(selectAbnormal.getStartTime(), selectAbnormal.getEndTime());
|
|
|
int other = 0; |
|
|
// int other = 0;
|
|
|
if(CollectionUtil.isNotEmpty(healthTypeNumberList)){ |
|
|
// if(CollectionUtil.isNotEmpty(healthTypeNumberList)){
|
|
|
for(HealthVo.HealthTypeNumber healthTypeNumber : healthTypeNumberList){ |
|
|
// for(HealthVo.HealthTypeNumber healthTypeNumber : healthTypeNumberList){
|
|
|
if(healthTypeNumber.getIndependent() == 0){ |
|
|
// if(healthTypeNumber.getIndependent() == 0){
|
|
|
other += healthTypeNumber.getNumber(); |
|
|
// other += healthTypeNumber.getNumber();
|
|
|
}else { |
|
|
// }else {
|
|
|
if("发烧".equalsIgnoreCase(healthTypeNumber.getName())){ |
|
|
// if("发烧".equalsIgnoreCase(healthTypeNumber.getName())){
|
|
|
AbnormalVo.AbnormalOverview abnormalOverview = new AbnormalVo.AbnormalOverview(); |
|
|
// AbnormalVo.AbnormalOverview abnormalOverview = new AbnormalVo.AbnormalOverview();
|
|
|
abnormalOverview.setAbnormalType(0); |
|
|
// abnormalOverview.setAbnormalType(0);
|
|
|
abnormalOverview.setAbnormalName(healthTypeNumber.getName()); |
|
|
// abnormalOverview.setAbnormalName(healthTypeNumber.getName());
|
|
|
abnormalOverview.setCode(healthTypeNumber.getId()); |
|
|
// abnormalOverview.setCode(healthTypeNumber.getId());
|
|
|
abnormalOverview.setNumber(healthTypeNumber.getNumber()); |
|
|
// abnormalOverview.setNumber(healthTypeNumber.getNumber());
|
|
|
abnormalOverviewList.add(abnormalOverview); |
|
|
// abnormalOverviewList.add(abnormalOverview);
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
AbnormalVo.AbnormalOverview abnormalOverview = new AbnormalVo.AbnormalOverview(); |
|
|
// AbnormalVo.AbnormalOverview abnormalOverview = new AbnormalVo.AbnormalOverview();
|
|
|
abnormalOverview.setAbnormalType(0); |
|
|
// abnormalOverview.setAbnormalType(0);
|
|
|
abnormalOverview.setAbnormalName("其他"); |
|
|
// abnormalOverview.setAbnormalName("其他");
|
|
|
abnormalOverview.setNumber(other); |
|
|
// abnormalOverview.setNumber(other);
|
|
|
abnormalOverviewList.add(abnormalOverview); |
|
|
// abnormalOverviewList.add(abnormalOverview);
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
//行程异常
|
|
|
//行程异常
|
|
|
int journeyNumber = healthAbnormalDao.selectJourneyNumber(selectAbnormal.getDepartment(), selectAbnormal.getStartTime(), selectAbnormal.getEndTime()); |
|
|
int journeyNumber = healthAbnormalDao.selectJourneyNumber(selectAbnormal.getDepartment(), selectAbnormal.getStartTime(), selectAbnormal.getEndTime()); |
|
|
@ -98,8 +99,6 @@ public class AbnormalService implements IAbnormalService { |
|
|
abnormalOverview.setAbnormalName("出行异常"); |
|
|
abnormalOverview.setAbnormalName("出行异常"); |
|
|
abnormalOverview.setNumber(journeyNumber); |
|
|
abnormalOverview.setNumber(journeyNumber); |
|
|
abnormalOverviewList.add(abnormalOverview); |
|
|
abnormalOverviewList.add(abnormalOverview); |
|
|
//未上报
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return abnormalOverviewList; |
|
|
return abnormalOverviewList; |
|
|
} |
|
|
} |
|
|
@ -111,39 +110,52 @@ public class AbnormalService implements IAbnormalService { |
|
|
@Override |
|
|
@Override |
|
|
public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) throws Exception { |
|
|
public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params) throws Exception { |
|
|
AbnormalDto.AddAbnormal addAbnormal = params.getParam(); |
|
|
AbnormalDto.AddAbnormal addAbnormal = params.getParam(); |
|
|
|
|
|
//判断时间是否正确
|
|
|
|
|
|
if(ObjectUtil.isNotNull(addAbnormal.getEndTime()) && addAbnormal.getEndTime() <= addAbnormal.getStartTime()){ |
|
|
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
//实名认证,检查是否属于该学校的学生
|
|
|
|
|
|
MemberExample memberExample = new MemberExample(); |
|
|
|
|
|
memberExample.createCriteria().andWknoEqualTo(addAbnormal.getWkno()).andNameEqualTo(addAbnormal.getName()); |
|
|
|
|
|
List<Member> memberList = memberDao.selectByExample(memberExample); |
|
|
|
|
|
log.info("校验身份信息:{}", memberList); |
|
|
|
|
|
if (CollectionUtil.isEmpty(memberList)) { |
|
|
|
|
|
throw new BaseException(CodeEnum.FILL_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
HealthAbnormal healthAbnormal = new HealthAbnormal(); |
|
|
HealthAbnormal healthAbnormal = new HealthAbnormal(); |
|
|
healthAbnormal.setId(snowflake.nextId()); |
|
|
healthAbnormal.setId(snowflake.nextId()); |
|
|
BeanUtil.copyProperties(addAbnormal, healthAbnormal); |
|
|
BeanUtil.copyProperties(addAbnormal, healthAbnormal); |
|
|
healthAbnormal.setHealthStatus(addAbnormal.getHealthType()); |
|
|
healthAbnormal.setHealthStatus(addAbnormal.getHealthType()); |
|
|
healthAbnormalDao.insertSelective(healthAbnormal); |
|
|
healthAbnormalDao.insertSelective(healthAbnormal); |
|
|
|
|
|
|
|
|
//如果是确诊状态,检查该学生最新上报的健康信息,将二维码换成红色
|
|
|
// //如果是确诊状态,检查该学生最新上报的健康信息,将二维码换成红色
|
|
|
Future<String> future = null; |
|
|
// Future<String> future = null;
|
|
|
if (addAbnormal.getHealthType() == 4) { |
|
|
// if (addAbnormal.getHealthType() == 4) {
|
|
|
HealthRecords healthRecords = healthAbnormalDao.selectHealthRecordByWkno(addAbnormal.getWkno()); |
|
|
// HealthRecords healthRecords = healthAbnormalDao.selectHealthRecordByWkno(addAbnormal.getWkno());
|
|
|
if (ObjectUtil.isNotNull(healthAbnormal)) { |
|
|
// if (ObjectUtil.isNotNull(healthAbnormal)) {
|
|
|
if ("prod".equals(active)) { |
|
|
// if ("prod".equals(active)) {
|
|
|
WxXcxUtil.LineColor color = new WxXcxUtil.LineColor(); |
|
|
// WxXcxUtil.LineColor color = new WxXcxUtil.LineColor();
|
|
|
color.r = "226"; |
|
|
// color.r = "226";
|
|
|
color.g = "32"; |
|
|
// color.g = "32";
|
|
|
color.b = "24"; |
|
|
// color.b = "24";
|
|
|
future = asyncService.generateQRCode("d=" + healthRecords.getUserId(), color); |
|
|
// future = asyncService.generateQRCode("d=" + healthRecords.getUserId(), color);
|
|
|
log.info("调用微信生成二维码"); |
|
|
// log.info("调用微信生成二维码");
|
|
|
HealthQRCodeExample healthQRCodeExample = new HealthQRCodeExample(); |
|
|
// HealthQRCodeExample healthQRCodeExample = new HealthQRCodeExample();
|
|
|
healthQRCodeExample.createCriteria().andHealthRecordsIdEqualTo(healthRecords.getId()); |
|
|
// healthQRCodeExample.createCriteria().andHealthRecordsIdEqualTo(healthRecords.getId());
|
|
|
List<HealthQRCode> healthQRCodeList = healthQRCodeDao.selectByExample(healthQRCodeExample); |
|
|
// List<HealthQRCode> healthQRCodeList = healthQRCodeDao.selectByExample(healthQRCodeExample);
|
|
|
if(CollectionUtil.isNotEmpty(healthQRCodeList)){ |
|
|
// if(CollectionUtil.isNotEmpty(healthQRCodeList)){
|
|
|
HealthQRCode healthQRCode = healthQRCodeList.get(0); |
|
|
// HealthQRCode healthQRCode = healthQRCodeList.get(0);
|
|
|
if(future != null){ |
|
|
// if(future != null){
|
|
|
healthQRCode.setQrcodePath(future.get()); |
|
|
// healthQRCode.setQrcodePath(future.get());
|
|
|
healthQRCodeDao.updateByPrimaryKeySelective(healthQRCode); |
|
|
// healthQRCodeDao.updateByPrimaryKeySelective(healthQRCode);
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
} else { |
|
|
// } else {
|
|
|
log.info("测试环境,不调用生成二维码"); |
|
|
// log.info("测试环境,不调用生成二维码");
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
} |
|
|
// }
|
|
|
AbnormalVo.AbnormalStatisticsVo abnormalStatisticsVo = new AbnormalVo.AbnormalStatisticsVo(); |
|
|
AbnormalVo.AbnormalStatisticsVo abnormalStatisticsVo = new AbnormalVo.AbnormalStatisticsVo(); |
|
|
BeanUtil.copyProperties(healthAbnormal, abnormalStatisticsVo); |
|
|
BeanUtil.copyProperties(healthAbnormal, abnormalStatisticsVo); |
|
|
abnormalStatisticsVo.setHealthType(healthAbnormal.getHealthStatus()); |
|
|
abnormalStatisticsVo.setHealthType(healthAbnormal.getHealthStatus()); |
|
|
@ -154,14 +166,13 @@ public class AbnormalService implements IAbnormalService { |
|
|
* 异常人员统计 |
|
|
* 异常人员统计 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<AbnormalVo.AbnormalStatisticsVo> abnormalStatistics(QueryDto<AbnormalDto.AbnormalStatisticsDto> params) { |
|
|
public PageInfo<AbnormalVo.AbnormalStatisticsVo> abnormalStatistics(QueryDto<AbnormalDto.AbnormalStatisticsDto> params) { |
|
|
AbnormalDto.AbnormalStatisticsDto abnormalDto = params.getParam(); |
|
|
AbnormalDto.AbnormalStatisticsDto abnormalDto = params.getParam(); |
|
|
Integer page = abnormalDto.getPage() == null ? 1 : abnormalDto.getPage(); |
|
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(page, 10); |
|
|
PageHelper.startPage(abnormalDto.getPage(), abnormalDto.getPageSize()); |
|
|
List<AbnormalVo.AbnormalStatisticsVo> abnormalList = healthAbnormalDao.getAbnormalList(abnormalDto.getPost(), abnormalDto.getDepartment(), abnormalDto.getHealthType()); |
|
|
List<AbnormalVo.AbnormalStatisticsVo> abnormalList = healthAbnormalDao.getAbnormalList(abnormalDto.getPost(), abnormalDto.getDepartment(), abnormalDto.getHealthType()); |
|
|
|
|
|
|
|
|
return abnormalList; |
|
|
return new PageInfo<>(abnormalList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -196,9 +207,18 @@ public class AbnormalService implements IAbnormalService { |
|
|
healthAbnormal.setHealthStatus(updateAbnormal.getHealthType()); |
|
|
healthAbnormal.setHealthStatus(updateAbnormal.getHealthType()); |
|
|
} |
|
|
} |
|
|
if (ObjectUtil.isNotNull(updateAbnormal.getStartTime())) { |
|
|
if (ObjectUtil.isNotNull(updateAbnormal.getStartTime())) { |
|
|
|
|
|
//判断时间是否正确
|
|
|
|
|
|
if(ObjectUtil.isNull(updateAbnormal.getEndTime()) && ObjectUtil.isNotNull(healthAbnormal.getEndTime()) && |
|
|
|
|
|
updateAbnormal.getStartTime() >= healthAbnormal.getEndTime()){ |
|
|
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
|
|
} |
|
|
healthAbnormal.setStartTime(updateAbnormal.getStartTime()); |
|
|
healthAbnormal.setStartTime(updateAbnormal.getStartTime()); |
|
|
} |
|
|
} |
|
|
if (ObjectUtil.isNotNull(updateAbnormal.getEndTime())) { |
|
|
if (ObjectUtil.isNotNull(updateAbnormal.getEndTime())) { |
|
|
|
|
|
//判断时间是否正确
|
|
|
|
|
|
if(updateAbnormal.getEndTime() <= healthAbnormal.getStartTime()){ |
|
|
|
|
|
throw new BaseException(CodeEnum.PARAM_ERROR); |
|
|
|
|
|
} |
|
|
healthAbnormal.setEndTime(updateAbnormal.getEndTime()); |
|
|
healthAbnormal.setEndTime(updateAbnormal.getEndTime()); |
|
|
} |
|
|
} |
|
|
healthAbnormalDao.updateByPrimaryKeySelective(healthAbnormal); |
|
|
healthAbnormalDao.updateByPrimaryKeySelective(healthAbnormal); |
|
|
|