|
@@ -33,8 +33,8 @@ public class EzXmlAnalysis {
|
|
|
Document doc = DocumentHelper.parseText(xml);
|
|
|
Element rootElement = doc.getRootElement();
|
|
|
jbxxInsertMap(rootElement, map);
|
|
|
- sgtzInsertMap(rootElement, map);
|
|
|
tgjcInsertMap(rootElement, map);
|
|
|
+ sgtzInsertMap(rootElement, map);
|
|
|
fzjcInsertMap(rootElement, map);
|
|
|
zkjcInsertMap(rootElement, map);
|
|
|
disInsertMap(rootElement, map);
|
|
@@ -53,7 +53,7 @@ public class EzXmlAnalysis {
|
|
|
rootText = rootText.substring(0, rootText.lastIndexOf(signTimeStr));
|
|
|
}
|
|
|
titles = CommonAnalysisUtil.sortTitles(titles, rootText);
|
|
|
- CommonAnalysisUtil.cutByTitles(rootText, titles, 0, map);
|
|
|
+ CommonAnalysisUtil.cutByTitlesNoColon(rootText, titles, 0, map);
|
|
|
}
|
|
|
|
|
|
public static void disInsertMap(Element rootElement, Map<String, String> map) {
|
|
@@ -65,7 +65,7 @@ public class EzXmlAnalysis {
|
|
|
if (disNode != null) {
|
|
|
String disText = elementTxt(disNode);
|
|
|
List<String> titles = CommonAnalysisUtil.sortTitles(Lists.newArrayList("初步诊断", "补充诊断", "再次补充诊断", "修正诊断", "出院诊断"), disText);
|
|
|
- CommonAnalysisUtil.cutByTitles(disText, titles, 0, map);
|
|
|
+ CommonAnalysisUtil.cutByTitlesNoColon(disText, titles, 0, map);
|
|
|
titles.forEach(title -> {
|
|
|
disExt(map, title);
|
|
|
});
|
|
@@ -147,38 +147,109 @@ public class EzXmlAnalysis {
|
|
|
|
|
|
//身高体重
|
|
|
public static void sgtzInsertMap(Element rootElement, Map<String, String> map) {
|
|
|
+ Map<String, String> map2 = Maps.newHashMap();
|
|
|
Node tgjcNode = rootElement.selectSingleNode("section[@name='体格检查']");
|
|
|
if (tgjcNode != null) {
|
|
|
Node ybqkNode = tgjcNode.selectSingleNode("section[@name='一般情况']");
|
|
|
if (ybqkNode != null) {
|
|
|
- elementInsertMap((Element) ybqkNode.selectSingleNode("fieldelem[@name='身高']"), map);
|
|
|
- elementInsertMap((Element) ybqkNode.selectSingleNode("fieldelem[@name='体重']"), map);
|
|
|
+ if (StringUtil.isBlank(map.get("身高"))) {
|
|
|
+ elementInsertMap((Element) ybqkNode.selectSingleNode("fieldelem[@name='身高']"), map);
|
|
|
+ }
|
|
|
+ if (StringUtil.isBlank(map.get("体重"))) {
|
|
|
+ elementInsertMap((Element) ybqkNode.selectSingleNode("fieldelem[@name='体重']"), map);
|
|
|
+ }
|
|
|
|
|
|
String ybqkText = elementTxt(ybqkNode);
|
|
|
- if (!map.containsKey("身高")){
|
|
|
- CommonAnalysisUtil.cutByTitlesNoColon(ybqkText,Lists.newArrayList("身高"),0,map);
|
|
|
+ List<String> titles = Lists.newArrayList("身高", "体重");
|
|
|
+ titles = CommonAnalysisUtil.sortTitles(titles, ybqkText);
|
|
|
+ CommonAnalysisUtil.cutByTitlesNoColon(ybqkText, titles, 0, map2);
|
|
|
+ sgtzxyInsertMap(map2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ smtzSgtzInsertMap(rootElement, map2);
|
|
|
+ if (!map.containsKey("身高")) {
|
|
|
+ map.put("身高", map2.get("身高"));
|
|
|
+
|
|
|
+ }
|
|
|
+ if (!map.containsKey("体重")) {
|
|
|
+ map.put("体重", map2.get("体重"));
|
|
|
+ }
|
|
|
+ if (!map.containsKey("收缩压")) {
|
|
|
+ map.put("收缩压", map2.get("收缩压"));
|
|
|
+ }
|
|
|
+ if (!map.containsKey("舒张压")) {
|
|
|
+ map.put("舒张压", map2.get("舒张压"));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ //生命体征中提取身高体重
|
|
|
+ public static void smtzSgtzInsertMap(Element rootElement, Map<String, String> map) {
|
|
|
+ Node tgjcNode = rootElement.selectSingleNode("section[@name='体格检查']");
|
|
|
+ if (tgjcNode != null) {
|
|
|
+ Node smtzNode = tgjcNode.selectSingleNode("section[@name='生命体征']");
|
|
|
+ if (smtzNode != null) {
|
|
|
+ Map<String, String> map2 = Maps.newHashMap();
|
|
|
+ String smtzText = elementTxt(smtzNode);
|
|
|
+ List<String> titles = Lists.newArrayList("身高", "体重", "血压", "BP");
|
|
|
+ titles = CommonAnalysisUtil.sortTitles(titles, smtzText);
|
|
|
+ CommonAnalysisUtil.cutByTitlesNoColon(smtzText, titles, 0, map2);
|
|
|
+ sgtzxyInsertMap(map2);
|
|
|
+
|
|
|
+ map.put("收缩压", map2.get("收缩压"));
|
|
|
+ map.put("舒张压", map2.get("舒张压"));
|
|
|
+ if (StringUtil.isBlank(map.get("身高"))) {
|
|
|
+ map.put("身高", map2.get("身高"));
|
|
|
}
|
|
|
- if (!map.containsKey("体重")){
|
|
|
- CommonAnalysisUtil.cutByTitlesNoColon(ybqkText,Lists.newArrayList("体重"),0,map);
|
|
|
+ if (StringUtil.isBlank(map.get("体重"))) {
|
|
|
+ map.put("体重", map2.get("体重"));
|
|
|
}
|
|
|
- Pattern pattern = Pattern.compile("[0-9]+");
|
|
|
- if (map.containsKey("身高")){
|
|
|
- String value = map.get("身高");
|
|
|
- if (StringUtil.isNotBlank(value)) {
|
|
|
- Matcher matcher = pattern.matcher(value);
|
|
|
- if (matcher.find()){
|
|
|
- map.put("身高",matcher.group());
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //身高、体重、血压公共处理方法
|
|
|
+ private static void sgtzxyInsertMap(Map<String, String> map) {
|
|
|
+ Pattern pattern = Pattern.compile("[0-9]+[.]{0,1}[0-9]+");
|
|
|
+ if (map.containsKey("身高")) {
|
|
|
+ String value = map.get("身高");
|
|
|
+ if (StringUtil.isNotBlank(value)) {
|
|
|
+ value = StringUtil.removeBlank(value);
|
|
|
+ Matcher matcher = pattern.matcher(value);
|
|
|
+ if (matcher.find()) {
|
|
|
+ map.put("身高", matcher.group());
|
|
|
+ } else {
|
|
|
+ map.put("身高", "");
|
|
|
}
|
|
|
- if (map.containsKey("体重")){
|
|
|
- String value = map.get("体重");
|
|
|
- if (StringUtil.isNotBlank(value)) {
|
|
|
- Matcher matcher = pattern.matcher(value);
|
|
|
- if (matcher.find()){
|
|
|
- map.put("体重",matcher.group());
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (map.containsKey("体重")) {
|
|
|
+ String value = map.get("体重");
|
|
|
+ if (StringUtil.isNotBlank(value)) {
|
|
|
+ value = StringUtil.removeBlank(value);
|
|
|
+ Matcher matcher = pattern.matcher(value);
|
|
|
+ if (matcher.find()) {
|
|
|
+ map.put("体重", matcher.group());
|
|
|
+ } else {
|
|
|
+ map.put("体重", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pattern = Pattern.compile("[0-9]+[.]{0,1}[0-9]+/[0-9]+[.]{0,1}[0-9]+");
|
|
|
+ if (map.containsKey("血压") || map.containsKey("BP")) {
|
|
|
+ String value = map.get("血压");
|
|
|
+ if (StringUtil.isBlank(value)) {
|
|
|
+ value = map.get("BP");
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(value)) {
|
|
|
+ value = StringUtil.removeBlank(value);
|
|
|
+ Matcher matcher = pattern.matcher(value);
|
|
|
+ if (matcher.find()) {
|
|
|
+ value = matcher.group();
|
|
|
+ String[] arry = value.split("/");
|
|
|
+ if (arry.length == 2) {
|
|
|
+ map.put("收缩压", arry[0]);
|
|
|
+ map.put("舒张压", arry[1]);
|
|
|
}
|
|
|
}
|
|
|
}
|