|
@@ -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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|