| | |
| | | import cn.hutool.extra.pinyin.PinyinUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | 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.utils.PDFDocumentUtil; |
| | | import com.ltkj.common.utils.SecurityUtils; |
| | | import com.ltkj.framework.config.MatchUtils; |
| | | import com.ltkj.framework.config.ThreadPoolConfig; |
| | | import com.ltkj.framework.config.UserHoder; |
| | | import com.ltkj.framework.datasource.DynamicDataSourceContextHolder; |
| | | import com.ltkj.hosp.domain.*; |
| | |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import com.ltkj.system.service.ISysUserService; |
| | | import com.ltkj.web.controller.his.HisApiMethod; |
| | | import com.ltkj.web.controller.his.HisMzJysqController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.DigestUtils; |
| | |
| | | private LtkjMiddleHeadService headService; |
| | | @Resource |
| | | private TjvLtkjvtjpatService tjvLtkjvtjpatService; |
| | | @Autowired |
| | | private ThreadPoolConfig threadPoolConfig; |
| | | |
| | | @Autowired |
| | | private HisApiMethod hisApiMethod; |
| | | |
| | | @Autowired |
| | | private HisMzJysqController hisMzJysqController; |
| | | |
| | | |
| | | /** |
| | |
| | | wq1.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation tjReservation = tjReservationService.getOne(wq1); |
| | | MallOrder mallOrder = null; |
| | | if (tjReservation != null) { |
| | | order.setReservationId(tjReservation.getId()); |
| | | if (null != tjReservation) { |
| | | 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("未到预约时间"); |
| | |
| | | tjOrder.setStatus(TjConstants.TJ_BEGIN); |
| | | tjOrder.setCardId(tjCustomer.getCardId()); |
| | | if (tjOrderService.save(tjOrder)) { |
| | | |
| | | //保存收货地址 |
| | | if ("2".equals(tjOrder.getGetType())) { |
| | | final TjReportGetAddress address = tjOrder.getAddAddress(); |
| | |
| | | // |
| | | // } |
| | | // } |
| | | |
| | | |
| | | /*调用his接口*/ |
| | | String config = configService.selectConfigByKey("sfkqdyhis"); |
| | | if(null !=config && config.equals("Y")){ |
| | | hisApiMethod.HisApiMethods(tjCustomer,tjOrder.getOrderId()); |
| | | } |
| | | tjCustomer.setCardId("0"); |
| | | tjCustomerService.updateById(tjCustomer); |
| | | |
| | | return AjaxResult.success(tjNumber); |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | wq.in(TjCustomer::getCusIdcard, cusIds); |
| | | List<Long> list = tjCustomerService.list(wq).stream().map(TjCustomer::getCusId).collect(Collectors.toList()); |
| | | if (list.size() > 0) { |
| | | ExecutorService threadPool = Executors.newFixedThreadPool(list.size()); |
| | | // ExecutorService threadPool = Executors.newFixedThreadPool(list.size()); |
| | | ThreadPoolTaskExecutor executor = threadPoolConfig.threadPoolTaskExecutor(); |
| | | for (Long aLong : list) { |
| | | // threadPool.execute(new Runnable() { |
| | | // @Override |
| | |
| | | // } |
| | | // } |
| | | // }); |
| | | Future<AjaxResult> future = threadPool.submit(new Callable<AjaxResult>() { |
| | | Future<AjaxResult> future = executor.submit(new Callable<AjaxResult>() { |
| | | @Override |
| | | public AjaxResult call() throws Exception { |
| | | return getAjaxResult(aLong, sysUser, daoDto.getTjCategory()); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | threadPool.shutdown(); |
| | | threadPools.shutdown(); |
| | | } |
| | | } |
| | | System.out.println("tjNumbers = " + tjNumbers); |
| | | // TODO 因为有体检号会查出空数据 先使用死数据 |
| | | tjNumbers = new ArrayList<>(); |
| | | tjNumbers.add("02095240229171627"); |
| | |
| | | try { |
| | | List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumbers.get(i)); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumbers.get(i)); |
| | | System.out.println(userInfo); |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | | String time = null; |
| | | if (tjsj != null) { |
| | | time = dateFormat.format(tjsj); |
| | | } |
| | | PDFDocumentUtil.makeUserInfoTable(document, (String) userInfo.get("tjname"), (String) userInfo.get("sex") |
| | | , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), dateFormat.format(tjsj)); |
| | | , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), time); |
| | | PDFDocumentUtil.makeTjInfo(document, djdInfos); |
| | | // 多条则换页 |
| | | if (i + 1 < tjNumbers.size()) { |
| | |
| | | } |
| | | } |
| | | document.close(); |
| | | // TODO 修改返回文件base64 |
| | | ByteArrayOutputStream outputStream = (ByteArrayOutputStream) map.get("stream"); |
| | | // 设置HTTP响应头 |
| | | response.setContentType("application/pdf"); |
| | | response.setHeader("Content-Disposition", "inline; filename=\"downloaded.pdf\""); |
| | | response.getOutputStream().write(outputStream.toByteArray()); |
| | | response.getOutputStream().flush(); |
| | | String encodeToString = java.util.Base64.getEncoder().encodeToString(outputStream.toByteArray()); |
| | | return AjaxResult.success().put("file", encodeToString); |
| | | } catch (IOException | DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | if (null != ppList && ppList.size() > 0) { |
| | | //异步保存数据库 |
| | | // asyncService.addRedisTransitionPac(cusId, pacId, ppList); |
| | | asyncService.saveRedisTransitionByPacId(cusId, pacId, null); |
| | | asyncService.saveRedisTransitionByPacId(cusId,cardId, pacId, null); |
| | | for (TjPackageProject tjPackageProject : ppList) { |
| | | TjProject project = projectService.getTjProjectById(String.valueOf(tjPackageProject.getProId())); |
| | | if (null != project) { |
| | |
| | | //单项 |
| | | if (null != proIds && proIds.size() > 0) { |
| | | //异步保存数据库表 |
| | | asyncService.saveRedisTransitionByPacId(cusId, null, proIds); |
| | | asyncService.saveRedisTransitionByPacId(cusId,cardId,null, proIds); |
| | | for (Long proId : proIds) { |
| | | List<TbTransition> transitions = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId)); |
| | | if (null != transitions && transitions.size() > 0) { |
| | |
| | | return AjaxResult.error("请选择要撤销的人员!"); |
| | | } |
| | | |
| | | // @PostMapping("makeTjPDF1") |
| | | // @ApiOperation(value = "根据体检号生成PDF") |
| | | // public AjaxResult makeTjPDF(@RequestBody List<String> tjNumbers, HttpServletResponse response) { |
| | | // System.out.println("tjNumbers = " + tjNumbers); |
| | | // Map<String, Object> map = null; |
| | | // try { |
| | | // map = PDFDocumentUtil.getDocument(); |
| | | // Document document = (Document) map.get("document"); |
| | | // for (int i = 0; i < tjNumbers.size(); i++) { |
| | | // try { |
| | | // List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumbers.get(i)); |
| | | // Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumbers.get(i)); |
| | | // PDFDocumentUtil.makeUserInfoTable(document, userInfo.get("tjname"), userInfo.get("sex"), userInfo.get("tjh"), userInfo.get("lxdh"), userInfo.get("tjname"), userInfo.get("tjsj")); |
| | | // PDFDocumentUtil.makeTjInfo(document, djdInfos); |
| | | // // 多条则换页 |
| | | // if (i + 1 < tjNumbers.size()) { |
| | | // document.newPage(); |
| | | // } |
| | | // } catch (DocumentException | IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // document.close(); |
| | | // } catch (IOException | DocumentException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return AjaxResult.success(); |
| | | // } |
| | | |
| | | @PostMapping("makeTjPDF") |
| | | @ApiOperation(value = "批量生成PDF") |
| | | public AjaxResult makeTjPDF(@RequestBody List<String> reservations) { |
| | | QueryWrapper<TjOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("reservation_id",reservations); |
| | | List<TjOrder> tjNumbers = tjOrderService.list(queryWrapper); |
| | | Map<String, Object> map = null; |
| | | try { |
| | | map = PDFDocumentUtil.getDocument(); |
| | | Document document = (Document) map.get("document"); |
| | | for (int i = 0; i < tjNumbers.size(); i++) { |
| | | String tjNumber = tjNumbers.get(i).getTjNumber(); |
| | | try { |
| | | List<Map<String, String>> djdInfos = tjOrderService.selectDjdInfo(tjNumber); |
| | | Map<String, Object> userInfo = tjOrderService.selectDjdUserInfo(tjNumber); |
| | | LocalDateTime tjsj = (LocalDateTime) userInfo.get("tjsj"); |
| | | DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| | | String time = null; |
| | | if (tjsj != null) { |
| | | time = dateFormat.format(tjsj); |
| | | } |
| | | PDFDocumentUtil.makeUserInfoTable(document, (String) userInfo.get("tjname"), (String) userInfo.get("sex") |
| | | , (String) userInfo.get("tjh"), (String) userInfo.get("lxdh"), (String) userInfo.get("tjname"), time); |
| | | PDFDocumentUtil.makeTjInfo(document, djdInfos); |
| | | // 多条则换页 |
| | | if (i + 1 < tjNumbers.size()) { |
| | | document.newPage(); |
| | | } |
| | | } catch (DocumentException | IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | document.close(); |
| | | ByteArrayOutputStream outputStream = (ByteArrayOutputStream) map.get("stream"); |
| | | String encodeToString = java.util.Base64.getEncoder().encodeToString(outputStream.toByteArray()); |
| | | return AjaxResult.success().put("file", encodeToString); |
| | | } catch (IOException | DocumentException e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | |