Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

wangyu před 5 roky
rodič
revize
5b0492ea83
19 změnil soubory, kde provedl 234 přidání a 39 odebrání
  1. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0023.java
  2. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0408.java
  3. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0174.java
  4. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0186.java
  5. 3 3
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0187.java
  6. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0189.java
  7. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0190.java
  8. 5 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0200.java
  9. 5 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0202.java
  10. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0239.java
  11. 14 3
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java
  12. 40 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0434.java
  13. 34 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0435.java
  14. 35 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0436.java
  15. 9 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessClinic.java
  16. 33 0
      kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java
  17. 2 2
      kernel/src/main/resources/kernel.properties
  18. 40 17
      kernel/src/test/java/com/lantone/qc/kernel/TaizDataImportApiTest.java
  19. 2 0
      public/src/main/java/com/lantone/qc/pub/model/label/PresentLabel.java

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0023.java

@@ -23,7 +23,8 @@ public class BEH0023 extends QCCatalogue {
         List<Pacs> pacses = inputInfo.getBeHospitalizedDoc().getPresentLabel().getPacses();
         List<Treat> treats = inputInfo.getBeHospitalizedDoc().getPresentLabel().getTreats();
         List<Operation> operations = inputInfo.getBeHospitalizedDoc().getPresentLabel().getOperations();
-        if(lises == null && pacses.size() == 0 && treats.size() == 0 && operations.size() == 0){
+        List<Medicine> medicines = inputInfo.getBeHospitalizedDoc().getPresentLabel().getMedicines();
+        if(lises == null && pacses.size() == 0 && treats.size() == 0 && operations.size() == 0 && medicines.size() == 0){
             status.set("-1");
         }
     }

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0408.java

@@ -22,7 +22,8 @@ public class BEH0408 extends QCCatalogue {
         status.set("0");
         Map<String, String> structureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
         if(structureMap != null){
-            String name = structureMap.get("联系地址");
+//            String name = structureMap.get("联系地址");
+            String name = structureMap.get("户口地址");
             if(CatalogueUtil.isEmpty(name)){
                 status.set("-1");
             }

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

@@ -23,7 +23,7 @@ public class FIRP0174 extends QCCatalogue {
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureExtMap() != null) {
             Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
             List<Map<String, String>> outpatientEmergencyDiag = (List) firstpageStructureMap.get(Content.dischargeDiag);
-            if (outpatientEmergencyDiag != null && outpatientEmergencyDiag.size() == 0) {
+            if (outpatientEmergencyDiag == null && outpatientEmergencyDiag.size() == 0) {
                 status.set("-1");
             }
         }

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

@@ -23,7 +23,7 @@ public class FIRP0186 extends QCCatalogue {
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
 //            String outWay = firstpageStructureMap.get(Content.outWay).toString();
-            String deadAutopsy = firstpageStructureMap.get(Content.deadAutopsy).toString();
+            String deadAutopsy = firstpageStructureMap.get(Content.deadAutopsy);
             if (StringUtils.isEmpty(deadAutopsy)){
                 status.set("-1");
             }

+ 3 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0187.java

@@ -20,9 +20,9 @@ public class FIRP0187 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
-            Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
-            String outWay = firstpageStructureMap.get(Content.outWay).toString();
-            String deadAutopsy = firstpageStructureMap.get(Content.deadAutopsy).toString();
+            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            String outWay = firstpageStructureMap.get(Content.outWay);
+            String deadAutopsy = firstpageStructureMap.get(Content.deadAutopsy);
             if (!CatalogueUtil.isEmpty(outWay) && !outWay.contains("死亡")
                     && !CatalogueUtil.isEmpty(deadAutopsy) && !deadAutopsy.trim().equals("-")){
                 status.set("-1");

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0189.java

@@ -20,8 +20,8 @@ public class FIRP0189 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
-            Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
-            String rhFactor = firstpageStructureMap.get(Content.rhFactor).toString();
+            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            String rhFactor = firstpageStructureMap.get(Content.rhFactor);
             if (CatalogueUtil.isEmpty(rhFactor)){
                 status.set("-1");
             }

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0190.java

@@ -23,9 +23,9 @@ public class FIRP0190 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null
                 && inputInfo.getClinicalBloodDocs().size() > 0) {
-            Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
+            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             List<ClinicalBloodDoc> clinicalBloodDocList = inputInfo.getClinicalBloodDocs();
-            String rhFactor = firstpageStructureMap.get(Content.rhFactor).toString();
+            String rhFactor = firstpageStructureMap.get(Content.rhFactor);
             if (CatalogueUtil.isEmpty(rhFactor)) {
                 return;
             }

+ 5 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0200.java

@@ -21,7 +21,11 @@ public class FIRP0200 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String newbornWeightStr = firstpageStructureMap.get(Content.newbornWeight).replace("-","");
+            String newbornWeightStr = firstpageStructureMap.get(Content.newbornWeight);
+            if (CatalogueUtil.isEmpty(newbornWeightStr)){
+                return;
+            }
+            newbornWeightStr = newbornWeightStr.replace("-","");
             if (!CatalogueUtil.isEmpty(newbornWeightStr)) {
                 int newbornWeight = Integer.parseInt(newbornWeightStr);
                 if (newbornWeight <= 1 || newbornWeight >= 10) {

+ 5 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0202.java

@@ -21,7 +21,11 @@ public class FIRP0202 extends QCCatalogue {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
-            String newbornAdmisWeightStr = firstpageStructureMap.get(Content.newbornAdmisWeight).replace("-","");
+            String newbornAdmisWeightStr = firstpageStructureMap.get(Content.newbornAdmisWeight);
+            if (CatalogueUtil.isEmpty(newbornAdmisWeightStr)){
+                return;
+            }
+            newbornAdmisWeightStr = newbornAdmisWeightStr.replace("-","");
             if (!CatalogueUtil.isEmpty(newbornAdmisWeightStr)) {
                 int newbornAdmisWeight = Integer.parseInt(newbornAdmisWeightStr);
                 if (newbornAdmisWeight <= 1 || newbornAdmisWeight >= 10) {

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0239.java

@@ -20,8 +20,8 @@ public class FIRP0239 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
-            Map<String, Object> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureExtMap();
-            String reHospitalization = firstpageStructureMap.get(Content.reHospitalization).toString();
+            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            String reHospitalization = firstpageStructureMap.get(Content.reHospitalization);
             if (CatalogueUtil.isEmpty(reHospitalization)) {
                 status.set("-1");
             }

+ 14 - 3
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0149.java

@@ -1,6 +1,7 @@
 package com.lantone.qc.kernel.catalogue.leavehospital;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
@@ -17,6 +18,8 @@ import org.springframework.stereotype.Component;
 
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @Description: 出院记录内容缺主诉
@@ -39,10 +42,18 @@ public class LEA0149 extends QCCatalogue {
                 if (lhStructureMap != null && chiefLabel != null) {
                     String bhChief = chiefLabel.getText().replaceAll("[\\p{Punct}\\pP]", "");
                     String bhThings = lhStructureMap.get("入院情况");
-                    bhThings = bhThings.replaceAll("[\\p{Punct}\\pP]", "");
-                    if (bhThings.indexOf(bhChief) < 0) {
-                        status.set("-1");
+                    Pattern compile = Pattern.compile("(?<=2.).*(?=3.体格检查)");
+                    Matcher matcher = compile.matcher(bhThings);
+                    while (matcher.find()){
+                        String number = matcher.group(0);
+                        if(CatalogueUtil.isEmpty(number)){
+                            status.set("-1");
+                        }
                     }
+//                    bhThings = bhThings.replaceAll("[\\p{Punct}\\pP]", "");
+//                    if (bhThings.indexOf(bhChief) < 0) {
+//                        status.set("-1");
+//                    }
                 }
             }
         }

+ 40 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0434.java

@@ -5,13 +5,20 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.DeathRecordDoc;
+import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.doc.SeriouslyIllNoticeDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
 
 /**
  * @ClassName : THR0434
@@ -23,9 +30,41 @@ import java.util.*;
 public class THR0434 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        //没有死亡记录并且没有离院记录,直接返回
+        if (inputInfo.getDeathRecordDoc() == null && inputInfo.getLeaveHospitalDoc() == null) {
+            return;
+        }
+        //没有病重通知书或者查房记录,直接返回
         if (ListUtil.isEmpty(inputInfo.getSeriouslyIllNoticeDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
+        //死亡记录不为空
+        if (inputInfo.getDeathRecordDoc() != null) {
+            DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
+            Map<String, String> deathRecordStructureMap = deathRecordDoc.getStructureMap();
+            String deathTime = deathRecordStructureMap.get("死亡时间");
+            if (StringUtil.isNotBlank(deathTime)) {
+                Date deathDate = StringUtil.parseDateTime(deathTime);
+                if (deathDate != null) {
+                    dealWithRescueRecord(inputInfo, deathDate);
+                }
+            }
+        }
+        //离院记录不为空
+        if (inputInfo.getLeaveHospitalDoc() != null) {
+            LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+            Map<String, String> leaveHospitalStructureMap = leaveHospitalDoc.getStructureMap();
+            String leaveHospitalTime = leaveHospitalStructureMap.get("出院时间");
+            if (StringUtil.isNotBlank(leaveHospitalTime)) {
+                Date leaveHospitalDate = StringUtil.parseDateTime(leaveHospitalTime);
+                if (leaveHospitalDate != null) {
+                    dealWithRescueRecord(inputInfo, leaveHospitalDate);
+                }
+            }
+        }
+    }
+
+    private void dealWithRescueRecord(InputInfo inputInfo, Date timeOfComparison) {
         List<SeriouslyIllNoticeDoc> seriouslyIllNoticeDocs = inputInfo.getSeriouslyIllNoticeDocs(); //病危通知书
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
             @Override

+ 34 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0435.java

@@ -5,7 +5,9 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.DeathRecordDoc;
 import com.lantone.qc.pub.model.doc.DifficultCaseDiscussDoc;
+import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
@@ -28,9 +30,41 @@ import java.util.TreeMap;
 public class THR0435 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        //没有死亡记录并且没有离院记录,直接返回
+        if (inputInfo.getDeathRecordDoc() == null && inputInfo.getLeaveHospitalDoc() == null) {
+            return;
+        }
+        //没有疑难病例讨论记录或者查房记录,直接返回
         if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
+        //死亡记录不为空
+        if (inputInfo.getDeathRecordDoc() != null) {
+            DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
+            Map<String, String> deathRecordStructureMap = deathRecordDoc.getStructureMap();
+            String deathTime = deathRecordStructureMap.get("死亡时间");
+            if (StringUtil.isNotBlank(deathTime)) {
+                Date deathDate = StringUtil.parseDateTime(deathTime);
+                if (deathDate != null) {
+                    dealWithRescueRecord(inputInfo, deathDate);
+                }
+            }
+        }
+        //离院记录不为空
+        if (inputInfo.getLeaveHospitalDoc() != null) {
+            LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+            Map<String, String> leaveHospitalStructureMap = leaveHospitalDoc.getStructureMap();
+            String leaveHospitalTime = leaveHospitalStructureMap.get("出院时间");
+            if (StringUtil.isNotBlank(leaveHospitalTime)) {
+                Date leaveHospitalDate = StringUtil.parseDateTime(leaveHospitalTime);
+                if (leaveHospitalDate != null) {
+                    dealWithRescueRecord(inputInfo, leaveHospitalDate);
+                }
+            }
+        }
+    }
+
+    private void dealWithRescueRecord(InputInfo inputInfo, Date timeOfComparison) {
         List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs(); //疑难病例讨论记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
             @Override

+ 35 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0436.java

@@ -5,6 +5,8 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.DeathRecordDoc;
+import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
 import com.lantone.qc.pub.model.doc.RescueDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.util.ListUtil;
@@ -28,9 +30,41 @@ import java.util.TreeMap;
 public class THR0436 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        //没有死亡记录并且没有离院记录,直接返回
+        if (inputInfo.getDeathRecordDoc() == null && inputInfo.getLeaveHospitalDoc() == null) {
+            return;
+        }
+        //没有抢救记录或者查房记录,直接返回
         if (ListUtil.isEmpty(inputInfo.getRescueDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
+        //死亡记录不为空
+        if (inputInfo.getDeathRecordDoc() != null) {
+            DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
+            Map<String, String> deathRecordStructureMap = deathRecordDoc.getStructureMap();
+            String deathTime = deathRecordStructureMap.get("死亡时间");
+            if (StringUtil.isNotBlank(deathTime)) {
+                Date deathDate = StringUtil.parseDateTime(deathTime);
+                if (deathDate != null) {
+                    dealWithRescueRecord(inputInfo, deathDate);
+                }
+            }
+        }
+        //离院记录不为空
+        if (inputInfo.getLeaveHospitalDoc() != null) {
+            LeaveHospitalDoc leaveHospitalDoc = inputInfo.getLeaveHospitalDoc();
+            Map<String, String> leaveHospitalStructureMap = leaveHospitalDoc.getStructureMap();
+            String leaveHospitalTime = leaveHospitalStructureMap.get("出院时间");
+            if (StringUtil.isNotBlank(leaveHospitalTime)) {
+                Date leaveHospitalDate = StringUtil.parseDateTime(leaveHospitalTime);
+                if (leaveHospitalDate != null) {
+                    dealWithRescueRecord(inputInfo, leaveHospitalDate);
+                }
+            }
+        }
+    }
+
+    private void dealWithRescueRecord(InputInfo inputInfo, Date timeOfComparison) {
         List<RescueDoc> rescueDocs = inputInfo.getRescueDocs(); //抢救记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
             @Override
@@ -44,7 +78,7 @@ public class THR0436 extends QCCatalogue {
             Map<String, String> rescueStructureMap = rescueDoc.getStructureMap();
             recordTime = rescueStructureMap.get("抢救时间");
             Date recordDate = StringUtil.parseDateTime(recordTime);
-            if (recordDate == null) {
+            if (recordDate == null || CatalogueUtil.equalsDate(recordDate, timeOfComparison, "yyyy-MM-dd")) {
                 continue;
             }
             dateRecord.put(recordDate, rescueStructureMap);

+ 9 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessClinic.java

@@ -99,6 +99,15 @@ public class EntityProcessClinic extends EntityProcess {
                 treats.add(treat);
             }
             presentLabel.setTreats(treats);
+            //治疗
+            List<Lemma> cureLemmas_me = createEntityTree(aiOut, EntityEnum.DRUG.toString());
+            List<Medicine> medicines = new ArrayList<>();
+            for (Lemma lemma : cureLemmas_me) {
+                Medicine medicine = new Medicine();
+                medicine.setName(lemma.getText());
+                medicines.add(medicine);
+            }
+            presentLabel.setMedicines(medicines);
 
             //手术
             List<Lemma> operationLemmas = createEntityTree(aiOut, EntityEnum.OPERATION.toString());

+ 33 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java

@@ -3,6 +3,7 @@ package com.lantone.qc.kernel.util;
 import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.util.ListUtil;
@@ -146,6 +147,14 @@ public class CatalogueUtil {
         return false;
     }
 
+    public static boolean equalsDate(Date firstDate, Date secondDate, String datePattren) {
+        if (firstDate != null && secondDate != null) {
+            SimpleDateFormat fmt = new SimpleDateFormat(datePattren);
+            return fmt.format(firstDate).equals(fmt.format(secondDate));
+        }
+        return false;
+    }
+
     /**
      * 对比两个String类型的Date先后
      *
@@ -312,6 +321,7 @@ public class CatalogueUtil {
 
     /**
      * 判断字符串是否包含中文字
+     *
      * @param str
      * @return
      */
@@ -323,4 +333,27 @@ public class CatalogueUtil {
         }
         return false;
     }
+
+    /**
+     * 判断是否为手术患者
+     *
+     * @param doctorAdviceDocs
+     * @return
+     */
+    public static boolean isOperativePatients(List<DoctorAdviceDoc> doctorAdviceDocs) {
+        String orderPrescriptionType, orderItemName;
+        for (DoctorAdviceDoc doctorAdviceDoc : doctorAdviceDocs) {
+            Map<String, String> doctorAdviceStructureMap = doctorAdviceDoc.getStructureMap();
+            orderPrescriptionType = doctorAdviceStructureMap.get("医嘱处方类型");
+            orderItemName = doctorAdviceStructureMap.get("医嘱项目名称");
+            if (StringUtil.isNotBlank(orderPrescriptionType) && "手术".equals(orderPrescriptionType)) {
+                return true;
+            }
+            if (StringUtil.isNotBlank(orderItemName) && Pattern.matches(".*拟.*术.*", orderItemName)
+                    && !orderItemName.contains("冠脉造影")) {
+                return true;
+            }
+        }
+        return false;
+    }
 }

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

@@ -8,6 +8,6 @@ mysql.test.password = lantone
 mysql.test.url = jdbc:mysql://192.168.2.236:3306/sys-qctest?useUnicode=true&characterEncoding=UTF-8
 
 oracle.test.driver = oracle.jdbc.driver.OracleDriver
-oracle.test.user = ETRACKMRQC
-oracle.test.password = ETRACKMRQC
+oracle.test.user = ETRACKMRQCNEW
+oracle.test.password = ETRACKMRQCNEW
 oracle.test.url = jdbc:oracle:thin:@192.168.2.246:1521:orcl

+ 40 - 17
kernel/src/test/java/com/lantone/qc/kernel/TaizDataImportApiTest.java

@@ -37,13 +37,16 @@ public class TaizDataImportApiTest {
 
     private static void initTableMap() {
         if (cid.equals("changx")) {
-            tableMap.put("BR_INPATIENTINFO", "BR_INPATIENTINFO_CX");//患者信息
-            tableMap.put("GI_USERINFO", "GI_USERINFO_CX"); //医生
-            tableMap.put("HI_DEPTINFO", "HI_DEPTINFO_CX");//科室
-            tableMap.put("BR_RECHOME", "BR_RECHOME_CX");//病案首页
-            tableMap.put("BR_RECDIAGNOSE", "BR_RECDIAGNOSE_CX");//病案首页--出院诊断 门急诊诊断
-            tableMap.put("BR_DOCTADVICE", "BR_DOCTADVICE_CX");//医嘱
-            tableMap.put("BR_RECOPERATION", "BR_RECOPERATION_CX");//病案首页--手术
+            tableMap.put("BR_INPATIENTINFO", "BR_INPATIENTINFO");//患者信息
+            tableMap.put("MR_MEDICALRECORDS", "MR_MEDICALRECORDS");//病案首页--手术
+            tableMap.put("AR_MEDIRECCLASS", "AR_MEDIRECCLASS");//病案首页--手术
+            tableMap.put("MR_MRCONTENT", "MR_MRCONTENT");//病案首页--手术
+            tableMap.put("GI_USERINFO", "GI_USERINFO"); //医生
+            tableMap.put("HI_DEPTINFO", "HI_DEPTINFO");//科室
+            tableMap.put("BR_RECHOME", "BR_RECHOME");//病案首页
+            tableMap.put("BR_RECDIAGNOSE", "BR_RECDIAGNOSE");//病案首页--出院诊断 门急诊诊断
+            tableMap.put("BR_DOCTADVICE", "BR_DOCTADVICE");//医嘱
+            tableMap.put("BR_RECOPERATION", "BR_RECOPERATION");//病案首页--手术
         } else if (cid.equals("taizhou")) {
             tableMap.put("BR_INPATIENTINFO", "BR_INPATIENTINFO_TZ");
             tableMap.put("GI_USERINFO", "GI_USERINFO_TZ");
@@ -56,16 +59,18 @@ public class TaizDataImportApiTest {
     }
 
     public static void main(String[] args) {
+        String patientId = "ZY010000650197";
+
         TaizDataImportApiTest test = new TaizDataImportApiTest();
         initTableMap();
         //模块映射
         test.loadModelHospital();
         //患者信息
-        test.insertPatient(test.loadOraclePatients(tableMap.get("BR_INPATIENTINFO")));
+        test.insertPatient(test.loadOraclePatients(tableMap.get("BR_INPATIENTINFO"), patientId));
 //        test.insertDoctor(test.loadOracleDoctorInfos(tableMap.get("GI_USERINFO"), tableMap.get("HI_DEPTINFO")));
 
         //病人流水号获取    病历号--->id
-        Map<String, String> patientMap = test.loadPatients(hospitalId);
+        Map<String, String> patientMap = test.loadPatients(hospitalId, patientId);
         //model-->id
         Map<String, String> modelMap = test.loadModel();
         test.insertPatientText(patientMap, modelMap);
@@ -79,7 +84,7 @@ public class TaizDataImportApiTest {
             patientMap.put("hospital_id", hospitalId);
             list.add(patientMap);
         }
-        initMysqlJdbc().insert(list, "qc_cases_number_copy", new String[]{"hospital_id", "case_number"});
+        initMysqlJdbc().insert(list, "qc_cases_number", new String[]{"hospital_id", "case_number"});
     }
 
     private void insertDoctor(List<Doctor> doctors) {
@@ -181,7 +186,7 @@ public class TaizDataImportApiTest {
                 list.add(patientTextMap);
             }
         }
-        initMysqlJdbc().insert(list, "qc_model_mapping_copy", new String[]{"case_number", "case_number_id", "origin_text", "mode_id", "text", "origin_mode"});
+        initMysqlJdbc().insert(list, "qc_model_mapping", new String[]{"case_number", "case_number_id", "origin_text", "mode_id", "text", "origin_mode"});
 
         deletePatientInfos(deletePatient);
     }
@@ -214,6 +219,10 @@ public class TaizDataImportApiTest {
     }
 
     private List<Patient> loadOraclePatients(String tableName) {
+        return loadOraclePatients(tableName, "");
+    }
+
+    private List<Patient> loadOraclePatients(String tableName, String patientId) {
         MysqlJdbc mysqlJdbc = initOracleJdbc();
         Connection conn = mysqlJdbc.connect();
         Statement st = null;
@@ -222,7 +231,12 @@ public class TaizDataImportApiTest {
         List<Patient> patients = new ArrayList<>();
         try {
             st = conn.createStatement();
-            String sql = "select BRZYID from " + tableName;
+            String sql = "";
+            if (StringUtils.isNotEmpty(patientId)) {
+                sql = "select BRZYID from " + tableName + " where BRZYID = '" + patientId + "'";
+            } else {
+                sql = "select BRZYID from " + tableName;
+            }
             rs = st.executeQuery(sql);
             while (rs.next()) {
                 r1 = rs.getString(1);
@@ -311,9 +325,9 @@ public class TaizDataImportApiTest {
         List<PatientText> patientTexts = new ArrayList<>();
         try {
             st = conn.createStatement();
-            String sql = "select a.brzyid,c.bllbmc,b.bljlnr from MR_MEDICALRECORDS_CX a " +
-                    "left join MR_MRCONTENT_CX b on a.bljlid=b.bljlid " +
-                    "left join AR_MEDIRECCLASS_CX c on a.Bllbid = c.bllbid " +
+            String sql = "select a.brzyid,c.bllbmc,b.bljlnr from " + tableMap.get("MR_MEDICALRECORDS") + " a " +
+                    "left join " + tableMap.get("MR_MRCONTENT") + " b on a.bljlid=b.bljlid " +
+                    "left join " + tableMap.get("AR_MEDIRECCLASS") + " c on a.Bllbid = c.bllbid " +
                     "where bljlnr is not null and brzyid = '" + brzyid + "' " +
                     "order by brzyid";
             rs = st.executeQuery(sql);
@@ -354,6 +368,10 @@ public class TaizDataImportApiTest {
     }
 
     private Map<String, String> loadPatients(String hospitalId) {
+        return loadPatients(hospitalId, null);
+    }
+
+    private Map<String, String> loadPatients(String hospitalId, String patientId) {
         MysqlJdbc mysqlJdbc = initMysqlJdbc();
         Connection conn = mysqlJdbc.connect();
         Statement st = null;
@@ -362,7 +380,12 @@ public class TaizDataImportApiTest {
         Map<String, String> map = new HashMap<>();
         try {
             st = conn.createStatement();
-            String sql = "select id, case_number from qc_cases_number_copy where hospital_id = " + hospitalId;
+            String sql = "";
+            if (StringUtils.isNotEmpty(patientId)) {
+                sql = "select id, case_number from qc_cases_number where hospital_id = " + hospitalId + " and case_number = '" + patientId + "'";
+            } else {
+                sql = "select id, case_number from qc_cases_number where hospital_id = " + hospitalId;
+            }
             rs = st.executeQuery(sql);
             while (rs.next()) {
                 r1 = rs.getString(1);
@@ -438,7 +461,7 @@ public class TaizDataImportApiTest {
         try {
             st = conn.createStatement();
             for (String caseNumber : caseNumbers) {
-                String sql = "delete from qc_cases_number_copy where case_number = '" + caseNumber + "'";
+                String sql = "delete from qc_cases_number where case_number = '" + caseNumber + "'";
                 st.execute(sql);
             }
         } catch (SQLException sqle) {

+ 2 - 0
public/src/main/java/com/lantone/qc/pub/model/label/PresentLabel.java

@@ -24,6 +24,8 @@ public class PresentLabel extends GeneralLabel {
     private List<Lis> lises;
     //治疗
     private List<Treat> treats;
+    //药物
+    private List<Medicine> medicines;
     //一般情况
     private List<General> gens = new ArrayList<>();
     //一般情况描述