|
@@ -0,0 +1,88 @@
|
|
|
+package com.lantone.qc.kernel;
|
|
|
+
|
|
|
+import com.lantone.qc.trans.util.http.db.DBUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import java.sql.Connection;
|
|
|
+import java.sql.ResultSet;
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.sql.Statement;
|
|
|
+import java.util.*;
|
|
|
+@Slf4j
|
|
|
+public class tzdiagnosisTest {
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ List<String> diagnosisList = WritXmlSelect();
|
|
|
+ AcquirePatientName(diagnosisList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //取患者姓名
|
|
|
+ private static void AcquirePatientName(List<String> diagnosisList) {
|
|
|
+
|
|
|
+ List<String> diagLists = new ArrayList<>();
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ String j = "1";
|
|
|
+ for (int i = 0; i < diagnosisList.size(); i++) {
|
|
|
+ int numInt=0;
|
|
|
+ if (i + 1 < diagnosisList.size()) {
|
|
|
+ String diagnosis = diagnosisList.get(i);
|
|
|
+ if (diagLists.contains(diagnosis)) {
|
|
|
+ String strNum = map.get(diagnosis);
|
|
|
+ numInt = Integer.parseInt(strNum);
|
|
|
+ numInt++;
|
|
|
+ String num = Integer.toString(numInt);
|
|
|
+ map.put(diagnosis, num);
|
|
|
+ } else {
|
|
|
+ diagLists.add(diagnosis);
|
|
|
+ map.put(diagnosis, j);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ReplaceSensitivity(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void ReplaceSensitivity(Map<String, String> map) {
|
|
|
+ for (Map.Entry<String, String> adc : map.entrySet()) {
|
|
|
+// log.error(adc.getKey() + "==" + adc.getValue() + "\r\n");
|
|
|
+ System.out.println(adc.getKey() + "\t" + adc.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询xml文件内容
|
|
|
+ public static List<String> WritXmlSelect() {
|
|
|
+ Connection conn = null;
|
|
|
+ Statement stmt = null;
|
|
|
+ ResultSet rs = null;
|
|
|
+ List<String> diagnosisList = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ conn = DBUtil.getConnection();
|
|
|
+ stmt = conn.createStatement();
|
|
|
+ rs = stmt.executeQuery("SELECT diagnosis FROM str_admission_note WHERE diagnosis NOT LIKE '%。%_' AND diagnosis NOT LIKE '%、%_' AND diagnosis NOT LIKE '% %_'AND diagnosis NOT LIKE '%;%_'AND diagnosis NOT LIKE '%,%_'AND diagnosis NOT LIKE '%?%_'" +
|
|
|
+ "AND diagnosis NOT LIKE '%:%_'AND diagnosis NOT LIKE '%:%_'");
|
|
|
+ while (rs.next()) {
|
|
|
+ diagnosisList.add(rs.getString(1));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ if (rs != null) {
|
|
|
+ rs.close();
|
|
|
+ rs = null;
|
|
|
+ }
|
|
|
+ if (stmt != null) {
|
|
|
+ stmt.close();
|
|
|
+ stmt = null;
|
|
|
+ }
|
|
|
+ if (conn != null) {
|
|
|
+ conn.close();
|
|
|
+ conn = null;
|
|
|
+ }
|
|
|
+ } catch (SQLException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return diagnosisList;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|