| | |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.databind.BeanProperty; |
| | | import com.ltkj.common.core.domain.entity.SysDept; |
| | |
| | | private LtkjMiddleHeadService headService; |
| | | @Resource |
| | | private TjvLtkjvtjpatService tjvLtkjvtjpatService; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | TjReservation tjReservation = tjReservationService.getOne(wq1); |
| | | MallOrder mallOrder = null; |
| | | if (tjReservation != null) { |
| | | order.setReservationId(tjReservation.getId()); |
| | | mallOrder = mallOrderService.getOne(new LambdaQueryWrapper<MallOrder>().eq(MallOrder::getReservationId, tjReservation.getId())); |
| | | if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | return AjaxResult.error("未到预约时间"); |
| | |
| | | mallOrder.setOrderStatus(301L); |
| | | mallOrderService.updateById(mallOrder); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/addPlOrderAndDetail") |
| | | @ApiOperation(value = "体检批量签到登记接口") |
| | | @Transactional //(切换数据库出错,所以注释) |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto){ |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto) { |
| | | SysUser sysUser = UserHoder.getLoginUser().getUser(); |
| | | List<String> cusIds = daoDto.getCusIds(); |
| | | if(null !=cusIds && cusIds.size()>0){ |
| | | if (null != cusIds && cusIds.size() > 0) { |
| | | ExecutorService threadPools = Executors.newFixedThreadPool(cusIds.size()); |
| | | for (String cusId : cusIds) { |
| | | threadPools.execute(new Runnable() { |
| | |
| | | }); |
| | | } |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.in(TjCustomer::getCusIdcard,cusIds); |
| | | wq.in(TjCustomer::getCusIdcard, cusIds); |
| | | List<Long> list = tjCustomerService.list(wq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | if(list.size()>0){ |
| | | if (list.size() > 0) { |
| | | ExecutorService threadPool = Executors.newFixedThreadPool(list.size()); |
| | | for (Long aLong : list) { |
| | | threadPool.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | try { |
| | | getAjaxResult(aLong,sysUser,daoDto.getTjCategory()); |
| | | getAjaxResult(aLong, sysUser, daoDto.getTjCategory()); |
| | | threadPool.shutdown(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | |
| | | if (!"".equals(cusIdcard) && cusIdcard != null) { |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | if ("Y".equals(getInfoFromSqlData)){ |
| | | if ("Y".equals(getInfoFromSqlData)) { |
| | | //根据身份证号从his查信息 |
| | | LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(cusIdcard); |
| | | if(null != tjPatByIdCard){ |
| | | if (null != tjPatByIdCard) { |
| | | String fcardNo = tjPatByIdCard.getFcardNo(); |
| | | if(null !=fcardNo && !fcardNo.equals("")){ |
| | | fcardNo=fcardNo.trim(); |
| | | if (null != fcardNo && !fcardNo.equals("")) { |
| | | fcardNo = fcardNo.trim(); |
| | | tjPatByIdCard.setFcardNo(fcardNo); |
| | | }else { |
| | | fcardNo=cusIdcard.trim(); |
| | | } else { |
| | | fcardNo = cusIdcard.trim(); |
| | | tjPatByIdCard.setFcardNo(fcardNo); |
| | | } |
| | | //根据身份证号从数据库拿信息 没有的话保存 |
| | | LtkjTjPat ltkjTjPat = tjvLtkjvtjpatService.getLtkjTjPatByCusIdCard(cusIdcard); |
| | | if(null==ltkjTjPat){ |
| | | if (null == ltkjTjPat) { |
| | | tjvLtkjvtjpatService.save(tjPatByIdCard); |
| | | } |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | //再根据身份证号写customer表 |
| | | TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(tjPatByIdCard.getFcardNo()); |
| | | if(null == tjCustomer){ |
| | | if (null == tjCustomer) { |
| | | //为空的话掉存储过程保存到客户表 |
| | | testMapper.getTjPatByCusId(cusIdcard); |
| | | LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>(); |
| | |
| | | TjCustomer customer = tjCustomerService.getOne(qw); |
| | | customer.setReservationId(customer.getCardId()); |
| | | extracteds(customer); |
| | | }else { |
| | | } else { |
| | | String cardId = tjPatByIdCard.getFcardId(); |
| | | if(null !=cardId && !cardId.equals("0")){ |
| | | if (null != cardId && !cardId.equals("0")) { |
| | | int i = tjOrderService.selectTjOrderByCardId(cardId); |
| | | if(i>0){ |
| | | if (i > 0) { |
| | | // return AjaxResult.error("不可重复签到"); |
| | | } |
| | | } |
| | |
| | | tjCustomer1.setAgeUnit(tjReservation.getAgeUnit()); |
| | | tjCustomer1.setCareer(tjReservation.getCareer()); |
| | | tjCustomerService.updateById(tjCustomer1); |
| | | }else { |
| | | } else { |
| | | TjCustomer tjCustomer = new TjCustomer(); |
| | | tjCustomer.setCusIdcard(tjReservation.getIdCard()); |
| | | tjCustomer.setCusName(tjReservation.getName()); |
| | |
| | | //从his表抓数据 |
| | | LtkjMiddleHead pat = testMapper.getMiddleHeadByPartId(customer.getCardId()); |
| | | if (null != pat) { |
| | | LambdaQueryWrapper<LtkjMiddleHead> wq1=new LambdaQueryWrapper<>(); |
| | | wq1.eq(LtkjMiddleHead::getFeadId,customer.getCardId()); |
| | | LambdaQueryWrapper<LtkjMiddleHead> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.eq(LtkjMiddleHead::getFeadId, customer.getCardId()); |
| | | headService.remove(wq1); |
| | | LambdaQueryWrapper<LtkjMiddleDetail> wq0=new LambdaQueryWrapper<>(); |
| | | wq0.eq(LtkjMiddleDetail::getFheadId,pat.getFeadId()); |
| | | LambdaQueryWrapper<LtkjMiddleDetail> wq0 = new LambdaQueryWrapper<>(); |
| | | wq0.eq(LtkjMiddleDetail::getFheadId, pat.getFeadId()); |
| | | middleDetailService.remove(wq0); |
| | | List<LtkjMiddleDetail> list = testMapper.getMiddleDetailByFeadId(pat.getFeadId()); |
| | | DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name()); |
| | | LtkjMiddleHead o = headService.getMiddleHeadByPartId(customer.getCardId()); |
| | | if(o==null){ |
| | | if (o == null) { |
| | | headService.save(pat); |
| | | for (LtkjMiddleDetail ltkjMiddleDetail : list) { |
| | | middleDetailService.save(ltkjMiddleDetail); |
| | |
| | | DynamicDataSourceContextHolder.clearDataSourceType(); |
| | | } |
| | | |
| | | private AjaxResult getAjaxResult(Long userId,SysUser sysUser,String tjCategory) throws IOException { |
| | | private AjaxResult getAjaxResult(Long userId, SysUser sysUser, String tjCategory) throws IOException { |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusId,userId); |
| | | wq.eq(TjCustomer::getCusId, userId); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(wq); |
| | | if (tjCustomer == null) return AjaxResult.error("该客户未登记或不存在"); |
| | | |
| | | LambdaQueryWrapper<TjOrder> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TjOrder::getUserId,userId); |
| | | wqq.eq(TjOrder::getUserId, userId); |
| | | wqq.eq(TjOrder::getCheckStatus, 0); |
| | | wqq.isNull(TjOrder::getFinishTime); |
| | | if (!tjCustomer.getCardId().equals("0")) { |
| | |
| | | transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId()); |
| | | return AjaxResult.error("不可重复登记"); |
| | | } |
| | | TjOrder tjOrder=new TjOrder(); |
| | | Date date=new Date(); |
| | | TjOrder tjOrder = new TjOrder(); |
| | | Date date = new Date(); |
| | | tjOrder.setCreateTime(date); |
| | | tjOrder.setUpdateTime(date); |
| | | tjOrder.setCreateBy(sysUser.getNickName()); |
| | |
| | | TjReservation tjReservation = tjReservationService.getOne(wq1); |
| | | MallOrder mallOrder = null; |
| | | if (tjReservation != null) { |
| | | tjOrder.setReservationId(tjReservation.getId()); |
| | | mallOrder = mallOrderService.getOne(new LambdaQueryWrapper<MallOrder>().eq(MallOrder::getReservationId, tjReservation.getId())); |
| | | if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | return AjaxResult.error("未到预约时间"); |
| | |
| | | //生成体检号 |
| | | String tjNumber = (sysUser.getUserName() + new SimpleDateFormat("yyMMddHHmmss").format(new Date())); |
| | | |
| | | tjNumber=tjNumber.replaceAll(".{4}$",userId.toString().substring(userId.toString().length() - 4)); |
| | | tjNumber = tjNumber.replaceAll(".{4}$", userId.toString().substring(userId.toString().length() - 4)); |
| | | |
| | | tjOrder.setTjNumber(tjNumber); |
| | | if (null != tjOrder.getPhoto()) { |
| | |
| | | |
| | | //调用SQL server拿取收费情况 |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | String isPay = configService.selectConfigByKey("isPay"); |
| | | String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | | String isPay = configService.selectConfigByKey("isPay"); |
| | | if ("Y".equals(getInfoFromSqlData)) { |
| | | LtkjMiddleHead middleHead = headService.getMiddleHeadByPartId(tjCustomer.getCardId()); |
| | | if (null != middleHead) { |
| | |
| | | mallOrder.setOrderStatus(301L); |
| | | mallOrderService.updateById(mallOrder); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | // tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith()); |
| | | // tjFlowingWater.setPaidIn(tjOrder.getTjFlowingWater().getPaidIn()); |
| | | // tjFlowingWater.setDiscount(tjOrder.getTjFlowingWater().getDiscount()); |
| | |
| | | |
| | | //团体 |
| | | // if ("1".equals(tjOrder.getTjType())) { |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | asyncService.ttextracted(tjOrder, tjCustomer, sysUser, tjReservation, tjFlowingWater); |
| | | // } |
| | | //个人 |
| | | // if ("2".equals(tjOrder.getTjType())) { |
| | |
| | | if (null != project) { |
| | | |
| | | BigDecimal divide = BigDecimal.valueOf(0); |
| | | if(tjPackageProject.getPriceNow().compareTo(BigDecimal.valueOf(0))==0 || project.getProPrice().compareTo(BigDecimal.valueOf(0))==0 ){ |
| | | divide=BigDecimal.valueOf(0); |
| | | }else { |
| | | divide=tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.HALF_DOWN); |
| | | if (tjPackageProject.getPriceNow().compareTo(BigDecimal.valueOf(0)) == 0 || project.getProPrice().compareTo(BigDecimal.valueOf(0)) == 0) { |
| | | divide = BigDecimal.valueOf(0); |
| | | } else { |
| | | divide = tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.HALF_DOWN); |
| | | } |
| | | List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId())); |
| | | if (null != tjProSonList && tjProSonList.size() > 0) { |
| | |
| | | // if (redisCache.hasKey(cardId + cusId)) { |
| | | // transitionList = redisCache.getCacheList(cardId + cusId); |
| | | // } else { |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); |
| | | transitionList = transitionService.getTbTransitionListByCusId(cusId, cardId); |
| | | // } |
| | | if (null == transitionList) return null; |
| | | Map<Long, List<TbTransition>> collect = transitionList.stream().collect(Collectors.groupingBy(TbTransition::getParentProId)); |
| | |
| | | // } else { |
| | | // map.put("nowPrice", tjProject.getProPrice()); |
| | | // } |
| | | map.put("nowPrice",transitionService.getTbTransitionDxPriceByPac(cusId,entry.getKey(),cardId,pacId)); |
| | | map.put("nowPrice", transitionService.getTbTransitionDxPriceByPac(cusId, entry.getKey(), cardId, pacId)); |
| | | } else { |
| | | map.put("pacName", "单项"); |
| | | List<TbTransition> tbTransitionList = entry.getValue(); |
| | |
| | | final List<TjFlowingWater> list1 = tjFlowingWaterService.list(wqq); |
| | | if (list1 != null) { |
| | | for (TjFlowingWater tjFlowingWater : list1) { |
| | | if (tjFlowingWater!=null && tjFlowingWater.getPaidIn()!=null){ |
| | | if (tjFlowingWater != null && tjFlowingWater.getPaidIn() != null) { |
| | | res.add(tjFlowingWater.getPaidIn()); |
| | | } |
| | | } |
| | |
| | | public AjaxResult revokeTjOrderByTjNum(@RequestParam @ApiParam(value = "体检号") String tjNum) { |
| | | |
| | | TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if(null !=order){ |
| | | if (null != order) { |
| | | String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | if(null!=payByTjNum){ |
| | | if (null != payByTjNum) { |
| | | return AjaxResult.success("该用户已收费不可撤销签到!"); |
| | | } |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | |
| | | return AjaxResult.success("签到记录不存在!"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getCusTomterListByCompId") |
| | | @ApiOperation(value = "获取单位id体检人信息接口") |
| | | public AjaxResult getCusTomterListByCompId(@RequestParam(required = false) @ApiParam(value = "单位id") String compId, |
| | | @RequestParam(required = false) @ApiParam(value = "名字") String name, |
| | | @RequestParam(required = false) @ApiParam(value = "部门id") String deptId, |
| | | @RequestParam(required = false) @ApiParam(value = "预约时间") Date reservationTime, |
| | | @RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "10") Integer pageSize) { |
| | | Page<TjReservation> pages = new Page<>(page, pageSize); |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | if (null != compId) wq.eq(TjReservation::getCompanyId, compId); |
| | | if (null != name) wq.eq(TjReservation::getName, name); |
| | | if (null != deptId) wq.eq(TjReservation::getDepartment, deptId); |
| | | if (null != reservationTime) |
| | | wq.between(TjReservation::getReservationTime, DateUtil.beginOfDay(reservationTime), DateUtil.endOfDay(reservationTime)); |
| | | List<TjReservation> reservationList = tjReservationService.list(wq); |
| | | if (null != reservationList && reservationList.size() > 0) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getReservationId, reservationList.stream().map(TjReservation::getId).collect(Collectors.toList())); |
| | | List<TjOrder> orderList = tjOrderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | LambdaQueryWrapper<TjReservation> wq3 = new LambdaQueryWrapper<>(); |
| | | wq3.in(TjReservation::getId, orderList.stream().map(TjOrder::getReservationId).collect(Collectors.toList())); |
| | | // wq3.eq(TjReservation::getTeamNo,reservationList.get(0).getTeamNo()); |
| | | Page<TjReservation> page1 = tjReservationService.page(pages, wq3); |
| | | return AjaxResult.success(page1); |
| | | |
| | | } |
| | | } |
| | | return AjaxResult.success("暂无信息"); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/plRevokeTjOrderByTjNum") |
| | | @ApiOperation(value = "根据客户体检号批量撤销体检记录") |
| | | @Transactional |
| | | public AjaxResult plRevokeTjOrderByTjNum(@RequestBody @ApiParam(value = "预约主键id集合") List<String> reservationIds) { |
| | | if (null != reservationIds && reservationIds.size() > 0) { |
| | | LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>(); |
| | | wq1.in(TjOrder::getReservationId, reservationIds); |
| | | List<TjOrder> orderList = tjOrderService.list(wq1); |
| | | if (null != orderList && orderList.size() > 0) { |
| | | for (TjOrder order : orderList) { |
| | | // TjOrder order = tjOrderService.getOrderByTjNum(tjNum); |
| | | if (null != order) { |
| | | // String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId())); |
| | | // if (null != payByTjNum) { |
| | | // return AjaxResult.success("该用户已收费不可撤销签到!"); |
| | | // } |
| | | tjOrderService.deleteTjOrderByOrderId(order.getOrderId()); |
| | | tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId())); |
| | | remarkService.deletedOrderRemarkByTjNum(order.getTjNumber()); |
| | | tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId())); |
| | | transitionService.deletedTbTransitionByTjNum(order.getTjNumber()); |
| | | transitionService.updateTbTransitionByTjNum(order.getTjNumber()); |
| | | } |
| | | } |
| | | for (String id : reservationIds) { |
| | | TjReservation reservation = tjReservationService.getById(id); |
| | | if(null !=reservation){ |
| | | reservation.setIsExpire(2); |
| | | tjReservationService.updateById(reservation); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success("撤销成功!!!"); |
| | | } |
| | | return AjaxResult.error("请选择要撤销的人员!"); |
| | | } |
| | | |
| | | } |
| | | |