|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fs.common.constant.Constants;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.ServiceException;
|
|
|
+import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.his.config.HealthIndicatorConfig;
|
|
|
import com.fs.his.domain.FsUserHealthData;
|
|
@@ -17,11 +18,15 @@ import com.fs.his.service.IFsUserHealthProfileService;
|
|
|
import com.fs.his.service.IFsUserInfoService;
|
|
|
import com.fs.system.domain.SysConfig;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -73,6 +78,51 @@ public class FsUserHealthDataServiceImpl extends ServiceImpl<FsUserHealthDataMap
|
|
|
return baseMapper.selectFsUserHealthDataListCount(fsUserHealthData);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> selectFsUserHealthDataListInfo(FsUserHealthData fsUserHealthData, Integer pageNum, Integer pageSize) {
|
|
|
+ // 时间格式字段处理
|
|
|
+ if (StringUtils.isNotEmpty(fsUserHealthData.getTimeSearch())) {
|
|
|
+ Map<String, Object> timeMap = new HashMap<>();
|
|
|
+ // 时间格式处理 2025-01-21 2025-01-01;2025-01-12 2025-01
|
|
|
+ if (fsUserHealthData.getTimeSearch().contains(";")) {
|
|
|
+ String[] timeArr = fsUserHealthData.getTimeSearch().split(";");
|
|
|
+ timeMap.put("beginTime", timeArr[0]);
|
|
|
+ timeMap.put("endTime", timeArr[1]);
|
|
|
+ } else if (fsUserHealthData.getTimeSearch().length() == 10) {
|
|
|
+ fsUserHealthData.setMeasurementDate(DateUtils.parseDate(fsUserHealthData.getTimeSearch()));
|
|
|
+ } else if (fsUserHealthData.getTimeSearch().length() == 7) {
|
|
|
+ // 按月 取当月第一个和最后一天
|
|
|
+ timeMap.put("beginTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.getStartOfMonth(DateUtils.parseDate(fsUserHealthData.getTimeSearch()))));
|
|
|
+ timeMap.put("endTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, DateUtils.getEndOfMonth(DateUtils.parseDate(fsUserHealthData.getTimeSearch()))));
|
|
|
+ }
|
|
|
+ fsUserHealthData.setParams(timeMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<FsUserHealthData> list = selectFsUserHealthDataList(fsUserHealthData);
|
|
|
+ if(list!=null && !list.isEmpty() && fsUserHealthData.getTimeSearch().contains(";")){// 加工数据,返回星期
|
|
|
+ list.forEach(item -> {
|
|
|
+ item.setWeek(DateUtils.getWeek(item.getMeasurementDate()));
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("data", new PageInfo<>(list));
|
|
|
+
|
|
|
+
|
|
|
+ // 如果测量类型是空 需要查询各等级(无-0,轻微-1,严重-2) 数量
|
|
|
+ if (fsUserHealthData.getLevel() == null) {
|
|
|
+ for (int i = 0; i < 3; i++) {
|
|
|
+ fsUserHealthData.setLevel(i);
|
|
|
+ int num = selectFsUserHealthDataListCount(fsUserHealthData);
|
|
|
+ data.put("count" + i, num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 新增用户身体检测数据
|
|
|
*
|