ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
@@ -129,6 +129,8 @@ private ISysDeptService deptService; @Autowired private TjCfService cfService; @Resource private LtkjHysqdService hysqdService; @Override public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) { @@ -1774,11 +1776,13 @@ private AjaxResult getPieCharts() { Map<String, Object> map = new HashMap<>(); Date date=new Date(); //获取体检登记数 LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>(); wq0.between(TjOrder::getCreateTime, DateUtil.lastMonth(), DateUtil.now()); wq0.between(TjOrder::getCreateTime,DateUtil.offsetMonth(date,-1),date); List<TjOrder> orderCountList = orderService.list(wq0); if (null != orderCountList && orderCountList.size() > 0) { if (null != orderCountList && !orderCountList.isEmpty()) { List<PieChartVo> pieChartVoList = getTjorderCountMap(orderCountList); map.put("tjdj", pieChartVoList); } else { @@ -1786,12 +1790,13 @@ } //获取体检异常数 LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); wq1.between(TjOrder::getCreateTime, DateUtil.lastMonth(), DateUtil.now()); wq1.isNotNull(TjOrder::getFinishTime); wq1.eq(TjOrder::getCheckStatus, 1); List<TjOrder> orderAbnormalCountList = orderService.list(wq1); if (null != orderAbnormalCountList && orderAbnormalCountList.size() > 0) { List<PieChartVo> pieChartVoList = getTjorderAbnormalCountMap(orderAbnormalCountList); wq1.between(TjOrder::getCreateTime,DateUtil.offsetMonth(date,-1),date); // wq1.isNotNull(TjOrder::getFinishTime); // wq1.eq(TjOrder::getCheckStatus, 1); List<TjOrder> orderList = orderService.list(wq1); if (null !=orderList && !orderList.isEmpty()) { // List<TjOrder> orderList = orderAbnormalCountList.stream().distinct().collect(Collectors.toList()); List<PieChartVo> pieChartVoList = getTjorderAbnormalCountMap(orderList); map.put("tjyc", pieChartVoList); } else { map.put("tjyc", 0); @@ -1858,14 +1863,14 @@ int c = 0; int d = 0; int e = 0; Map<String, Object> map = null; Map<String, Object> map = new HashMap<>(); 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 = tjOrderDetailService.list(wq); if (null != list && list.size() > 0) { int count = hysqdService.getHyYcXmCount(tjOrder.getCardId()); if ((null != list && !list.isEmpty()) || (count>0)) { TjCustomer customer = tjCustomerService.getById(tjOrder.getUserId()); if (null != customer) { int age = DateUtil.ageOfNow(customer.getCusBrithday()); @@ -1881,15 +1886,14 @@ 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); } } 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()); ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
@@ -1738,14 +1738,30 @@ */ @GetMapping("/getDeptAdvice") @ApiOperation(value = "根据项目id获取建议") public AjaxResult getDeptAdvice(@ApiParam(value = "父项目项目id") @RequestParam(required = false) String proId) { public AjaxResult getDeptAdvice(@ApiParam(value = "父项目项目id") @RequestParam(required = false) String proId, @ApiParam(value = "内容") @RequestParam(required = false) String nr, @ApiParam(value = "拼音码") @RequestParam(required = false) String pym, @ApiParam(value = "页码") @RequestParam(defaultValue ="1") int page, @ApiParam(value = "每页展示条数") @RequestParam(defaultValue ="10") int pageSize) { LambdaQueryWrapper<TjAdvice> wq1 = new LambdaQueryWrapper<>(); if(null !=proId){ wq1.eq(TjAdvice::getProId, proId); } wq1.last("limit 20"); List<TjAdvice> list = tjAdviceService.list(wq1); return AjaxResult.success(list); if(null !=nr && !nr.isEmpty()){ wq1.like(TjAdvice::getTitle,nr); }else if (null !=pym && !pym.isEmpty()){ wq1.like(TjAdvice::getTitle,pym); } // else { // wq1.last("limit 20"); // } Page<TjAdvice> pages=new Page<>(page,pageSize); Page<TjAdvice> advicePage = tjAdviceService.page(pages, wq1); Map<String,Object> map=new HashMap<>(); map.put("list",advicePage.getRecords()); map.put("total",advicePage.getTotal()); // List<TjAdvice> list = tjAdviceService.list(wq1); return AjaxResult.success(map); } /** ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCheckController.java
@@ -606,7 +606,7 @@ List<String> baoGaoDans = ltkjHybgdService.getJianYanBaoGaoDan(order.getCardId()); List<String> jianChaBaoGaoDan = ltkjHybgdService.getJianChaBaoGaoDan(order.getCardId()); //同步检验 if (null != baoGaoDans && baoGaoDans.size() > 0) { if (null != baoGaoDans && !baoGaoDans.isEmpty()) { Date dates = new Date(); Map<String, Object> map = new HashMap<>(); map.put("his_registration_id", order.getCardId()); @@ -671,7 +671,7 @@ log.info("检查项目查询返回值: " + results.toString()); if (Integer.parseInt(results.get("code").toString()) == 200) { List<Map<String, Object>> datas = (List<Map<String, Object>>) results.get("data"); if (null != datas && datas.size() > 0) { if (null != datas && !datas.isEmpty()) { jcsqdService.deletedLtkjJcsqdByTjhAndTmh(order.getCardId()); jcbgdService.deletedLtkjJcbgdByTjhAndTmh(order.getCardId()); for (Map<String, Object> objectMap : datas) { ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjHomePageController.java
@@ -18,6 +18,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.models.auth.In; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -59,7 +61,8 @@ @Resource private ITjFlowingWaterService tjFlowingWaterService; @Resource private LtkjHysqdService hysqdService; @GetMapping("/GetChartByDate") @ApiOperation(value = "条形统计时间段内个人和团队体检数") @@ -151,179 +154,6 @@ 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++; } 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 = "体检结果异常数据统计分析") @@ -456,10 +286,10 @@ @GetMapping("/getLineChart") @ApiOperation(value = "首页折线图数据") public AjaxResult getLineChart() { asyncService.getLineChart(); if(redisCache.hasKey("getLineChart")){ return redisCache.getCacheObject("getLineChart"); } // asyncService.getLineChart(); // if(redisCache.hasKey("getLineChart")){ // return redisCache.getCacheObject("getLineChart"); // } return getResult(); } @@ -473,33 +303,37 @@ @GetMapping("/getPieChart") @ApiOperation(value = "首页饼状图登记人数接口") public AjaxResult getPieChart() { asyncService.getPieChart(); if(redisCache.hasKey("getPieChart")){ return redisCache.getCacheObject("getPieChart"); } // asyncService.getPieChart(); // if(redisCache.hasKey("getPieChart")){ // return redisCache.getCacheObject("getPieChart"); // } return getAjaxResult(); } private AjaxResult getAjaxResult() { Map<String, Object> map = new HashMap<>(); Date date=new Date(); //获取体检登记数 LambdaQueryWrapper<TjOrder> wq0 = new LambdaQueryWrapper<>(); wq0.between(TjOrder::getCreateTime, DateUtil.lastMonth(), DateUtil.now()); wq0.between(TjOrder::getCreateTime,DateUtil.offsetMonth(date,-1),date); List<TjOrder> orderCountList = orderService.list(wq0); if (null != orderCountList && orderCountList.size() > 0) { List<PieChartVo> pieChartVoList = getTjorderCountMap(orderCountList); if (null != orderCountList && !orderCountList.isEmpty()) { List<PieChartVo> pieChartVoList = getTjorderCountMap(); 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); wq1.between(TjOrder::getCreateTime,DateUtil.offsetMonth(date,-1),date); // wq1.isNotNull(TjOrder::getFinishTime); // wq1.eq(TjOrder::getCheckStatus, 1); List<TjOrder> orderList = orderService.list(wq1); if (null !=orderList && !orderList.isEmpty()) { // List<TjOrder> orderList = orderAbnormalCountList.stream().distinct().collect(Collectors.toList()); List<PieChartVo> pieChartVoList = getTjorderAbnormalCountMap(); map.put("tjyc", pieChartVoList); } else { map.put("tjyc", 0); @@ -509,17 +343,17 @@ } //获取体检登记数 private List<PieChartVo> getTjorderCountMap(List<TjOrder> orderList) { private List<PieChartVo> getTjorderCountMap() { 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) { Map<String, Object> map = new HashMap<>(); Date date=new Date(); List<TjCustomer> customers = hysqdService.getCgYcXmList(DateUtil.offsetMonth(date, -1), date); if (null != customers && !customers.isEmpty()) { for (TjCustomer customer : customers) { int age = DateUtil.ageOfNow(customer.getCusBrithday()); if (age >= 0 && age <= 3) { a += 1; @@ -533,14 +367,13 @@ 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); } 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()); @@ -551,44 +384,37 @@ } //获取体检异常数 private List<PieChartVo> getTjorderAbnormalCountMap(List<TjOrder> orderList) { private List<PieChartVo> getTjorderAbnormalCountMap() { 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<String, Object> map = new HashMap<>(); Date date=new Date(); List<TjCustomer> customers = hysqdService.getHyYcXmList(DateUtil.offsetMonth(date, -1), date); if (null != customers && !customers.isEmpty()) { for (TjCustomer customer : customers) { 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); } } 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()); ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjReservationController.java
@@ -157,6 +157,7 @@ @ApiOperation(value = "查询体检预约列表接口(默认)") public TableDataInfo list(TjReservation tjReservation) { startPage(); tjReservation.setIsExpire(2); List<TjReservation> list = tjReservationService.selectTjReservationList(tjReservation); // if(null !=list && list.size()>0){ // for (TjReservation reservation : list) { @@ -177,11 +178,11 @@ startPage(); List<TjReservation> list = tjReservationService.selectTjReservationByDelete(tjReservation); if(null !=list && list.size()>0){ for (TjReservation reservation : list) { reservation.setName(MatchUtils.hideCusName(reservation.getName())); reservation.setPhoe(MatchUtils.hidePhoneNum(reservation.getPhoe())); reservation.setIdCard(MatchUtils.hideIdCardNum(reservation.getIdCard())); } // for (TjReservation reservation : list) { // reservation.setName(MatchUtils.hideCusName(reservation.getName())); // reservation.setPhoe(MatchUtils.hidePhoneNum(reservation.getPhoe())); // reservation.setIdCard(MatchUtils.hideIdCardNum(reservation.getIdCard())); // } } return getDataTable(list); } @@ -795,7 +796,7 @@ reservation.setProIds(Joiner.on(",").join(proIds)); reservation.setReservationTime(DateUtil.parse(reservationTime, "yyyy-MM-dd")); reservation.setCompanyId(dwGrouping.getDwId()); reservation.setCompany(dwGrouping.getDwDeptName()); reservation.setCompany(dwGrouping.getDwName()); reservation.setPayType(Long.valueOf(dwGrouping.getPayType())); reservation.setPacId(dwDept.getId()); compPay=compPay.add(dwGrouping.getYsPrice()); ltkj-admin/src/test/java/zjhTest.java
@@ -123,8 +123,7 @@ public static void main(String[] args) { // System.out.println(DateUtil.date()); // System.out.println(DateUtil.offsetDay(DateUtil.date(),1)); // System.out.println(DateUtil.offsetDay(DateUtil.date(),0)); // System.out.println(DateUtil.offsetMonth(DateUtil.date(),-1)); } ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/LtkjHysqdMapper.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ltkj.common.annotation.DataSource; import com.ltkj.common.enums.DataSourceType; import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.domain.TjOrder; import com.ltkj.hosp.sqlDomain.LtkjExamJcsqd; import com.ltkj.hosp.sqlDomain.LtkjHysqd; import org.apache.ibatis.annotations.Delete; @@ -10,6 +12,7 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.Date; import java.util.List; /** @@ -31,4 +34,69 @@ @Select("SELECT * FROM ltkj_hysqd a WHERE a.tjh=#{tjh}") List<LtkjHysqd> getLtkjHysqdByTjh(@Param("tjh") String tjh); @Select("SELECT * FROM tj_customer cus JOIN (\n" + "SELECT\n" + "\txx.user_id \n" + "FROM\n" + "\t(\n" + "\tSELECT\n" + "\t\td.* \n" + "\tFROM\n" + "\t\ttj_order d\n" + "\t\tLEFT JOIN (\n" + "\t\tSELECT\n" + "\t\t\ta.tjh \n" + "\t\tFROM\n" + "\t\t\tltkj_hysqd a\n" + "\t\t\tJOIN ltkj_hybgd b ON a.tmh = b.tmh \n" + "\t\tWHERE\n" + "\t\t\tb.jyjg NOT BETWEEN SUBSTRING_INDEX( b.fwz, '-', 1 ) \n" + "\t\t\tAND b.jyjg > SUBSTRING_INDEX( b.fwz, '-',- 1 ) \n" + "\t\tGROUP BY\n" + "\t\t\ta.tjh \n" + "\t\t) aa ON aa.tjh = d.card_id \n" + "\tWHERE\n" + "\t\td.deleted = 0 \n" + "\t\tAND ! ISNULL( aa.tjh ) \n" + "\t\tAND d.create_time BETWEEN #{strTime} \n" + "\t\tAND #{endTime}\n" + "\t\t UNION\n" + "\tSELECT\n" + "\t\to.* \n" + "\tFROM\n" + "\t\ttj_order o\n" + "\t\tLEFT JOIN ( SELECT e.order_id FROM tj_order_detail e WHERE e.deleted = 0 AND e.exception_desc = 1 GROUP BY e.order_id ) bb ON bb.order_id = o.order_id \n" + "\tWHERE\n" + "\t\to.deleted = 0 \n" + "\t\tAND ! ISNULL( bb.order_id ) \n" + "\t\tAND o.create_time BETWEEN #{strTime} \n" + "\tAND #{endTime}\n" + "\t)xx GROUP BY xx.order_id)c ON c.user_id=cus.cus_id") List<TjCustomer> getHyYcXmList(@Param("strTime") Date strTime, @Param("endTime")Date endTime); @Select("SELECT * FROM tj_customer cus JOIN (\t\n" + "SELECT\n" + "\t\to.* \n" + "\tFROM\n" + "\t\ttj_order o\n" + "\tWHERE\n" + "\t\to.deleted = 0 \n" + "\t\tAND o.create_time BETWEEN #{strTime} \n" + "\tAND #{endTime}) c ON c.user_id=cus.cus_id") List<TjCustomer> getCgYcXmList(@Param("strTime") Date strTime, @Param("endTime")Date endTime); @Select("SELECT\n" + " COUNT(*)\n" + " FROM\n" + " ltkj_hysqd a\n" + " JOIN ltkj_hybgd b ON a.tmh = b.tmh \n" + " WHERE\n" + " b.jyjg NOT BETWEEN SUBSTRING_INDEX( b.fwz, '-', 1 ) AND b.jyjg > SUBSTRING_INDEX( b.fwz, '-',- 1 )\n" + " AND\n" + " a.tjh=#{cardId}") int getHyYcXmCount(String cardId); } ltkj-hosp/src/main/java/com/ltkj/hosp/service/LtkjHysqdService.java
@@ -1,9 +1,12 @@ package com.ltkj.hosp.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.domain.TjOrder; import com.ltkj.hosp.sqlDomain.LtkjHybgd; import com.ltkj.hosp.sqlDomain.LtkjHysqd; import java.util.Date; import java.util.List; /** @@ -19,4 +22,10 @@ void deletedLtkjHysqdByTjhAndTmh(String tjh,String tmh); List<LtkjHysqd> getLtkjHysqdByTjh(String tjh); List<TjCustomer> getCgYcXmList(Date strTime, Date endTime); List<TjCustomer> getHyYcXmList(Date strTime, Date endTime); int getHyYcXmCount(String cardId); } ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/LtkjHysqdServiceImpl.java
@@ -1,6 +1,8 @@ package com.ltkj.hosp.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ltkj.hosp.domain.TjCustomer; import com.ltkj.hosp.domain.TjOrder; import com.ltkj.hosp.mapper.LtkjExamJcsqdMapper; import com.ltkj.hosp.mapper.LtkjHysqdMapper; import com.ltkj.hosp.service.LtkjExamJcsqdService; @@ -10,6 +12,8 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Collections; import java.util.Date; import java.util.List; /** @@ -38,4 +42,19 @@ public List<LtkjHysqd> getLtkjHysqdByTjh(String tjh) { return mapper.getLtkjHysqdByTjh(tjh); } @Override public List<TjCustomer> getCgYcXmList(Date strTime, Date endTime) { return mapper.getCgYcXmList(strTime,endTime); } @Override public List<TjCustomer> getHyYcXmList(Date strTime, Date endTime) { return mapper.getHyYcXmList(strTime,endTime); } @Override public int getHyYcXmCount(String cardId) { return mapper.getHyYcXmCount(cardId); } }