|
@@ -12,6 +12,8 @@ import org.dom4j.DocumentHelper;
|
|
|
import org.dom4j.Element;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* @Description: xml解析工具
|
|
@@ -46,6 +48,7 @@ public class YiWuFirstPageRecordXmlUtil {
|
|
|
Map<String, Object> sourceMap = xmlToMap(xml);
|
|
|
Map<String, Object> structureMap = mapKeyContrast(sourceMap, keyContrasts);
|
|
|
newbornAge(structureMap);
|
|
|
+ rescueNum(structureMap);//抢救情况
|
|
|
Map<String, Object> structureExtMap = Maps.newHashMap();
|
|
|
structureExtMap.putAll(structureMap);
|
|
|
JSONArray leaveDiags = new JSONArray();
|
|
@@ -90,6 +93,44 @@ public class YiWuFirstPageRecordXmlUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //抢救情况处理,抢救次数及抢救成功次数
|
|
|
+ private static void rescueNum(Map<String, Object> structureMap){
|
|
|
+ try{
|
|
|
+ if (structureMap != null && structureMap.size() > 0) {
|
|
|
+ String text = structureMap.get("原始文本").toString();
|
|
|
+ if(StringUtil.isNotBlank(text) && text.contains("抢救情况")){
|
|
|
+ int i=0;
|
|
|
+ String tempText = "";
|
|
|
+ tempText=text.substring(text.indexOf("抢救情况"),text.indexOf("抢救情况")+14);
|
|
|
+ Pattern p= Pattern.compile("\\d+");
|
|
|
+ Matcher m=p.matcher(tempText);
|
|
|
+ while(m.find()){
|
|
|
+ if(i==0){
|
|
|
+ structureMap.put("抢救次数",m.group(0));
|
|
|
+ i++;
|
|
|
+ }else if(i==1){
|
|
|
+ structureMap.put("抢救成功次数",m.group(0));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /*if(StringUtil.isNotBlank(text) && text.contains("颅脑损伤患者昏迷时间")){
|
|
|
+ String tempText = "";
|
|
|
+ tempText=text.substring(text.indexOf("颅脑损伤患者昏迷时间"),text.indexOf("入院后"));
|
|
|
+ Pattern p=Pattern.compile("\\d+");
|
|
|
+ Matcher m=p.matcher(tempText);
|
|
|
+ if (m.find()) {
|
|
|
+ structureMap.put("颅脑损伤患者昏迷前天数",m.find(text.indexOf("天")));
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ structureMap.put("抢救次数",0);
|
|
|
+ structureMap.put("抢救成功次数",0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static Map<String, Object> xmlToMap(String xml) {
|
|
|
Map<String, Object> map = Maps.newHashMap();
|
|
|
Map<String, Object> IDsMap = Maps.newHashMap();
|