| | |
| | | private ISysDictDataService dictDataService; |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | @Autowired |
| | | private IDictCompService dictCompService; |
| | | @Autowired |
| | | private ITjDwDeptService tjDwDeptService; |
| | | @Autowired |
| | | private ITjDwGroupingService tjDwGroupingService; |
| | | |
| | | @Value("${path.filePath}") |
| | | private String value; |
| | |
| | | @ApiOperation(value = "导出excel表模板") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | //原来的下载模板调用接口 |
| | | String base64String = PDFBinaryUtil.getPDFBinary(configService.selectConfigByKey("default_excelTemplate")); |
| | | if (null != base64String) { |
| | | PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls"); |
| | | String filePath = value + File.separator + "团体预约Excel模版.xls"; |
| | | File f = new File(filePath); |
| | | BufferedInputStream br = null; |
| | | OutputStream out = null; |
| | | FileInputStream fileInputStream = null; |
| | | try { |
| | | fileInputStream = new FileInputStream(f); |
| | | br = new BufferedInputStream(fileInputStream); |
| | | byte[] bs = new byte[1024]; |
| | | int len = 0; |
| | | response.reset(); // 非常重要 |
| | | if (true) { |
| | | // 在线打开方式 |
| | | URL u = new URL("file:///" + filePath); |
| | | //System.out.println(u); |
| | | String contentType = u.openConnection().getContentType(); |
| | | response.setContentType(contentType); |
| | | response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls"); |
| | | } else { |
| | | // 纯下载方式 |
| | | response.setContentType("application/x-msdownload"); |
| | | response.setContentType("application/pdf;charset=utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls"); |
| | | } |
| | | out = response.getOutputStream(); |
| | | while ((len = br.read(bs)) > 0) { |
| | | out.write(bs, 0, len); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | //System.out.println("pdf处理文件异常" + e); |
| | | } finally { |
| | | if (out != null) { |
| | | try { |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | try { |
| | | String base64String = PDFBinaryUtil.getPDFBinary(value + File.separator + "西安路泰机电科技有限公司.xls"); |
| | | if (null != base64String) { |
| | | PDFBinaryUtil.base64StringToPDF(base64String, FileUtil.mkdir(value).getPath() + File.separator + "团体预约Excel模版.xls"); |
| | | String filePath = value + File.separator + "团体预约Excel模版.xls"; |
| | | File f = new File(filePath); |
| | | BufferedInputStream br = null; |
| | | OutputStream out = null; |
| | | FileInputStream fileInputStream = null; |
| | | try { |
| | | fileInputStream = new FileInputStream(f); |
| | | br = new BufferedInputStream(fileInputStream); |
| | | byte[] bs = new byte[1024]; |
| | | int len = 0; |
| | | response.reset(); // 非常重要 |
| | | if (true) { |
| | | // 在线打开方式 |
| | | URL u = new URL("file:///" + filePath); |
| | | //System.out.println(u); |
| | | String contentType = u.openConnection().getContentType(); |
| | | response.setContentType(contentType); |
| | | response.setHeader("Content-Disposition", "inline;filename=团体预约Excel模版.xls"); |
| | | } else { |
| | | // 纯下载方式 |
| | | response.setContentType("application/x-msdownload"); |
| | | response.setContentType("application/pdf;charset=utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=团体预约Excel模版.xls"); |
| | | } |
| | | out = response.getOutputStream(); |
| | | while ((len = br.read(bs)) > 0) { |
| | | out.write(bs, 0, len); |
| | | } |
| | | out.flush(); |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | //System.out.println("pdf处理文件异常" + e); |
| | | } finally { |
| | | if (out != null) { |
| | | try { |
| | | out.close(); |
| | | br.close(); |
| | | fileInputStream.close(); |
| | | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | ExcelUtils.exportTemplate(response,"团体预约Excel模版",TjReservation.class); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | reservation.setPacId(dwDept.getId()); |
| | | reservation.setPacId(dwGrouping.getId()); |
| | | compPay = compPay.add(dwGrouping.getYsPrice()); |
| | | // reservation.setTjType(String.valueOf(1)); |
| | | reservation.setTeamNo(teamNo); |
| | |
| | | return AjaxResult.error("请选择预约对象"); |
| | | } |
| | | |
| | | /** |
| | | * 团体预约体检信息 联动下拉框 |
| | | * @param pid |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @GetMapping("/linkage") |
| | | public String linkage(@RequestParam("pid") String pid, @RequestParam("type") String type) { |
| | | switch (type){ |
| | | case "1": |
| | | List<DictComp> list = dictCompService.list(); |
| | | List<HashMap<String, Object>> collect = list.stream().map(i -> { |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("value", i.getDrugManufacturerId()); |
| | | hashMap.put("text", i.getCnName()); |
| | | return hashMap; |
| | | }).collect(Collectors.toList()); |
| | | return JSONUtil.toJsonStr(collect); |
| | | case "2": |
| | | List<TjDwDept> list1 = tjDwDeptService.getDwDeptListByTjDwDeptId(pid); |
| | | List<HashMap<String, Object>> collect1 = list1.stream().map(i -> { |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("value", i.getId()); |
| | | hashMap.put("text", i.getDwDeptName()); |
| | | return hashMap; |
| | | }).collect(Collectors.toList()); |
| | | return JSONUtil.toJsonStr(collect1); |
| | | case "3": |
| | | LambdaQueryWrapper<TjDwGrouping> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TjDwGrouping::getDwDeptId,pid); |
| | | List<TjDwGrouping> list2 = tjDwGroupingService.list(wrapper); |
| | | List<HashMap<String, Object>> collect2 = list2.stream().map(i -> { |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("value", i.getId()); |
| | | hashMap.put("text", i.getGroupingName()); |
| | | return hashMap; |
| | | }).collect(Collectors.toList()); |
| | | return JSONUtil.toJsonStr(collect2); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |