|
@@ -1,13 +1,30 @@
|
|
|
package com.zskk.service;
|
|
|
|
|
|
+import java.io.BufferedReader;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStreamReader;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import javax.xml.parsers.DocumentBuilder;
|
|
|
+import javax.xml.parsers.DocumentBuilderFactory;
|
|
|
+import javax.xml.parsers.ParserConfigurationException;
|
|
|
+
|
|
|
+import org.w3c.dom.Document;
|
|
|
+import org.w3c.dom.Element;
|
|
|
+import org.w3c.dom.NamedNodeMap;
|
|
|
+import org.w3c.dom.Node;
|
|
|
+import org.w3c.dom.NodeList;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
+import com.zskk.tools.XmlHelper;
|
|
|
|
|
|
import okhttp3.FormBody;
|
|
|
import okhttp3.OkHttpClient;
|
|
@@ -77,11 +94,57 @@ public class DataService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", "47600001");
|
|
|
- map.put("num", "10");
|
|
|
- postWithParameters(GET_EXAM_URL, map);
|
|
|
+ public static void main(String[] args) throws IOException, ParserConfigurationException {
|
|
|
+ File fin_floder = new File("/Users/liutao/Desktop/test/test51.xml");
|
|
|
+
|
|
|
+ //创建从文件读取数据的FileInputStream流
|
|
|
+ FileInputStream fin;
|
|
|
+ try {
|
|
|
+ fin = new FileInputStream(fin_floder);
|
|
|
+ InputStreamReader isr = null;
|
|
|
+
|
|
|
+ isr = new InputStreamReader(fin);
|
|
|
+
|
|
|
+ BufferedReader raf = null;
|
|
|
+
|
|
|
+ raf = new BufferedReader(isr);
|
|
|
+
|
|
|
+ String s = null;
|
|
|
+
|
|
|
+ // 读取文件内容,并将其打印
|
|
|
+// while((s = raf.readLine()) != null) {
|
|
|
+// System.out.println(s);
|
|
|
+//
|
|
|
+// }
|
|
|
+ s = raf.readLine();
|
|
|
+ s = s.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
|
|
|
+ s = "<a>" + s + "</a>";
|
|
|
+ System.out.println(s);
|
|
|
+ XmlHelper xmlHelper = XmlHelper.of(s);
|
|
|
+
|
|
|
+ int ount = 0;
|
|
|
+ NodeList nodeList = xmlHelper.getNodeList("/a/NativeDicomModel/DicomAttribute");
|
|
|
+ for (int i = 0; i < nodeList.getLength(); i++) {
|
|
|
+ NamedNodeMap as = nodeList.item(i).getAttributes();
|
|
|
+ if (as != null && as.getLength() > 0) {
|
|
|
+ for (int j = 0; j < as.getLength(); j++) {
|
|
|
+ if (as.item(j).getNodeName().equals("keyword")) {
|
|
|
+ if (as.item(j).getNodeValue().equals("StudyDate")) {
|
|
|
+ String b =xmlHelper.getString("/a/NativeDicomModel["+i+"]/DicomAttribute["+j+"]/Value");
|
|
|
+
|
|
|
+ System.out.println(xmlHelper.getString(nodeList.item(i), "Value"));
|
|
|
+ ount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(ount);
|
|
|
+
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|