修复大屏体检异常统计bug

This commit is contained in:
wanghao
2025-08-20 13:33:06 +08:00
parent a035d3f47e
commit 59ade8db2b
@@ -76,8 +76,8 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
List<LargeScreenMap> maps = new ArrayList<>(); List<LargeScreenMap> maps = new ArrayList<>();
if (StrUtil.isEmpty(type) || type.equals("1")) { if (StrUtil.isEmpty(type) || type.equals("1")) {
List<Resource> list = resourceService.list(new LambdaQueryWrapper<Resource>() List<Resource> list = resourceService.list(new LambdaQueryWrapper<Resource>()
.eq(StrUtil.isNotEmpty(type),Resource::getType, type) .eq(StrUtil.isNotEmpty(type), Resource::getType, type)
.eq(StrUtil.isEmpty(type),Resource::getType, "1")); .eq(StrUtil.isEmpty(type), Resource::getType, "1"));
maps.addAll(list.stream().map(LargeScreenMap::new).collect(Collectors.toList())); maps.addAll(list.stream().map(LargeScreenMap::new).collect(Collectors.toList()));
} }
if (StrUtil.isEmpty(type) || type.equals("2")) { if (StrUtil.isEmpty(type) || type.equals("2")) {
@@ -86,18 +86,18 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
} }
if (StrUtil.isEmpty(type) || type.equals("5")) { if (StrUtil.isEmpty(type) || type.equals("5")) {
List<Resource> list = resourceService.list(new LambdaQueryWrapper<Resource>() List<Resource> list = resourceService.list(new LambdaQueryWrapper<Resource>()
.eq(StrUtil.isNotEmpty(type),Resource::getType, type) .eq(StrUtil.isNotEmpty(type), Resource::getType, type)
.eq(StrUtil.isEmpty(type),Resource::getType, "5")); .eq(StrUtil.isEmpty(type), Resource::getType, "5"));
maps.addAll(list.stream().map(LargeScreenMap::new).collect(Collectors.toList())); maps.addAll(list.stream().map(LargeScreenMap::new).collect(Collectors.toList()));
} }
return maps; return maps;
} }
@Override @Override
public List<HealthRoomBaseVO> healthRoomBase(HealthRoomBaseDTO dto){ public List<HealthRoomBaseVO> healthRoomBase(HealthRoomBaseDTO dto) {
List<HealthRoomBaseVO> list = new ArrayList<>(); List<HealthRoomBaseVO> list = new ArrayList<>();
List<Resource> resources = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getType, 3) List<Resource> resources = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getType, 3)
.between(ObjUtil.isNotEmpty(dto.getCheckInDateBegin()),Resource::getCreateTime,dto.getCheckInDateBegin(),dto.getCheckInDateEnd())); .between(ObjUtil.isNotEmpty(dto.getCheckInDateBegin()), Resource::getCreateTime, dto.getCheckInDateBegin(), dto.getCheckInDateEnd()));
for (Resource resource : resources) { for (Resource resource : resources) {
HealthRoomBaseVO baseVO = new HealthRoomBaseVO(); HealthRoomBaseVO baseVO = new HealthRoomBaseVO();
baseVO.setId(resource.getId()); baseVO.setId(resource.getId());
@@ -112,15 +112,15 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
} }
@Override @Override
public IPage<HealthRoomVO> healthRoomDetail(HealthRoomDTO dto){ public IPage<HealthRoomVO> healthRoomDetail(HealthRoomDTO dto) {
IPage<HealthPlaceHomDetailsVO> detailsIPage; IPage<HealthPlaceHomDetailsVO> detailsIPage;
try { try {
detailsIPage = anYanClient.healthPlaceHomDetailList(dto); detailsIPage = anYanClient.healthPlaceHomDetailList(dto);
if (ObjUtil.isEmpty(detailsIPage.getRecords())) { if (ObjUtil.isEmpty(detailsIPage.getRecords())) {
return new Page<>(); return new Page<>();
} }
}catch (Exception e){ } catch (Exception e) {
log.error("调用安眼API失败",e); log.error("调用安眼API失败", e);
throw new RuntimeException("调用安眼API失败"); throw new RuntimeException("调用安眼API失败");
} }
IPage<HealthRoomVO> page = new Page<>(); IPage<HealthRoomVO> page = new Page<>();
@@ -131,100 +131,100 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
} }
@Override @Override
public IPage<MedicalAbnormalVO> medicalAbnormal (MedicalAbnormalDTO dto){ public IPage<MedicalAbnormalVO> medicalAbnormal(MedicalAbnormalDTO dto) {
IPage<MedicalAbnormalVO> page; IPage<MedicalAbnormalVO> page;
try { try {
page = anYanClient.medicalAbnormalList(dto); page = anYanClient.medicalAbnormalList(dto);
if (ObjUtil.isEmpty(page.getRecords())) { if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>(); return new Page<>();
} }
}catch (Exception e){ } catch (Exception e) {
log.error("调用安眼API失败",e); log.error("调用安眼API失败", e);
throw new RuntimeException("调用安眼API失败"); throw new RuntimeException("调用安眼API失败");
} }
return page; return page;
} }
@Override @Override
public IPage<WeightPressureList> healthWeightLoss (HealthSignListParam dto){ public IPage<WeightPressureList> healthWeightLoss(HealthSignListParam dto) {
IPage<WeightPressureList> page; IPage<WeightPressureList> page;
try { try {
page = anYanClient.weightPressureList(dto); page = anYanClient.weightPressureList(dto);
if (ObjUtil.isEmpty(page.getRecords())) { if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>(); return new Page<>();
} }
}catch (Exception e){ } catch (Exception e) {
log.error("调用安眼API失败",e); log.error("调用安眼API失败", e);
throw new RuntimeException("调用安眼API失败"); throw new RuntimeException("调用安眼API失败");
} }
return page; return page;
} }
@Override @Override
public IPage<BloodSugarClockSList> healthBloodSugar (HealthSignListParam dto){ public IPage<BloodSugarClockSList> healthBloodSugar(HealthSignListParam dto) {
IPage<BloodSugarClockSList> page; IPage<BloodSugarClockSList> page;
try { try {
page = anYanClient.bloodSugarClockSList(dto); page = anYanClient.bloodSugarClockSList(dto);
if (ObjUtil.isEmpty(page.getRecords())) { if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>(); return new Page<>();
} }
}catch (Exception e){ } catch (Exception e) {
log.error("调用安眼API失败",e); log.error("调用安眼API失败", e);
throw new RuntimeException("调用安眼API失败"); throw new RuntimeException("调用安眼API失败");
} }
return page; return page;
} }
@Override @Override
public IPage<BloodPressureList> healthBloodPressure (HealthSignListParam dto){ public IPage<BloodPressureList> healthBloodPressure(HealthSignListParam dto) {
IPage<BloodPressureList> page; IPage<BloodPressureList> page;
try { try {
page = anYanClient.bloodPressureList(dto); page = anYanClient.bloodPressureList(dto);
if (ObjUtil.isEmpty(page.getRecords())) { if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>(); return new Page<>();
} }
}catch (Exception e){ } catch (Exception e) {
log.error("调用安眼API失败",e); log.error("调用安眼API失败", e);
throw new RuntimeException("调用安眼API失败"); throw new RuntimeException("调用安眼API失败");
} }
return page; return page;
} }
@Override @Override
public List<HospitalVO> hospital(){ public List<HospitalVO> hospital() {
List<HospitalVO> list = new ArrayList<>(); List<HospitalVO> list = new ArrayList<>();
List<Resource> resources = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getType, 1)); List<Resource> resources = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getType, 1));
if(CollUtil.isEmpty(resources)) { if (CollUtil.isEmpty(resources)) {
return list; return list;
} }
return resources.stream().map(HospitalVO::new).collect(Collectors.toList()); return resources.stream().map(HospitalVO::new).collect(Collectors.toList());
} }
@Override @Override
public List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatistics (MedicalPeopleNumStatisticsDTO dto){ public List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatistics(MedicalPeopleNumStatisticsDTO dto) {
List<MedicalPeopleNumStatisticsVO> list = redisClientUtil.getList(MEDICAL, List<MedicalPeopleNumStatisticsVO> list = redisClientUtil.getList(MEDICAL,
MEDICAL_PEOPLE_NUM_STATISTICS+":"+dto.getMedicalYear()+":"+dto.getCenterId(),MedicalPeopleNumStatisticsVO.class); MEDICAL_PEOPLE_NUM_STATISTICS + ":" + dto.getMedicalYear() + ":" + dto.getCenterId(), MedicalPeopleNumStatisticsVO.class);
// 获取假数据 // 获取假数据
List<MedicalDataVO> medicalDataList = screenDataService.medicalDataDetail(dto.getCenterId()); List<MedicalDataVO> medicalDataList = screenDataService.medicalDataDetail(dto.getCenterId());
if (CollUtil.isEmpty(list)){ if (CollUtil.isEmpty(list)) {
list = new ArrayList<>(); list = new ArrayList<>();
for (MedicalDataVO medicalData : medicalDataList) { for (MedicalDataVO medicalData : medicalDataList) {
if ("1".equals(medicalData.getStatus())){ if ("1".equals(medicalData.getStatus())) {
MedicalPeopleNumStatisticsVO vo = new MedicalPeopleNumStatisticsVO(); MedicalPeopleNumStatisticsVO vo = new MedicalPeopleNumStatisticsVO();
vo.setHospitalName(medicalData.getName()); vo.setHospitalName(medicalData.getName());
vo.setCheckedCount(Integer.valueOf(medicalData.getCount())); vo.setCheckedCount(Integer.valueOf(medicalData.getCount()));
list.add(vo); list.add(vo);
} }
} }
}else { } else {
for (MedicalPeopleNumStatisticsVO statistics : list) { for (MedicalPeopleNumStatisticsVO statistics : list) {
MedicalDataVO medicalData = medicalDataList.stream().filter(item -> item.getName().equals(statistics.getHospitalName())).findFirst().orElse(null); MedicalDataVO medicalData = medicalDataList.stream().filter(item -> item.getName().equals(statistics.getHospitalName())).findFirst().orElse(null);
if (null != medicalData){ if (null != medicalData) {
if ("1".equals(medicalData.getStatus())){ if ("1".equals(medicalData.getStatus())) {
if (medicalData.getCount().contains("+")){ if (medicalData.getCount().contains("+")) {
statistics.setCheckedCount(statistics.getCheckedCount()+Integer.parseInt(medicalData.getCount().replace("+", "").trim())); statistics.setCheckedCount(statistics.getCheckedCount() + Integer.parseInt(medicalData.getCount().replace("+", "").trim()));
}else { } else {
statistics.setCheckedCount(Integer.parseInt(medicalData.getCount().replace("+", "").trim())); statistics.setCheckedCount(Integer.parseInt(medicalData.getCount().replace("+", "").trim()));
} }
} }
@@ -235,54 +235,57 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
} }
@Override @Override
public MedicalAbnormalStatisticsVO medicalAbnormalStatistics (MedicalAbnormalStatisticsDTO dto){ public MedicalAbnormalStatisticsVO medicalAbnormalStatistics(MedicalAbnormalStatisticsDTO dto) {
if (dto.getMedicalYear().isEmpty()) {
dto.setMedicalYear(String.valueOf(DateUtil.thisYear()));
}
MedicalAbnormalStatisticsVO statisticsVO = redisClientUtil.get(MEDICAL, MedicalAbnormalStatisticsVO statisticsVO = redisClientUtil.get(MEDICAL,
MEDICAL_ABNORMAL_STATISTICS+":"+dto.getMedicalYear()+":"+dto.getCenterId(),MedicalAbnormalStatisticsVO.class); MEDICAL_ABNORMAL_STATISTICS + ":" + dto.getMedicalYear() + ":" + dto.getCenterId(), MedicalAbnormalStatisticsVO.class);
// 获取假数据 // 获取假数据
DataDetailVO dataDetailVO = screenDataService.dataDetail(dto.getCenterId(), "34"); DataDetailVO dataDetailVO = screenDataService.dataDetail(dto.getCenterId(), "34");
if (ObjUtil.isEmpty(statisticsVO)){ if (ObjUtil.isEmpty(statisticsVO)) {
statisticsVO = new MedicalAbnormalStatisticsVO(); statisticsVO = new MedicalAbnormalStatisticsVO();
if (null != dataDetailVO){ if (null != dataDetailVO) {
if ("1".equals(dataDetailVO.getTotalCountStatus())){ if ("1".equals(dataDetailVO.getTotalCountStatus())) {
statisticsVO.setTotalCount(Integer.valueOf(dataDetailVO.getTotalCount().replace("+", "").trim())); statisticsVO.setTotalCount(Integer.valueOf(dataDetailVO.getTotalCount().replace("+", "").trim()));
} }
if ("1".equals(dataDetailVO.getCardiovaAbCountStatus())){ if ("1".equals(dataDetailVO.getCardiovaAbCountStatus())) {
statisticsVO.setCardiovaAbCount(Integer.valueOf(dataDetailVO.getCardiovaAbCount().replace("+", "").trim())); statisticsVO.setCardiovaAbCount(Integer.valueOf(dataDetailVO.getCardiovaAbCount().replace("+", "").trim()));
} }
if ("1".equals(dataDetailVO.getCerebrovAbCountStatus())){ if ("1".equals(dataDetailVO.getCerebrovAbCountStatus())) {
statisticsVO.setCerebrovAbCount(Integer.valueOf(dataDetailVO.getCerebrovAbCount().replace("+", "").trim())); statisticsVO.setCerebrovAbCount(Integer.valueOf(dataDetailVO.getCerebrovAbCount().replace("+", "").trim()));
} }
if ("1".equals(dataDetailVO.getCctaAbCountStatus())){ if ("1".equals(dataDetailVO.getCctaAbCountStatus())) {
statisticsVO.setCctaAbCount(Integer.valueOf(dataDetailVO.getCctaAbCount().replace("+", "").trim())); statisticsVO.setCctaAbCount(Integer.valueOf(dataDetailVO.getCctaAbCount().replace("+", "").trim()));
} }
} }
}else { } else {
if (null != dataDetailVO){ if (null != dataDetailVO) {
if ("1".equals(dataDetailVO.getTotalCountStatus())){ if ("1".equals(dataDetailVO.getTotalCountStatus())) {
if (dataDetailVO.getTotalCount().contains("+")){ if (dataDetailVO.getTotalCount().contains("+")) {
statisticsVO.setTotalCount(statisticsVO.getTotalCount() + Integer.parseInt(dataDetailVO.getTotalCount().replace("+", "").trim())); statisticsVO.setTotalCount(statisticsVO.getTotalCount() + Integer.parseInt(dataDetailVO.getTotalCount().replace("+", "").trim()));
}else { } else {
statisticsVO.setTotalCount(Integer.valueOf(dataDetailVO.getTotalCount().replace("+", "").trim())); statisticsVO.setTotalCount(Integer.valueOf(dataDetailVO.getTotalCount().replace("+", "").trim()));
} }
} }
if ("1".equals(dataDetailVO.getCardiovaAbCountStatus())){ if ("1".equals(dataDetailVO.getCardiovaAbCountStatus())) {
if (dataDetailVO.getCardiovaAbCount().contains("+")){ if (dataDetailVO.getCardiovaAbCount().contains("+")) {
statisticsVO.setCardiovaAbCount(statisticsVO.getCardiovaAbCount() + Integer.parseInt(dataDetailVO.getCardiovaAbCount().replace("+", "").trim())); statisticsVO.setCardiovaAbCount(statisticsVO.getCardiovaAbCount() + Integer.parseInt(dataDetailVO.getCardiovaAbCount().replace("+", "").trim()));
}else { } else {
statisticsVO.setCardiovaAbCount(Integer.valueOf(dataDetailVO.getCardiovaAbCount().replace("+", "").trim())); statisticsVO.setCardiovaAbCount(Integer.valueOf(dataDetailVO.getCardiovaAbCount().replace("+", "").trim()));
} }
} }
if ("1".equals(dataDetailVO.getCerebrovAbCountStatus())){ if ("1".equals(dataDetailVO.getCerebrovAbCountStatus())) {
if (dataDetailVO.getCerebrovAbCount().contains("+")){ if (dataDetailVO.getCerebrovAbCount().contains("+")) {
statisticsVO.setCerebrovAbCount(statisticsVO.getCerebrovAbCount() + Integer.parseInt(dataDetailVO.getCerebrovAbCount().replace("+", "").trim())); statisticsVO.setCerebrovAbCount(statisticsVO.getCerebrovAbCount() + Integer.parseInt(dataDetailVO.getCerebrovAbCount().replace("+", "").trim()));
}else { } else {
statisticsVO.setCerebrovAbCount(Integer.valueOf(dataDetailVO.getCerebrovAbCount().replace("+", "").trim())); statisticsVO.setCerebrovAbCount(Integer.valueOf(dataDetailVO.getCerebrovAbCount().replace("+", "").trim()));
} }
} }
if ("1".equals(dataDetailVO.getCctaAbCountStatus())){ if ("1".equals(dataDetailVO.getCctaAbCountStatus())) {
if (dataDetailVO.getCctaAbCount().contains("+")){ if (dataDetailVO.getCctaAbCount().contains("+")) {
statisticsVO.setCctaAbCount(statisticsVO.getCctaAbCount() + Integer.parseInt(dataDetailVO.getCctaAbCount().replace("+", "").trim())); statisticsVO.setCctaAbCount(statisticsVO.getCctaAbCount() + Integer.parseInt(dataDetailVO.getCctaAbCount().replace("+", "").trim()));
}else { } else {
statisticsVO.setCctaAbCount(Integer.valueOf(dataDetailVO.getCctaAbCount().replace("+", "").trim())); statisticsVO.setCctaAbCount(Integer.valueOf(dataDetailVO.getCctaAbCount().replace("+", "").trim()));
} }
} }
@@ -297,7 +300,7 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
public HealthSignVO healthSign(HealthSignDTO dto) { public HealthSignVO healthSign(HealthSignDTO dto) {
// 健康打卡数据 // 健康打卡数据
HealthSignVO vo = redisClientUtil.get(MEDICAL, HealthSignVO vo = redisClientUtil.get(MEDICAL,
HEALTH_SIGN+":"+dto.getCenterId(), HealthSignVO.class); HEALTH_SIGN + ":" + dto.getCenterId(), HealthSignVO.class);
// 获取数据 // 获取数据
DataDetailVO dataDetailVO = screenDataService.dataDetail(dto.getCenterId(), "33"); DataDetailVO dataDetailVO = screenDataService.dataDetail(dto.getCenterId(), "33");
@@ -389,21 +392,21 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
} }
@Override @Override
public void runJob(){ public void runJob() {
// 查询默认应急中心 // 查询默认应急中心
EmergencyCenter defaultCenter = centerService.getOne(new LambdaQueryWrapper<EmergencyCenter>().eq(EmergencyCenter::getDefaultCenter, true), false); EmergencyCenter defaultCenter = centerService.getOne(new LambdaQueryWrapper<EmergencyCenter>().eq(EmergencyCenter::getDefaultCenter, true), false);
if (ObjUtil.isEmpty(defaultCenter)){ if (ObjUtil.isEmpty(defaultCenter)) {
return; return;
} }
Date today = new Date(); Date today = new Date();
if (anYanProperties.isEnable()){ if (anYanProperties.isEnable()) {
// 体检人数统计查询 // 体检人数统计查询
List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = anYanClient.examinationStatistics(DateUtil.thisYear()); List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = anYanClient.examinationStatistics(DateUtil.thisYear());
redisClientUtil.set(MEDICAL,MEDICAL_PEOPLE_NUM_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalPeopleNumStatisticsVOS); redisClientUtil.set(MEDICAL, MEDICAL_PEOPLE_NUM_STATISTICS + ":" + DateUtil.thisYear() + ":" + defaultCenter.getId(), medicalPeopleNumStatisticsVOS);
// 体检异常数据查询 // 体检异常数据查询
MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = anYanClient.medicalAbnormalStatistics(DateUtil.thisYear()); MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = anYanClient.medicalAbnormalStatistics(DateUtil.thisYear());
redisClientUtil.set(MEDICAL,MEDICAL_ABNORMAL_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalAbnormalStatisticsVO); redisClientUtil.set(MEDICAL, MEDICAL_ABNORMAL_STATISTICS + ":" + DateUtil.thisYear() + ":" + defaultCenter.getId(), medicalAbnormalStatisticsVO);
// 健康打卡今日数据查询 // 健康打卡今日数据查询
HealthSignStatVO healthSignToday = anYanClient.healthCheckStatistics(DateUtil.beginOfDay(today), DateUtil.endOfDay(today)); HealthSignStatVO healthSignToday = anYanClient.healthCheckStatistics(DateUtil.beginOfDay(today), DateUtil.endOfDay(today));
@@ -426,13 +429,13 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
healthSign.setBloodSugarCountMonth(Integer.valueOf(healthSignMonth.getBpTotalCount())); healthSign.setBloodSugarCountMonth(Integer.valueOf(healthSignMonth.getBpTotalCount()));
healthSign.setBloodSugarAbnormalCountMonth(Integer.valueOf(healthSignMonth.getBpAbCount())); healthSign.setBloodSugarAbnormalCountMonth(Integer.valueOf(healthSignMonth.getBpAbCount()));
redisClientUtil.set(MEDICAL,HEALTH_SIGN+defaultCenter.getId(),healthSign); redisClientUtil.set(MEDICAL, HEALTH_SIGN + defaultCenter.getId(), healthSign);
}else { } else {
randomData(defaultCenter); randomData(defaultCenter);
} }
} }
private void randomData(EmergencyCenter defaultCenter){ private void randomData(EmergencyCenter defaultCenter) {
List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = new ArrayList<>(); List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = new ArrayList<>();
Random random = new Random(); Random random = new Random();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@@ -443,14 +446,14 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
vo.setCheckedCount(randomCount); vo.setCheckedCount(randomCount);
medicalPeopleNumStatisticsVOS.add(vo); medicalPeopleNumStatisticsVOS.add(vo);
} }
redisClientUtil.set(MEDICAL,MEDICAL_PEOPLE_NUM_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalPeopleNumStatisticsVOS); redisClientUtil.set(MEDICAL, MEDICAL_PEOPLE_NUM_STATISTICS + ":" + DateUtil.thisYear() + ":" + defaultCenter.getId(), medicalPeopleNumStatisticsVOS);
// 体检异常数据查询 // 体检异常数据查询
MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = new MedicalAbnormalStatisticsVO(); MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = new MedicalAbnormalStatisticsVO();
medicalAbnormalStatisticsVO.setTotalCount(100); medicalAbnormalStatisticsVO.setTotalCount(100);
medicalAbnormalStatisticsVO.setCardiovaAbCount(50); medicalAbnormalStatisticsVO.setCardiovaAbCount(50);
medicalAbnormalStatisticsVO.setCerebrovAbCount(50); medicalAbnormalStatisticsVO.setCerebrovAbCount(50);
redisClientUtil.set(MEDICAL,MEDICAL_ABNORMAL_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalAbnormalStatisticsVO); redisClientUtil.set(MEDICAL, MEDICAL_ABNORMAL_STATISTICS + ":" + DateUtil.thisYear() + ":" + defaultCenter.getId(), medicalAbnormalStatisticsVO);
// 减重 血压 血糖 三种数据整合存 // 减重 血压 血糖 三种数据整合存
HealthSignVO healthSign = new HealthSignVO(); HealthSignVO healthSign = new HealthSignVO();
healthSign.setWeightLossCountDay(random.nextInt(100) + 1); healthSign.setWeightLossCountDay(random.nextInt(100) + 1);
@@ -466,23 +469,23 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
healthSign.setBloodPressureAbnormalCountMonth(random.nextInt(100) + 1); healthSign.setBloodPressureAbnormalCountMonth(random.nextInt(100) + 1);
healthSign.setBloodSugarCountMonth(random.nextInt(100) + 1); healthSign.setBloodSugarCountMonth(random.nextInt(100) + 1);
healthSign.setBloodSugarAbnormalCountMonth(random.nextInt(100) + 1); healthSign.setBloodSugarAbnormalCountMonth(random.nextInt(100) + 1);
redisClientUtil.set(MEDICAL,HEALTH_SIGN+defaultCenter.getId(),healthSign); redisClientUtil.set(MEDICAL, HEALTH_SIGN + defaultCenter.getId(), healthSign);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void syncAnYanHospital() { public void syncAnYanHospital() {
//PS: 重要说明, 目前该同步逻辑只会向emergency_resource表中新增数据或者编辑已经存在的数据, 不会将历史存在且本次同步不存在的数据删除,若需要删除在此处理 //PS: 重要说明, 目前该同步逻辑只会向emergency_resource表中新增数据或者编辑已经存在的数据, 不会将历史存在且本次同步不存在的数据删除,若需要删除在此处理
if(anYanProperties.isEnable()){ if (anYanProperties.isEnable()) {
//更新医院信息 //更新医院信息
List<HospitalListVO> hospitalListVOList = anYanClient.hospitalList(); List<HospitalListVO> hospitalListVOList = anYanClient.hospitalList();
if(ObjectUtil.isEmpty(hospitalListVOList)){ if (ObjectUtil.isEmpty(hospitalListVOList)) {
LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Resource::getType,"1"); wrapper.eq(Resource::getType, "1");
wrapper.in(Resource::getId,hospitalListVOList.stream().map(HospitalListVO::getId).collect(Collectors.toList())); wrapper.in(Resource::getId, hospitalListVOList.stream().map(HospitalListVO::getId).collect(Collectors.toList()));
List<Resource> hospitalList = resourceService.list(wrapper); List<Resource> hospitalList = resourceService.list(wrapper);
List<Resource> saveOrUpdateBatchList = new ArrayList<>(); List<Resource> saveOrUpdateBatchList = new ArrayList<>();
for(HospitalListVO hospital : hospitalListVOList){ for (HospitalListVO hospital : hospitalListVOList) {
Resource resource = hospitalList.stream().filter(re -> hospital.getId().equals(re.getId())).findFirst().orElse(new Resource()); Resource resource = hospitalList.stream().filter(re -> hospital.getId().equals(re.getId())).findFirst().orElse(new Resource());
resource.setAddress(hospital.getAddress()); resource.setAddress(hospital.getAddress());
resource.setMemo(hospital.getAlias()); //医院别名使用备注字段 resource.setMemo(hospital.getAlias()); //医院别名使用备注字段
@@ -498,13 +501,13 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
} }
//更新健康小屋信息 //更新健康小屋信息
List<HealthRoomBaseVO> healthRoomVOList = anYanClient.healthPlaceHomList(); List<HealthRoomBaseVO> healthRoomVOList = anYanClient.healthPlaceHomList();
if(ObjectUtil.isEmpty(healthRoomVOList)){ if (ObjectUtil.isEmpty(healthRoomVOList)) {
List<Resource> saveOrUpdateBatchList = new ArrayList<>(); List<Resource> saveOrUpdateBatchList = new ArrayList<>();
LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Resource> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Resource::getType,"2"); wrapper.eq(Resource::getType, "2");
wrapper.in(Resource::getId,healthRoomVOList.stream().map(HealthRoomBaseVO::getId).collect(Collectors.toList())); wrapper.in(Resource::getId, healthRoomVOList.stream().map(HealthRoomBaseVO::getId).collect(Collectors.toList()));
List<Resource> roomList = resourceService.list(wrapper); List<Resource> roomList = resourceService.list(wrapper);
for(HealthRoomBaseVO room : healthRoomVOList){ for (HealthRoomBaseVO room : healthRoomVOList) {
Resource resource = roomList.stream().filter(re -> room.getId().equals(re.getId())).findFirst().orElse(new Resource()); Resource resource = roomList.stream().filter(re -> room.getId().equals(re.getId())).findFirst().orElse(new Resource());
resource.setAddress(room.getAddress()); resource.setAddress(room.getAddress());
resource.setCreateTime(DateUtil.parseDate(room.getBuildDate())); resource.setCreateTime(DateUtil.parseDate(room.getBuildDate()));