大屏改动

This commit is contained in:
wanghao
2025-08-13 10:34:55 +08:00
parent b327524823
commit 23c53a782c
16 changed files with 336 additions and 448 deletions
@@ -1,11 +1,13 @@
package com.renkang.emergency.largeScreen.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.anyan.model.vo.MedicalAbnormalStatisticsVO;
import com.renkang.anyan.model.dto.HealthRoomDTO;
import com.renkang.anyan.model.dto.HealthSignListParam;
import com.renkang.anyan.model.dto.MedicalAbnormalDTO;
import com.renkang.anyan.model.vo.*;
import com.renkang.anyan.model.vo.HealthRoomBaseVO;
import com.renkang.anyan.model.vo.MedicalAbnormalVO;
import com.renkang.anyan.model.vo.MedicalPeopleNumStatisticsVO;
import com.renkang.anyan.model.vo.MedicalAbnormalStatisticsVO;
import com.renkang.anyan.model.vo.MedicalAbnormalVO;
import com.renkang.emergency.entity.dto.*;
import com.renkang.emergency.entity.vo.DataDetailVO;
import com.renkang.emergency.entity.vo.MedicalDataVO;
@@ -114,19 +116,19 @@ public class LargeScreenNewController {
@PostMapping("/healthWeightLoss")
@Operation(summary = "健康打卡减重详情列表", description = "健康打卡减重详情列表")
public Result<IPage<HealthWeightLossVO>> healthWeightLoss(@RequestBody HealthWeightLossDTO dto){
public Result<IPage<WeightPressureList>> healthWeightLoss(@RequestBody HealthSignListParam dto){
return Result.ok(largeScreenService.healthWeightLoss(dto));
}
@PostMapping("/healthBloodSugar")
@Operation(summary = "健康打卡血糖详情列表", description = "健康打卡血糖详情列表")
public Result<IPage<HealthBloodSugarVO>> healthBloodSugar(@RequestBody HealthBloodSugarDTO dto){
public Result<IPage<BloodSugarClockSList>> healthBloodSugar(@RequestBody HealthSignListParam dto){
return Result.ok(largeScreenService.healthBloodSugar(dto));
}
@PostMapping("/healthBloodPressure")
@Operation(summary = "健康打卡血压详情列表", description = "健康打卡血压详情列表")
public Result<IPage<HealthBloodPressureVO>> healthBloodPressure(@RequestBody HealthBloodPressureDTO dto){
public Result<IPage<BloodPressureList>> healthBloodPressure(@RequestBody HealthSignListParam dto){
return Result.ok(largeScreenService.healthBloodPressure(dto));
}
@@ -157,7 +159,7 @@ public class LargeScreenNewController {
@GetMapping("runTest")
@Operation(summary = "初始化假数据", description = "初始化假数据")
public void runTest(){
largeScreenDataService.runTest();
largeScreenService.runJob();
}
/**
@@ -10,65 +10,65 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class HealthRoomDTO {
/**
* 健康小屋ID
*/
@Schema(title = "健康小屋ID")
@NotNull
private String healthRoomId;
/**
* 检查类型 11:BMI/21:收缩压/22:舒张压/31:血糖/41:低密度脂蛋白/42:总胆固醇/43:甘油三酯/51:尿酸/61:同型半胱氨酸 等等,缺失的可以继续加
*/
@Schema(title = "检查类型 11:BMI/21:收缩压/22:舒张压/31:血糖/41:低密度脂蛋白/42:总胆固醇/43:甘油三酯/51:尿酸/61:同型半胱氨酸 等等,缺失的可以继续加")
@Dict(dicCode = "xj_check_type")
private String checkType;
/**
* 单位名称
*/
@Schema(title = "单位名称")
private String departName;
/**
* 员工姓名
*/
@Schema(title = "员工姓名")
private String name;
/**
* 检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(title = "检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01")
private Date checkInDateBegin;
/**
* 检查日期止期 参数为空时,默认为今天
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(title = "检查日期止期 参数为空时,默认为今天")
private Date checkInDateEnd;
/**
* 是否成功控降 是否成功空降,1:是/0.否
*/
@Schema(title = "是否成功控降 是否成功空降,1:是/0.否")
private String successFlag;
/**
* 页码 从1开始
*/
@Schema(title = "页码 从1开始")
private Integer pageNo;
/**
* 每页数量
*/
@Schema(title = "每页数量")
private Integer pageSize;
public HealthRoomDTO() {
Date date = new Date();
this.checkInDateBegin = DateUtil.beginOfYear(date);
this.checkInDateEnd = DateUtil.endOfDay(date);
this.pageNo = 1;
this.pageSize = 10;
}
}
//@Data
//public class HealthRoomDTO {
// /**
// * 健康小屋ID
// */
// @Schema(title = "健康小屋ID")
// @NotNull
// private String healthRoomId;
// /**
// * 检查类型 11:BMI/21:收缩压/22:舒张压/31:血糖/41:低密度脂蛋白/42:总胆固醇/43:甘油三酯/51:尿酸/61:同型半胱氨酸 等等,缺失的可以继续加
// */
// @Schema(title = "检查类型 11:BMI/21:收缩压/22:舒张压/31:血糖/41:低密度脂蛋白/42:总胆固醇/43:甘油三酯/51:尿酸/61:同型半胱氨酸 等等,缺失的可以继续加")
// @Dict(dicCode = "xj_check_type")
// private String checkType;
// /**
// * 单位名称
// */
// @Schema(title = "单位名称")
// private String departName;
// /**
// * 员工姓名
// */
// @Schema(title = "员工姓名")
// private String name;
// /**
// * 检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01
// */
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @Schema(title = "检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01")
// private Date checkInDateBegin;
// /**
// * 检查日期止期 参数为空时,默认为今天
// */
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @Schema(title = "检查日期止期 参数为空时,默认为今天")
// private Date checkInDateEnd;
// /**
// * 是否成功控降 是否成功空降,1:是/0.否
// */
// @Schema(title = "是否成功控降 是否成功空降,1:是/0.否")
// private String successFlag;
// /**
// * 页码 从1开始
// */
// @Schema(title = "页码 从1开始")
// private Integer pageNo;
// /**
// * 每页数量
// */
// @Schema(title = "每页数量")
// private Integer pageSize;
//
// public HealthRoomDTO() {
// Date date = new Date();
// this.checkInDateBegin = DateUtil.beginOfYear(date);
// this.checkInDateEnd = DateUtil.endOfDay(date);
// this.pageNo = 1;
// this.pageSize = 10;
// }
//}
@@ -9,52 +9,52 @@ import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
public class MedicalAbnormalDTO {
/**
* 单位名称
*/
private String departName;
/**
* 员工姓名
*/
private String name;
/**
* 检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(title = "检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01")
private Date checkInDateBegin;
/**
* 检查日期止期 参数为空时,默认为今天
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(title = "检查日期止期 参数为空时,默认为今天")
private Date checkInDateEnd;
/**
* 查询类型 1:心血管异常/2:脑血管异常/3:冠脉CT异常
*/
@Schema(title = "查询类型 1:心血管异常/2:脑血管异常/3:冠脉CT异常")
@NotNull
private String queryType;
/**
* 页码 从1开始
*/
@Schema(title = "页码 从1开始")
private Integer pageNo;
/**
* 每页数量
*/
@Schema(title = "每页数量")
private Integer pageSize;
public MedicalAbnormalDTO() {
Date date = new Date();
this.checkInDateBegin = DateUtil.beginOfYear(date);
this.checkInDateEnd = DateUtil.endOfDay(date);
this.pageNo = 1;
this.pageSize = 10;
}
}
//@Data
//public class MedicalAbnormalDTO {
// /**
// * 单位名称
// */
// private String departName;
// /**
// * 员工姓名
// */
// private String name;
// /**
// * 检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01
// */
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @Schema(title = "检查日期起期 参数为空时,默认为今年第一天,如:2025-01-01")
// private Date checkInDateBegin;
// /**
// * 检查日期止期 参数为空时,默认为今天
// */
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
// @DateTimeFormat(pattern = "yyyy-MM-dd")
// @Schema(title = "检查日期止期 参数为空时,默认为今天")
// private Date checkInDateEnd;
// /**
// * 查询类型 1:心血管异常/2:脑血管异常/3:冠脉CT异常
// */
// @Schema(title = "查询类型 1:心血管异常/2:脑血管异常/3:冠脉CT异常")
// @NotNull
// private String queryType;
// /**
// * 页码 从1开始
// */
// @Schema(title = "页码 从1开始")
// private Integer pageNo;
// /**
// * 每页数量
// */
// @Schema(title = "每页数量")
// private Integer pageSize;
//
// public MedicalAbnormalDTO() {
// Date date = new Date();
// this.checkInDateBegin = DateUtil.beginOfYear(date);
// this.checkInDateEnd = DateUtil.endOfDay(date);
// this.pageNo = 1;
// this.pageSize = 10;
// }
//}
@@ -11,6 +11,10 @@ import java.util.Date;
@Data
public class MedicalAbnormalStatisticsDTO {
private String centerId;
/**
* 体检年份
*/
private String medicalYear;
/**
* 检查日期起期 参数为空时,默认为今年第一天
*/
@@ -1,5 +1,6 @@
package com.renkang.emergency.largeScreen.entity.vo;
import com.renkang.anyan.model.vo.HealthPlaceHomDetailsVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
@@ -52,4 +53,19 @@ public class HealthRoomVO {
*/
@Schema(title = "是否成功空降,1:是/0.否")
private String successFlag;
public HealthRoomVO() {}
public HealthRoomVO(HealthPlaceHomDetailsVO detailsVO){
departName = detailsVO.getDepartName();
name = detailsVO.getName();
checkInDate = detailsVO.getCheckInDate();
checkType = detailsVO.getCheckType();
lastVal = detailsVO.getLastVal();
goalVal = detailsVO.getGoalVal();
currentVal = detailsVO.getCurrentVal();
compareVal = detailsVO.getCompareVal();
successFlag = detailsVO.getSuccessFlag();
}
}
@@ -1,6 +1,7 @@
package com.renkang.emergency.largeScreen.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.renkang.emergency.entity.Resource;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -9,6 +10,10 @@ import java.util.Date;
@Data
public class HospitalVO {
/**
* id
*/
private String id;
/**
* 医院名字
*/
@@ -41,4 +46,16 @@ public class HospitalVO {
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(title = "签约时间")
private Date contractDate;
public HospitalVO() {}
public HospitalVO(Resource resource){
id = resource.getId();
hospitalName = resource.getName();
alias = resource.getName();
address = resource.getAddress();
lon = resource.getLongitude().toString();
lat = resource.getLatitude().toString();
contractDate = resource.getCreateTime();
}
}
@@ -16,8 +16,6 @@ import java.util.List;
*/
public interface ILargeScreenDataService extends IService<LargeScreenData> {
void runTest();
Boolean editValue(LargeScreenDataValueDTO dto);
Boolean editData(DataDetailVO dto);
@@ -2,10 +2,12 @@ package com.renkang.emergency.largeScreen.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.renkang.anyan.model.dto.HealthRoomDTO;
import com.renkang.anyan.model.dto.HealthSignListParam;
import com.renkang.anyan.model.dto.MedicalAbnormalDTO;
import com.renkang.anyan.model.vo.*;
import com.renkang.anyan.model.vo.HealthRoomBaseVO;
import com.renkang.anyan.model.vo.MedicalAbnormalVO;
import com.renkang.anyan.model.vo.MedicalPeopleNumStatisticsVO;
import com.renkang.anyan.model.vo.MedicalAbnormalStatisticsVO;
import com.renkang.emergency.largeScreen.entity.dto.*;
import com.renkang.emergency.largeScreen.entity.vo.*;
@@ -27,11 +29,11 @@ public interface ILargeScreenService extends IService<LargeScreenMap> {
IPage<MedicalAbnormalVO> medicalAbnormal(MedicalAbnormalDTO dto);
IPage<HealthWeightLossVO> healthWeightLoss(HealthWeightLossDTO dto);
IPage<WeightPressureList> healthWeightLoss(HealthSignListParam dto);
IPage<HealthBloodSugarVO> healthBloodSugar(HealthBloodSugarDTO dto);
IPage<BloodSugarClockSList> healthBloodSugar(HealthSignListParam dto);
IPage<HealthBloodPressureVO> healthBloodPressure(HealthBloodPressureDTO dto);
IPage<BloodPressureList> healthBloodPressure(HealthSignListParam dto);
List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatistics(MedicalPeopleNumStatisticsDTO dto);
@@ -11,7 +11,9 @@ import com.renkang.emergency.entity.dto.LargeScreenDataValueDTO;
import com.renkang.emergency.entity.vo.DataDetailVO;
import com.renkang.emergency.entity.vo.MedicalDataVO;
import com.renkang.emergency.largeScreen.mapper.LargeScreenDataMapper;
import com.renkang.emergency.largeScreen.mapper.LargeScreenMapper;
import com.renkang.emergency.largeScreen.service.ILargeScreenDataService;
import com.renkang.emergency.largeScreen.service.ILargeScreenService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -31,49 +33,6 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class LargeScreenDataServiceImpl extends ServiceImpl<LargeScreenDataMapper, LargeScreenData> implements ILargeScreenDataService {
@Transactional(rollbackFor = Exception.class)
public void runTest() {
if (CollUtil.isNotEmpty(list())) {
return;
}
List<LargeScreenData> list = new ArrayList<>();
// 服务详情
LargeScreenData service1 = new LargeScreenData();
service1.setType("gross");
list.add(service1);
LargeScreenData service2 = new LargeScreenData();
service2.setType("alerdyreceive");
list.add(service2);
LargeScreenData service3 = new LargeScreenData();
service3.setType("jqqz");
list.add(service3);
LargeScreenData service4 = new LargeScreenData();
service4.setType("dbjy");
list.add(service4);
LargeScreenData service5 = new LargeScreenData();
service5.setType("totaldeal");
list.add(service5);
LargeScreenData service6 = new LargeScreenData();
service6.setType("totalacceptance");
list.add(service6);
// 主诉分类
// 体检人数
LargeScreenData medical1 = new LargeScreenData();
medical1.setType("medical");
medical1.setName("克拉玛依医院");
list.add(medical1);
// 健康打卡人数
// 体检数据
saveBatch(list);
}
public Boolean editValue(LargeScreenDataValueDTO dto) {
if (StrUtil.isEmpty(dto.getCenterId())) {
return false;
@@ -1,5 +1,6 @@
package com.renkang.emergency.largeScreen.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
@@ -10,6 +11,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.renkang.anyan.client.AnYanClient;
import com.renkang.anyan.model.dto.HealthRoomDTO;
import com.renkang.anyan.model.dto.HealthSignListParam;
import com.renkang.anyan.model.dto.MedicalAbnormalDTO;
import com.renkang.anyan.model.vo.HealthSignStatVO;
import com.renkang.anyan.model.vo.MedicalAbnormalStatisticsVO;
import com.renkang.anyan.model.vo.MedicalPeopleNumStatisticsVO;
@@ -21,6 +25,7 @@ import com.renkang.anyan.model.vo.*;
import com.renkang.emergency.bean.response.XjHealthSignFakerData;
import com.renkang.emergency.bean.response.XjMedicalCountFakerData;
import com.renkang.emergency.bean.response.XjMedicalDataFakerData;
import com.renkang.emergency.entity.EmergencyCenter;
import com.renkang.emergency.entity.EmergencyHealthRoom;
import com.renkang.emergency.entity.Resource;
import com.renkang.emergency.entity.vo.DataDetailVO;
@@ -30,6 +35,7 @@ import com.renkang.emergency.largeScreen.entity.vo.*;
import com.renkang.emergency.largeScreen.mapper.LargeScreenMapper;
import com.renkang.emergency.largeScreen.service.ILargeScreenDataService;
import com.renkang.emergency.largeScreen.service.ILargeScreenService;
import com.renkang.emergency.service.IEmergencyCenterService;
import com.renkang.emergency.service.IEmergencyHealthRoomService;
import com.renkang.emergency.service.IResourceService;
import lombok.RequiredArgsConstructor;
@@ -42,6 +48,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Supplier;
@@ -60,38 +67,14 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
private final String MEDICAL_PEOPLE_NUM_STATISTICS = "medicalPeopleNumStatistics";
private final String MEDICAL_ABNORMAL_STATISTICS = "medicalAbnormalStatistics";
private final String HEALTH_SIGN = "healthSign";
private final IEmergencyCenterService centerService;
private final IResourceService resourceService;
private final IEmergencyHealthRoomService roomService;
private final RedisClientUtil redisClientUtil;
private final RedisUtil redisUtil;
private final ILargeScreenDataService screenDataService;
private final AnYanClient anYanClient;
private final AnYanProperties anYanProperties;
private static final double MIN_LONGITUDE = 80.0;
private static final double MAX_LONGITUDE = 100.0;
private static final double MIN_LATITUDE = 35.0;
private static final double MAX_LATITUDE = 50.0;
private static final String[] CITIES = {
"乌鲁木齐", "喀什", "克拉玛依", "吐鲁番", "哈密",
"阿克苏", "巴音郭楞", "昌吉", "石河子", "博乐"
};
private static final String[] SURNAMES = {
"", "", "", "", "",
"", "", "", "", "",
"", "", "", "", "",
"", "", "", "", ""
};
private static final String[] FIRST_NAMES = {
"", "", "", "", "",
"", "", "", "", "",
"", "", "", "", "",
"", "", "", "", ""
};
@Override
public List<LargeScreenMap> map(String type) {
List<LargeScreenMap> maps = new ArrayList<>();
@@ -117,172 +100,114 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
@Override
public List<HealthRoomBaseVO> healthRoomBase(HealthRoomBaseDTO dto){
List<HealthRoomBaseVO> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
List<Resource> resources = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getType, 3)
.between(ObjUtil.isNotEmpty(dto.getCheckInDateBegin()),Resource::getCreateTime,dto.getCheckInDateBegin(),dto.getCheckInDateEnd()));
for (Resource resource : resources) {
HealthRoomBaseVO baseVO = new HealthRoomBaseVO();
baseVO.setId(UUID.randomUUID().toString());
String[] data = generateRandomLocation();
baseVO.setAddress(data[0]);
baseVO.setLon(data[1]);
baseVO.setLat(data[2]);
baseVO.setDepartName("新疆大厂的单位");
baseVO.setBuildDate(DateUtil.formatDate(new Date()));
baseVO.setId(resource.getId());
baseVO.setAddress(resource.getAddress());
baseVO.setLon(String.valueOf(resource.getLongitude()));
baseVO.setLat(String.valueOf(resource.getLatitude()));
baseVO.setDepartName(resource.getName());
baseVO.setBuildDate(String.valueOf(resource.getCreateTime()));
list.add(baseVO);
}
List<com.renkang.anyan.model.vo.HealthRoomBaseVO> healthRoomVOS = anYanClient.healthPlaceHomList();
// 查询第三方接口返回 此接口返回对象跟原有可能不太一样 要注意
return list;
}
@Override
public IPage<HealthRoomVO> healthRoomDetail(HealthRoomDTO dto){
IPage<HealthRoomVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page.setTotal(20);
List<HealthRoomVO> list = new ArrayList<>();
Map<String, String> CHECK_TYPES = new HashMap<>();
CHECK_TYPES.put("11", "BMI");
CHECK_TYPES.put("21", "收缩压");
CHECK_TYPES.put("22", "舒张压");
CHECK_TYPES.put("31", "血糖");
CHECK_TYPES.put("41", "低密度脂蛋白");
CHECK_TYPES.put("42", "总胆固醇");
CHECK_TYPES.put("43", "甘油三酯");
CHECK_TYPES.put("51", "尿酸");
CHECK_TYPES.put("61", "同型半胱氨酸");
List<String> keys = new ArrayList<>(CHECK_TYPES.keySet());
for (int i = 0; i < 10; i++) {
HealthRoomVO roomVO = new HealthRoomVO();
roomVO.setName("小屋");
roomVO.setDepartName("新疆大厂");
roomVO.setCheckInDate(DateUtil.today());
Random random = new Random();
String randomKey = keys.get(random.nextInt(keys.size()));
roomVO.setCheckType(randomKey);
roomVO.setLastVal("111");
roomVO.setGoalVal("100");
roomVO.setCurrentVal("105");
roomVO.setCompareVal("5");
roomVO.setSuccessFlag("0");
list.add(roomVO);
IPage<HealthPlaceHomDetailsVO> detailsIPage;
try {
detailsIPage = anYanClient.healthPlaceHomDetailList(dto);
if (ObjUtil.isEmpty(detailsIPage.getRecords())) {
return new Page<>();
}
}catch (Exception e){
log.error("调用安眼API失败",e);
throw new RuntimeException("调用安眼API失败");
}
page.setRecords(list);
// 查询第三方接口返回
IPage<HealthRoomVO> page = new Page<>();
BeanUtil.copyProperties(detailsIPage, page);
List<HealthPlaceHomDetailsVO> records = detailsIPage.getRecords();
page.setRecords(records.stream().map(HealthRoomVO::new).collect(Collectors.toList()));
return page;
}
@Override
public IPage<MedicalAbnormalVO> medicalAbnormal (MedicalAbnormalDTO dto){
IPage<MedicalAbnormalVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page.setTotal(20);
List<MedicalAbnormalVO> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
MedicalAbnormalVO abnormalVO = new MedicalAbnormalVO();
abnormalVO.setCheckInDate(DateUtil.today());
abnormalVO.setHospitalName("新疆医院");
abnormalVO.setDepartName("新疆大厂");
Random random = new Random();
abnormalVO.setSex(random.nextInt(2) + 1);
abnormalVO.setAge(random.nextInt(65 - 18 + 1) + 18);
abnormalVO.setName(generateRandomName());
list.add(abnormalVO);
IPage<MedicalAbnormalVO> page;
try {
page = anYanClient.medicalAbnormalList(dto);
if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>();
}
}catch (Exception e){
log.error("调用安眼API失败",e);
throw new RuntimeException("调用安眼API失败");
}
page.setRecords(list);
// 查询第三方接口返回
return page;
}
@Override
public IPage<HealthWeightLossVO> healthWeightLoss (HealthWeightLossDTO dto){
IPage<HealthWeightLossVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page.setTotal(20);
List<HealthWeightLossVO> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
HealthWeightLossVO weightLossVO = new HealthWeightLossVO();
weightLossVO.setName(generateRandomName());
weightLossVO.setWeight("80");
weightLossVO.setDepartName("新疆大厂");
weightLossVO.setBmi("26.8");
weightLossVO.setWaist("80");
weightLossVO.setHeight("180");
weightLossVO.setBmiFlag("0");
weightLossVO.setInputDate(new Date());
Random random = new Random();
weightLossVO.setSex(random.nextInt(2) + 1);
weightLossVO.setAge(random.nextInt(65 - 18 + 1) + 18);
list.add(weightLossVO);
public IPage<WeightPressureList> healthWeightLoss (HealthSignListParam dto){
IPage<WeightPressureList> page;
try {
page = anYanClient.weightPressureList(dto);
if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>();
}
}catch (Exception e){
log.error("调用安眼API失败",e);
throw new RuntimeException("调用安眼API失败");
}
page.setRecords(list);
// 查询第三方接口返回
return page;
}
@Override
public IPage<HealthBloodSugarVO> healthBloodSugar (HealthBloodSugarDTO dto){
IPage<HealthBloodSugarVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page.setTotal(20);
List<HealthBloodSugarVO> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
HealthBloodSugarVO bloodSugarVO = new HealthBloodSugarVO();
bloodSugarVO.setName(generateRandomName());
bloodSugarVO.setDepartName("新疆大厂");
bloodSugarVO.setBmiFlag("0");
bloodSugarVO.setInputDate(new Date());
bloodSugarVO.setBsVal("100");
bloodSugarVO.setWaist("88");
Random random = new Random();
bloodSugarVO.setSex(random.nextInt(2) + 1);
bloodSugarVO.setAge(random.nextInt(65 - 18 + 1) + 18);
list.add(bloodSugarVO);
public IPage<BloodSugarClockSList> healthBloodSugar (HealthSignListParam dto){
IPage<BloodSugarClockSList> page;
try {
page = anYanClient.bloodSugarClockSList(dto);
if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>();
}
}catch (Exception e){
log.error("调用安眼API失败",e);
throw new RuntimeException("调用安眼API失败");
}
page.setRecords(list);
// 查询第三方接口返回
return page;
}
@Override
public IPage<HealthBloodPressureVO> healthBloodPressure (HealthBloodPressureDTO dto){
IPage<HealthBloodPressureVO> page = new Page<>(dto.getPageNo(), dto.getPageSize());
page.setTotal(20);
List<HealthBloodPressureVO> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
HealthBloodPressureVO bloodPressureVO = new HealthBloodPressureVO();
bloodPressureVO.setName(generateRandomName());
bloodPressureVO.setDepartName("新疆大厂");
bloodPressureVO.setInputDate(new Date());
bloodPressureVO.setDbp("25");
bloodPressureVO.setDbpFlag("0");
bloodPressureVO.setSbp("15");
bloodPressureVO.setSbpFlag("0");
Random random = new Random();
bloodPressureVO.setSex(random.nextInt(2) + 1);
bloodPressureVO.setAge(random.nextInt(65 - 18 + 1) + 18);
list.add(bloodPressureVO);
public IPage<BloodPressureList> healthBloodPressure (HealthSignListParam dto){
IPage<BloodPressureList> page;
try {
page = anYanClient.bloodPressureList(dto);
if (ObjUtil.isEmpty(page.getRecords())) {
return new Page<>();
}
}catch (Exception e){
log.error("调用安眼API失败",e);
throw new RuntimeException("调用安眼API失败");
}
page.setRecords(list);
// 查询第三方接口返回
return page;
}
@Override
public List<HospitalVO> hospital(){
List<HospitalVO> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
HospitalVO hospitalVO = new HospitalVO();
hospitalVO.setHospitalName("新疆医院");
String[] data = generateRandomLocation();
hospitalVO.setAddress(data[0]);
hospitalVO.setAlias(""+i);
hospitalVO.setContractDate(new Date());
hospitalVO.setLon(data[1]);
hospitalVO.setLat(data[2]);
list.add(hospitalVO);
List<Resource> resources = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getType, 1));
if(CollUtil.isEmpty(resources)) {
return list;
}
return list;
return resources.stream().map(HospitalVO::new).collect(Collectors.toList());
}
@Override
public List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatistics (MedicalPeopleNumStatisticsDTO dto){
List<MedicalPeopleNumStatisticsVO> list = redisClientUtil.getList(MEDICAL,MEDICAL_PEOPLE_NUM_STATISTICS,MedicalPeopleNumStatisticsVO.class);
List<MedicalPeopleNumStatisticsVO> list = redisClientUtil.getList(MEDICAL,
MEDICAL_PEOPLE_NUM_STATISTICS+":"+dto.getMedicalYear()+":"+dto.getCenterId(),MedicalPeopleNumStatisticsVO.class);
// 获取假数据
List<MedicalDataVO> medicalDataList = screenDataService.medicalDataDetail(dto.getCenterId());
@@ -315,23 +240,24 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
@Override
public MedicalAbnormalStatisticsVO medicalAbnormalStatistics (MedicalAbnormalStatisticsDTO dto){
MedicalAbnormalStatisticsVO statisticsVO = redisClientUtil.get(MEDICAL,MEDICAL_ABNORMAL_STATISTICS,MedicalAbnormalStatisticsVO.class);
MedicalAbnormalStatisticsVO statisticsVO = redisClientUtil.get(MEDICAL,
MEDICAL_ABNORMAL_STATISTICS+":"+dto.getMedicalYear()+":"+dto.getCenterId(),MedicalAbnormalStatisticsVO.class);
// 获取假数据
DataDetailVO dataDetailVO = screenDataService.dataDetail(dto.getCenterId(), "34");
if (ObjUtil.isEmpty(statisticsVO)){
statisticsVO = new MedicalAbnormalStatisticsVO();
if (null != dataDetailVO){
if ("1".equals(dataDetailVO.getTotalCountStatus())){
statisticsVO.setTotalCount(Integer.valueOf(dataDetailVO.getTotalCount()));
statisticsVO.setTotalCount(Integer.valueOf(dataDetailVO.getTotalCount().replace("+", "").trim()));
}
if ("1".equals(dataDetailVO.getCardiovaAbCountStatus())){
statisticsVO.setCardiovaAbCount(Integer.valueOf(dataDetailVO.getCardiovaAbCount()));
statisticsVO.setCardiovaAbCount(Integer.valueOf(dataDetailVO.getCardiovaAbCount().replace("+", "").trim()));
}
if ("1".equals(dataDetailVO.getCerebrovAbCountStatus())){
statisticsVO.setCerebrovAbCount(Integer.valueOf(dataDetailVO.getCerebrovAbCount()));
statisticsVO.setCerebrovAbCount(Integer.valueOf(dataDetailVO.getCerebrovAbCount().replace("+", "").trim()));
}
if ("1".equals(dataDetailVO.getCctaAbCountStatus())){
statisticsVO.setCctaAbCount(Integer.valueOf(dataDetailVO.getCctaAbCount()));
statisticsVO.setCctaAbCount(Integer.valueOf(dataDetailVO.getCctaAbCount().replace("+", "").trim()));
}
}
}else {
@@ -374,7 +300,8 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
@Override
public HealthSignVO healthSign(HealthSignDTO dto) {
// 健康打卡数据
HealthSignVO vo = redisClientUtil.get(MEDICAL, HEALTH_SIGN, HealthSignVO.class);
HealthSignVO vo = redisClientUtil.get(MEDICAL,
HEALTH_SIGN+":"+dto.getCenterId(), HealthSignVO.class);
// 获取数据
DataDetailVO dataDetailVO = screenDataService.dataDetail(dto.getCenterId(), "33");
@@ -449,7 +376,7 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
private void setIfActive(Consumer<Integer> setter, String status, String value) {
if ("1".equals(status) && value != null) {
setter.accept(Integer.valueOf(value));
setter.accept(Integer.valueOf(value.replace("+", "").trim()));
}
}
@@ -467,37 +394,83 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
@Override
public void runJob(){
// 查询默认应急中心
EmergencyCenter defaultCenter = centerService.getOne(new LambdaQueryWrapper<EmergencyCenter>().eq(EmergencyCenter::getDefaultCenter, true), false);
if (ObjUtil.isEmpty(defaultCenter)){
return;
}
Date today = new Date();
// 体检人数统计查询
List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = anYanClient.examinationStatistics(DateUtil.thisYear());
redisClientUtil.set(MEDICAL,MEDICAL_PEOPLE_NUM_STATISTICS,medicalPeopleNumStatisticsVOS);
if (anYanProperties.isEnable()){
// 体检人数统计查询
List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = anYanClient.examinationStatistics(DateUtil.thisYear());
redisClientUtil.set(MEDICAL,MEDICAL_PEOPLE_NUM_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalPeopleNumStatisticsVOS);
// 体检异常数据查询
MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = anYanClient.medicalAbnormalStatistics(DateUtil.thisYear());
redisClientUtil.set(MEDICAL,MEDICAL_ABNORMAL_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalAbnormalStatisticsVO);
// 健康打卡今日数据查询
HealthSignStatVO healthSignToday = anYanClient.healthCheckStatistics(DateUtil.beginOfDay(today), DateUtil.endOfDay(today));
// 健康打卡本月数据查询
HealthSignStatVO healthSignMonth = anYanClient.healthCheckStatistics(DateUtil.beginOfMonth(today), DateUtil.endOfMonth(today));
// 减重 血压 血糖 三种数据整合存
HealthSignVO healthSign = new HealthSignVO();
healthSign.setWeightLossCountDay(Integer.valueOf(healthSignToday.getWeigtTotalCount()));
healthSign.setWeightLossAbnormalCountDay(Integer.valueOf(healthSignToday.getWeigtAbCount()));
healthSign.setBloodPressureCountDay(Integer.valueOf(healthSignToday.getBpTotalCount()));
healthSign.setBloodPressureAbnormalCountDay(Integer.valueOf(healthSignToday.getBpAbCount()));
healthSign.setBloodSugarCountDay(Integer.valueOf(healthSignToday.getBsTotalCount()));
healthSign.setBloodSugarAbnormalCountDay(Integer.valueOf(healthSignToday.getBsAbCount()));
healthSign.setWeightLossCountMonth(Integer.valueOf(healthSignMonth.getWeigtTotalCount()));
healthSign.setWeightLossAbnormalCountMonth(Integer.valueOf(healthSignMonth.getWeigtAbCount()));
healthSign.setBloodPressureCountMonth(Integer.valueOf(healthSignMonth.getBpTotalCount()));
healthSign.setBloodPressureAbnormalCountMonth(Integer.valueOf(healthSignMonth.getBpAbCount()));
healthSign.setBloodSugarCountMonth(Integer.valueOf(healthSignMonth.getBpTotalCount()));
healthSign.setBloodSugarAbnormalCountMonth(Integer.valueOf(healthSignMonth.getBpAbCount()));
redisClientUtil.set(MEDICAL,HEALTH_SIGN+defaultCenter.getId(),healthSign);
}else {
randomData(defaultCenter);
}
}
private void randomData(EmergencyCenter defaultCenter){
List<MedicalPeopleNumStatisticsVO> medicalPeopleNumStatisticsVOS = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
MedicalPeopleNumStatisticsVO vo = new MedicalPeopleNumStatisticsVO();
vo.setHospitalName("新疆医院");
vo.setAlias("新疆医院");
int randomCount = random.nextInt(100) + 1;
vo.setCheckedCount(randomCount);
medicalPeopleNumStatisticsVOS.add(vo);
}
redisClientUtil.set(MEDICAL,MEDICAL_PEOPLE_NUM_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalPeopleNumStatisticsVOS);
// 体检异常数据查询
MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = anYanClient.medicalAbnormalStatistics(DateUtil.thisYear());
redisClientUtil.set(MEDICAL,MEDICAL_ABNORMAL_STATISTICS,medicalAbnormalStatisticsVO);
// 健康打卡今日数据查询
HealthSignStatVO healthSignToday = anYanClient.healthCheckStatistics(DateUtil.beginOfDay(today), DateUtil.endOfDay(today));
// 健康打卡本月数据查询
HealthSignStatVO healthSignMonth = anYanClient.healthCheckStatistics(DateUtil.beginOfMonth(today), DateUtil.endOfMonth(today));
MedicalAbnormalStatisticsVO medicalAbnormalStatisticsVO = new MedicalAbnormalStatisticsVO();
medicalAbnormalStatisticsVO.setTotalCount(100);
medicalAbnormalStatisticsVO.setCardiovaAbCount(50);
medicalAbnormalStatisticsVO.setCerebrovAbCount(50);
redisClientUtil.set(MEDICAL,MEDICAL_ABNORMAL_STATISTICS+":"+DateUtil.thisYear()+":"+defaultCenter.getId(),medicalAbnormalStatisticsVO);
// 减重 血压 血糖 三种数据整合存
HealthSignVO healthSign = new HealthSignVO();
healthSign.setWeightLossCountDay(random.nextInt(100) + 1);
healthSign.setWeightLossAbnormalCountDay(random.nextInt(100) + 1);
healthSign.setBloodPressureCountDay(random.nextInt(100) + 1);
healthSign.setBloodPressureAbnormalCountDay(random.nextInt(100) + 1);
healthSign.setBloodSugarCountDay(random.nextInt(100) + 1);
healthSign.setBloodSugarAbnormalCountDay(random.nextInt(100) + 1);
healthSign.setWeightLossCountDay(Integer.valueOf(healthSignToday.getWeigtTotalCount()));
healthSign.setWeightLossAbnormalCountDay(Integer.valueOf(healthSignToday.getWeigtAbCount()));
healthSign.setBloodPressureCountDay(Integer.valueOf(healthSignToday.getBpTotalCount()));
healthSign.setBloodPressureAbnormalCountDay(Integer.valueOf(healthSignToday.getBpAbCount()));
healthSign.setBloodSugarCountDay(Integer.valueOf(healthSignToday.getBsTotalCount()));
healthSign.setBloodSugarAbnormalCountDay(Integer.valueOf(healthSignToday.getBsAbCount()));
healthSign.setWeightLossCountMonth(Integer.valueOf(healthSignMonth.getWeigtTotalCount()));
healthSign.setWeightLossAbnormalCountMonth(Integer.valueOf(healthSignMonth.getWeigtAbCount()));
healthSign.setBloodPressureCountMonth(Integer.valueOf(healthSignMonth.getBpTotalCount()));
healthSign.setBloodPressureAbnormalCountMonth(Integer.valueOf(healthSignMonth.getBpAbCount()));
healthSign.setBloodSugarCountMonth(Integer.valueOf(healthSignMonth.getBpTotalCount()));
healthSign.setBloodSugarAbnormalCountMonth(Integer.valueOf(healthSignMonth.getBpAbCount()));
redisClientUtil.set(MEDICAL,HEALTH_SIGN,healthSign);
healthSign.setWeightLossCountMonth(random.nextInt(100) + 1);
healthSign.setWeightLossAbnormalCountMonth(random.nextInt(100) + 1);
healthSign.setBloodPressureCountMonth(random.nextInt(100) + 1);
healthSign.setBloodPressureAbnormalCountMonth(random.nextInt(100) + 1);
healthSign.setBloodSugarCountMonth(random.nextInt(100) + 1);
healthSign.setBloodSugarAbnormalCountMonth(random.nextInt(100) + 1);
redisClientUtil.set(MEDICAL,HEALTH_SIGN+defaultCenter.getId(),healthSign);
}
@Override
@@ -550,84 +523,4 @@ public class LargeScreenServiceImpl extends ServiceImpl<LargeScreenMapper, Large
}
}
}
public static String[] generateRandomLocation() {
Random random = new Random();
// 生成随机经纬度
double longitude = MIN_LONGITUDE + (MAX_LONGITUDE - MIN_LONGITUDE) * random.nextDouble();
double latitude = MIN_LATITUDE + (MAX_LATITUDE - MIN_LATITUDE) * random.nextDouble();
// 随机选择一个城市作为地址
String city = CITIES[random.nextInt(CITIES.length)];
String[] data = new String[3];
data[0] = city;
data[1] = String.valueOf(longitude);
data[2] = String.valueOf(latitude);
return data;
}
public static String generateRandomName() {
Random random = new Random();
// 随机选择一个姓
String surname = SURNAMES[random.nextInt(SURNAMES.length)];
// 随机选择一个名
String firstName = FIRST_NAMES[random.nextInt(FIRST_NAMES.length)];
// 组合成完整姓名
return surname + firstName;
}
private List<MedicalPeopleNumStatisticsVO> XjMedicalCountFakerData(String centerId) {
try {
Object data = redisUtil.get(StrUtil.isNotEmpty(centerId) ?
FakerDataConstant.XJ_MEDICAL_COUNT + ":" + centerId : FakerDataConstant.XJ_MEDICAL_COUNT);
if (data == null) {
return Collections.emptyList();
}
try {
List<MedicalPeopleNumStatisticsVO> voList = new ArrayList<>();
List<XjMedicalCountFakerData> returnDataList = (List<XjMedicalCountFakerData>) data;
for (XjMedicalCountFakerData fakerData : returnDataList) {
MedicalPeopleNumStatisticsVO vo = new MedicalPeopleNumStatisticsVO();
vo.setHospitalName(fakerData.getName());
vo.setCheckedCount(Integer.valueOf(fakerData.getCount()));
voList.add(vo);
}
return voList;
} catch (Exception e) {
log.error("新疆大屏体检人数统计数据转化异常", e);
return Collections.emptyList();
}
} catch (Exception e) {
return null;
}
}
private HealthSignVO XjHealthSignFakerDataNew(String centerId) {
try {
HealthSignVO vo = new HealthSignVO();
XjHealthSignFakerData data = (XjHealthSignFakerData) redisUtil.get(StrUtil.isNotEmpty(centerId)
? FakerDataConstant.XJ_HEALTH_SIGN_COUNT + ":" + centerId : FakerDataConstant.XJ_HEALTH_SIGN_COUNT);
BeanUtils.copyProperties(data,vo);
return vo;
} catch (Exception e) {
return null;
}
}
private MedicalAbnormalStatisticsVO XjMedicalDataFakerDataNew(String centerId) {
try {
MedicalAbnormalStatisticsVO vo = new MedicalAbnormalStatisticsVO();
XjMedicalDataFakerData data = (XjMedicalDataFakerData) redisUtil.get(StrUtil.isNotEmpty(centerId)
? FakerDataConstant.XJ_MEDICAL_DATA + ":" + centerId : FakerDataConstant.XJ_MEDICAL_DATA);
BeanUtils.copyProperties(data,vo);
return vo;
} catch (Exception e) {
return null;
}
}
}
@@ -2,30 +2,21 @@ package com.renkang.emergency.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.renkang.emergency.entity.*;
import com.renkang.emergency.entity.dto.ResourcesAllDTO;
import com.renkang.emergency.largeScreen.entity.dto.HealthRoomDTO;
import com.renkang.emergency.mapper.EmergencyHealthRoomMapper;
import com.renkang.emergency.mapper.TblAmbulanceGpsMapper;
import com.renkang.emergency.mapper.TblBaseHospitalMapper;
import com.renkang.emergency.service.IEmergencyCenterResourceService;
import com.renkang.emergency.service.IEmergencyHealthRoomService;
import com.renkang.emergency.service.ITblAmbulanceGpsService;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author TianZi
@@ -40,8 +31,6 @@ public class TblAmbulanceGpsServiceImpl extends ServiceImpl<TblAmbulanceGpsMappe
@Resource
private TblBaseHospitalMapper tblBaseHospitalMapper;
@Resource
private IEmergencyCenterResourceService resourceService;
@Resource
private EmergencyHealthRoomMapper roomMapper;
@Override