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

上级医师查房记录

chengyao 4 éve
szülő
commit
bc75fa90d2

+ 41 - 1
structure-center/src/main/java/com/lantone/structure/ai/ThreeLevelWardAI.java

@@ -11,6 +11,7 @@ import com.lantone.structure.model.InputInfo;
 import com.lantone.structure.model.doc.DifficultCaseDiscussDoc;
 import com.lantone.structure.model.doc.RescueDoc;
 import com.lantone.structure.model.doc.ThreeLevelWardDoc;
+import com.lantone.structure.model.doc.WardRecordDoc;
 import com.lantone.structure.model.doc.ward.AttendingDoctorWardDoc;
 import com.lantone.structure.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.structure.model.label.ThreeLevelWardLabel;
@@ -37,13 +38,33 @@ public class ThreeLevelWardAI extends ModelAI {
     /**
      *
      */
-    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx", "CourseRecordSRR");
+    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx", "CourseRecordSRR","Taizhou_Ward_Record");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
     public static String content = "content";
 
     public void medrec(InputInfo inputInfo, CRFServiceClient crfServiceClient) {
         JSONArray crfContent = new JSONArray();
+        List<WardRecordDoc> wardRecordDocList = inputInfo.getWardRecordDocs();
+        if(ListUtil.isNotEmpty(wardRecordDocList)){
+            for (int i = 0; i < wardRecordDocList.size(); i++) {
+                String content = wardRecordDocList.get(i).getText();
+                putContent(crfContent, medicalTextType.get(3), content, Content.wardRecord);
+            }
+            JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
+            for (int i = 0; i < wardRecordDocList.size(); i++) {
+                if (midData.get(Content.wardRecord) == null) {
+                    continue;
+                }
+                WardRecordDoc wardRecordDoc = wardRecordDocList.get(i);
+                ThreeLevelWardLabel threeLevelWardLabel = putRescueCrfData(midData.getJSONObject(Content.wardRecord), inputInfo);
+                if (threeLevelWardLabel != null) {
+                    wardRecordDoc.setThreeLevelWardLabel(threeLevelWardLabel);
+                }
+            }
+            return;
+        }
+
         List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
         if (threeLevelWardDocs.size() == 0) {
             return;
@@ -145,6 +166,25 @@ public class ThreeLevelWardAI extends ModelAI {
 
     }
 
+    /**
+     * 处理查房记录
+     *
+     * @param jsonObject
+     */
+    public ThreeLevelWardLabel putRescueCrfData(JSONObject jsonObject, InputInfo inputInfo) {
+        ThreeLevelWardLabel threeLevelWardLabel = new ThreeLevelWardLabel();
+        if (jsonObject == null) {
+            return threeLevelWardLabel;
+        }
+        JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(ThreeLevelWardAI.outputs);
+        if (aiOut == null) {
+            return threeLevelWardLabel;
+        }
+        EntityProcessThreeLevelWard entityProcessThreeLevelWard = new EntityProcessThreeLevelWard();
+        threeLevelWardLabel = entityProcessThreeLevelWard.extractEntityLate(aiOut);
+        return threeLevelWardLabel;
+    }
+
     protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign, String wardDate) {
         String moveText = CatalogueUtil.removeSpecialChar(text);
         if (StringUtil.isEmpty(moveText)) {

+ 2 - 1
structure-center/src/main/java/com/lantone/structure/ai/model/EntityEnum.java

@@ -41,7 +41,8 @@ public enum EntityEnum {
     CORD_AROUND_BODY("脐带绕身"), UTERINE_WALL_SUTURE("子宫壁缝合情况"), UC_AGENT("宫缩剂名称"), UC_CONSUMPTION("宫缩剂用量"), UC_USAGE_WARD_ROUND("宫缩剂用法"),
     UTERINE_CAVITY_ABNORMITY("宫腔探查异常情况描述"), UTERINE_CAVITY_DISPOSE("宫腔探查处理情况"), PUERPERA_CONDITION("手术时产妇情况"), HEMORRHAGE("术中出血"),
     FLUID_INFUSION("补液"),BLOOD_PRESSURE("血压情况"), NEWBORN("新生儿"), APGAR_SCORE("Apgar评分"), SCORE("分数"), CAPUT_SUCCEDANEUM("产瘤"),
-    CAPUT_SUCCEDANEUM_PART("产瘤部位"), OPE_DRUG("手术用药名称"), OPE_CONSUMPTION("手术用药量"), OPE_USAGE_WARD_ROUND("手术用药方法"), TRANSFUSION("输血成分");
+    CAPUT_SUCCEDANEUM_PART("产瘤部位"), OPE_DRUG("手术用药名称"), OPE_CONSUMPTION("手术用药量"), OPE_USAGE_WARD_ROUND("手术用药方法"), TRANSFUSION("输血成分"), DOCTORADVICE_RECORD("医嘱内容"), ASSESSMENTPLAN("诊疗计划");
+
 
 
     private String value;

+ 16 - 0
structure-center/src/main/java/com/lantone/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -1,6 +1,7 @@
 package com.lantone.structure.ai.process;
 
 import com.alibaba.fastjson.JSONObject;
+import com.lantone.common.util.ListUtil;
 import com.lantone.structure.ai.model.EntityEnum;
 import com.lantone.structure.ai.model.Lemma;
 import com.lantone.structure.model.entity.*;
@@ -29,6 +30,21 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
             EntityEnum.TITLE_FOR_DIFF.toString(),
             EntityEnum.TITLE_FOR_TREAT.toString());
 
+    public ThreeLevelWardLabel extractEntityLate(JSONObject aiOut) {
+        ThreeLevelWardLabel threeLevelWardLabel = new ThreeLevelWardLabel();
+            //医嘱内容
+            List<Lemma> lemma = createEntityTree(aiOut, EntityEnum.DOCTORADVICE_RECORD.toString());
+            if(ListUtil.isNotEmpty(lemma)){
+                threeLevelWardLabel.setDoctorAdviceRecord(lemma.get(0).getText());
+            }
+            //诊疗计划
+        List<Lemma> lemmaTree = createEntityTree(aiOut, EntityEnum.ASSESSMENTPLAN.toString());
+        if(ListUtil.isNotEmpty(lemmaTree)){
+            threeLevelWardLabel.setAssessmentPlan(lemmaTree.get(0).getText());
+        }
+        return threeLevelWardLabel;
+    }
+
     public ThreeLevelWardLabel extractEntity(JSONObject aiOut) {
         ThreeLevelWardLabel threeLevelWardLabel = new ThreeLevelWardLabel();
         String content = aiOut.getString("content");

+ 4 - 5
structure-center/src/main/java/com/lantone/structure/facade/StructureFacade.java

@@ -2,11 +2,7 @@ package com.lantone.structure.facade;
 
 import com.lantone.common.util.StringUtil;
 import com.lantone.structure.dto.AnalysisDTO;
-import com.lantone.structure.facade.tran.CesareanSectionTran;
-import com.lantone.structure.facade.tran.ClinicalBloodTran;
-import com.lantone.structure.facade.tran.RescueTran;
-import com.lantone.structure.facade.tran.StagesSummaryTran;
-import com.lantone.structure.facade.tran.TargetTran;
+import com.lantone.structure.facade.tran.*;
 import com.lantone.structure.vo.AnalysisVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
@@ -39,6 +35,9 @@ public class StructureFacade {
             case "阶段小结":
                 targetTran = new StagesSummaryTran();
                 break;
+           /* case "上级医师查房记录":
+                targetTran = new WardRecordTran();
+                break;*/
             default:
                 break;
         }

+ 254 - 0
structure-center/src/main/java/com/lantone/structure/facade/tran/WardRecordTran.java

@@ -0,0 +1,254 @@
+package com.lantone.structure.facade.tran;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.lantone.common.util.ListUtil;
+import com.lantone.common.util.StringUtil;
+import com.lantone.structure.facade.tran.util.CommonAnalysisUtil;
+import com.lantone.structure.model.doc.RescueDoc;
+import com.lantone.structure.model.doc.ThreeLevelWardDoc;
+import com.lantone.structure.model.doc.WardRecordDoc;
+import com.lantone.structure.model.entity.*;
+import com.lantone.structure.model.label.RescueLabel;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description:上级医师查房记录
+ * @author: cy
+ * @time: 2021/2/20 14:07
+ */
+@Slf4j
+public class WardRecordTran extends TargetTran {
+
+    @Override
+    public Map<String, String> convert(String text) {
+        List<WardRecordDoc> wardRecordDocList = new ArrayList<>();
+        WardRecordDoc wardRecordDoc = new WardRecordDoc();
+        wardRecordDoc.setText(text);
+        wardRecordDocList.add(wardRecordDoc);
+        inputInfo.setWardRecordDocs(wardRecordDocList);
+        aiProcess();
+      //  ============================封装完成==============================
+        Map<String, String> structureMap = cutWord(text);
+        rescueContrast(inputInfo.getRescueDocs(), structureMap);
+        return structureMap;
+    }
+
+    private Map<String, String> cutWord(String text) {
+        Map<String, String> sourceMap = Maps.newHashMap();
+        List<String> titles = CommonAnalysisUtil.sortTitles(
+                Lists.newArrayList("抢救措施","参与现场抢救的医务人员","注意事项"),
+                text
+        );
+        CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
+        if(sourceMap.containsKey("参与现场抢救的医务人员")){
+            sourceMap.remove("参与现场抢救的医务人员");
+        }
+        return sourceMap;
+    }
+
+
+    public void rescueContrast( List<RescueDoc> rescueDocs,Map<String, String> retMap) {
+        if(ListUtil.isNotEmpty(rescueDocs)){
+            rescueDocs.forEach(rescueDoc -> {
+                int auxiliaryCount = 1;
+                int auxiliaryResultCount = 1;
+                int operationsCount = 1;
+                int operationLocationCount = 1;
+                int methodsCount = 1;
+                int count = 1;
+                int interventionCount = 1;
+                int conditionsCount = 1;
+                int diagnosisCount = 1;
+                int drugsCount = 1;
+                StringBuffer auxiliaryTestString = new StringBuffer();
+                StringBuffer auxiliaryResultString  = new StringBuffer();
+                StringBuffer operationsString = new StringBuffer();
+                StringBuffer operationLocationString = new StringBuffer();
+                StringBuffer methodsString = new StringBuffer();
+                StringBuffer countString = new StringBuffer();
+                StringBuffer conditionsString = new StringBuffer();
+                StringBuffer diagnosisString = new StringBuffer();
+                StringBuffer interventionString = new StringBuffer();
+                StringBuffer drugsString = new StringBuffer();
+                StringBuffer resMedString = new StringBuffer();
+
+                RescueLabel rescueLabel = rescueDoc.getRescueLabel();
+                    if(ListUtil.isNotEmpty( rescueLabel.getAuxiliaryTest())){
+                        for (AuxiliaryTest auxiliaryTest : rescueLabel.getAuxiliaryTest()) {
+                                for (AuxiliaryResult auxiliaryResult : auxiliaryTest.getAuxiliaryResult()) {
+                                    if(StringUtils.isNotEmpty( auxiliaryResult.getName())){
+                                        if(auxiliaryTest.getAuxiliaryResult().size()>1){
+                                            auxiliaryResultString.append((auxiliaryResultCount++) + ".");
+                                        }
+                                        auxiliaryResultString.append(auxiliaryResult.getName());
+                                    }
+                                }
+
+                            if(StringUtils.isNotEmpty(auxiliaryTest.getName())){
+                                if(rescueLabel.getAuxiliaryTest().size()>1) {
+                                    auxiliaryTestString.append((auxiliaryCount++) + ".");
+                                }
+                                auxiliaryTestString.append(auxiliaryTest.getName());
+                            }
+
+                        }
+                        if(StringUtil.isNotEmpty(auxiliaryTestString.toString())){
+                            retMap.put("检查/检验项目名称", auxiliaryTestString.toString());
+                        }
+
+                        if(StringUtil.isNotEmpty(auxiliaryResultString.toString())){
+                            retMap.put("检查/检验结果", auxiliaryResultString.toString());
+                        }
+                       }
+
+                    if(ListUtil.isNotEmpty( rescueLabel.getOperations())){
+                        for (Operation operations : rescueLabel.getOperations()) {
+                            if(operations.getOperationLocation()!=null && StringUtils.isNotEmpty( operations.getOperationLocation().getName())){
+                                if(rescueLabel.getOperations().size()>1){
+                                    operationLocationString.append((operationLocationCount++) + ".");
+                                }
+                                operationLocationString.append(operations.getOperationLocation().getName());
+                            }
+                            if(StringUtils.isNotEmpty(operations.getName())){
+                                if(rescueLabel.getOperations().size()>1){
+                                    operationsString.append((operationsCount++) + ".");
+                                }
+                                operationsString.append( operations.getName());
+                            }
+
+                        }
+                        if(StringUtil.isNotEmpty(operationsString.toString())){
+                            retMap.put("手术及操作名称", operationsString.toString());
+                        }
+
+                        if(StringUtil.isNotEmpty(operationLocationString.toString())){
+                            retMap.put("手术及操作目标部位名称", operationLocationString.toString());
+                        }
+                        if(StringUtils.isNotEmpty(retMap.get("手术及操作名称"))){
+                            resMedString.append("手术及操作名称"+":"+retMap.get("手术及操作名称")+";");
+                        }
+
+                        if(StringUtils.isNotEmpty(retMap.get("手术及操作目标部位名称"))){
+                            resMedString.append("手术及操作目标部位名称"+":"+retMap.get("手术及操作目标部位名称")+";");
+                        }
+
+                  }
+
+                    if(ListUtil.isNotEmpty(rescueLabel.getMethods())){
+                        for (Method methods : rescueLabel.getMethods()) {
+                            if(StringUtils.isNotEmpty(methods.getName())){
+                                if(rescueLabel.getMethods().size()>1){
+                                    methodsString.append((methodsCount++) + ".");
+                                }
+                                methodsString.append( methods.getName());
+                            }
+                            if( methods.getCount() != null){
+                                if(rescueLabel.getMethods().size()>1){
+                                    countString.append((count++) + ".");
+                                }
+                                countString.append(methods.getName()+methods.getCount().getName());
+                            }
+                        }
+                        if(StringUtil.isNotEmpty(methodsString.toString())){
+                            retMap.put("操作方法", methodsString.toString());
+                        }
+                        if(StringUtil.isNotEmpty(countString.toString())){
+                            retMap.put("操作次数", countString.toString());
+                        }
+
+                        if(StringUtils.isNotEmpty(retMap.get("操作方法"))){
+                            resMedString.append("操作方法"+":"+retMap.get("操作方法")+";");
+                        }
+                        if(StringUtils.isNotEmpty(retMap.get("操作次数"))){
+                            resMedString.append("操作次数"+":"+retMap.get("操作次数")+";");
+                        }
+
+                        }
+
+                    if(ListUtil.isNotEmpty(rescueLabel.getInterventions())){
+                        for (Intervention intervention : rescueLabel.getInterventions()) {
+                            if(StringUtils.isNotEmpty(intervention.getName())){
+                                if(rescueLabel.getInterventions().size()>1){
+                                    interventionString.append((interventionCount++) + ".");
+                                }
+                                interventionString.append(intervention.getName());
+                            }
+                        }
+                        if(StringUtil.isNotEmpty(interventionString.toString())){
+                            retMap.put("介入物名称",interventionString.toString());
+                        }
+                    }
+
+                    if(ListUtil.isNotEmpty(rescueLabel.getConditions())){
+                        //抢救病情长度1时间没有,大于1时间开始取最初 结束取最后
+                        if(rescueLabel.getConditions().size()>1){
+                            if( null != (rescueLabel.getConditions().get(0).getPd()) && StringUtils.isNotEmpty(rescueLabel.getConditions().get(0).getPd().getValue())){
+                                retMap.put("抢救开始日期时间",rescueLabel.getConditions().get(0).getPd().getValue());
+                            }
+
+                            if( null != (rescueLabel.getConditions().get(rescueLabel.getConditions().size()-1).getPd()) && StringUtils.isNotEmpty(rescueLabel.getConditions().get(rescueLabel.getConditions().size()-1).getPd().getValue())){
+                                retMap.put("抢救开始日期时间",rescueLabel.getConditions().get(rescueLabel.getConditions().size()-1).getPd().getValue());
+                            }
+                        }
+                    for (Condition conditions : rescueLabel.getConditions()) {
+                        if(StringUtils.isNotEmpty(conditions.getName())){
+                            if(rescueLabel.getInterventions().size()>1){
+                                conditionsString.append((conditionsCount++) + ".");
+                            }
+                            conditionsString.append(conditions.getName());
+                        }
+
+                    }
+                        if(StringUtil.isNotEmpty(conditionsString.toString())){
+                            retMap.put("病情变化情况",conditionsString.toString());
+                        }
+                  }
+
+                    if(ListUtil.isNotEmpty(rescueLabel.getDiagnosis())){
+                    for (Diagnosis diagnosis : rescueLabel.getDiagnosis()) {
+                        if(StringUtils.isNotEmpty(diagnosis.getName())){
+                            if(rescueLabel.getInterventions().size()>1){
+                                diagnosisString.append((diagnosisCount++) + ".");
+                            }
+                            diagnosisString.append(diagnosis.getName());
+                        }
+                    }
+                        if(StringUtil.isNotEmpty(conditionsString.toString())){
+                            retMap.put("疾病诊断名称", diagnosisString.toString());
+                        }
+                  }
+
+
+                if(!retMap.containsKey("抢救措施")&&StringUtils.isEmpty(retMap.get("抢救措施"))){
+                    //抢救药品只会出现在抢救措施里面
+                    if(ListUtil.isNotEmpty(rescueLabel.getDrugs())){
+                        for (Drug drugs : rescueLabel.getDrugs()) {
+                            if(StringUtils.isNotEmpty(drugs.getName())){
+                                if(rescueLabel.getDrugs().size()>1){
+                                    drugsString.append((drugsCount++) + ".");
+                                }
+                                drugsString.append(drugs.getName());
+                            }
+                        }
+                        if(StringUtils.isNotEmpty( drugsString.toString())){
+                            resMedString.append("抢救药品"+":"+ drugsString.toString()+";");
+                        }
+                    }
+                    if(StringUtils.isNotEmpty( drugsString.toString())){
+                        String resMedStr = resMedString.toString();
+                        if(resMedStr.endsWith(";")){
+                            resMedStr = resMedStr.substring(0, resMedStr.lastIndexOf(";"));
+                        }
+                        retMap.put("抢救措施",resMedStr);
+                    }
+                }
+            });
+        }
+    }
+}

+ 1 - 0
structure-center/src/main/java/com/lantone/structure/model/Content.java

@@ -254,6 +254,7 @@ public class Content {
     public static final String bloodRecord = "输血记录";
     public static final String stagesSummary = "阶段小结";
     public static final String rescue = "抢救记录";
+    public static final String wardRecord = "上级医师查房记录";
     public static final String caesareanSection = "剖宫产手术";
 
     public static String[] dateFormats = {

+ 2 - 0
structure-center/src/main/java/com/lantone/structure/model/InputInfo.java

@@ -79,6 +79,8 @@ public class InputInfo {
     private List<StagesSummaryDoc> stagesSummaryDocs = new ArrayList<>();
     //查房记录
     private List<ThreeLevelWardDoc> threeLevelWardDocs = new ArrayList<>();
+    //上级医师查房记录
+    private List<WardRecordDoc> wardRecordDocs = new ArrayList<>();
     //知情同意书
     private InformedConsentDoc informedConsentDoc;
     //谈话告知书

+ 17 - 0
structure-center/src/main/java/com/lantone/structure/model/doc/WardRecordDoc.java

@@ -0,0 +1,17 @@
+package com.lantone.structure.model.doc;
+
+import com.lantone.structure.model.label.ThreeLevelWardLabel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : WardRecordDoc
+ * @Description : 查房记录
+ * @Author : cy
+ * @Date: 2021-02-20 15:43
+ */
+@Getter
+@Setter
+public class WardRecordDoc extends ModelDoc {
+    private ThreeLevelWardLabel threeLevelWardLabel;
+}

+ 2 - 0
structure-center/src/main/java/com/lantone/structure/model/label/ThreeLevelWardLabel.java

@@ -35,4 +35,6 @@ public class ThreeLevelWardLabel {
     private List<Laboratory> laboratories = new ArrayList<>();  //实验室检查
     private List<AuxiliaryExamination> auxiliaryExaminations = new ArrayList<>();  //辅助检查
     private List<Drug> drugs = new ArrayList<>();  //药物
+    private String doctorAdviceRecord;//医嘱内容
+    private String assessmentPlan;//诊疗计划
 }