|
@@ -1,12 +1,42 @@
|
|
|
package com.zskk.task;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.jfinal.kit.PropKit;
|
|
|
+import com.jfinal.plugin.activerecord.Record;
|
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
|
+import com.zskk.service.DataService;
|
|
|
+import com.zskk.service.ServiceFactory;
|
|
|
+import com.zskk.service.ThreadPoolService;
|
|
|
|
|
|
public class UpdateTask implements ITask {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ //报告状态
|
|
|
+ params.put("report_status", "9");
|
|
|
+ //医疗机构ID
|
|
|
+ params.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ //时间段
|
|
|
+ params.put("time", parseStringToDate());
|
|
|
+
|
|
|
+ JSONArray jsonArray = dService.getReport(params);
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(object.toString());
|
|
|
+ Record record = new Record();
|
|
|
+// record.
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -15,5 +45,21 @@ public class UpdateTask implements ITask {
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 日期字符串格式转换
|
|
|
+ * @param dateStr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String parseStringToDate() {
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ Long dateBeforeLong = date.getTime()-86400000;
|
|
|
+ Date dateBefore = new Date(dateBeforeLong);
|
|
|
+ String timeStringBefore = sdf.format(dateBefore);
|
|
|
+ String timeString = sdf.format(date);
|
|
|
+
|
|
|
+ return timeStringBefore + "," + timeString;
|
|
|
+ }
|
|
|
|
|
|
}
|