刘韬 3 years ago
parent
commit
2b130823c5
1 changed files with 23 additions and 17 deletions
  1. 23 17
      DataFusion/src/com/zskk/control/ViewController.java

+ 23 - 17
DataFusion/src/com/zskk/control/ViewController.java

@@ -93,26 +93,32 @@ public class ViewController extends Controller {
 			//状态4:下载中
 			studyidfind.set("status", 4);
 			Db.use("local").update("study", studyidfind);
-			dicomfind = Db.use("connected_dicom").find("select top 2000 * from dicominfo where studyuid=?",studyidfind.getStr("studyuid"));
+			dicomfind = Db.use("connected_dicom").find("select top 500 * from dicominfo where studyuid=?",studyidfind.getStr("studyuid"));
 			for (Record record : dicomfind) {
-				String urlString = record.getStr("URL");
-				if (urlString.isBlank()) {
+				try {
+					String urlString = record.getStr("URL");
+					if (urlString.isBlank()) {
+						continue;
+					}
+					Request request = new Request.Builder()
+					        .url(urlString)
+					        .build();
+					aString =aString+urlString+"\n";
+					try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
+					      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
+
+		                   int cString =  writeFile(response,studyidfind.getStr("studyuid"));
+		                   bString =bString+cString;
+					    } catch (IOException e1) {
+							// TODO Auto-generated catch block
+							e1.printStackTrace();
+					    	continue;
+						}
+				} catch (Exception e) {
+					// TODO: handle exception
 					continue;
 				}
-				Request request = new Request.Builder()
-				        .url(urlString)
-				        .build();
-				aString =aString+urlString+"\n";
-				try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
-				      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
-
-	                   int cString =  writeFile(response,studyidfind.getStr("studyuid"));
-	                   bString =bString+cString;
-				    } catch (IOException e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-				    	continue;
-					}
+				
 				
 			}
 			studyidfind.set("status", 3);