Sfoglia il codice sorgente

1、创建新模块 医嘱、有创操作记录
诊疗合理性
病历书写规范
麻醉相关

louhr 5 anni fa
parent
commit
39c7cefb7c

+ 6 - 0
kernel/pom.xml

@@ -94,6 +94,12 @@
 			<artifactId>cglib</artifactId>
 			<version>2.2.2</version>
 		</dependency>
+
+		<dependency>
+			<groupId>net.sourceforge.jexcelapi</groupId>
+			<artifactId>jxl</artifactId>
+			<version>2.6.12</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 10 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/anesthesiarelated/ANES0679.java

@@ -0,0 +1,10 @@
+package com.lantone.qc.kernel.catalogue.anesthesiarelated;
+
+/**
+ * @ClassName : ANES0679
+ * @Description : 麻醉相关
+ * @Author : 楼辉荣
+ * @Date: 2020-03-28 17:33
+ */
+public class ANES0679 {
+}

+ 10 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/doctorsadvice/ADVI0589.java

@@ -0,0 +1,10 @@
+package com.lantone.qc.kernel.catalogue.doctorsadvice;
+
+/**
+ * @ClassName : ADVI0589
+ * @Description : 医嘱
+ * @Author : 楼辉荣
+ * @Date: 2020-03-28 17:35
+ */
+public class ADVI0589 {
+}

+ 10 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/invasiveoperation/INVA0622.java

@@ -0,0 +1,10 @@
+package com.lantone.qc.kernel.catalogue.invasiveoperation;
+
+/**
+ * @ClassName : INVA0622
+ * @Description :
+ * @Author : 楼辉荣
+ * @Date: 2020-03-28 17:28
+ */
+public class INVA0622 {
+}

+ 10 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/medicalwriting/MEDI0653.java

@@ -0,0 +1,10 @@
+package com.lantone.qc.kernel.catalogue.medicalwriting;
+
+/**
+ * @ClassName : MEDI0653
+ * @Description :病历书写规范
+ * @Author : 楼辉荣
+ * @Date: 2020-03-28 17:32
+ */
+public class MEDI0653 {
+}

+ 10 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/reasonablediagnosis/REAS0627.java

@@ -0,0 +1,10 @@
+package com.lantone.qc.kernel.catalogue.reasonablediagnosis;
+
+/**
+ * @ClassName : REAS0627
+ * @Description : 诊疗合理性-诊治过程欠合理
+ * @Author : 楼辉荣
+ * @Date: 2020-03-28 17:30
+ */
+public class REAS0627 {
+}

+ 64 - 35
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java

@@ -66,20 +66,27 @@ public class BeHospitalizedAI extends ModelAI {
             String vital_text = beHospitalizedDoc.getVitalLabel().getText();
             //专科体格检查
             String vitalSpecial_text = beHospitalizedDoc.getVitalLabelSpecial().getText();
-            //主诉
-            putContent(crfContent, medicalTextType.get(3), chief_text, Content.chief);
-            //现病史
-            putContent(crfContent, medicalTextType.get(7), present_text, Content.present);
-            //专科检查
-            putContent(crfContent, medicalTextType.get(3), vitalSpecial_text, Content.special_exam);
-            //既往史
-            putContent(crfContent, medicalTextType.get(1), past_text, Content.past);
-            //家族史
-            putContent(crfContent, medicalTextType.get(1), family_text, Content.family);
-            //存放一般查体
-            putContent(crfContent, medicalTextType.get(4), vital_text, Content.phys_exam);
-            //个人史
-            putContent(crfContent, medicalTextType.get(2), personal_text, Content.personal);
+            if (beHospitalizedDoc.getChiefLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(3), chief_text, Content.chief);  //主诉
+            }
+            if (beHospitalizedDoc.getPresentLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(7), present_text, Content.present);//现病史
+            }
+            if (beHospitalizedDoc.getVitalLabelSpecial().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(3), vitalSpecial_text, Content.special_exam);//专科检查
+            }
+            if (beHospitalizedDoc.getPastLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(1), past_text, Content.past);//既往史
+            }
+            if (beHospitalizedDoc.getFamilyLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(1), family_text, Content.family);//家族史
+            }
+            if (beHospitalizedDoc.getVitalLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(4), vital_text, Content.phys_exam);//存放一般查体
+            }
+            if (beHospitalizedDoc.getPersonalLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(2), personal_text, Content.personal);//个人史
+            }
             //月经史
             String concatMenstrual = "";
             if(personal_text != null){
@@ -89,49 +96,71 @@ public class BeHospitalizedAI extends ModelAI {
                     concatMenstrual = personal_text;
                 }
             }
-
-            putContent(crfContent, medicalTextType.get(2), concatMenstrual, menstrual_text, Content.menses);
-            //婚育史
-            putContent(crfContent, medicalTextType.get(2), marital_text, Content.marriage);
-            //辅助检查(暂用主诉现病史模型,之后会新训练单独模型再做修改)
-            putContent(crfContent, medicalTextType.get(3), pacs_text, Content.pacs);
-            //初步诊断
-            putContent(crfContent, medicalTextType.get(6), initial_diag_text, Content.initial_diag);
-            if (StringUtils.isNotEmpty(revised_diag_text)) {
+            if (beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(2), concatMenstrual, menstrual_text, Content.menses);//月经史
+            }
+            if (beHospitalizedDoc.getMaritalLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(2), marital_text, Content.marriage);//婚育史
+            }
+            if (beHospitalizedDoc.getPacsLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(3), pacs_text, Content.pacs);//辅助检查(暂用主诉现病史模型,之后会新训练单独模型再做修改)
+            }
+            if (beHospitalizedDoc.getInitialDiagLabel().isCrfLabel()) {
+                putContent(crfContent, medicalTextType.get(6), initial_diag_text, Content.initial_diag);//初步诊断
+            }
+            if (StringUtils.isNotEmpty(revised_diag_text) && beHospitalizedDoc.getRevisedDiagLabel().isCrfLabel()) {
                 //修正诊断
                 putContent(crfContent, medicalTextType.get(6), revised_diag_text, Content.revised_diag);
             }
-            if (StringUtils.isNotEmpty(supple_diag_text)) {
+            if (StringUtils.isNotEmpty(supple_diag_text) && beHospitalizedDoc.getSuppleDiagLabel().isCrfLabel()) {
                 //补充诊断
                 putContent(crfContent, medicalTextType.get(6), supple_diag_text, Content.supple_diag);
             }
             JSONObject midData = loadAI(crfContent, crfServiceClient);
             //处理主诉
-            putChiefCrfData(midData.getJSONObject(Content.chief), inputInfo);
+            if (beHospitalizedDoc.getChiefLabel().isCrfLabel()) {
+                putChiefCrfData(midData.getJSONObject(Content.chief), inputInfo);
+            }
             //处理现病史
-            putPresentCrfData(midData.getJSONObject(Content.present), inputInfo);
+            if (beHospitalizedDoc.getPresentLabel().isCrfLabel()) {
+                putPresentCrfData(midData.getJSONObject(Content.present), inputInfo);
+            }
             //处理既往史
-            putPastCrfData(midData.getJSONObject(Content.past), inputInfo);
+            if (beHospitalizedDoc.getPastLabel().isCrfLabel()) {
+                putPastCrfData(midData.getJSONObject(Content.past), inputInfo);
+            }
             //处理个人史
-            putPersonalCrfData(midData.getJSONObject(Content.personal), inputInfo);
+            if (beHospitalizedDoc.getPersonalLabel().isCrfLabel()) {
+                putPersonalCrfData(midData.getJSONObject(Content.personal), inputInfo);
+            }
             //处理月经史
-            putMensesCrfData(midData.getJSONObject(Content.menses), inputInfo);
+            if (beHospitalizedDoc.getMenstrualLabel().isCrfLabel()) {
+                putMensesCrfData(midData.getJSONObject(Content.menses), inputInfo);
+            }
             //处理家族史
-            putFamilyCrfData(midData.getJSONObject(Content.family), inputInfo);
+            if (beHospitalizedDoc.getFamilyLabel().isCrfLabel()) {
+                putFamilyCrfData(midData.getJSONObject(Content.family), inputInfo);
+            }
             //处理婚育史
-            putMaritalCrfData(midData.getJSONObject(Content.marriage), inputInfo);
+            if (beHospitalizedDoc.getMaritalLabel().isCrfLabel()) {
+                putMaritalCrfData(midData.getJSONObject(Content.marriage), inputInfo);
+            }
             //处理初步诊断
-            putInitialDiagCrfData(midData.getJSONObject(Content.pridiag), inputInfo);
-            if (StringUtils.isNotEmpty(revised_diag_text)) {
+            if (beHospitalizedDoc.getInitialDiagLabel().isCrfLabel()) {
+                putInitialDiagCrfData(midData.getJSONObject(Content.pridiag), inputInfo);
+            }
+            if (StringUtils.isNotEmpty(revised_diag_text) && beHospitalizedDoc.getRevisedDiagLabel().isCrfLabel()) {
                 //处理修正诊断
                 putRevisedDiagCrfData(midData.getJSONObject(Content.revised_diag), inputInfo);
             }
-            if (StringUtils.isNotEmpty(revised_diag_text)) {
+            if (StringUtils.isNotEmpty(revised_diag_text) && beHospitalizedDoc.getSuppleDiagLabel().isCrfLabel()) {
                 //处理补充诊断
                 putSuppleDiagCrfData(midData.getJSONObject(Content.supple_diag), inputInfo);
             }
             //处理辅助检查
-            putPacsCrfData(midData.getJSONObject(Content.pacs), inputInfo);
+            if (beHospitalizedDoc.getPacsLabel().isCrfLabel()) {
+                putPacsCrfData(midData.getJSONObject(Content.pacs), inputInfo);
+            }
         }
     }
 

+ 1 - 1
kernel/src/main/resources/kernel.properties

@@ -5,4 +5,4 @@ mysql.redis.url = jdbc:mysql://192.168.2.236:3306/qc?useUnicode=true&characterEn
 
 mysql.test.user = root
 mysql.test.password = lantone
-mysql.test.url = jdbc:mysql://192.168.2.236:3306/sys-mrqc?useUnicode=true&characterEncoding=UTF-8
+mysql.test.url = jdbc:mysql://192.168.2.236:3306/sys-qctest?useUnicode=true&characterEncoding=UTF-8

+ 135 - 0
kernel/src/test/java/com/lantone/qc/kernel/ImportTaizDataTest.java

@@ -0,0 +1,135 @@
+package com.lantone.qc.kernel;
+
+
+import com.lantone.qc.pub.jdbc.MysqlJdbc;
+import com.lantone.qc.pub.util.PropertiesUtil;
+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.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.*;
+
+/**
+ * @ClassName : ImportTaizTestData
+ * @Description :
+ * @Author : 楼辉荣
+ * @Date: 2020-03-28 09:51
+ */
+public class ImportTaizDataTest {
+    private static Map<String, String> modelInfoMap = new HashMap<>();
+
+    public static void main(String[] args) {
+        ImportTaizDataTest importTaizDataTest = new ImportTaizDataTest();
+        String filePath = "E:\\docs\\产品目录\\病历质控\\病历数据\\台州\\质控医院数据采集标准格式20200326.xls";
+        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);
+            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()) {
+                        String text = "";
+                        Map<String, Object> rowMap = new HashMap<>();
+                        rowMap.put("mode_id", modelInfoMap.get(modelEntry.getKey()));
+                        rowMap.put("origin_text", s);
+                        if (StringUtils.isNotEmpty(s)) {
+                            Map<String, String> textMap = TzXmlUtil.getXmlToMapForTZ(s);
+                            for (Map.Entry<String, String> e : textMap.entrySet()) {
+                                text = text + "【" + e.getKey() + "】:" + e.getValue() + "\n";
+                            }
+                        }
+                        rowMap.put("case_number", entry.getKey());
+                        rowMap.put("text", text);
+                        modelMappingInserts.add(rowMap);
+                    }
+                }
+                patients.add(entry.getKey());
+            }
+
+            for (String patientSerial : patients) {
+                Map<String, Object> patientSerialMap = new HashMap<>();
+                patientSerialMap.put("case_number", patientSerial);
+                patientSerialMap.put("hospital_id", "3");
+                patientInserts.add(patientSerialMap);
+            }
+
+            PropertiesUtil propertiesUtil = new PropertiesUtil("kernel.properties");
+            MysqlJdbc mysqlJdbc = new MysqlJdbc(propertiesUtil.getProperty("mysql.test.user"),
+                    propertiesUtil.getProperty("mysql.test.password"),
+                    propertiesUtil.getProperty("mysql.test.url"));
+            mysqlJdbc.insert(patientInserts, "qc_cases_number", new String[]{"hospital_id", "case_number"});
+            mysqlJdbc.insert(modelMappingInserts, "qc_model_mapping", new String[]{"case_number", "origin_text", "mode_id", "text"});
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private Map<String, Map<String, List<String>>> readFromExcel(String filePath) throws Exception {
+        Map<String, Map<String, List<String>>> excelDataMap = new HashMap<>();
+        //创建输入流
+        InputStream stream = new FileInputStream(filePath);
+        //获取Excel文件对象
+        Workbook rwb = Workbook.getWorkbook(stream);
+        //获取文件的指定工作表 默认的第一个
+        Sheet sheet = rwb.getSheet(0);
+        //行数(表头的目录不需要,从1开始)
+        String patientSerial = "";
+        Map<String, List<String>> modelMap = initData();
+        for (int i = 1; i < sheet.getRows(); i++) {
+            Cell patientCell = sheet.getCell(0, i);
+            Cell modelCell = sheet.getCell(1, i);
+            Cell contentCell = sheet.getCell(2, i);
+            modelMap.get(modelCell.getContents()).add(contentCell.getContents());
+            if (StringUtils.isNotEmpty(patientSerial) && !patientSerial.equals(patientCell.getContents())) {
+                excelDataMap.put(patientSerial, modelMap);
+                modelMap = initData();
+            }
+            patientSerial = patientCell.getContents();
+        }
+        excelDataMap.put(patientSerial, modelMap);
+        return excelDataMap;
+    }
+
+    private Map<String, List<String>> initData() {
+        PropertiesUtil propertiesUtil = new PropertiesUtil("kernel.properties");
+        MysqlJdbc mysqlJdbc = new MysqlJdbc(propertiesUtil.getProperty("mysql.test.user"),
+                propertiesUtil.getProperty("mysql.test.password"),
+                propertiesUtil.getProperty("mysql.test.url"));
+        Connection conn = mysqlJdbc.connect();
+        Statement st = null;
+        ResultSet rs = null;
+        String r1, r2;
+        List<String> modeNamesList = new ArrayList<>();
+        try {
+            st = conn.createStatement();
+            String sql = "select id, name from qc_mode";
+            rs = st.executeQuery(sql);
+            while (rs.next()) {
+                r1 = rs.getString(1);
+                r2 = rs.getString(2);
+                modelInfoMap.put(r2, r1);
+                modeNamesList.add(r2);
+            }
+        } catch (SQLException sqle) {
+            sqle.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            mysqlJdbc.close(rs, st, conn);
+        }
+        Map<String, List<String>> map = new HashMap<>();
+        modeNamesList.stream().forEach(x ->
+                map.put(x, new ArrayList<String>()));
+        return map;
+    }
+}

+ 1 - 0
public/src/main/java/com/lantone/qc/pub/model/label/GeneralLabel.java

@@ -17,6 +17,7 @@ import java.util.Map;
 @Getter
 public class GeneralLabel {
     private String text;
+    private boolean crfLabel = true;
     protected  <T> void add(List<T> list, T obj) {
         list.add(obj);
     }