|
@@ -0,0 +1,35 @@
|
|
|
+package com.lantone.qc.trans.taizhou.util;
|
|
|
+
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+import com.lantone.qc.pub.util.StringUtil;
|
|
|
+import org.dom4j.Document;
|
|
|
+import org.dom4j.DocumentHelper;
|
|
|
+import org.dom4j.Element;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: xml解析工具
|
|
|
+ * @author: rengb
|
|
|
+ * @time: 2020/3/28 14:23
|
|
|
+ */
|
|
|
+public class TzXmlUtil {
|
|
|
+
|
|
|
+ public static Map<String, String> getXmlToMapForTZ(String xml) {
|
|
|
+ Map<String, String> retMap = Maps.newHashMap();
|
|
|
+ try {
|
|
|
+ Document doc = DocumentHelper.parseText(xml);
|
|
|
+ List<Element> emrTermElements = doc.getRootElement().element("BLHLNR").element("emr_xml_root").element("TermList").elements("EMR-TERM");
|
|
|
+ emrTermElements.forEach(emrTermElement -> {
|
|
|
+ retMap.put(
|
|
|
+ StringUtil.removeBlank(emrTermElement.attributeValue("ename")),
|
|
|
+ emrTermElement.getStringValue().trim()
|
|
|
+ );
|
|
|
+ });
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|