|
@@ -16,6 +16,8 @@ import org.apache.commons.lang3.StringUtils;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description:上级医师查房记录
|
|
* @Description:上级医师查房记录
|
|
@@ -35,220 +37,73 @@ public class WardRecordTran extends TargetTran {
|
|
aiProcess();
|
|
aiProcess();
|
|
// ============================封装完成==============================
|
|
// ============================封装完成==============================
|
|
Map<String, String> structureMap = cutWord(text);
|
|
Map<String, String> structureMap = cutWord(text);
|
|
- rescueContrast(inputInfo.getRescueDocs(), structureMap);
|
|
|
|
|
|
+ wardRecordContrast(inputInfo.getWardRecordDocs(), structureMap);
|
|
return structureMap;
|
|
return structureMap;
|
|
}
|
|
}
|
|
|
|
|
|
private Map<String, String> cutWord(String text) {
|
|
private Map<String, String> cutWord(String text) {
|
|
Map<String, String> sourceMap = Maps.newHashMap();
|
|
Map<String, String> sourceMap = Maps.newHashMap();
|
|
List<String> titles = CommonAnalysisUtil.sortTitles(
|
|
List<String> titles = CommonAnalysisUtil.sortTitles(
|
|
- Lists.newArrayList("抢救措施","参与现场抢救的医务人员","注意事项"),
|
|
|
|
|
|
+ Lists.newArrayList("鉴别诊断","诊疗计划","补充诊断"),
|
|
text
|
|
text
|
|
);
|
|
);
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
- if(sourceMap.containsKey("参与现场抢救的医务人员")){
|
|
|
|
- sourceMap.remove("参与现场抢救的医务人员");
|
|
|
|
|
|
+ if(sourceMap.containsKey("鉴别诊断") || sourceMap.containsKey("补充诊断")){
|
|
|
|
+ sourceMap.remove("鉴别诊断");
|
|
|
|
+ sourceMap.remove("补充诊断");
|
|
}
|
|
}
|
|
return sourceMap;
|
|
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());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ public void wardRecordContrast( List<WardRecordDoc> wardRecordDoc,Map<String, String> retMap) {
|
|
|
|
+ String text = wardRecordDoc.get(0).getText();
|
|
|
|
+ //查房日期时间
|
|
|
|
+ String sumdDate = extractDate(text);
|
|
|
|
+ if(StringUtil.isNotEmpty(sumdDate)){
|
|
|
|
+ retMap.put("查房日期时间",sumdDate);
|
|
|
|
+ }
|
|
|
|
+ if(text.contains("鉴别诊断")){
|
|
|
|
+ String logo = text.split("\n")[1];
|
|
|
|
+ String fir = text.substring(text.indexOf(logo) + logo.length(),text.lastIndexOf("鉴别诊断"));
|
|
|
|
+ if(StringUtil.isNotEmpty(fir)){
|
|
|
|
+ retMap.put("查房记录",fir);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- 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(StringUtil.isNotEmpty(retMap.get("诊疗计划"))){
|
|
|
|
+ String plan = retMap.get("诊疗计划");
|
|
|
|
+ String Data = parseString(plan);
|
|
|
|
+ retMap.put("诊疗计划",Data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public static String parseString(String text){
|
|
|
|
+ if(text.contains("/")){
|
|
|
|
+ text = text.substring(0,text.lastIndexOf("/"));
|
|
|
|
+ text= parseString(text);
|
|
|
|
+ }
|
|
|
|
+ return text;
|
|
|
|
+ }
|
|
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 抽取文本中的第一个时间
|
|
|
|
+ *
|
|
|
|
+ * @param top
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static String extractDate(String top) {
|
|
|
|
+ Pattern pattern = Pattern.compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}");
|
|
|
|
+ Matcher matcher = pattern.matcher(top);
|
|
|
|
+ if (matcher.find()) {
|
|
|
|
+ return matcher.group(0);
|
|
|
|
+ } else {
|
|
|
|
+ Pattern p1 = Pattern.compile("[0-9]{4}年[0-9]+月[0-9]+日");
|
|
|
|
+ Matcher m1 = p1.matcher(top);
|
|
|
|
+ if (m1.find()) {
|
|
|
|
+ return m1.group(0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
}
|
|
}
|