Explorar o código

三级查房规则修改bug

hujing %!s(int64=5) %!d(string=hai) anos
pai
achega
e12dd7a2fa

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0429.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -20,6 +21,9 @@ import java.util.List;
 public class THR0429 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs())){
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0430.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -20,6 +21,9 @@ import java.util.List;
 public class THR0430 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getRescueDocs())){
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0431.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,6 +20,9 @@ import java.util.List;
 public class THR0431 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getSeriouslyIllNoticeDocs())){
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0432.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,6 +20,9 @@ import java.util.List;
 public class THR0432 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs())){
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0433.java

@@ -5,6 +5,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.ListUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -19,6 +20,9 @@ import java.util.List;
 public class THR0433 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        if (ListUtil.isEmpty(inputInfo.getRescueDocs())){
+            return;
+        }
         if (inputInfo.getThreeLevelWardDocs().size() > 0) {
             List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
             for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0435.java

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.DifficultCaseDiscussDoc;
 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;
 
@@ -27,7 +28,7 @@ import java.util.TreeMap;
 public class THR0435 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getDifficultCaseDiscussDocs().size() == 0 || inputInfo.getThreeLevelWardDocs().size() == 0) {
+        if (ListUtil.isEmpty(inputInfo.getDifficultCaseDiscussDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
         List<DifficultCaseDiscussDoc> difficultCaseDiscussDocs = inputInfo.getDifficultCaseDiscussDocs(); //疑难病例讨论记录

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

@@ -7,6 +7,7 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.RescueDoc;
 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;
 
@@ -27,7 +28,7 @@ import java.util.TreeMap;
 public class THR0436 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getRescueDocs().size() == 0 || inputInfo.getThreeLevelWardDocs().size() == 0) {
+        if (ListUtil.isEmpty(inputInfo.getRescueDocs()) || ListUtil.isEmpty(inputInfo.getThreeLevelWardDocs())) {
             return;
         }
         List<RescueDoc> rescueDocs = inputInfo.getRescueDocs(); //抢救记录

+ 28 - 7
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -56,7 +56,7 @@ public class ThreeLevelWardAI extends ModelAI {
         Map<String, String> lastCourseRecord = getLastCourseRecord(threeLevelWardDocs);
         if (lastCourseRecord != null && lastCourseRecord.containsKey("病情记录")) {
             //主任医师最后一次查房记录
-            putContent(crfContent, medicalTextType.get(1), lastCourseRecord.get("病情记录"), "最后一次" + Content.director);
+            putContent(crfContent, medicalTextType.get(1), lastCourseRecord.get("病情记录"), Content.director + "最后一次");
         }
 
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
@@ -86,7 +86,10 @@ public class ThreeLevelWardAI extends ModelAI {
         if (midData.get(Content.director) != null) {
             putWardRoundCrfData(midData.getJSONObject(Content.director), inputInfo, Content.director, 0);//查房记录
         }
-        putWardRoundCrfData(midData.getJSONObject("最后一次" + Content.director), inputInfo, "最后一次" + Content.director, 0);//最后一次查房记录
+        //主任医师最后一次查房记录模型输出
+        if (midData.get(Content.director + "最后一次") != null) {
+            putWardRoundCrfData(midData.getJSONObject(Content.director + "最后一次"), inputInfo, Content.director + "最后一次", 0);//最后一次查房记录
+        }
         //疑难患者副高及以上查房记录模型输出
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0 && ListUtil.isNotEmpty(directorDifficultRecord)) {
             for (int i = 0; i < directorDifficultRecord.size(); i++) {
@@ -108,6 +111,19 @@ public class ThreeLevelWardAI extends ModelAI {
 
     }
 
+    protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign) {
+        String move_text = CatalogueUtil.removeSpecialChar(text);
+        if (StringUtil.isEmpty(move_text)) {
+            return;
+        }
+        JSONObject detailContent = new JSONObject();
+        detailContent.put("medical_text_type", medicalTextType);
+        detailContent.put("content", move_text);
+        detailContent.put("detail_title", sign);
+        detailContent.put("originalText", text);
+        crfContent.add(detailContent);
+    }
+
     /**
      * 处理查房记录
      *
@@ -116,15 +132,20 @@ public class ThreeLevelWardAI extends ModelAI {
      */
     public void putWardRoundCrfData(JSONObject jsonObject, InputInfo inputInfo, String detailTitle, int serious) {
         JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        String originalText = jsonObject.getString("originalText");
         //使用现病史结构来处理病历特点
         EntityProcessThreeLevelWard entityProcessThreeLevelWard = new EntityProcessThreeLevelWard();
         ThreeLevelWardLabel threeLevelWardLabel = entityProcessThreeLevelWard.extractEntity(aiOut);
         threeLevelWardLabel.setTitle(detailTitle);
         threeLevelWardLabel.setSerious(serious);
-        ThreeLevelWardDoc threeLevelWardDoc = new ThreeLevelWardDoc();
-        threeLevelWardDoc.setThreeLevelWardLabel(threeLevelWardLabel);
-        //临床表现
-        inputInfo.getThreeLevelWardDocs().add(threeLevelWardDoc);
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+            String text = threeLevelWardDoc.getText();
+            if (StringUtil.isNotBlank(text) && StringUtil.isNotBlank(originalText) && text.equals(originalText)) {
+                threeLevelWardDoc.setThreeLevelWardLabel(threeLevelWardLabel);
+                break;
+            }
+        }
     }
 
     /**
@@ -303,7 +324,7 @@ public class ThreeLevelWardAI extends ModelAI {
             dateRecord.put(recordDate, rescueStructureMap);
         }
         List<Map<String, String>> dateRecordList = new ArrayList<>(dateRecord.values());
-        if (ListUtil.isEmpty(dateRecordList)){
+        if (ListUtil.isEmpty(dateRecordList)) {
             return null;
         }
         return dateRecordList.get(0);

+ 8 - 9
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -65,9 +65,8 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
             //补充诊断/初步诊断/修正诊断
             addDiag(threeLevelWardLabel, diffDiagSplit, diagLemmas);
             //添加鉴别诊断
-            List<Lemma> dieaseLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
             List<Diag> diags = new ArrayList<>();
-            for (Lemma dieaseLemma : dieaseLemmas) {
+            for (Lemma dieaseLemma : diagLemmas) {
                 if (Integer.parseInt(dieaseLemma.getPosition()) < Integer.parseInt(diffDiagSplit[0])
                         || Integer.parseInt(dieaseLemma.getPosition()) > Integer.parseInt(diffDiagSplit[diffDiagSplit.length - 1])) {
                     continue;
@@ -173,25 +172,25 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         String subContentIndex = "", title = "";
         for (int i = 0; i < lemmaList.size(); i++) {
             lemma = lemmaList.get(i);
-            if (!titleList.contains(lemma.getProperty()) && i != lemmaList.size() - 1) {
+            if (!titleList.contains(lemma.getProperty())) {
                 continue;
             }
             if (i != lemmaList.size() - 1) {
                 if (start == 0) {
                     start = Integer.parseInt(lemma.getPosition());
-                    title = lemma.getText();//截取的这一段文本的标题
+                    title = lemma.getProperty();//截取的这一段文本的标题
                 } else {
                     //subContent = content.substring(start + title.length(), Integer.parseInt(lemma.getPosition()));
-                    subContentIndex = start + title.length() + "," + Integer.parseInt(lemma.getPosition());
+                    subContentIndex = start + lemma.getText().length() + 1 + "," + Integer.parseInt(lemma.getPosition());
                     putSubContent(titleText, title, subContentIndex);
                     start = Integer.parseInt(lemma.getPosition());
-                    title = lemma.getText();//截取的这一段文本的标题
+                    title = lemma.getProperty();//截取的这一段文本的标题
                 }
             } else {
                 //如果是最后一个Lemma,文本就从start开始取,取到结束
                 //subContent = content.substring((start + lemma.getText().length()));
                 int lastIndex = content.length() - 1;
-                subContentIndex = start + title.length() + "," + lastIndex;
+                subContentIndex = start + lemma.getText().length() + "," + lastIndex;
                 putSubContent(titleText, title, subContentIndex);
             }
         }
@@ -220,7 +219,7 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         List<Clinical> clinicals = new ArrayList<>();
         for (Lemma lemma : clinicalLemmas) {
             if (Integer.parseInt(lemma.getPosition()) > Integer.parseInt(indexArray[0])
-                    || Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
+                    && Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
                 continue;
             }
             Clinical clinical = new Clinical();
@@ -245,7 +244,7 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         List<Diag> diags = new ArrayList<>();
         for (Lemma lemma : diagLemmas) {
             if (Integer.parseInt(lemma.getPosition()) > Integer.parseInt(indexArray[0])
-                    || Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
+                    && Integer.parseInt(lemma.getPosition()) < Integer.parseInt(indexArray[indexArray.length - 1])) {
                 continue;
             }
             Diag diag = new Diag();