function doSearch() { var bllx = $("input[name='bllx']:checked").val(); var param = new Object(); var qxbm = $("#qxbm").combobox("getValue"); var yydj = $("#yydj").combobox("getValue"); var bgrqstartDate = $("#bgrqstartDate").val(); var bgrqendDate = $("#bgrqendDate").val(); if(bgrqstartDate==null||bgrqstartDate==""){ } else if(bgrqendDate==null||bgrqendDate==""){ } else if(bgrqstartDate > bgrqendDate){ $.messager.alert("警告", getMessage(MSG_C012,"就诊日期(结束)","就诊日期(开始)")); return false; } if(bllx) { param.bllx = bllx; } if(qxbm) { param.qxbm = qxbm; } if(yydj) { param.yydj = yydj; } if(bgrqstartDate) { param.bgrqstartDate = bgrqstartDate; } if(bgrqendDate) { param.bgrqendDate = bgrqendDate; } $("#grid").datagrid("options").url="<%= request.getContextPath() %>/sh/shReportFyybgsQuery.action"; $("#grid").datagrid("load",param); } function exportExcel() { var rows = $("#grid").datagrid("getData").rows; var params = $.param($("#grid").datagrid("options").queryParams); var maxCount = rows.length; if(maxCount <= 10000 && maxCount >= 1) { window.location.href = "<%= request.getContextPath() %>/sh/shReportFyybgsExcel.action?"+params; }else if(maxCount < 1) { $.messager.alert("警告",getMessage(MSG_C017)); }else{ $.messager.alert("警告",getMessage(MSG_C005)); }; }
/** * 分医院报告数报表查询 * @return */ public String query() { List<ShReportFyybgsVo> queryVo = shReportFyybgsService.query(vo); BaseJqueryGridVo gridVo = new BaseJqueryGridVo(); gridVo.setRows(queryVo); gridVo.setTotal(queryVo.size()); String json = VOUtils.getJsonData(gridVo); createJSonData(json); return "ajax"; } /** * 分医院报告数报表导出 * @return */ public void excelQuery() { String realPath = PublicUtil.getRealPath(this.servletRequest); try { String filepath = ""; filepath = realPath+"\excel\ShReportFyybgs.xls"; HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(new File(filepath))); List<ShReportFyybgsVo> list = shReportFyybgsService.query(vo); HSSFSheet sheet = wb.getSheetAt(0); ExportExcelUtil exportExce = new ExportExcelUtil(wb, sheet); String[] fields = {"yymc","bls","gcb"}; if(list != null) { exportExce.cteateTableByList(list, fields, 2); } exportExce.outputExcel("伤害分医院报告数统计报表"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public class ShReportFyybgsDaoImpl extends AbstractHibernateDaoImpl<TC8Shmjzbl> implements ShReportFyybgsDao { /** * 分医院报告数查询 * @param vo * @return */ @SuppressWarnings("unchecked") public List<ShReportFyybgsVo> query(ShReportFyybgsVo vo) { List<ShReportFyybgsVo> voList = new ArrayList<ShReportFyybgsVo>(); StringBuffer sql = new StringBuffer(); if(vo.getBllx().equals("1")) { sql.append(" with v_tb as (select Y.CNAME,COUNT(T.BLBH) AS sl from T_C8_SHMJZBL T" + " left join TB_DIC_YLJG Y ON Y.YLJGDM = T.YLJGDM" + " WHERE T.YXBZ = '"+ConstantsUtils.YXBZ_YX+"' AND T.CFBZ = '"+ConstantsUtils.CFBZ_FCF+"'" + " AND DECODE('"+vo.getQxbm()+"','null',T.BGQXDM,'"+vo.getQxbm()+"') = T.BGQXDM" + " AND DECODE('"+vo.getYydj()+"','null',Y.CLEVEL,'"+vo.getYydj()+"') = Y.CLEVEL" + " AND DECODE('"+vo.getBgrqstartDate()+"','null','null',TO_CHAR(T.BGRQ,'YYYY-MM-DD')) BETWEEN '"+vo.getBgrqstartDate()+"' AND '"+vo.getBgrqendDate()+"'" + " GROUP BY Y.CNAME)" + " select cname 医院,sl 例数,to_char(sl/(select sum(sl) from v_tb)*100,'FM990.00')||'%' 构成比 from v_tb" + " union all" + " select '合计',nvl((select sum(sl) from v_tb),0),nvl2((select sum(sl) from v_tb),'100.00%','0.00%') from dual"); }else { sql.append(" with v_tb as (select Y.CNAME,COUNT(T.BLBH) AS sl from T_C8_SHZYBL T" + " left join TB_DIC_YLJG Y ON Y.YLJGDM = T.YLJGDM" + " WHERE T.YXBZ = '"+ConstantsUtils.YXBZ_YX+"' AND T.CFBZ = '"+ConstantsUtils.CFBZ_FCF+"'" + " AND DECODE('"+vo.getQxbm()+"','null',T.BGQXDM,'"+vo.getQxbm()+"') = T.BGQXDM" + " AND DECODE('"+vo.getYydj()+"','null',Y.CLEVEL,'"+vo.getYydj()+"') = Y.CLEVEL" + " AND DECODE('"+vo.getBgrqstartDate()+"','null','null',TO_CHAR(T.BGRQ,'YYYY-MM-DD')) BETWEEN '"+vo.getBgrqstartDate()+"' AND '"+vo.getBgrqendDate()+"'" + " GROUP BY Y.CNAME)" + " select cname 医院,sl 例数,to_char(sl/(select sum(sl) from v_tb)*100,'FM990.00')||'%' 构成比 from v_tb" + " union all" + " select '合计',nvl((select sum(sl) from v_tb),0),nvl2((select sum(sl) from v_tb),'100.00%','0.00%') from dual"); } List<Object[]> list = super.getSession().createSQLQuery(sql.toString()).list(); if(list != null && list.size() > 0){ for(int i = 0; i < list.size(); i++){ ShReportFyybgsVo result = new ShReportFyybgsVo(); int a = 0; Object[] obj = list.get(i); result.setYymc(StringUtils.ObjectToString(obj[a++])); result.setBls(StringUtils.ObjectToString(obj[a++])); result.setGcb(StringUtils.ObjectToString(obj[a++])); voList.add(result); } } return voList; } }
if(vo.getBllx().equals("1")) { sql.append(" with v_tb as (select C.NAME QXMC,COUNT(T.BLBH) AS sl from T_C8_SHMJZBL T" + " RIGHT JOIN CF_CODE_INFO C ON C.CODE = T.BGQXDM AND T.YXBZ = '"+ConstantsUtils.YXBZ_YX+"' AND T.CFBZ = '"+ConstantsUtils.CFBZ_FCF+"'" + " AND DECODE('"+vo.getBgrqstartDate()+"','null','null',TO_CHAR(T.BGRQ,'YYYY-MM-DD')) BETWEEN '"+vo.getBgrqstartDate()+"' AND '"+vo.getBgrqendDate()+"'" + " WHERE C.CODE_INFO_ID='4093' AND REMOVED='0' GROUP BY C.NAME)" + " select qxmc 区县,sl 例数,to_char(sl/DECODE((select sum(sl) from v_tb),0,1,(select sum(sl) from v_tb))*100,'FM990.00')||'%' 构成比 from v_tb" + " union all" + " select '合计',(select sum(sl) from v_tb),DECODE((select sum(sl) from v_tb),0,'0.00%','100.00%') from dual"); }else { sql.append(" with v_tb as (select C.NAME QXMC,COUNT(T.BLBH) AS sl from T_C8_SHZYBL T" + " RIGHT JOIN CF_CODE_INFO C ON C.CODE = T.BGQXDM AND T.YXBZ = '"+ConstantsUtils.YXBZ_YX+"' AND T.CFBZ = '"+ConstantsUtils.CFBZ_FCF+"'" + " AND DECODE('"+vo.getBgrqstartDate()+"','null','null',TO_CHAR(T.BGRQ,'YYYY-MM-DD')) BETWEEN '"+vo.getBgrqstartDate()+"' AND '"+vo.getBgrqendDate()+"'" + " WHERE C.CODE_INFO_ID='4093' AND REMOVED='0' GROUP BY C.NAME)" + " select qxmc 区县,sl 例数,to_char(sl/DECODE((select sum(sl) from v_tb),0,1,(select sum(sl) from v_tb))*100,'FM990.00')||'%' 构成比 from v_tb" + " union all" + " select '合计',(select sum(sl) from v_tb),DECODE((select sum(sl) from v_tb),0,'0.00%','100.00%') from dual"); }