package com.ltkj.web.controller.system;
|
|
import cn.hutool.core.date.DateUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.ltkj.common.core.domain.AjaxResult;
|
import com.ltkj.common.core.domain.entity.SysDept;
|
import com.ltkj.common.core.domain.entity.SysUser;
|
import com.ltkj.common.utils.DateUtils;
|
import com.ltkj.hosp.domain.*;
|
import com.ltkj.hosp.service.*;
|
import com.ltkj.hosp.vodomain.*;
|
import com.ltkj.system.service.ISysDeptService;
|
import com.ltkj.system.service.ISysUserService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiParam;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.text.DateFormat;
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
|
/**
|
* @Author: 西安路泰科技有限公司/赵佳豪
|
* @Date: 2022/12/14 13:50
|
*/
|
@RestController
|
@RequestMapping("/home/page")
|
@Api(tags = "体检后台管理端首页面数据汇总")
|
public class TjHomePageController {
|
|
@Resource
|
private ITjOrderService orderService;
|
@Resource
|
private ITjOrderDetailService detailService;
|
@Resource
|
private ITjCustomerService customerService;
|
@Resource
|
private ITjProjectService projectService;
|
@Resource
|
private ISysDeptService deptService;
|
@Resource
|
private ISysUserService userService;
|
@Resource
|
private ITjOrderRemarkService remarkService;
|
|
|
@GetMapping("/GetChartByDate")
|
@ApiOperation(value = "条形统计时间段内个人和团队体检数")
|
// @PreAuthorize("@ss.hasPermi('home:page:GetChartByDate')")
|
public List<Map<Object, Object>> GetChartByDate(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) throws ParseException {
|
List<Map<Object, Object>> list = new ArrayList<>();
|
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
if (startDate != null & endDate != null) {
|
for (String date : findDates(startDate, endDate)) {
|
ChartVO chartVO = new ChartVO();
|
Map<Object, Object> result = new HashMap<>();
|
Date beginTime = DateUtils.parseDate(date + " 00:00:00");
|
Date endTime = DateUtils.parseDate(date + " 23:59:59");
|
QueryWrapper<TjOrder> queryWrapper1 = new QueryWrapper<>();
|
queryWrapper1.ge("finish_time", beginTime);
|
queryWrapper1.lt("finish_time", endTime);
|
queryWrapper1.eq("tj_type", 2);
|
Integer personCount = orderService.count(queryWrapper1);
|
QueryWrapper<TjOrder> queryWrapper2 = new QueryWrapper<>();
|
queryWrapper2.ge("finish_time", beginTime);
|
queryWrapper2.lt("finish_time", endTime);
|
queryWrapper2.eq("tj_type", 1);
|
Integer teamCount = orderService.count(queryWrapper2);
|
|
chartVO.setPersonNum(personCount);
|
chartVO.setTeamNum(teamCount);
|
result.put("date", date);
|
result.put("num", chartVO);
|
list.add(result);
|
}
|
return list;
|
} else {
|
for (int i = 7; i >= 0; i--) {
|
ChartVO chartVO = new ChartVO();
|
Map<Object, Object> result = new HashMap<>();
|
|
String formatdate = dateFormat.format(getFrontDay(new Date(), i));
|
Date beginTime = DateUtils.parseDate(formatdate + " 00:00:00");
|
Date endTime = DateUtils.parseDate(formatdate + " 23:59:59");
|
QueryWrapper<TjOrder> queryWrapper1 = new QueryWrapper<>();
|
queryWrapper1.ge("finish_time", beginTime);
|
queryWrapper1.lt("finish_time", endTime);
|
queryWrapper1.eq("tj_type", 2);
|
Integer personCount = orderService.count(queryWrapper1);
|
|
QueryWrapper<TjOrder> queryWrapper2 = new QueryWrapper<>();
|
queryWrapper2.ge("finish_time", beginTime);
|
queryWrapper2.lt("finish_time", endTime);
|
queryWrapper2.eq("tj_type", 1);
|
Integer teamCount = orderService.count(queryWrapper2);
|
|
chartVO.setPersonNum(personCount);
|
chartVO.setTeamNum(teamCount);
|
result.put("date", formatdate);
|
result.put("num", chartVO);
|
|
list.add(result);
|
}
|
return list;
|
}
|
}
|
|
//传参数 开始日期和结束日期 将中间的日期放入list集合
|
public static List<String> findDates(String beginTime, String endTime) throws ParseException {
|
List<String> allDate = new ArrayList<>();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
Date dBegin = sdf.parse(beginTime);
|
Date dEnd = sdf.parse(endTime);
|
allDate.add(sdf.format(dBegin));
|
Calendar calBegin = Calendar.getInstance();
|
// 使用给定的 Date 设置此 Calendar 的时间
|
calBegin.setTime(dBegin);
|
Calendar calEnd = Calendar.getInstance();
|
// 使用给定的 Date 设置此 Calendar 的时间
|
calEnd.setTime(dEnd);
|
// 测试此日期是否在指定日期之后
|
while (dEnd.after(calBegin.getTime())) {
|
// 根据日历的规则,为给定的日历字段添加或减去指定的时间量
|
calBegin.add(Calendar.DAY_OF_MONTH, 1);
|
allDate.add(sdf.format(calBegin.getTime()));
|
}
|
return allDate;
|
}
|
|
//返回某个日期前几天的日期
|
public static Date getFrontDay(Date date, int i) {
|
Calendar cal = new GregorianCalendar();
|
cal.setTime(date);
|
cal.set(Calendar.DATE, cal.get(Calendar.DATE) - i);
|
return cal.getTime();
|
}
|
|
|
/* @GetMapping("/getTjDeptCountList")
|
@ApiOperation(value = "体检科室工作量数据统计接口")
|
// @PreAuthorize("@ss.hasPermi('home:page:getTjDeptCountList')")
|
public AjaxResult getTjDeptCountList(@RequestParam(required = false) @ApiParam(value = "开始时间") String beginTime, @RequestParam(required = false) @ApiParam(value = "结束时间") String endTime) {
|
List<SysDept> deptList = deptService.list();
|
if (null != deptList && deptList.size() > 0) {
|
List<TjDeptCountVo> deptCountVoList = new ArrayList<>();
|
for (SysDept sysDept : deptList) {
|
LambdaQueryWrapper<SysUser> wq0 = new LambdaQueryWrapper<>();
|
wq0.eq(SysUser::getDeptId, sysDept.getDeptId());
|
List<SysUser> sysUserList = userService.list(wq0);
|
if (null == sysUserList) {
|
return AjaxResult.error("该科室下没有人员");
|
}
|
TjDeptCountVo deptCountVo = new TjDeptCountVo();
|
deptCountVo.setDoctorName("/");
|
deptCountVo.setDeptName(sysDept.getDeptName());
|
LambdaQueryWrapper<TjProject> wq1 = new LambdaQueryWrapper<>();
|
wq1.eq(TjProject::getDeptId, sysDept.getDeptId());
|
List<TjProject> list = projectService.list(wq1);
|
|
LambdaQueryWrapper<TjOrderDetail> wq2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<TjOrderDetail> wq3 = new LambdaQueryWrapper<>();
|
wq2.eq(TjOrderDetail::getTjStatus, 0);
|
if (null != beginTime && null != endTime) {
|
wq2.between(TjOrderDetail::getCreateTime, DateUtil.parse(beginTime), DateUtil.parse(endTime));
|
wq3.between(TjOrderDetail::getCreateTime, DateUtil.parse(beginTime), DateUtil.parse(endTime));
|
} else {
|
wq2.between(TjOrderDetail::getCreateTime, DateUtil.lastWeek(), DateUtil.now());
|
wq3.between(TjOrderDetail::getCreateTime, DateUtil.lastWeek(), DateUtil.now());
|
}
|
wq3.eq(TjOrderDetail::getTjStatus, 1);
|
if (null != list && list.size() > 0) {
|
//获取该科室下的项目
|
List<Long> ksproList = list.stream().map(TjProject::getProId).collect(Collectors.toList());
|
wq2.in(TjOrderDetail::getProId, ksproList);
|
wq3.in(TjOrderDetail::getProId, ksproList);
|
} else {
|
continue;
|
}
|
LambdaQueryWrapper<TjOrderRemark> wq4 = new LambdaQueryWrapper<>();
|
wq4.eq(TjOrderRemark::getDeptId, sysDept.getDeptId());
|
|
List<TjOrderDetail> detailList = detailService.list(wq2);
|
List<TjOrderDetail> detailList1 = detailService.list(wq3);
|
List<TjOrderRemark> remarkList = remarkService.list(wq4);
|
|
if (detailList == null && detailList1 != null && remarkList != null) {
|
deptCountVo.setTjCount(0);
|
deptCountVo.setTjFinishCount(detailList1.size());
|
deptCountVo.setTjFinishRate("0%");
|
deptCountVo.setReportCount(remarkList.size());
|
deptCountVo.setReportRate("0%");
|
} else if (detailList1 == null && detailList != null && remarkList != null) {
|
deptCountVo.setTjCount(detailList.size());
|
deptCountVo.setTjFinishCount(0);
|
deptCountVo.setTjFinishRate("0%");
|
deptCountVo.setReportCount(remarkList.size());
|
deptCountVo.setReportRate((remarkList.size()) / (detailList.size()) * 100 + "%");
|
} else if (detailList1 != null && detailList != null && remarkList == null) {
|
deptCountVo.setTjCount(detailList.size());
|
deptCountVo.setTjFinishCount(detailList1.size());
|
deptCountVo.setTjFinishRate((detailList1.size()) / (detailList.size()) * 100 + "%");
|
deptCountVo.setReportCount(0);
|
deptCountVo.setReportRate("0%");
|
} else {
|
deptCountVo.setTjCount(0);
|
deptCountVo.setTjFinishCount(0);
|
deptCountVo.setTjFinishRate("0%");
|
deptCountVo.setReportCount(0);
|
deptCountVo.setReportRate("0%");
|
}
|
deptCountVoList.add(deptCountVo);
|
}
|
return AjaxResult.success("操作成功", deptCountVoList);
|
}
|
return AjaxResult.error();
|
}*/
|
|
/*@GetMapping("/GetCheckDate")
|
@ApiOperation(value = "报告工作量统计")
|
// @PreAuthorize("@ss.hasPermi('home:page:GetCheckDate')")
|
public List<CheckDataVO> GetCheckDate(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) {
|
List<CheckDataVO> list = new ArrayList<>();
|
if (startDate != null & endDate != null) {
|
Date beginTime = DateUtils.parseDate(startDate + " 00:00:00");
|
Date endTime = DateUtils.parseDate(endDate + " 23:59:59");
|
QueryWrapper<TjOrder> queryWrapper1 = new QueryWrapper<>();
|
queryWrapper1.ge("finish_time", beginTime);
|
queryWrapper1.lt("finish_time", endTime);
|
List<TjOrder> list1 = orderService.list(queryWrapper1);
|
//不可重复 所有医生名
|
Set<String> collect1 = list1.stream().map(TjOrder::getCheckDoctor).collect(Collectors.toSet());
|
for (String s : collect1) {
|
QueryWrapper<TjOrder> queryWrapper2 = new QueryWrapper<>();
|
queryWrapper2.ge("finish_time", beginTime);
|
queryWrapper2.lt("finish_time", endTime);
|
queryWrapper2.eq("check_doctor", s);
|
List<TjOrder> list2 = orderService.list(queryWrapper2);
|
CheckDataVO checkDataVO = new CheckDataVO();
|
Integer checkCount = 0;
|
Integer releaseCount = 0;
|
Integer messageCount = 0;
|
Integer printCount = 0;
|
for (TjOrder tjOrder : list2) {
|
if (s.equals(tjOrder.getCheckDoctor()) && tjOrder.getCheckStatus() == 1) {
|
checkCount++;
|
}
|
if (s.equals(tjOrder.getCheckDoctor()) && tjOrder.getReleaseTime() != null) {
|
releaseCount++;
|
}
|
if (s.equals(tjOrder.getCheckDoctor()) && "1".equals(tjOrder.getSendMessage())) {
|
messageCount++;
|
}
|
//报告生成时间
|
if (s.equals(tjOrder.getCheckDoctor()) && tjOrder.getReportTime() != null) {
|
printCount++;
|
}
|
checkDataVO.setDoctorName(s);
|
checkDataVO.setCheckCount(checkCount);
|
checkDataVO.setReleaseCount(releaseCount);
|
checkDataVO.setMessageCount(messageCount);
|
checkDataVO.setPrintCount(printCount);
|
|
}
|
list.add(checkDataVO);
|
}
|
|
} else {
|
LambdaQueryWrapper<TjOrder> queryWrapper1 = new LambdaQueryWrapper<>();
|
queryWrapper1.between(TjOrder::getFinishTime, DateUtil.lastWeek(), DateUtil.now());
|
List<TjOrder> list1 = orderService.list(queryWrapper1);
|
|
//List<String> collect = list1.stream().map(TjOrder::getCheckDoctor).collect(Collectors.toList());
|
//不可重复 所有医生名
|
Set<String> collect1 = list1.stream().map(TjOrder::getCheckDoctor).collect(Collectors.toSet());
|
for (String s : collect1) {
|
QueryWrapper<TjOrder> queryWrapper2 = new QueryWrapper<>();
|
queryWrapper2.between("finish_time", DateUtil.lastWeek(), DateUtil.now());
|
queryWrapper2.eq("check_doctor", s);
|
List<TjOrder> list2 = orderService.list(queryWrapper2);
|
CheckDataVO checkDataVO = new CheckDataVO();
|
Integer checkCount = 0;
|
Integer releaseCount = 0;
|
Integer messageCount = 0;
|
Integer printCount = 0;
|
for (TjOrder tjOrder : list2) {
|
if (s.equals(tjOrder.getCheckDoctor()) && tjOrder.getCheckStatus() == 1) {
|
checkCount++;
|
}
|
if (s.equals(tjOrder.getCheckDoctor()) && tjOrder.getReleaseTime() != null) {
|
releaseCount++;
|
}
|
// TODO: 2023/3/31 发送短信/邮件统计
|
if (s.equals(tjOrder.getCheckDoctor()) && "1".equals(tjOrder.getSendEmail())) {
|
messageCount++;
|
}
|
if (s.equals(tjOrder.getCheckDoctor()) && tjOrder.getReportTime() != null) {
|
printCount++;
|
}
|
checkDataVO.setDoctorName(s);
|
checkDataVO.setCheckCount(checkCount);
|
checkDataVO.setReleaseCount(releaseCount);
|
checkDataVO.setMessageCount(messageCount);
|
checkDataVO.setPrintCount(printCount);
|
|
}
|
list.add(checkDataVO);
|
}
|
}
|
return list;
|
}*/
|
|
@GetMapping("/GetAbnormalData")
|
@ApiOperation(value = "体检结果异常数据统计分析")
|
// @PreAuthorize("@ss.hasPermi('home:page:GetAbnormalData')")
|
public List<AbnormalVO> GetAbnormalData(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) {
|
List<AbnormalVO> list = new ArrayList<>();
|
List<TjOrderDetail> list1 = detailService.getTjOrderDetailList(startDate,endDate);
|
Set<TjProject> abProLists = new HashSet<>();
|
Set<TjProject> ll = new HashSet<>();
|
for (TjOrderDetail tjOrderDetail : list1) {
|
TjProject one = projectService.selectTjProjectByProId(tjOrderDetail.getProId());
|
tjOrderDetail.setProject(one);
|
abProLists.add(one);
|
}
|
for (TjProject abProList : abProLists) {
|
if (abProList!=null){
|
if (abProList.getProParentId() != 0) {
|
TjProject one = projectService.selectTjProjectByProId(abProList.getProParentId());
|
ll.add(one);
|
} else {
|
ll.add(abProList);
|
}
|
}
|
|
}
|
|
for (TjProject abProList : ll) {
|
Set<Long> lll = new HashSet<>();
|
AbnormalVO abnormalVO = new AbnormalVO();
|
int TjPersonNum = 0;
|
int AbPersonNum = 0;
|
Integer AbManNum = 0;
|
Integer AbWomanNum = 0;
|
Integer AbThNum = 0;
|
Integer AbThSeNum = 0;
|
Integer AbSeNum = 0;
|
for (TjOrderDetail tjOrderDetail : list1) {
|
if (tjOrderDetail.getProject().getProParentId().equals(abProList.getProId())) {
|
lll.add(tjOrderDetail.getOrderId());
|
AbPersonNum = lll.size();
|
}
|
abnormalVO.setAbPersonNum(AbPersonNum);
|
}
|
abnormalVO.setAbProName(abProList.getProName());
|
for (Long aLong : lll) {
|
TjOrder one = orderService.selectTjOrderByOrderId(aLong);
|
Long userId = one.getUserId();
|
TjCustomer one1 = customerService.selectTjCustomerByCusId(userId);
|
if (one1.getCusSex() == 0) {
|
AbManNum++;
|
} else {
|
AbWomanNum++;
|
}
|
if (DateUtil.ageOfNow(one1.getCusBrithday()) < 3) {
|
AbThNum++;
|
} else if (DateUtil.ageOfNow(one1.getCusBrithday()) >= 3 && DateUtil.ageOfNow(one1.getCusBrithday()) <= 70) {
|
AbThSeNum++;
|
} else if (DateUtil.ageOfNow(one1.getCusBrithday()) > 70) {
|
AbSeNum++;
|
}
|
abnormalVO.setAbManNum(AbManNum);
|
abnormalVO.setAbWomanNum(AbWomanNum);
|
abnormalVO.setAbSeNum(AbSeNum);
|
abnormalVO.setAbThNum(AbThNum);
|
abnormalVO.setAbThSeNum(AbThSeNum);
|
}
|
|
List<TjProject> list3 = projectService.getTjProjectListBySoneId(String.valueOf(abProList.getProId()));
|
Set<Long> l = new HashSet<>();
|
for (TjProject tjProject : list3) {
|
for (TjOrderDetail tjOrderDetail : detailService.list()) {
|
if (tjProject.getProId().equals(tjOrderDetail.getProId())) {
|
l.add(tjOrderDetail.getOrderId());
|
TjPersonNum = l.size();
|
}
|
}
|
}
|
abnormalVO.setTjPersonNum(TjPersonNum);
|
list.add(abnormalVO);
|
}
|
return list;
|
}
|
|
|
@GetMapping("/getDiseaseList")
|
@ApiOperation("根据疾病名称查询相关人员信息接口")
|
// @PreAuthorize("@ss.hasPermi('home:page:getDiseaseList')")
|
public AjaxResult getDiseaseList(@ApiParam(value = "疾病名称") @RequestParam String disesseName,
|
@ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime,
|
@ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) {
|
if (null == disesseName) {
|
return AjaxResult.error("请输入要查询的内容");
|
}
|
List<DiseaseVo> diseaseVos = new ArrayList<>();
|
LambdaQueryWrapper<TjOrderRemark> wq0 = new LambdaQueryWrapper<>();
|
wq0.like(TjOrderRemark::getRemark, disesseName);
|
if (null != beginTime && null != endTime) {
|
wq0.between(TjOrderRemark::getCreateTime, beginTime, endTime);
|
}
|
List<TjOrderRemark> remarkList = remarkService.list(wq0);
|
if (null != remarkList && remarkList.size() > 0) {
|
for (TjOrderRemark orderRemark : remarkList) {
|
LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
|
wq1.eq(TjOrder::getTjNumber, orderRemark.getTjNumber());
|
TjOrder tjOrder = orderService.getOne(wq1);
|
if (null != tjOrder) {
|
DiseaseVo diseaseVo = new DiseaseVo();
|
TjCustomer customer = customerService.getById(tjOrder.getUserId());
|
diseaseVo.setName(customer.getCusName());
|
diseaseVo.setAge(DateUtil.ageOfNow(customer.getCusBrithday()));
|
diseaseVo.setSex(Math.toIntExact(customer.getCusSex()));
|
diseaseVo.setPhone(customer.getCusPhone());
|
diseaseVo.setTjTime(tjOrder.getFinishTime());
|
if(tjOrder.getIsReturn()==0){
|
diseaseVo.setType("已复检");
|
}else {
|
diseaseVo.setType("未复检");
|
}
|
diseaseVos.add(diseaseVo);
|
}
|
}
|
return AjaxResult.success(diseaseVos);
|
}
|
return AjaxResult.success("暂时没有数据");
|
}
|
|
/**
|
* 首页折线图数据
|
*/
|
@GetMapping("/getLineChart")
|
@ApiOperation(value = "首页折线图数据")
|
public AjaxResult getLineChart() {
|
List<Map<Object, Object>> line = orderService.getLine();
|
Collections.reverse(line);
|
return AjaxResult.success("折线图数据", line);
|
}
|
|
@GetMapping("/getPieChart")
|
@ApiOperation(value = "首页饼状图登记人数接口")
|
public AjaxResult getPieChart() {
|
Map<String, Object> map = new HashMap<>();
|
|
//获取体检登记数
|
LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>();
|
wq0.between(TjOrder::getCreateTime, DateUtil.lastMonth(), DateUtil.now());
|
List<TjOrder> orderCountList = orderService.list(wq0);
|
if (null != orderCountList && orderCountList.size() > 0) {
|
List<PieChartVo> pieChartVoList = getTjorderCountMap(orderCountList);
|
map.put("tjdj", pieChartVoList);
|
} else {
|
map.put("tjdj", 0);
|
}
|
//获取体检异常数
|
LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
|
wq1.between(TjOrder::getFinishTime, DateUtil.lastMonth(), DateUtil.now());
|
wq1.eq(TjOrder::getCheckStatus, 1);
|
List<TjOrder> orderAbnormalCountList = orderService.list(wq1);
|
if (null != orderAbnormalCountList && orderAbnormalCountList.size() > 0) {
|
List<PieChartVo> pieChartVoList = getTjorderAbnormalCountMap(orderAbnormalCountList);
|
map.put("tjyc", pieChartVoList);
|
} else {
|
map.put("tjyc", 0);
|
}
|
return AjaxResult.success(map);
|
}
|
|
//获取体检登记数
|
private List<PieChartVo> getTjorderCountMap(List<TjOrder> orderList) {
|
int a = 0;
|
int b = 0;
|
int c = 0;
|
int d = 0;
|
int e = 0;
|
Map<String, Object> map = null;
|
for (TjOrder tjOrder : orderList) {
|
map = new HashMap<>();
|
TjCustomer customer = customerService.getById(tjOrder.getUserId());
|
if (null != customer) {
|
int age = DateUtil.ageOfNow(customer.getCusBrithday());
|
if (age >= 0 && age <= 3) {
|
a += 1;
|
} else if (age > 3 && age <= 16) {
|
b += 1;
|
} else if (age > 16 && age <= 40) {
|
c += 1;
|
} else if (age > 40 && age <= 60) {
|
d += 1;
|
} else {
|
e += 1;
|
}
|
}
|
map.put("0-3岁", a);
|
map.put("3-16岁", b);
|
map.put("16-40岁", c);
|
map.put("40-60岁", d);
|
map.put("60岁以上", e);
|
}
|
List<PieChartVo> pieChartVoList = new ArrayList<>();
|
assert map != null;
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
PieChartVo pieChartVo = new PieChartVo();
|
pieChartVo.setName(entry.getKey());
|
pieChartVo.setCount((Integer) entry.getValue());
|
pieChartVoList.add(pieChartVo);
|
}
|
return pieChartVoList;
|
}
|
|
//获取体检异常数
|
private List<PieChartVo> getTjorderAbnormalCountMap(List<TjOrder> orderList) {
|
int a = 0;
|
int b = 0;
|
int c = 0;
|
int d = 0;
|
int e = 0;
|
Map<String, Object> map = null;
|
for (TjOrder tjOrder : orderList) {
|
map = new HashMap<>();
|
LambdaQueryWrapper<TjOrderDetail> wq = new LambdaQueryWrapper<>();
|
wq.eq(TjOrderDetail::getOrderId, tjOrder.getOrderId());
|
wq.eq(TjOrderDetail::getExceptionDesc, 1);
|
List<TjOrderDetail> list = detailService.list(wq);
|
if (null != list && list.size() > 0) {
|
TjCustomer customer = customerService.getById(tjOrder.getUserId());
|
if (null != customer) {
|
int age = DateUtil.ageOfNow(customer.getCusBrithday());
|
if (age >= 0 && age <= 3) {
|
a += 1;
|
} else if (age > 3 && age <= 16) {
|
b += 1;
|
} else if (age > 16 && age <= 40) {
|
c += 1;
|
} else if (age > 40 && age <= 60) {
|
d += 1;
|
} else {
|
e += 1;
|
}
|
}
|
map.put("0-3岁", a);
|
map.put("3-16岁", b);
|
map.put("16-40岁", c);
|
map.put("40-60岁", d);
|
map.put("60岁以上", e);
|
}
|
}
|
List<PieChartVo> pieChartVoList = new ArrayList<>();
|
assert map != null;
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
PieChartVo pieChartVo = new PieChartVo();
|
pieChartVo.setName(entry.getKey());
|
pieChartVo.setCount((Integer) entry.getValue());
|
pieChartVoList.add(pieChartVo);
|
}
|
return pieChartVoList;
|
}
|
|
|
/**
|
* 查询今日待检
|
*
|
* @return
|
*/
|
@GetMapping("/tobeToday")
|
@ApiOperation(value = "查询今日待检")
|
public Integer ToBeToday() {
|
//当前日期拼接开始和结束时间
|
//时间字符串类型转换时间类型
|
return orderService.count(new QueryWrapper<TjOrder>().between("create_time", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date())).eq("check_status", 0));
|
}
|
|
/**
|
* 查询今日已检
|
*
|
* @return
|
*/
|
@GetMapping("/checkedToday")
|
@ApiOperation(value = "查询今日已检")
|
public Integer checkedToday() {
|
//当前日期拼接开始和结束时间
|
//时间字符串类型转换时间类型
|
return orderService.count(new QueryWrapper<TjOrder>().isNotNull("finish_time").between("finish_time", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date())));
|
}
|
|
/**
|
* 查询今日报告
|
*/
|
@GetMapping("/reportToday")
|
@ApiOperation(value = "查询今日报告")
|
public Integer ReportToday() {
|
//当前日期拼接开始和结束时间
|
//时间字符串类型转换时间类型
|
return orderService.count(new QueryWrapper<TjOrder>().isNotNull("report_time").between("report_time", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date())));
|
}
|
|
/**
|
* 查询今日登记
|
*
|
* @return
|
*/
|
@GetMapping("/registerToday")
|
@ApiOperation(value = "查询今日登记")
|
public Integer RegisterToday() {
|
return orderService.count(new QueryWrapper<TjOrder>().between("create_time", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date())));
|
}
|
}
|