|
@@ -1,6 +1,9 @@
|
|
|
package com.zskk.control;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
@@ -58,6 +61,54 @@ public class ViewController extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void name() {
|
|
|
+ try {
|
|
|
+
|
|
|
+
|
|
|
+ List<Record> record = Db.use("connected").find("select * from v_webpacs_image where rownum <10 and IMAGEDATE>to_date('"+parseStringToDate()+"','yyyy-mm-dd hh24:mi:ss')");
|
|
|
+ for (Record record2 : record) {
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .url(record2.getStr("FILEPATH").replace("\\\\", "/"))
|
|
|
+ .build();
|
|
|
+
|
|
|
+ String fileName = record2.getStr("IMAGE_UID");
|
|
|
+
|
|
|
+ try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
+ if (!response.isSuccessful())
|
|
|
+ throw new IOException("Unexpected code " + response);
|
|
|
+ String dirName = "/zskk_system/zskk_dicomQRScp/DICOM";
|
|
|
+ File file = new File(dirName);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdir();
|
|
|
+ }
|
|
|
+ if (response != null) {
|
|
|
+ InputStream is = response.body().byteStream();
|
|
|
+ FileOutputStream fos = new FileOutputStream(new File(dirName + "/" + fileName));
|
|
|
+ int len = 0;
|
|
|
+ byte[] buffer = new byte[2048];
|
|
|
+ while (-1 != (len = is.read(buffer))) {
|
|
|
+ fos.write(buffer, 0, len);
|
|
|
+ }
|
|
|
+
|
|
|
+ fos.flush();
|
|
|
+ fos.close();
|
|
|
+ is.close();
|
|
|
+ File filen2 = new File(dirName + "/" + fileName);
|
|
|
+ File filen = new File(dirName + "/" + fileName+".dcm");
|
|
|
+ filen2.renameTo(filen);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ this.renderText("1*"+e.toString());
|
|
|
+ }
|
|
|
+ }} catch (Exception e) {
|
|
|
+ // TODO: handle exception
|
|
|
+ this.renderText(e.toString());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
public static DruidPlugin createConnectedDruidPlugin() {
|
|
|
|
|
|
return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());
|
|
@@ -89,25 +140,18 @@ public class ViewController extends Controller {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* 日期字符串格式转换
|
|
|
* @param dateStr
|
|
|
* @return
|
|
|
*/
|
|
|
- private Date parseStringToDate(String dateStr) {
|
|
|
- if (dateStr == null) {
|
|
|
- return new Date();
|
|
|
- }
|
|
|
+ private String parseStringToDate() {
|
|
|
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Date date = null;
|
|
|
- try {
|
|
|
- date = sdf.parse(dateStr);
|
|
|
- } catch (ParseException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return date;
|
|
|
+ Date date = new Date();
|
|
|
+ long dInteger =date.getTime()-65000;
|
|
|
+ String daString = sdf.format(new Date(dInteger));
|
|
|
+ return daString;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|