Forráskód Böngészése

1、删除excel导入测试类,已改名

louhr 5 éve
szülő
commit
5695a1e151

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/QCCatalogue.java

@@ -35,7 +35,7 @@ public class QCCatalogue {
             start(inputInfo, outputInfo);
         } catch (Exception e) {
             variablePreset("-1", "");
-            log.info(e.getMessage());
+            log.info(e.getMessage() + "......类名:" + this.className);
         }
         insertOpt(outputInfo);
     }

+ 36 - 16
kernel/src/main/java/com/lantone/qc/kernel/web/controller/QCTestController.java

@@ -64,18 +64,20 @@ public class QCTestController {
             OutputInfo outputInfo = qCAnalysis.anlysis(entry.getValue());
 
             Map<String, String> passMap = inputCaseMappingMap.get(entry.getKey());
-            for (Map.Entry<String, String> e : passMap.entrySet()) {
-                Map<String, Object> m = new HashMap<>();
-                Map<String, Object> w = new HashMap<>();
-                if (outputInfo.getResult().get(e.getKey()) == null) {
-                    m.put("check_label", "-2");
-                } else {
-                    m.put("check_label", outputInfo.getResult().get(e.getKey()).get("status"));
-                }
-                w.put("id", e.getValue());
+            if (passMap != null) {
+                for (Map.Entry<String, String> e : passMap.entrySet()) {
+                    Map<String, Object> m = new HashMap<>();
+                    Map<String, Object> w = new HashMap<>();
+                    if (outputInfo.getResult().get(e.getKey()) == null) {
+                        m.put("check_label", "-2");
+                    } else {
+                        m.put("check_label", outputInfo.getResult().get(e.getKey()).get("status"));
+                    }
+                    w.put("id", e.getValue());
 
-                updates.add(m);
-                wheres.add(w);
+                    updates.add(m);
+                    wheres.add(w);
+                }
             }
         }
         PropertiesUtil propertiesUtil = new PropertiesUtil("kernel.properties");
@@ -117,7 +119,10 @@ public class QCTestController {
                 modeIds.add(r1);
             }
 
-            sql = "select code, name from qc_cases_entry";   //查询所有条目
+            sql = "select code, name from qc_cases_entry q1, qc_cases_entry_hospital q2 where q1.id = q2.cases_entry_id ";   //查询所有条目
+            if (StringUtils.isNotEmpty(hospitalId)) {
+                sql = sql + " and q2.hospital_id = " + hospitalId;
+            }
             rs = st.executeQuery(sql);
             Map<String, Map<String, String>> inputCatalogueMap = new HashMap<>();
             while (rs.next()) {
@@ -136,6 +141,10 @@ public class QCTestController {
             if (StringUtils.isNotEmpty(caseNumber)) {
                 sql = sql + " and n.case_number = " + caseNumber;
             }
+            if (StringUtils.isNotEmpty(hospitalId)) {
+                sql = sql + " and n.hospital_id = " + hospitalId;
+            }
+            sql = sql + " and qmm.case_number_id in (select distinct case_number_id from qc_inputcases_mapping_all) ";
             sql = sql + " order by n.id, q.id";
             rs = st.executeQuery(sql);
             String tempCaseNumber = "", label = "";
@@ -149,7 +158,7 @@ public class QCTestController {
                     queryVo.setCid(cid);
                     queryVo.setMedrec(medrec);
                     queryVo.setInputCatalogueMap(inputCatalogueMap);
-                    queryVoMap.put(r1, queryVo);
+                    queryVoMap.put(r2, queryVo);
                     //新的一份病历记录
                     medrec = new ArrayList<>();
                     queryVo = new QueryVo();
@@ -158,7 +167,9 @@ public class QCTestController {
                     MedrecVo medrecVo = new MedrecVo();
                     medrecVo.setTitle(r3);
                     Map<String, Object> m = new HashMap<>();
-                    m.put("content", r4);
+                    List<String> contentList = new ArrayList<>();
+                    contentList.add(r4);
+                    m.put("content", contentList);
                     medrecVo.setContent(m);
                     medrec.add(medrecVo);
                 } else if (r3.equals("查房记录") || r3.equals("会诊") || r3.equals("医嘱信息") || r3.equals("值班交接制度") || r3.equals("输血/血制品病程记录")
@@ -176,9 +187,16 @@ public class QCTestController {
                         details = new ArrayList<>();
                     }
                     details.add(r4);
-                    label = r3;
                 }
+                label = r3;
+                tempCaseNumber = r2;
             }
+
+            queryVo.setCid(cid);
+            queryVo.setMedrec(medrec);
+            queryVo.setInputCatalogueMap(inputCatalogueMap);
+            queryVoMap.put(tempCaseNumber, queryVo);
+
         } catch (SQLException sqle) {
             sqle.printStackTrace();
         } catch (Exception e) {
@@ -201,7 +219,7 @@ public class QCTestController {
         String r1, r2, r3, r4, r5;
         try {
             st = conn.createStatement();
-            String sql = "SELECT qim.id, qim.case_number_id, qc.code  FROM qc_inputcases_mapping qim, qc_cases_number q, qc_cases_entry qc " +
+            String sql = "SELECT qim.id, q.case_number, qc.code FROM qc_inputcases_mapping_all qim, qc_cases_number q, qc_cases_entry qc " +
                     "where qim.case_number_id = q.id and qim.cases_entry_id = qc.id and q.is_deleted = 'N' " +
                     "and q.hospital_id = " + hospitalId ;
             if (StringUtils.isNotEmpty(caseNumber)) {
@@ -221,7 +239,9 @@ public class QCTestController {
                     m = new HashMap<>();
                 }
                 m.put(r3, r1);
+                caseNumberId = r2;
             }
+            result.put(caseNumberId, m);
         } catch (SQLException sqle) {
             sqle.printStackTrace();
         } catch (Exception e) {

+ 38 - 6
kernel/src/test/java/com/lantone/qc/kernel/ImportTaizDataTest.java

@@ -3,14 +3,14 @@ package com.lantone.qc.kernel;
 
 import com.lantone.qc.pub.jdbc.MysqlJdbc;
 import com.lantone.qc.pub.util.PropertiesUtil;
+import com.lantone.qc.trans.changx.util.CxXmlUtil;
 import com.lantone.qc.trans.taizhou.util.TzXmlUtil;
 import jxl.Cell;
 import jxl.Sheet;
 import jxl.Workbook;
 import org.apache.commons.lang3.StringUtils;
 
-import java.io.FileInputStream;
-import java.io.InputStream;
+import java.io.*;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -28,13 +28,15 @@ public class ImportTaizDataTest {
 
     public static void main(String[] args) {
         ImportTaizDataTest importTaizDataTest = new ImportTaizDataTest();
-        String filePath = "E:\\docs\\产品目录\\病历质控\\病历数据\\台州\\质控医院数据采集标准格式20200326.xls";
+//        String filePath = "E:\\docs\\产品目录\\病历质控\\病历数据\\台州\\质控医院数据采集标准格式20200326.xls";
+
+        String filePath = "E:\\docs\\产品目录\\病历质控\\病历数据\\长兴\\入院记录";
         try {
             List<Map<String, Object>> patientInserts = new ArrayList<>();
             List<Map<String, Object>> modelMappingInserts = new ArrayList<>();
 
             Set<String> patients = new LinkedHashSet<>();
-            Map<String, Map<String, List<String>>> records = importTaizDataTest.readFromExcel(filePath);
+            Map<String, Map<String, List<String>>> records = importTaizDataTest.readFromTxt(filePath);
             for (Map.Entry<String, Map<String, List<String>>> entry : records.entrySet()) {
                 for (Map.Entry<String, List<String>> modelEntry : entry.getValue().entrySet()) {
                     for (String s : modelEntry.getValue()) {
@@ -43,7 +45,7 @@ public class ImportTaizDataTest {
                         rowMap.put("mode_id", modelInfoMap.get(modelEntry.getKey()));
                         rowMap.put("origin_text", s);
                         if (StringUtils.isNotEmpty(s)) {
-                            Map<String, String> textMap = TzXmlUtil.getXmlToMapForTZ(s);
+                            Map<String, String> textMap = CxXmlUtil.beHospitalizedXmlToMap(s);
                             for (Map.Entry<String, String> e : textMap.entrySet()) {
                                 text = text + "【" + e.getKey() + "】:" + e.getValue() + "\n";
                             }
@@ -59,7 +61,7 @@ public class ImportTaizDataTest {
             for (String patientSerial : patients) {
                 Map<String, Object> patientSerialMap = new HashMap<>();
                 patientSerialMap.put("case_number", patientSerial);
-                patientSerialMap.put("hospital_id", "3");
+                patientSerialMap.put("hospital_id", "1");
                 patientInserts.add(patientSerialMap);
             }
 
@@ -74,6 +76,36 @@ public class ImportTaizDataTest {
         }
     }
 
+    private Map<String, Map<String, List<String>>> readFromTxt(String filePath) throws Exception {
+        initData();
+        Map<String, Map<String, List<String>>> result = new HashMap<>();
+        File file = new File(filePath);
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+            for (File f : files) {
+                BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"), 512);
+                List<String> list = new ArrayList<>();
+
+                String theWord = "";
+                String content = "";
+                do {
+                    theWord = br.readLine();
+                    if (theWord != null && !"".equals(theWord.trim())) {
+                        content = content + theWord;
+                    }
+                } while (theWord != null);
+
+                list.add(content);
+
+                Map<String, List<String>> map = new HashMap<>();
+                map.put("入院记录", list);
+
+                result.put(f.getName().substring(0, f.getName().indexOf(".")), map);
+            }
+        }
+        return result;
+    }
+
     private Map<String, Map<String, List<String>>> readFromExcel(String filePath) throws Exception {
         Map<String, Map<String, List<String>>> excelDataMap = new HashMap<>();
         //创建输入流