|
@@ -7,6 +7,8 @@ import java.io.IOException;
|
|
import java.io.InputStreamReader;
|
|
import java.io.InputStreamReader;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
import org.w3c.dom.NamedNodeMap;
|
|
import org.w3c.dom.NamedNodeMap;
|
|
import org.w3c.dom.NodeList;
|
|
import org.w3c.dom.NodeList;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
@@ -19,62 +21,75 @@ public class UpdateTask implements ITask {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
- String dateString = parseStringToDate();
|
|
|
|
- String fileString = dateString.replace("0", "o");
|
|
|
|
- File fin_floder = new File("/home/zskk/CFIND_XML/STUDYUID_" + fileString + "1.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 xmlContent = null;
|
|
|
|
- xmlContent = raf.readLine();
|
|
|
|
- xmlContent = xmlContent.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
|
|
|
|
- xmlContent = "<zskk>" + xmlContent + "</zskk>";
|
|
|
|
- xmlContent = xmlContent.replace("�", "");
|
|
|
|
- XmlHelper xmlHelper = XmlHelper.of(xmlContent);
|
|
|
|
- // NativeDicomModel节点列表
|
|
|
|
- NodeList nativeDicomModelList = xmlHelper.getNodeList("/zskk/NativeDicomModel");
|
|
|
|
- for (int i = 0; i < nativeDicomModelList.getLength(); i++) {
|
|
|
|
- String qString = "";
|
|
|
|
- String studyuidString = "";
|
|
|
|
- String modalitiesString = "";
|
|
|
|
- // DicomAttribute节点列表
|
|
|
|
- NodeList dicomAttributeList = xmlHelper.getNodeList(nativeDicomModelList.item(i), "DicomAttribute");
|
|
|
|
- for (int j = 0; j < dicomAttributeList.getLength(); j++) {
|
|
|
|
- // DicomAttribute节点属性列表
|
|
|
|
- NamedNodeMap attributeMap = dicomAttributeList.item(j).getAttributes();
|
|
|
|
- if (attributeMap != null && attributeMap.getLength() > 0) {
|
|
|
|
- for (int k = 0; k < attributeMap.getLength(); k++) {
|
|
|
|
- if (attributeMap.item(k).getNodeName().equals("tag")) {
|
|
|
|
- // 获取studyuid
|
|
|
|
- if (attributeMap.item(k).getNodeValue().equals("00080050")) {
|
|
|
|
- studyuidString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- // 获取检查类型00080060or00080061
|
|
|
|
- if (attributeMap.item(k).getNodeValue().equals("00080060")) {
|
|
|
|
- modalitiesString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
|
|
|
|
- studyuidString);
|
|
|
|
- if (studyidfind == null) {
|
|
|
|
- Record studyinfo = new Record().set("studyuid", studyuidString).set("modalities", modalitiesString)
|
|
|
|
- .set("status", 1).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
|
|
|
|
- Db.use("local").save("study", studyinfo);
|
|
|
|
- }
|
|
|
|
|
|
+ List<Record> records = Db.use("connected").find("SELECT * FROM (SELECT ACCESSIONNUMBER,STUDYTIME FROM studyinfo group BY STUDYTIME,ACCESSIONNUMBER order by STUDYTIME desc)WHERE ROWNUM <= 10");
|
|
|
|
+ for (Record record : records) {
|
|
|
|
+ String studyuidString = record.getStr("ACCESSIONNUMBER");
|
|
|
|
+ String modalitiesString = "";
|
|
|
|
+
|
|
|
|
+ Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
|
|
|
|
+ studyuidString);
|
|
|
|
+ if (studyidfind == null) {
|
|
|
|
+ Record studyinfo = new Record().set("studyuid", studyuidString).set("modalities", modalitiesString)
|
|
|
|
+ .set("status", 1).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
|
|
|
|
+ Db.use("local").save("study", studyinfo);
|
|
}
|
|
}
|
|
- } catch (IOException e) {
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
- e.printStackTrace();
|
|
|
|
}
|
|
}
|
|
|
|
+// String dateString = parseStringToDate();
|
|
|
|
+// String fileString = dateString.replace("0", "o");
|
|
|
|
+// File fin_floder = new File("/home/zskk/CFIND_XML/STUDYUID_" + fileString + "1.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 xmlContent = null;
|
|
|
|
+// xmlContent = raf.readLine();
|
|
|
|
+// xmlContent = xmlContent.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
|
|
|
|
+// xmlContent = "<zskk>" + xmlContent + "</zskk>";
|
|
|
|
+// xmlContent = xmlContent.replace("�", "");
|
|
|
|
+// XmlHelper xmlHelper = XmlHelper.of(xmlContent);
|
|
|
|
+// // NativeDicomModel节点列表
|
|
|
|
+// NodeList nativeDicomModelList = xmlHelper.getNodeList("/zskk/NativeDicomModel");
|
|
|
|
+// for (int i = 0; i < nativeDicomModelList.getLength(); i++) {
|
|
|
|
+// String qString = "";
|
|
|
|
+// String studyuidString = "";
|
|
|
|
+// String modalitiesString = "";
|
|
|
|
+// // DicomAttribute节点列表
|
|
|
|
+// NodeList dicomAttributeList = xmlHelper.getNodeList(nativeDicomModelList.item(i), "DicomAttribute");
|
|
|
|
+// for (int j = 0; j < dicomAttributeList.getLength(); j++) {
|
|
|
|
+// // DicomAttribute节点属性列表
|
|
|
|
+// NamedNodeMap attributeMap = dicomAttributeList.item(j).getAttributes();
|
|
|
|
+// if (attributeMap != null && attributeMap.getLength() > 0) {
|
|
|
|
+// for (int k = 0; k < attributeMap.getLength(); k++) {
|
|
|
|
+// if (attributeMap.item(k).getNodeName().equals("tag")) {
|
|
|
|
+// // 获取studyuid
|
|
|
|
+// if (attributeMap.item(k).getNodeValue().equals("00080050")) {
|
|
|
|
+// studyuidString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
+// // 获取检查类型00080060or00080061
|
|
|
|
+// if (attributeMap.item(k).getNodeValue().equals("00080060")) {
|
|
|
|
+// modalitiesString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
|
|
|
|
+// studyuidString);
|
|
|
|
+// if (studyidfind == null) {
|
|
|
|
+// Record studyinfo = new Record().set("studyuid", studyuidString).set("modalities", modalitiesString)
|
|
|
|
+// .set("status", 1).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
|
|
|
|
+// Db.use("local").save("study", studyinfo);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// } catch (IOException e) {
|
|
|
|
+// // TODO Auto-generated catch block
|
|
|
|
+// e.printStackTrace();
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|