|
@@ -29,14 +29,15 @@ public class ExcelReadTest {
|
|
|
private static Map<String, String> pacs_words = new HashMap<>();
|
|
|
private static Map<String, String> symptom_words = new HashMap<>();
|
|
|
private static Map<String, String> vital_words = new HashMap<>();
|
|
|
+ private static Map<String, String> disease_words = new HashMap<>();
|
|
|
|
|
|
private static final String lis_path = "E:\\git\\docs\\医学知识库\\化验\\化验标准库第一期-邵启华0618.xlsx";
|
|
|
private static final String pacs_path = "E:\\git\\docs\\医学知识库\\辅检\\辅检标准库第一期-邵青华0617.xlsx";
|
|
|
- private static final String symptom_path = "E:\\git\\docs\\医学知识库\\症状\\症状标准库-王玲0619.xlsx";
|
|
|
+ private static final String symptom_path = "E:\\git\\docs\\医学知识库\\症状\\症状标准库-王玲0625.xlsx";
|
|
|
private static final String drug_path = "E:\\git\\docs\\医学知识库\\药品\\药品标准库-邵启华0515.xlsx";
|
|
|
- private static final String vital_path = "E:\\git\\docs\\医学知识库\\体征\\体征标准库第一阶段-吕纯0618.xlsx";
|
|
|
+ private static final String vital_path = "E:\\git\\docs\\医学知识库\\体征\\体征标准库第一阶段-吕纯0620.xlsx";
|
|
|
private static final String part_path = "E:\\git\\docs\\医学知识库\\部位和科室\\部位标准库-邵启华0605.xlsx";
|
|
|
- private static final String disease_path = "E:\\git\\docs\\医学知识库\\诊断名和治疗方案\\知识库标准疾病名称和疾病治疗方案-邵青华0605.xlsx";
|
|
|
+ private static final String disease_path = "E:\\git\\docs\\医学知识库\\诊断名和治疗方案\\知识库标准疾病名称和疾病治疗方案-邵青华0627.xlsx";
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
try {
|
|
@@ -173,23 +174,37 @@ public class ExcelReadTest {
|
|
|
Workbook workbook = getWorkbok(in, excelFile);
|
|
|
Sheet sheet = workbook.getSheetAt(0);
|
|
|
|
|
|
- Map<String, String> words = new HashMap<>();
|
|
|
- words = loadDataFromSheet(sheet, words, new int[]{0, 1});
|
|
|
-
|
|
|
- List<Map<String, Object>> lists = new ArrayList<>();
|
|
|
- MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/diagbot-rule?useUnicode=true&characterEncoding=UTF-8");
|
|
|
- List<Map<String, String>> data = nlpJdbc.query("kl_standard_info", new String[]{"id","name"}, " where category_id = 19");
|
|
|
- for (Map<String, String> map : data) {
|
|
|
- String name = map.get("name");
|
|
|
- if (words.get(name) == null) {
|
|
|
- Map<String, Object> line = new HashMap<>();
|
|
|
- line.put("disease", name);
|
|
|
- lists.add(line);
|
|
|
- words.put(name, name);
|
|
|
+ int count = 0;
|
|
|
+ String[] alias = null;
|
|
|
+ for (Row row : sheet) {
|
|
|
+ // 跳过第一和第二行的目录
|
|
|
+ if (count < 1) {
|
|
|
+ count++;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ count++;
|
|
|
+ try {
|
|
|
+ Cell cell0 = row.getCell(0);
|
|
|
+ Cell cell1 = row.getCell(1);
|
|
|
+ if (cell0 != null && !"".equals(cell0.getStringCellValue())) {
|
|
|
+ put(disease_words, cell0);
|
|
|
+ }
|
|
|
+ if (cell1 != null && !"".equals(cell1.getStringCellValue())) {
|
|
|
+ String val = cell1.getStringCellValue();
|
|
|
+ if (val.indexOf("、") > -1) {
|
|
|
+ alias = val.split("、");
|
|
|
+ for (int i = 0; i < alias.length; i++) {
|
|
|
+ put(disease_words, alias[i], null, null);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ put(disease_words, cell1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ System.out.println("第" + count + "出现错误!");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- nlpJdbc.insert(lists, "disease_notin", new String[]{"disease"});
|
|
|
}
|
|
|
|
|
|
public static void readPart() throws Exception {
|
|
@@ -449,34 +464,41 @@ public class ExcelReadTest {
|
|
|
}
|
|
|
|
|
|
public static void readPart1() throws Exception {
|
|
|
- readPacs();
|
|
|
- readLis();
|
|
|
- readSymptom();
|
|
|
- readVital();
|
|
|
+// readPacs();
|
|
|
+// readLis();
|
|
|
+// readSymptom();
|
|
|
+// readVital();
|
|
|
+ readDisease();
|
|
|
|
|
|
Map<String, String> all_words = new HashMap<>();
|
|
|
|
|
|
String key = "";
|
|
|
String value = "";
|
|
|
- for (Map.Entry<String, String> entry : symptom_words.entrySet()) {
|
|
|
- key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
- value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
- all_words.put(key, value);
|
|
|
- }
|
|
|
- for (Map.Entry<String, String> entry : vital_words.entrySet()) {
|
|
|
- key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
- value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
- all_words.put(key, value);
|
|
|
- }
|
|
|
- for (Map.Entry<String, String> entry : lis_words.entrySet()) {
|
|
|
- if (key.equals("血常规")) {
|
|
|
- System.out.println("血常规");
|
|
|
- }
|
|
|
- key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
- value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
- all_words.put(key, value);
|
|
|
- }
|
|
|
- for (Map.Entry<String, String> entry : pacs_words.entrySet()) {
|
|
|
+// for (Map.Entry<String, String> entry : symptom_words.entrySet()) {
|
|
|
+// key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
+// value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
+// all_words.put(key, value);
|
|
|
+// }
|
|
|
+// for (Map.Entry<String, String> entry : vital_words.entrySet()) {
|
|
|
+// key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
+// value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
+// all_words.put(key, value);
|
|
|
+// }
|
|
|
+// for (Map.Entry<String, String> entry : lis_words.entrySet()) {
|
|
|
+// if (key.equals("血气分析")) {
|
|
|
+// System.out.println("血气分析");
|
|
|
+// }
|
|
|
+// key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
+// value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
+// all_words.put(key, value);
|
|
|
+// }
|
|
|
+// for (Map.Entry<String, String> entry : pacs_words.entrySet()) {
|
|
|
+// key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
+// value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
+// all_words.put(key, value);
|
|
|
+// }
|
|
|
+
|
|
|
+ for (Map.Entry<String, String> entry : disease_words.entrySet()) {
|
|
|
key = entry.getKey().trim().replace("(", "(").replace(")",")");
|
|
|
value = entry.getValue().trim().replace("(", "(").replace(")",")");
|
|
|
all_words.put(key, value);
|
|
@@ -533,7 +555,7 @@ public class ExcelReadTest {
|
|
|
} else if (CellType.NUMERIC == cell1.getCellTypeEnum()) {
|
|
|
number = nf.format(cell1.getNumericCellValue());
|
|
|
}
|
|
|
- if (number.indexOf("1.") > -1 || number.indexOf("2.") > -1) {
|
|
|
+ if (number.indexOf("5.") > -1 || "鉴别诊断".equals(cell0.getStringCellValue())) {
|
|
|
if (cell2 != null && !"".equals(cell2.getStringCellValue())) {
|
|
|
Map<String, Object> line = new HashMap<>();
|
|
|
line.put("disease", diag);
|
|
@@ -545,6 +567,7 @@ public class ExcelReadTest {
|
|
|
|
|
|
notinFound(all_words, not_in_lists, line);
|
|
|
}
|
|
|
+
|
|
|
if (cell3 != null && !"".equals(cell3.getStringCellValue())) {
|
|
|
String val = cell3.getStringCellValue();
|
|
|
if (val.indexOf("、") > -1) {
|
|
@@ -572,67 +595,110 @@ public class ExcelReadTest {
|
|
|
notinFound(all_words, not_in_lists, line);
|
|
|
}
|
|
|
}
|
|
|
- }else if (number.indexOf("3.") > -1) {
|
|
|
- if (cell3 != null && cell4 != null) {
|
|
|
- String val3 = cell3.getStringCellValue();
|
|
|
- String val4 = cell4.getStringCellValue();
|
|
|
- if (val4.indexOf("、") > -1) {
|
|
|
- alias = val4.split("、");
|
|
|
- for (int j = 0; j < alias.length; j++) {
|
|
|
- Map<String, Object> line = new HashMap<>();
|
|
|
- line.put("disease", diag);
|
|
|
- line.put("type", cell0.getStringCellValue());
|
|
|
- line.put("number", number);
|
|
|
- line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
- line.put("correlationWord", val3.trim());
|
|
|
- line.put("result", alias[j].trim());
|
|
|
- line.put("update_date", updateDate);
|
|
|
- lists.add(line);
|
|
|
-
|
|
|
- notinFound(all_words, not_in_lists, line);
|
|
|
- }
|
|
|
- } else {
|
|
|
- Map<String, Object> line = new HashMap<>();
|
|
|
- line.put("disease", diag);
|
|
|
- line.put("type", cell0.getStringCellValue());
|
|
|
- line.put("number", number);
|
|
|
- line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
- line.put("correlationWord", val3.trim());
|
|
|
- line.put("result", val4.trim());
|
|
|
- line.put("update_date", updateDate);
|
|
|
- lists.add(line);
|
|
|
-
|
|
|
- notinFound(all_words, not_in_lists, line);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (cell2 != null) {
|
|
|
- Map<String, Object> line = new HashMap<>();
|
|
|
- line.put("disease", diag);
|
|
|
- line.put("type", cell0.getStringCellValue());
|
|
|
- line.put("number", number);
|
|
|
- line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
- line.put("check_label", "4");
|
|
|
- line.put("update_date", updateDate);
|
|
|
- not_in_lists.add(line);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- Map<String, Object> line = new HashMap<>();
|
|
|
- line.put("disease", diag);
|
|
|
- line.put("type", cell0.getStringCellValue());
|
|
|
- line.put("number", number);
|
|
|
- line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
- if (cell3 != null) {
|
|
|
- line.put("correlationWord", cell3.getStringCellValue().trim());
|
|
|
- }
|
|
|
- if (cell4 != null) {
|
|
|
- line.put("result", cell4.getStringCellValue().trim());
|
|
|
- }
|
|
|
- line.put("update_date", updateDate);
|
|
|
- lists.add(line);
|
|
|
-
|
|
|
- notinFound(all_words, not_in_lists, line);
|
|
|
}
|
|
|
+// if (number.indexOf("1.") > -1 || number.indexOf("2.") > -1) {
|
|
|
+// if (cell2 != null && !"".equals(cell2.getStringCellValue())) {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// lists.add(line);
|
|
|
+//
|
|
|
+// notinFound(all_words, not_in_lists, line);
|
|
|
+// }
|
|
|
+// if (cell3 != null && !"".equals(cell3.getStringCellValue())) {
|
|
|
+// String val = cell3.getStringCellValue();
|
|
|
+// if (val.indexOf("、") > -1) {
|
|
|
+// alias = val.split("、");
|
|
|
+// for (int j = 0; j < alias.length; j++) {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", alias[j].trim());
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// lists.add(line);
|
|
|
+//
|
|
|
+// notinFound(all_words, not_in_lists, line);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", val.trim());
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// lists.add(line);
|
|
|
+//
|
|
|
+// notinFound(all_words, not_in_lists, line);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else if (number.indexOf("3.") > -1) {
|
|
|
+// if (cell3 != null && cell4 != null) {
|
|
|
+// String val3 = cell3.getStringCellValue();
|
|
|
+// String val4 = cell4.getStringCellValue();
|
|
|
+// if ("血气分析".equals(val3)) {
|
|
|
+// System.out.println("val3 血气分析");
|
|
|
+// }
|
|
|
+// if (val4.indexOf("、") > -1) {
|
|
|
+// alias = val4.split("、");
|
|
|
+// for (int j = 0; j < alias.length; j++) {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
+// line.put("correlationWord", val3.trim());
|
|
|
+// line.put("result", alias[j].trim());
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// lists.add(line);
|
|
|
+//
|
|
|
+// notinFound(all_words, not_in_lists, line);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
+// line.put("correlationWord", val3.trim());
|
|
|
+// line.put("result", val4.trim());
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// lists.add(line);
|
|
|
+//
|
|
|
+// notinFound(all_words, not_in_lists, line);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// if (cell2 != null) {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
+// line.put("check_label", "4");
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// not_in_lists.add(line);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// Map<String, Object> line = new HashMap<>();
|
|
|
+// line.put("disease", diag);
|
|
|
+// line.put("type", cell0.getStringCellValue());
|
|
|
+// line.put("number", number);
|
|
|
+// line.put("standWord", cell2.getStringCellValue().trim());
|
|
|
+// if (cell3 != null) {
|
|
|
+// line.put("correlationWord", cell3.getStringCellValue().trim());
|
|
|
+// }
|
|
|
+// if (cell4 != null) {
|
|
|
+// line.put("result", cell4.getStringCellValue().trim());
|
|
|
+// }
|
|
|
+// line.put("update_date", updateDate);
|
|
|
+// lists.add(line);
|
|
|
+//
|
|
|
+// notinFound(all_words, not_in_lists, line);
|
|
|
+// }
|
|
|
}catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
System.out.println("第" + count + "出现错误!" + excelFile[i].getName());
|
|
@@ -642,12 +708,12 @@ public class ExcelReadTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/diagbot-rule?useUnicode=true&characterEncoding=UTF-8");
|
|
|
- nlpJdbc.insert(lists, "medicine_rule_part1", new String[]{"disease", "type", "number", "standWord", "correlationWord", "result", "update_date", "check_label"});
|
|
|
+// MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/diagbot-rule?useUnicode=true&characterEncoding=UTF-8");
|
|
|
+// nlpJdbc.insert(lists, "medicine_rule_part1", new String[]{"disease", "type", "number", "standWord", "correlationWord", "result", "update_date", "check_label"});
|
|
|
|
|
|
|
|
|
-// MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/diagbot-rule?useUnicode=true&characterEncoding=UTF-8");
|
|
|
-// nlpJdbc.insert(not_in_lists, "medicine_rule_part1_notin", new String[]{"disease", "type", "number", "standWord", "correlationWord", "result", "update_date", "check_label"});
|
|
|
+ MysqlJdbc nlpJdbc = new MysqlJdbc("root", "diagbot@20180822", "jdbc:mysql://192.168.2.235:3306/diagbot-rule?useUnicode=true&characterEncoding=UTF-8");
|
|
|
+ nlpJdbc.insert(not_in_lists, "medicine_rule_part1_notin", new String[]{"disease", "type", "number", "standWord", "correlationWord", "result", "update_date", "check_label"});
|
|
|
|
|
|
}
|
|
|
|