|
@@ -7,6 +7,7 @@ import java.util.List;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
|
|
+import com.zskk.service.DataService;
|
|
import com.zskk.service.ServiceFactory;
|
|
import com.zskk.service.ServiceFactory;
|
|
import com.zskk.service.ThreadPoolService;
|
|
import com.zskk.service.ThreadPoolService;
|
|
import com.zskk.tools.ExecUtil;
|
|
import com.zskk.tools.ExecUtil;
|
|
@@ -16,40 +17,29 @@ public class ReCMoveTask implements ITask {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
-// List<Record> count = Db.use("local").find("select * from study where status =4");
|
|
|
|
-// //同时下载的队列
|
|
|
|
-// Integer flag = count.size();
|
|
|
|
-// if (flag >= 5) {
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
- //2小时到2天内的检查重新获取
|
|
|
|
- List<Record> studyidfinds = Db.use("local").find("select * from study where status =3 and updateAt between ? and ? and (modalities like '%CT%' or modalities like '%MR%' or modalities like '%DX%' or modalities like '%CR%') order by createAt asc limit 2", parseStringToDateTo(), parseStringToDateFrom());
|
|
|
|
- if (studyidfinds == null) {
|
|
|
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
|
+ Record recordfind = Db.use("local").findFirst("select * from study where status=1 order by createAt asc");
|
|
|
|
+// JSONArray array = dService.getImage(recordfind.getStr("accessionNumber"));
|
|
|
|
+ List<Record> array = Db.use("connected").find("SELECT * FROM studyinfo where ACCESSIONNUMBER=?",recordfind.getStr("studyuid"));
|
|
|
|
+
|
|
|
|
+ if (array==null) {
|
|
|
|
+ recordfind.set("status", 2);
|
|
|
|
+ Db.use("local").update("study",recordfind);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- for (Record studyidfind : studyidfinds) {
|
|
|
|
-// flag++;
|
|
|
|
-// if (flag <= 5) {
|
|
|
|
- //状态4:下载中
|
|
|
|
- studyidfind.set("status", 4);
|
|
|
|
- studyidfind.set("updateAt", parseStringToDateTime());
|
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
|
- String execCmd = ExecUtil.execCmd("/zskk_system/other/cmove.sh " + studyidfind.getStr("studyuid"));
|
|
|
|
- if (execCmd.contains("Connection refused")) {
|
|
|
|
- // 状态2:错误
|
|
|
|
- studyidfind.set("status", 2);
|
|
|
|
- studyidfind.set("updateAt", parseStringToDateTime());
|
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
|
- } else {
|
|
|
|
- // 状态5:重新下载完成
|
|
|
|
- studyidfind.set("status", 5);
|
|
|
|
- studyidfind.set("updateAt", parseStringToDateTime());
|
|
|
|
- Db.use("local").update("study", studyidfind);
|
|
|
|
- }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
|
|
+ recordfind.set("status", 4);
|
|
|
|
+ recordfind.set("imageNum", array.size());
|
|
|
|
+ recordfind.set("updateAt", parseStringToDateTime());
|
|
|
|
+ Db.use("local").update("study",recordfind);
|
|
|
|
+ for (Record object : array) {
|
|
|
|
+// JSONObject jsonObject = JSON.parseObject(object.toString());
|
|
|
|
+ String[] strings = object.getStr("YYK_PATHNAME").split("\\\\");
|
|
|
|
+ int len = strings.length;
|
|
|
|
+// dService.downloadFileToFolder(jsonObject.getString("Path"), strings[len-1],"/home/zskk/SMB_FILE",null);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ recordfind.set("status", 3);
|
|
|
|
+ recordfind.set("updateAt", parseStringToDateTime());
|
|
|
|
+ Db.use("local").update("study",recordfind);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -58,36 +48,6 @@ public class ReCMoveTask implements ITask {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 日期字符串格式转换
|
|
|
|
- *
|
|
|
|
- * @param dateStr
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private String parseStringToDateFrom() {
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- Date date = new Date();
|
|
|
|
- long dInteger = date.getTime() - 43200000;
|
|
|
|
- String daString = sdf.format(new Date(dInteger));
|
|
|
|
- return daString;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 日期字符串格式转换
|
|
|
|
- *
|
|
|
|
- * @param dateStr
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private String parseStringToDateTo() {
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- Date date = new Date();
|
|
|
|
- long dInteger = date.getTime() - 259200000;
|
|
|
|
- String daString = sdf.format(new Date(dInteger));
|
|
|
|
- return daString;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 日期字符串格式转换年月日时分秒
|
|
* 日期字符串格式转换年月日时分秒
|
|
*
|
|
*
|