|
@@ -21,33 +21,18 @@ public class UpdateTask implements ITask {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
- List<Record> records = Db.use("connected").find("SELECT * FROM (SELECT ACCESSIONNUMBER,STUDYTIME FROM studyinfo group BY STUDYTIME,ACCESSIONNUMBER order by STUDYTIME desc)WHERE ROWNUM <= 20");
|
|
|
- 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);
|
|
|
- }
|
|
|
+ List<Record> records = Db.use("connected").find("select * from examinfo where REQDATE > TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')",parseStringToDate());
|
|
|
+ if (records==null) {
|
|
|
+ return;
|
|
|
}
|
|
|
- //补充RF
|
|
|
- List<Record> recordsrf = Db.use("connected").find("SELECT * FROM (SELECT ACCESSIONNUMBER,STUDYTIME FROM studyinfo where F_MODALITY='RF' group BY STUDYTIME,ACCESSIONNUMBER order by STUDYTIME desc)WHERE ROWNUM <= 10");
|
|
|
- for (Record record : recordsrf) {
|
|
|
- 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);
|
|
|
+ for (Record record : records) {
|
|
|
+ Record recordfind = Db.use("local").findFirst("select * from study where studyuid=?",record.getStr("SELECTSTUDYINSUID"));
|
|
|
+ if (recordfind!=null) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- }
|
|
|
+ Record study = new Record().set("studyuid", record.getStr("SELECTSTUDYINSUID")).set("modalities", record.getStr("MODALITY")).set("status", 1).set("imageNum", 0).set("createAt", getDateStr()).set("updateAt", getDateStr());
|
|
|
+ Db.use("local").save("study", study);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -84,5 +69,18 @@ public class UpdateTask implements ITask {
|
|
|
return daString;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 日期字符串格式转换
|
|
|
+ * @param dateStr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getDateStr() {
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ String timeString = null;
|
|
|
+ timeString = sdf.format(date);
|
|
|
+ return timeString;
|
|
|
+ }
|
|
|
|
|
|
}
|