コード例 #1
0
  @RequestMapping(value = "/exportInStationTransfor", method = RequestMethod.GET)
  public void export(Parameter parameter, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    logger.info("导出院内转运统计到excel");
    response.setContentType("application/msexcel;charset=UTF-8");

    String title = "院内转运统计";
    String[] headers = new String[] {"出诊分站", "转运次数", "里程", "转运耗时"};
    String[] fields = new String[] {"station", "transforTimes", "distance", "transforTime"};
    int spanCount = 1; // 需要合并的列数。从第1列开始到指定列。
    TableData td =
        ExcelUtils.createTableData(
            inStationTransforService.getData(parameter).getRows(),
            ExcelUtils.createTableHeader(headers, spanCount),
            fields);
    JsGridReportBase report = new JsGridReportBase(request, response);

    HttpSession session = request.getSession();
    SessionInfo sessionInfo = (SessionInfo) session.getAttribute("sessionInfo");
    if (null != sessionInfo) {
      report.exportToExcel(title, sessionInfo.getUser().getName(), td, parameter);
    } else {
      report.exportToExcel(title, "", td, parameter);
    }
  }
コード例 #2
0
  @RequestMapping(value = "/exportInStationTransforDetail", method = RequestMethod.GET)
  public void export(Parameter parameter, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    logger.info("导出院内转运明细到excel");
    response.setContentType("application/msexcel;charset=UTF-8");

    String title = "院内转运明细";
    String[] headers =
        new String[] {"日期", "病人姓名", "年龄", "性别", "诊断", "出诊分站", "送达科室", "现场地址", "距离", "耗时"};
    String[] fields =
        new String[] {
          "date",
          "patientName",
          "age",
          "gender",
          "diagnose",
          "outCallAddress",
          "sendClass",
          "spot",
          "distance",
          "time"
        };
    int spanCount = 1; // 需要合并的列数。从第1列开始到指定列。
    TableData td =
        ExcelUtils.createTableData(
            inStationTransforDetailService.getData(parameter).getRows(),
            ExcelUtils.createTableHeader(headers, spanCount),
            fields);
    JsGridReportBase report = new JsGridReportBase(request, response);

    HttpSession session = request.getSession();
    SessionInfo sessionInfo = (SessionInfo) session.getAttribute("sessionInfo");
    if (null != sessionInfo) {
      report.exportToExcel(title, sessionInfo.getUser().getName(), td, parameter);
    } else {
      report.exportToExcel(title, "", td, parameter);
    }
  }