刘韬 3 năm trước cách đây
mục cha
commit
33103f68ba

+ 1 - 1
DataFusion/src/com/zskk/task/DataTask.java

@@ -80,7 +80,7 @@ public class DataTask implements ITask {
 			// 门诊号
 			params.put("out_patient", record.getStr("outPatientNum") == null ? "" : record.getStr("outPatientNum"));
 			// 病人ID
-			params.put("his_patient_id", record.getStr("patientNum") == null ? "" : record.getStr("patientNum"));
+			params.put("his_patient_id", record.getStr("patientid") == null ? "" : record.getStr("patientid"));
 			// 检查方法
 			params.put("exam_project", record.getStr("project"));
 			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);

+ 18 - 21
DataFusion/src/com/zskk/task/DownloadTask.java

@@ -32,21 +32,21 @@ public class DownloadTask implements ITask {
 		OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
 
 		Integer max = 2;
-		List<Record> count = Db.use("local").find("select * from study where status =4");
+//		List<Record> count = Db.use("local").find("select * from study where status =4");
 		//同时下载的队列
-		Integer flag = count.size();
-		if (flag >= max) {
-			return;
-		}
-		List<Record> studyidfinds = Db.use("local").find("select * from study where status =1 or status =2 order by createAt asc limit 5");
+//		Integer flag = count.size();
+//		if (flag >= max) {
+//			return;
+//		}
+		List<Record> studyidfinds = Db.use("local").find("select * from study where status =1 or status =2 order by createAt asc limit 1");
 		if (studyidfinds == null) {
 			return;
 		}
 		for (Record studyidfind : studyidfinds) {
-			flag++;
-			if (flag > max) {
-				continue;
-			}
+//			flag++;
+//			if (flag > max) {
+//				continue;
+//			}
 			//状态4:下载中
 			studyidfind.set("status", 4);
 			Db.use("local").update("study", studyidfind);
@@ -55,19 +55,16 @@ public class DownloadTask implements ITask {
 				Request request = new Request.Builder()
 				        .url(record.getStr("URL"))
 				        .build();
+				try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
+				      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
 
-				OKHTTP_CLIENT.newCall(request).enqueue(new Callback() {
-				      @Override public void onFailure(Call call, IOException e) {
-				        e.printStackTrace();
-				      }
+	                    writeFile(response,studyidfind.getStr("studyuid"));
 
-				      @Override public void onResponse(Call call, Response response) throws IOException {
-				        try (ResponseBody responseBody = response.body()) {
-				          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
-		                    writeFile(response,studyidfind.getStr("studyuid"));
-				        }
-				      }
-				    });
+				    } catch (IOException e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+				
 			}
 			studyidfind.set("status", 3);
 			Db.use("local").update("study", studyidfind);