/** * @param dataSet * @return local_code,core_code */ public static HashMap<String, String> fungetCode1(DataSet dataSet) { HashMap<String, String> map = new HashMap<String, String>(); int row = dataSet.getRowNum(); for (int i = 0; i < row; i++) { JiekouModel model = new JiekouModel(); String local_code = dataSet.funGetFieldByCol(i, "LOCAL_CODE"); String core_code = dataSet.funGetFieldByCol(i, "CORE_CODE"); map.put(local_code, core_code); } return map; }
public static HashMap<String, JiekouModel> fungetCode(DataSet dataSet) { HashMap<String, JiekouModel> map = new HashMap<String, JiekouModel>(); int row = dataSet.getRowNum(); for (int i = 0; i < row; i++) { JiekouModel model = new JiekouModel(); String code = dataSet.funGetFieldByCol(i, "CODE"); String table_id = dataSet.funGetFieldByCol(i, "TABLE_ID"); String table_item_id = dataSet.funGetFieldByCol(i, "TABLE_ITEM_ID"); model.setCp_node_table_id(table_id); model.setCp_node_table_item_id(table_item_id); model.setCode(code); map.put(code, model); } return map; }
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setCharacterEncoding("UTF-8"); String operate = request.getParameter("op"); if ("getAllTable".equals(operate)) { String pageNo_js = request.getParameter("pageNo"); int pageNo = 1; try { pageNo = Integer.parseInt(pageNo_js); } catch (Exception e) { // TODO: handle exception pageNo = 1; } String sql = " SELECT A.* " + " FROM DCP_DICT_DIAGNOSIS A" + " ORDER BY A.DIAGNOSIS_CODE"; int totalRecord = match.funGetCount(sql); Page page = new Page(totalRecord, pageNo, PAGESIZE); int nowPage = page.getNowPage(); int start = page.getStart(); int end = page.getEnd(); int totalPage = page.getTotolPage(); String tableHtml = match.funCreateTable(sql, start, end); PageTable pageTable = new PageTable(); String pageHtml = pageTable.funGetPageHtml(totalRecord, nowPage, totalPage); MatchLocal matchlocalTable = new MatchLocalImpl(); String localTable = matchlocalTable.funGetTable( "select * from lcp_local_diagnosis t", "DIAGNOSIS_CODE", "DIAGNOSIS_name", "input_code_py", "input_code_wb"); response .getWriter() .println( "[{\"result\":\"OK\"," + "\"method\":\"getAllTable\", " + "\"pageHtml\":\"" + pageHtml + "\", " + "\"localTable\":\"" + localTable + "\", " + "\"tableHtml\":\"" + tableHtml + "\"}]"); } if ("changeTable".equals(operate)) { String zxksbm_ajax = URLDecoder.decode(request.getParameter("zxksbm_ajax"), "UTF-8").replace("%2B", "+"); String zxksmc_ajax = URLDecoder.decode(request.getParameter("zxksmc_ajax"), "UTF-8").replace("%2B", "+"); String zxkspy_ajax = URLDecoder.decode(request.getParameter("zxkspy_ajax"), "UTF-8").replace("%2B", "+"); String zxkswb_ajax = URLDecoder.decode(request.getParameter("zxkswb_ajax"), "UTF-8").replace("%2B", "+"); zxksbm_ajax = zxksbm_ajax.replace("'", "''"); zxksmc_ajax = zxksmc_ajax.replace("'", "''"); zxkspy_ajax = zxkspy_ajax.replace("'", "''"); zxkswb_ajax = zxkswb_ajax.replace("'", "''"); String sql = " SELECT A.* " + " FROM DCP_DICT_DIAGNOSIS A " + " WHERE 1=1 "; if (zxksbm_ajax != "" && zxksbm_ajax != null) { sql = sql + " and (A.DIAGNOSIS_CODE like '%" + zxksbm_ajax + "%' or A.DIAGNOSIS_CODE like '%" + zxksbm_ajax.toUpperCase() + "%' or A.DIAGNOSIS_CODE like '%" + zxksbm_ajax.toLowerCase() + "%')"; } if (zxksmc_ajax != "" && zxksmc_ajax != null) { if (zxksmc_ajax.indexOf("_") >= 0 || zxksmc_ajax.indexOf("%") >= 0) { zxksmc_ajax = zxksmc_ajax.replace("_", "/_"); zxksmc_ajax = zxksmc_ajax.replace("%", "/%"); zxksmc_ajax = zxksmc_ajax + "%' escape '/'"; sql = sql + " and A.DIAGNOSIS_name like '%" + zxksmc_ajax + " "; } else { sql = sql + " and A.DIAGNOSIS_name like '%" + zxksmc_ajax + "%' "; } } if (zxkspy_ajax != "" && zxkspy_ajax != null) { sql = sql + " and (input_code_py like '%" + zxkspy_ajax + "%' or input_code_py like '%" + zxkspy_ajax.toUpperCase() + "%' or input_code_py like '%" + zxkspy_ajax.toLowerCase() + "%')"; } if (zxkswb_ajax != "" && zxkswb_ajax != null) { sql = sql + " and (input_code_wb like '%" + zxkswb_ajax + "%' or input_code_wb like '%" + zxkswb_ajax.toUpperCase() + "%' or input_code_wb like '%" + zxkswb_ajax.toLowerCase() + "%')"; } sql = sql + " ORDER BY A.DIAGNOSIS_CODE"; String pageNo_js = request.getParameter("pageNo"); int pageNo = 1; try { pageNo = Integer.parseInt(pageNo_js); } catch (Exception e) { // TODO: handle exception pageNo = 1; } int totalRecord = match.funGetCount(sql); Page page = new Page(totalRecord, pageNo, PAGESIZE); int nowPage = page.getNowPage(); int start = page.getStart(); int end = page.getEnd(); int totalPage = page.getTotolPage(); String tableHtml = match.funCreateTable(sql, start, end); PageTable pageTable = new PageTable(); String pageHtml = pageTable.funGetPageHtml(totalRecord, nowPage, totalPage); response .getWriter() .println( "[{\"result\":\"OK\"," + "\"method\":\"changeTable\", " + "\"pageHtml\":\"" + pageHtml + "\", " + "\"tableHtml\":\"" + tableHtml + "\"}]"); } if ("zcchaxun".equals(operate)) { // 左侧查询 String zxksbm_ajax = request.getParameter("zxksbm_ajax"); zxksbm_ajax = URLDecoder.decode(zxksbm_ajax, "UTF-8").replace("%2B", "+"); System.out.println(zxksbm_ajax); String zxksmc_ajax = URLDecoder.decode(request.getParameter("zxksmc_ajax"), "UTF-8").replace("%2B", "+"); String zxkspy_ajax = URLDecoder.decode(request.getParameter("zxkspy_ajax"), "UTF-8").replace("%2B", "+"); String zxkswb_ajax = URLDecoder.decode(request.getParameter("zxkswb_ajax"), "UTF-8").replace("%2B", "+"); zxksbm_ajax = zxksbm_ajax.replace("'", "''"); zxksmc_ajax = zxksmc_ajax.replace("'", "''"); zxkspy_ajax = zxkspy_ajax.replace("'", "''"); zxkswb_ajax = zxkswb_ajax.replace("'", "''"); String sql = " SELECT A.* " + " FROM DCP_DICT_DIAGNOSIS A" + " WHERE 1=1 "; if (zxksbm_ajax != "" && zxksbm_ajax != null) { sql = sql + " and (A.DIAGNOSIS_CODE like '%" + zxksbm_ajax + "%' or A.DIAGNOSIS_CODE like '%" + zxksbm_ajax.toUpperCase() + "%' or A.DIAGNOSIS_CODE like '%" + zxksbm_ajax.toLowerCase() + "%')"; } if (zxksmc_ajax != "" && zxksmc_ajax != null) { if (zxksmc_ajax.indexOf("_") >= 0 || zxksmc_ajax.indexOf("%") >= 0) { zxksmc_ajax = zxksmc_ajax.replace("_", "/_"); zxksmc_ajax = zxksmc_ajax.replace("%", "/%"); zxksmc_ajax = zxksmc_ajax + "%' escape '/'"; sql = sql + " and A.DIAGNOSIS_name like '%" + zxksmc_ajax + " "; } else { sql = sql + " and A.DIAGNOSIS_name like '%" + zxksmc_ajax + "%' "; } } if (zxkspy_ajax != "" && zxkspy_ajax != null) { sql = sql + " and (input_code_py like '%" + zxkspy_ajax + "%' or input_code_py like '%" + zxkspy_ajax.toUpperCase() + "%' or input_code_py like '%" + zxkspy_ajax.toLowerCase() + "%')"; } if (zxkswb_ajax != "" && zxkswb_ajax != null) { sql = sql + " and (input_code_wb like '%" + zxkswb_ajax + "%' or input_code_wb like '%" + zxkswb_ajax.toUpperCase() + "%' or input_code_wb like '%" + zxkswb_ajax.toLowerCase() + "%')"; } sql = sql + " ORDER BY A.DIAGNOSIS_CODE"; int totalRecord = match.funGetCount(sql); System.out.println(sql); Page page = new Page(totalRecord, 1, PAGESIZE); int nowPage = page.getNowPage(); int start = page.getStart(); int end = page.getEnd(); int totalPage = page.getTotolPage(); String tableHtml = match.funCreateTable(sql, start, end); PageTable pageTable = new PageTable(); String pageHtml = pageTable.funGetPageHtml(totalRecord, nowPage, totalPage); response .getWriter() .println( "[{\"result\":\"OK\"," + "\"method\":\"zcchaxun\", " + "\"tableHtml\":\"" + tableHtml + "\", " + "\"pageHtml\":\"" + pageHtml + "\"}]"); } if ("ycchaxun".equals(operate)) { // 右侧查询 String bdksbm_ajax = URLDecoder.decode(request.getParameter("bdksbm_ajax"), "UTF-8").replace("%2B", "+"); String bdksmc_ajax = URLDecoder.decode(request.getParameter("bdksmc_ajax"), "UTF-8").replace("%2B", "+"); String bdkspy_ajax = URLDecoder.decode(request.getParameter("bdkspy_ajax"), "UTF-8").replace("%2B", "+"); String bdkswb_ajax = URLDecoder.decode(request.getParameter("bdkswb_ajax"), "UTF-8").replace("%2B", "+"); bdksmc_ajax = bdksmc_ajax.replace("'", "''"); bdksbm_ajax = bdksbm_ajax.replace("'", "''"); bdkspy_ajax = bdkspy_ajax.replace("'", "''"); bdkswb_ajax = bdkswb_ajax.replace("'", "''"); String sql = "select * from lcp_local_diagnosis a where 1=1 "; if (bdksbm_ajax != "" && bdksbm_ajax != null) { sql = sql + " and (A.DIAGNOSIS_CODE like '%" + bdksbm_ajax + "%' or A.DIAGNOSIS_CODE like '%" + bdksbm_ajax.toUpperCase() + "%' or A.DIAGNOSIS_CODE like '%" + bdksbm_ajax.toLowerCase() + "%')"; } if (bdksmc_ajax != "" && bdksmc_ajax != null) { if (bdksmc_ajax.indexOf("_") >= 0 || bdksmc_ajax.indexOf("%") >= 0) { bdksmc_ajax = bdksmc_ajax.replace("_", "/_"); bdksmc_ajax = bdksmc_ajax.replace("%", "/%"); bdksmc_ajax = bdksmc_ajax + "%' escape '/'"; sql = sql + " and A.DIAGNOSIS_name like '%" + bdksmc_ajax + " "; } else { sql = sql + " and A.DIAGNOSIS_name like '%" + bdksmc_ajax + "%' "; } } if (bdkspy_ajax != "" && bdkspy_ajax != null) { sql = sql + " and (input_code_py like '%" + bdkspy_ajax + "%' or input_code_py like '%" + bdkspy_ajax.toUpperCase() + "%' or input_code_py like '%" + bdkspy_ajax.toLowerCase() + "%')"; } if (bdkswb_ajax != "" && bdkswb_ajax != null) { sql = sql + " and (input_code_wb like '%" + bdkswb_ajax + "%' or input_code_wb like '%" + bdkswb_ajax.toUpperCase() + "%' or input_code_wb like '%" + bdkswb_ajax.toLowerCase() + "%')"; } MatchLocal matchlocalTable = new MatchLocalImpl(); String localTable = matchlocalTable.funGetTable( sql, "DIAGNOSIS_CODE", "DIAGNOSIS_name", "input_code_py", "input_code_wb"); response .getWriter() .println( "[{\"result\":\"OK\"," + "\"method\":\"ycchaxun\", " + "\"localTable\":\"" + localTable + "\"}]"); } if ("xuanzhongzcl".equals(operate)) { String youxiajiaoHtml = ""; String zcl_ajax = URLDecoder.decode(request.getParameter("zcl_ajax"), "UTF-8").replace("%2B", "+"); System.out.println("zcl_ajax=" + zcl_ajax); if (zcl_ajax != "") youxiajiaoHtml = match.funCreateMatchTable(zcl_ajax); response .getWriter() .println( "[{\"result\":\"OK\"," + "\"method\":\"xuanzhongzcl\", " + "\"youxiajiaoHtml\":\"" + youxiajiaoHtml + "\"}]"); } if ("pipeiutil".equals(operate)) { String youxiajiaoHtml = ""; String localTable = ""; String zcl_ajax = URLDecoder.decode(request.getParameter("zcl_ajax"), "UTF-8").replace("%2B", "+"); String _mingcheng = ""; String _pinyin = ""; String _wubi = ""; String _code = ""; if (zcl_ajax != "") { MatchLocal matchlocalTable = new MatchLocalImpl(); localTable = matchlocalTable.funGetTable( "select * from lcp_local_diagnosis t", "DIAGNOSIS_CODE", "DIAGNOSIS_name", "input_code_py", "input_code_wb"); youxiajiaoHtml = match.funCreateMatchTable(zcl_ajax); String sql = "SELECT * FROM DCP_DICT_DIAGNOSIS T WHERE T.DIAGNOSIS_CODE='" + zcl_ajax + "'"; DataSet _dataset = new DataSet(); _dataset.funSetDataSetBySql(sql); _code = _dataset.funGetFieldByCol(0, "DIAGNOSIS_CODE"); _mingcheng = _dataset.funGetFieldByCol(0, "DIAGNOSIS_NAME"); _pinyin = _dataset.funGetFieldByCol(0, "INPUT_CODE_PY"); _wubi = _dataset.funGetFieldByCol(0, "INPUT_CODE_WB"); } response .getWriter() .println( "[{\"result\":\"OK\"," + "\"method\":\"pipeiutil\", " + "\"_mingcheng\":\"" + _mingcheng + "\", " + "\"_pinyin\":\"" + _pinyin + "\", " + "\"_wubi\":\"" + _wubi + "\", " + "\"_code\":\"" + _code + "\", " + "\"localTable\":\"" + localTable + "\", " + "\"youxiajiaoHtml\":\"" + youxiajiaoHtml + "\"}]"); } if ("tijiao".equals(operate)) { String yxj_add_ajax = URLDecoder.decode(request.getParameter("yxj_add_ajax"), "UTF-8").replace("%2B", "+"); String yxj_del_ajax = URLDecoder.decode(request.getParameter("yxj_del_ajax"), "UTF-8").replace("%2B", "+"); String code = ""; boolean isSuc = true; if (yxj_add_ajax == "") { code = yxj_del_ajax.split("_and_")[0]; } else { code = yxj_add_ajax.split("_and_")[0]; } if (yxj_add_ajax != "") { int insertRow = match.funPiPeiInsert(yxj_add_ajax); if (insertRow < 0) { isSuc = false; } } if (yxj_del_ajax != "") { int delRow = match.funDelMatch(yxj_del_ajax); if (delRow < 0) { isSuc = false; } } match.funUpdateYDD(code); int row = match.funGetCountByCode(code); String localCode = match.funGetLocalCodeMatched(); if (isSuc) { response .getWriter() .println( "[{\"result\":\"OK\"," + "\"row\":\"" + row + "\", " + "\"method\":\"tijiao\"}]"); } else { response .getWriter() .println( "[{\"result\":\"ERROR\"," + "\"row\":\"" + row + "\", " + "\"localCode\":\"" + localCode + "\", " + "\"method\":\"tijiao\"}]"); } } if ("befordDel".equals(operate)) { String delStr = URLDecoder.decode(request.getParameter("delStr"), "UTF-8").replace("%2B", "+"); int row = match.funFindIsUsedBeforeDel(delStr); response .getWriter() .println( "[{\"result\":\"OK\"," + "\"row\":\"" + row + "\", " + "\"method\":\"befordDel\"}]"); } }