Browse Source

Merge branch 'i_44800001' into i_22100006

# Conflicts:
#	DataFusion/res/config.properties
#	DataFusion/src/com/zskk/config/ZskkConfig.java
#	DataFusion/src/com/zskk/control/ViewController.java
#	DataFusion/src/com/zskk/service/DataService.java
#	DataFusion/src/com/zskk/task/DataTask.java
#	DataFusion/src/com/zskk/task/UpdateTask.java
LAPTOP-5NTQJPUS\LT 1 year ago
parent
commit
7a92b9e4c1

+ 22 - 9
DataFusion/src/com/zskk/config/ZskkConfig.java

@@ -20,14 +20,17 @@ import com.zskk.task.CFindTask;
 import com.zskk.task.CMoveTask;
 import com.zskk.task.DataTask;
 import com.zskk.task.InfoTask;
-import com.zskk.task.ReCMoveTask;
 import com.zskk.task.ReviewTask;
+import com.zskk.task.CheckTask;
+import com.zskk.task.DataTask;
+import com.zskk.task.InsertTask;
 import com.zskk.task.UpdateTask;
 
 public class ZskkConfig extends JFinalConfig {
 
 	// 本地开发模式
 	private boolean isLocalDev = false;
+
 	/**
 	 * 如果生产环境配置文件存在,则优先加载该配置,否则加载开发环境配置文件
 	 * 
@@ -46,13 +49,14 @@ public class ZskkConfig extends JFinalConfig {
 	public void configConstant(Constants me) {
 		loadProp("config.properties", "a_little_config.txt");
 		me.setDevMode(PropKit.getBoolean("devMode", false));
+		me.setBaseDownloadPath("/download");// 配置文件下载路径
 	}
 
 	@Override
 	public void configRoute(Routes me) {
 		// TODO Auto-generated method stub
 		me.add("/view", ViewController.class);
-		me.add("/", ViewController.class,"");
+		me.add("/", ViewController.class, "");
 	}
 
 	@Override
@@ -63,7 +67,8 @@ public class ZskkConfig extends JFinalConfig {
 
 	public static DruidPlugin createConnectedDruidPlugin() {
 
-		return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());
+		return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),
+				PropKit.get("password_connected").trim());
 	}
 	
 	public static DruidPlugin createLocalDruidPlugin() {
@@ -71,6 +76,12 @@ public class ZskkConfig extends JFinalConfig {
 		return new DruidPlugin(PropKit.get("jdbcUrl_local"), PropKit.get("user_local"),PropKit.get("password_local").trim());
 	}
 
+	public static DruidPlugin createConnectedDruidPlugintemp() {
+
+		return new DruidPlugin(PropKit.get("jdbcUrl_connectedtemp"), PropKit.get("user_connectedtemp"),
+				PropKit.get("password_connectedtemp").trim());
+	}
+	
 	@Override
 	public void configPlugin(Plugins me) {
 		// 配置数据库连接池插件
@@ -80,9 +91,10 @@ public class ZskkConfig extends JFinalConfig {
 		DruidPlugin druidPluginLocal = createLocalDruidPlugin();
 		me.add(druidPluginLocal);
 
+
 		// 配置ActiveRecord插件
 		ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
-		arpConnected.setDialect(new OracleDialect());
+		arpConnected.setDialect(new SqlServerDialect());
 		me.add(arpConnected);
 		
 		ActiveRecordPlugin arpLocal = new ActiveRecordPlugin("local", druidPluginLocal);
@@ -120,9 +132,10 @@ public class ZskkConfig extends JFinalConfig {
 //		me.add(upData);
 //		
 //		//二次CMOVE
-		Cron4jPlugin reData = new Cron4jPlugin();
-		reData.addTask("*/3 * * * *", new ReCMoveTask());
-		me.add(reData);
+//		Cron4jPlugin reData = new Cron4jPlugin();
+//		reData.addTask("*/3 * * * *", new ReCMoveTask());
+//		me.add(reData);
+
 	}
 
 	@Override
@@ -136,14 +149,14 @@ public class ZskkConfig extends JFinalConfig {
 		// TODO Auto-generated method stub
 
 	}
-	
+
 	@Override
 	public void onStart() {
 		// TODO Auto-generated method stub
 		super.onStart();
 		ServiceFactory.init();
 	}
-	
+
 //	public static void main(String[] args) {
 //		JFinal.start("WebRoot", 10002, "/", 5);
 //	}

+ 67 - 182
DataFusion/src/com/zskk/control/ViewController.java

@@ -1,10 +1,10 @@
 package com.zskk.control;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -48,14 +48,12 @@ public class ViewController extends Controller {
 	 */
 	public void executeSql() {
 		try {
-			List<Record> d = Db.use("connected").find(this.getPara("sqlstr"));
-			this.renderJson(d);
+		List<Record> d = Db.use("connected").find(this.getPara("sqlstr"));
+		this.renderJson(d);
 		} catch (Exception e) {
 			// TODO: handle exception
 			this.renderText(e.toString());
-
 		}
-		
 	}
 
 	public void testConn() {
@@ -73,171 +71,67 @@ public class ViewController extends Controller {
 		}
 	}
 	
-	public void test() {
-		Record recordfind = Db.use("connected").findFirst("select * from studyinfo where rownum < 2");
-		String[] strings = recordfind.getStr("YYK_PATHNAME").split("\\\\");
-		String aaString= "";
-		int index = 0;
-		for (String string : strings) {
-			aaString = aaString+index+"*"+string;
-			index++;
-		}
-		renderText(aaString);
-
+	public void testtime() {
+		SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	    Date date = new Date();
+	    long dInteger =date.getTime()-360000;
+		String daString = sdf.format(new Date(dInteger));
+		this.renderText(daString);
 	}
 	
 	
-	public void sdcfind() {
-		String execCmd = ExecUtil.execCmd("/zskk_system/other/cfind.sh " + this.getPara("time") + " STUDYUID_" + "temppp" + ".xml");
-		if (execCmd.contains("Connection refused")) {
-			return;
-		}
-		
-	
-		File fin_floder = new File("/home/zskk/CFIND_XML/STUDYUID_" + "temppp" + "1.xml");
-		// 创建从文件读取数据的FileInputStream流
-		FileInputStream fin;
+	public void name() {
 		try {
-			fin = new FileInputStream(fin_floder);
-			InputStreamReader isr = null;
-			isr = new InputStreamReader(fin);
-			BufferedReader raf = null;
-			raf = new BufferedReader(isr);
-			String xmlContent = null;
-			xmlContent = raf.readLine();
-			xmlContent = xmlContent.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
-			xmlContent = "<zskk>" + xmlContent + "</zskk>";
-			xmlContent = xmlContent.replace("&#0", "");
-			XmlHelper xmlHelper = XmlHelper.of(xmlContent);
-			// NativeDicomModel节点列表
-			NodeList nativeDicomModelList = xmlHelper.getNodeList("/zskk/NativeDicomModel");
-			for (int i = 0; i < nativeDicomModelList.getLength(); i++) {
-				String qString = "";
-				String studyuidString = "";
-				String modalitiesString = "";
-				// DicomAttribute节点列表
-				NodeList dicomAttributeList = xmlHelper.getNodeList(nativeDicomModelList.item(i), "DicomAttribute");
-				for (int j = 0; j < dicomAttributeList.getLength(); j++) {
-					// DicomAttribute节点属性列表
-					NamedNodeMap attributeMap = dicomAttributeList.item(j).getAttributes();
-					if (attributeMap != null && attributeMap.getLength() > 0) {
-						for (int k = 0; k < attributeMap.getLength(); k++) {
-							if (attributeMap.item(k).getNodeName().equals("tag")) {
-								// 获取studyuid
-								if (attributeMap.item(k).getNodeValue().equals("0020000D")) {
-									studyuidString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
-									continue;
-								}
-								// 获取检查类型00080060or00080061
-								if (attributeMap.item(k).getNodeValue().equals("00080060")) {
-									modalitiesString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
-								}
-							}
-						}
-					}
+			List<Record> record = Db.use("connected").find("select * from tjpacs.V_ZSKK_WEBPACS_IMAGE where STUDYID=?","1832510");
+		for (Record record2 : record) {
+			Request request = new Request.Builder()
+					.url(record2.getStr("HTTP_URL"))
+			        .build();
+
+			String fileName = record2.getStr("INSUID");
+//			String fileName = "aaaa";
+
+
+			try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
+				if (!response.isSuccessful())
+					throw new IOException("Unexpected code " + response);
+				String dirName = "/home/zskk/桌面/DICOM_URL";
+				File file = new File(dirName);
+				if (!file.exists()) {
+					file.mkdir();
 				}
-				Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
-						studyuidString);
-				if (studyidfind == null) {
-					Record studyinfo = new Record().set("studyuid", studyuidString).set("modalities", modalitiesString)
-							.set("status", 1).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
-					Db.use("local").save("study", studyinfo);
-				}else {
-					studyidfind.set("status", 2);
-					Db.use("local").update("study", studyidfind);
-
+				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 (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
 		}
-
-	}
-	
-	public void sdreview() {
-		try {
-			DataService dService = ServiceFactory.getService(DataService.class);
-			  
-			List<Record> records = Db.use("connected").find(
-					"SELECT * FROM (select * from reportinfo where REVIEWDATE>to_date(?,'YYYY-MM-DD HH24:MI:SS') and REVIEWDATE<to_date(?,'YYYY-MM-DD HH24:MI:SS') and rownum < 500)ORDER BY REVIEWDATE DESC",this.getPara("from"),this.getPara("to"));
-			if (records == null) {
-				return;
-			}
-			for (Record record : records) {
-				try {
-				if (record.getStr("IMPRESSION") == null && record.getStr("DESCRPTION") == null
-						&& record.getStr("REVIEWDOCTOR") == null) {
-					continue;
-				}
-				Map<String, String> params = new HashMap<>();
-				params.put("type", "4");
-
-				params.put("institution_id", PropKit.get("institution_id"));
-
-				params.put("code", record.getStr("STUDYUID"));
-				// 报告医生姓名
-				params.put("report_doctor_name", record.getStr("REPORTDOCTOR"));
-				// 报告时间
-				params.put("report_datetime", record.getStr("REVIEWDATE"));
-				// 审核医生姓名
-				params.put("review_doctor_name",
-						record.getStr("REVIEWDOCTOR") == null ? "" : record.getStr("REVIEWDOCTOR"));
-				// 审核时间
-				params.put("review_datetime", record.getStr("REVIEWDATE"));
-				// 确认医生姓名
-				params.put("confirm_doctor_name",
-						record.getStr("REVIEWDOCTOR") == null ? "" : record.getStr("REVIEWDOCTOR"));
-				// 确认时间
-				params.put("confirm_datetime", record.getStr("REVIEWDATE"));
-				// 意见建议
-				params.put("impression", record.getStr("IMPRESSION"));
-				// 影像所见
-				params.put("description", record.getStr("DESCRPTION"));
-				// exams表
-				// 申请科室
-				params.put("application_department", record.getStr("DEPARTMENT")== null ? "" : record.getStr("DEPARTMENT"));
-				// 申请医生
-				params.put("application_doctor", record.getStr("CLINICALDOCTOR")== null ? "" : record.getStr("CLINICALDOCTOR"));
-				// 临床诊断
-				params.put("clin_diag", record.getStr("DIAGNOSE") == null ? "" : record.getStr("DIAGNOSE"));
-				// 症状
-				params.put("clin_symp", record.getStr("SYMPROM") == null ? "" : record.getStr("SYMPROM"));
-				// patient_infos表
-				// 患者姓名
-				params.put("name", record.getStr("PATIENTNAME"));
-				// 患者手机号
-				params.put("phone", record.getStr("PHONE") == null ? "" : record.getStr("PHONE"));
-				// 患者身份证号
-				params.put("card_num", record.getStr("IDCARD") == null ? "" : record.getStr("IDCARD"));
-				// 检查结果1阴2阳
-				params.put("report_result", record.getStr("RESULT").contains("阳") ? "2" : "1");
-				// 门诊号住院号
-				params.put("hopitalized_no", record.getStr("INPATIENTNUM") == null ? "" : record.getStr("INPATIENTNUM"));
-				// 门诊号
-				params.put("out_patient", record.getStr("OUTPATIENTNUM") == null ? "" : record.getStr("OUTPATIENTNUM"));
-				// 病人ID
-				params.put("his_patient_id", record.getStr("PATIENTID") == null ? "" : record.getStr("PATIENTID"));
-				// 检查方法
-				params.put("exam_project", record.getStr("PROIECT")==null?"":record.getStr("PROIECT"));
-				ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
-				tService.execute(() -> {
-					dService.saveReport(params);
-				});
-				} catch (Exception e) {
-					// TODO: handle exception
-					continue;
-				}
-			}
-			this.renderJson(records);
 		} catch (Exception e) {
 			// TODO: handle exception
 			this.renderText(e.toString());
 
 		}
-		
+
+		this.renderText("succ");
+
 	}
-	
+
 	public static DruidPlugin createConnectedDruidPlugin() {
 
 		return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());
@@ -269,38 +163,29 @@ public class ViewController extends Controller {
 			return null;
 		}
 	}
-	
-	private String parseStringToDate() {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-		Date date = new Date();
-		long dInteger = date.getTime() - 86400000;
-		String daString = sdf.format(new Date(dInteger));
-		return daString;
-
-	}
-	
-	private String parseStringToDate2() {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		Date date = new Date();
-		long dInteger = date.getTime() - 300000;
-		String daString = sdf.format(new Date(dInteger));
-		return daString;
 
-	}
-	
-	
 	/**
 	 * 日期字符串格式转换
 	 * 
 	 * @param dateStr
 	 * @return
 	 */
-	private String parseStringToDate1(String dString) {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-		Date date = new Date();
-		long dInteger = date.getTime();
+
+	private String parseStringToDate() {
+		SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	    Date date = new Date();
+	    long dInteger =date.getTime()-65000;
 		String daString = sdf.format(new Date(dInteger));
-		return daString;
+	    return daString;
+		
+	}
+
+	public static void main(String[] args) {
+        Map<String,String> paramsMap=new HashMap<String,String>();
+        paramsMap.put("institution_id", "44100001");
+
+		String contentString = doPost("https://risserver3.pacsonline.cn/butt/getExam/butt/getExam", paramsMap);
+		System.out.println(contentString);
 
 	}
 	

+ 97 - 161
DataFusion/src/com/zskk/service/DataService.java

@@ -10,6 +10,10 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -39,181 +43,113 @@ import okhttp3.RequestBody;
 import okhttp3.Response;
 
 public class DataService {
-	
-    private static String GET_EXAM_URL = "https://risserver3.pacsonline.cn/butt/getExam";
-    
-    private static String SAVE_REPORT_URL = "https://risserver3.pacsonline.cn/butt/saveReport";
-    
-    private static String UPDATE_PATIENT_URL = "https://risserver3.pacsonline.cn/butt/saveExam";
-	
-    private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
-    public static final MediaType MEDIA_TYPE_MARKDOWN = MediaType.parse("multipart/form-data");
-
-    
-    /**
-     * 获取未出报告的检查列表
-     * @param instutionId
-     * @param number
-     */
-    public JSONArray getExamList(Integer number) {
-    	Map <String,String> map = new HashMap<String,String>();
-    	map.put("institution_id", PropKit.get("institution_id"));
-    	map.put("num", number.toString());
+
+	private static String GET_EXAM_URL = "https://risserver3.pacsonline.cn/butt/getExam";
+
+	private static String SAVE_REPORT_URL = "https://risserver3.pacsonline.cn/butt/saveReport";
+
+	private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
+
+	/**
+	 * 获取未出报告的检查列表
+	 * 
+	 * @param instutionId
+	 * @param number
+	 */
+	public JSONArray getExamList(Integer number) {
+		Map<String, String> map = new HashMap<String, String>();
+		map.put("institution_id", PropKit.get("institution_id"));
+		map.put("num", number.toString());
 		String content = postWithParameters(GET_EXAM_URL, map);
-	    JSONObject jsonObject = JSON.parseObject(content);
-	    if (!jsonObject.getString("msg").equals("success")) {
+		JSONObject jsonObject = JSON.parseObject(content);
+		if (!jsonObject.getString("msg").equals("success")) {
 			return null;
 		}
-		JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));		
+		JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));
 		return jsonArray;
-		
+
 	}
-    
-    /**
-     * 写入报告
-     * @param instutionId
-     * @param number
-     */
-    public void saveReport(Map <String,String> map) {
+
+	/**
+	 * 写入报告
+	 * 
+	 * @param instutionId
+	 * @param number
+	 */
+	public void saveReport(Map<String, String> map) {
 		postWithParameters(SAVE_REPORT_URL, map);
-		
-	}
-    
-    /**
-        * 更新患者信息
-        * 
-        * @param instutionId
-        * @param number
-        */
-	public void updatePatientInfo(Map<String, String> map) {
-		postWithParameters(UPDATE_PATIENT_URL, map);
+
 	}
-    
-    public static String postWithParameters(String url, Map<String, String> map) {
-    	
-    	FormBody.Builder formbody = new FormBody.Builder();
-    	
-    	for (Map.Entry<String, String> entry : map.entrySet()) {
-    		formbody.add(entry.getKey(), entry.getValue());
+
+
+	public static String postWithParameters(String url, Map<String, String> map) {
+
+		FormBody.Builder formbody = new FormBody.Builder();
+
+		for (Map.Entry<String, String> entry : map.entrySet()) {
+			formbody.add(entry.getKey(), entry.getValue());
 		}
 		RequestBody requestBody = formbody.build();
-		
-		Request request = new Request.Builder()
-		        .url(url)
-		        .post(requestBody)
-		        .build();
-
-		    try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
-		      if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
-		      String content = response.body().string();
-		      return content;
-		    } catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				return null;
-			}	
-	}
-    
-    public void downloadFileToFolder(String remoteUrl, String shareFolderPath, String fileName, String localDir,Record recoeRecord) {
-        InputStream in = null;
-        OutputStream out = null;
-        try {
-            SmbFile remoteFile = new SmbFile(remoteUrl + shareFolderPath + "/" + fileName);
-            File localFile = new File(localDir + File.separator + fileName);
-            localFile.getParentFile().mkdirs();
-            in = new BufferedInputStream(new SmbFileInputStream(remoteFile));
-            out = new BufferedOutputStream(new FileOutputStream(localFile));
-            byte[] buffer = new byte[1024];
-            while (in.read(buffer) != -1) {
-                out.write(buffer);
-                buffer = new byte[1024];
-            }
-        } catch (Exception e) {
-//            e.printStackTrace();
-        	e.fillInStackTrace();
-        } finally {
-            File localFile = new File(localDir + File.separator + fileName);
-            try {
-                out.close();
-                in.close();
-                System.out.print("11");
-
-                RequestBody requestBody = new MultipartBody.Builder()
-                        .setType(MultipartBody.FORM)
-                        .addFormDataPart("file", localFile.getName(),
-                            RequestBody.create(MEDIA_TYPE_MARKDOWN, localFile))
-                        .build();
-
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-    
-    public static void main(String[] args) throws IOException, ParserConfigurationException {
-    	
-		File fin_floder = new File("/Users/liutao/Desktop/tt121.xml");
-		int inti=0;
-		// 创建从文件读取数据的FileInputStream流
-		FileInputStream fin;
-		try {
-			fin = new FileInputStream(fin_floder);
-			InputStreamReader isr = null;
-			isr = new InputStreamReader(fin);
-			BufferedReader raf = null;
-			raf = new BufferedReader(isr);
-			String xmlContent = null;
-			xmlContent = raf.readLine();
-			xmlContent = xmlContent.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
-			xmlContent = "<zskk>" + xmlContent + "</zskk>";
-			xmlContent = xmlContent.replace("&#0", "");
-			XmlHelper xmlHelper = XmlHelper.of(xmlContent);
-			// NativeDicomModel节点列表
-			NodeList nativeDicomModelList = xmlHelper.getNodeList("/zskk/NativeDicomModel");
-			for (int i = 0; i < nativeDicomModelList.getLength(); i++) {
-				String qString = "";
-				String studyuidString = "";
-				String modalitiesString = "";
-				// DicomAttribute节点列表
-				NodeList dicomAttributeList = xmlHelper.getNodeList(nativeDicomModelList.item(i), "DicomAttribute");
-				for (int j = 0; j < dicomAttributeList.getLength(); j++) {
-					// DicomAttribute节点属性列表
-					NamedNodeMap attributeMap = dicomAttributeList.item(j).getAttributes();
-					if (attributeMap != null && attributeMap.getLength() > 0) {
-						for (int k = 0; k < attributeMap.getLength(); k++) {
-							if (attributeMap.item(k).getNodeName().equals("tag")) {
-								// 获取studyuid
-								if (attributeMap.item(k).getNodeValue().equals("0020000D")) {
-									studyuidString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
-									System.out.println(studyuidString);
-
-									continue;
-								}
-								// 获取检查类型
-								if (attributeMap.item(k).getNodeValue().equals("00080061")) {
-									modalitiesString = xmlHelper.getString(dicomAttributeList.item(j), "Value");
-									System.out.print(modalitiesString);
-
-								}
-							}
-						}
-					}
-				}
-				inti++;
-//				Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
-//						studyuidString);
-//				if (studyidfind == null) {
-//					Record studyinfo = new Record().set("studyuid", studyuidString).set("modalities", modalitiesString)
-//							.set("status", 1).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
-//					Db.use("local").save("study", studyinfo);
-//				}
-			}
-			System.out.print(inti);
+
+		Request request = new Request.Builder().url(url).post(requestBody).build();
+
+		try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
+			if (!response.isSuccessful())
+				throw new IOException("Unexpected code " + response);
+			String content = response.body().string();
+			return content;
 		} catch (IOException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
+			return null;
 		}
+	}
+
+
+	public static void main(String[] args) {
+//    	Map <String,String> map = new HashMap<String,String>();
+//    	map.put("institution_id", "47600001");
+//    	map.put("num", "10");
+//		postWithParameters(GET_EXAM_URL, map);
+//		String fileName = "ss";
+//		Request request = new Request.Builder()
+//				.url("https://zskk-dcm.oss-cn-beijing.aliyuncs.com/73090001/d10378a36815fe3babd9b1e814b68fe6").build();
+//
+//		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
+//			e.printStackTrace();
+//		}
 
+		SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+	    Date date = new Date();
+	    long dInteger =date.getTime()-65000;
+		String daString = sdf.format(new Date(dInteger));
+		System.out.println(daString);
 	}
 
 }

+ 103 - 0
DataFusion/src/com/zskk/task/CheckTask.java

@@ -0,0 +1,103 @@
+package com.zskk.task;
+
+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;
+import java.util.List;
+
+import com.jfinal.plugin.activerecord.Db;
+import com.jfinal.plugin.activerecord.Record;
+import com.jfinal.plugin.cron4j.ITask;
+
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+public class CheckTask implements ITask {
+
+    private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
+
+	@Override
+	public void run() {
+		// TODO Auto-generated method stub
+		List<Record> record = Db.use("connectedtemp").find("select * from study where status>=3 and imageNum is not null order by createAt desc limit 15");
+		if (record == null) {
+			return;
+		}
+		for (Record record3 : record) {
+			int i = record3.getInt("imageNum");
+			List<Record> recordList = Db.use("connected").find("select * from tjpacs.V_ZSKK_WEBPACS_IMAGE where STUDYID=?",record3.getStr("studyid"));
+			if (recordList.size()<=i) {
+				continue;
+			}else {
+				record3.set("status", 4);
+				Db.use("connectedtemp").update("study", record3);
+				for (Record record2 : recordList) {
+					Request request = new Request.Builder()
+							.url(record2.getStr("HTTP_URL"))
+					        .build();
+
+					String fileName = record2.getStr("INSUID");
+
+					try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
+						if (!response.isSuccessful())
+							throw new IOException("Unexpected code " + response);
+						String dirName = "/home/zskk/桌面/DICOM_URL";
+						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
+						e.printStackTrace();
+					}
+				}
+			}			
+			record3.set("imageNum", recordList.size());
+			record3.set("status", 5);
+			Db.use("connectedtemp").update("study", record3);
+		}
+
+	}
+
+	@Override
+	public void stop() {
+		// 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 dInteger =date.getTime()-65000;
+		String daString = sdf.format(new Date(dInteger));
+	    return daString;
+		
+	}
+}

+ 4 - 3
DataFusion/src/com/zskk/task/DataTask.java

@@ -25,7 +25,8 @@ public class DataTask implements ITask {
         JSONArray jsonArray = dService.getExamList(400);	
         for (Object object : jsonArray) {
 			JSONObject jsonObject = JSON.parseObject(object.toString());
-			Record record = Db.use("connected").findFirst("select * from reportinfo where ACCESSIONNUMBER=?", jsonObject.getString("accession_num"));
+			Record record = Db.use("connected").findFirst("select * from zskk_reportinfo where ACCESSIONNUMBER=?", jsonObject.getString("accession_num"));
+
 			if (record == null) {
 				continue;
 			}
@@ -39,7 +40,7 @@ public class DataTask implements ITask {
 
 			params.put("code", jsonObject.getString("id"));
 			//报告医生姓名
-			params.put("report_doctor_name", record.getStr("REPORTDOCTOR"));
+			params.put("report_doctor_name", record.getStr("REPORTDOCTER"));
 			//报告时间
 			params.put("report_datetime", record.getStr("REPORTDATE"));
 			//审核医生姓名
@@ -58,7 +59,7 @@ public class DataTask implements ITask {
 			//申请科室
 			params.put("application_department", record.getStr("DEPARTMENT")==null?"":record.getStr("DEPARTMENT"));
 			//申请医生
-			params.put("application_doctor", record.getStr("CLINICALDOCTOR")==null?"":record.getStr("CLINICALDOCTOR"));
+			params.put("application_doctor", "");
 			//临床诊断
 			params.put("clin_diag", record.getStr("DIAGNOSIS")==null?"":record.getStr("DIAGNOSIS"));
 			//症状

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

@@ -74,7 +74,7 @@ public class InfoTask implements ITask {
 			params.put("exam_project", record.getStr("PROIECT")==null?"":record.getStr("PROIECT"));
 			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
 			tService.execute(() -> {
-				dService.updatePatientInfo(params);
+//				dService.updatePatientInfo(params);
 			});	
         }
 	}

+ 57 - 0
DataFusion/src/com/zskk/task/InsertTask.java

@@ -0,0 +1,57 @@
+package com.zskk.task;
+
+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;
+import java.util.List;
+
+import com.jfinal.plugin.activerecord.Db;
+import com.jfinal.plugin.activerecord.Record;
+import com.jfinal.plugin.cron4j.ITask;
+
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+public class InsertTask implements ITask {
+
+	private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
+
+	@Override
+	public void run() {
+		// TODO Auto-generated method stub
+		List<Record> records = Db.use("connected").find("select * from tjpacs.V_ZSKK_WEBPACS_STUDY where SDATE>to_date('" + parseStringToDate()+ "','yyyy-mm-dd hh24:mi:ss') and MODALITY!='US' and MODALITY!='XA' order by SDATE desc");
+		for (Record record : records) {
+			Record studyidfind = Db.use("connectedtemp").findFirst("select * from study where studyid = ?",record.getStr("STUDYID"));
+			if (studyidfind == null) {
+				Record studyinfo = new Record().set("studyid", record.getStr("STUDYID")).set("status", "1").set("createAt", new Date());
+				Db.use("connectedtemp").save("study", studyinfo);
+			}
+		}
+	}
+
+	@Override
+	public void stop() {
+		// 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 dInteger = date.getTime() - 7200000;
+		String daString = sdf.format(new Date(dInteger));
+		return daString;
+
+	}
+}

+ 0 - 66
DataFusion/src/com/zskk/task/ReCMoveTask.java

@@ -1,66 +0,0 @@
-package com.zskk.task;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import com.jfinal.plugin.activerecord.Db;
-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;
-import com.zskk.tools.ExecUtil;
-
-public class ReCMoveTask implements ITask {
-
-	@Override
-	public void run() {
-		// TODO Auto-generated method stub
-		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;
-		}
-		recordfind.set("status", 4);
-		
-		recordfind.set("imageNum", array.size());
-		recordfind.set("updateAt", parseStringToDateTime());
-		Db.use("local").update("study",recordfind);
-		for (Record object : array) {
-			recordfind.set("modalities", object.getStr("F_MODALITY"));
-			String[] strings = object.getStr("YYK_PATHNAME").split("\\\\");
-//			int len = strings.length;
-			dService.downloadFileToFolder("smb://pacs:pacs@"+strings[2], "/"+strings[3]+"/"+strings[4], strings[5],"/home/zskk/SMB_FILE",null);
-		}
-		recordfind.set("status", 3);
-		recordfind.set("updateAt", parseStringToDateTime());
-		Db.use("local").update("study",recordfind);
-	}
-
-	@Override
-	public void stop() {
-		// TODO Auto-generated method stub
-
-	}
-	
-	/**
-	 * 日期字符串格式转换年月日时分秒
-	 * 
-	 * @param dateStr
-	 * @return
-	 */
-	private String parseStringToDateTime() {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		Date date = new Date();
-		String daString = sdf.format(date);
-		return daString;
-
-	}
-
-}

+ 10 - 4
DataFusion/src/com/zskk/task/UpdateTask.java

@@ -5,19 +5,28 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
+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;
 import java.util.List;
-
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.NodeList;
 import com.jfinal.plugin.activerecord.Db;
 import com.jfinal.plugin.activerecord.Record;
 import com.jfinal.plugin.cron4j.ITask;
 import com.zskk.tools.XmlHelper;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
 
 public class UpdateTask implements ITask {
 
+    private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
+
 	@Override
 	public void run() {
 		// TODO Auto-generated method stub
@@ -26,8 +35,6 @@ public class UpdateTask implements ITask {
 			String studyuidString = record.getStr("AccessionNumber");
 			String modalitiesString = record.getStr("Modality");
 			String examdateString = record.getStr("ReqDate");
-
-
 			Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
 					studyuidString);
 			if (studyidfind == null) {
@@ -72,5 +79,4 @@ public class UpdateTask implements ITask {
 		return daString;
 
 	}
-
 }