刘韬 4 년 전
부모
커밋
69fb0e7651

+ 6 - 0
DataFusion/src/com/zskk/control/ViewController.java

@@ -51,6 +51,12 @@ public class ViewController extends Controller {
 		}
 	}
 	
+	public void st() {
+		
+			this.renderText(new Date().toString());
+	
+	}
+	
 	public static DruidPlugin createConnectedDruidPlugin() {
 
 		return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());

+ 16 - 0
DataFusion/src/com/zskk/service/DataService.java

@@ -20,6 +20,8 @@ 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 GET_CONFIRM_EXAM_URL = "https://risserver3.pacsonline.cn/butt/getConfirmExam";
 	
     private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
     
@@ -42,6 +44,20 @@ public class DataService {
 		
 	}
     
+    public JSONArray getExamListConfirmed(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_CONFIRM_EXAM_URL, map);
+	    JSONObject jsonObject = JSON.parseObject(content);
+	    if (!jsonObject.getString("msg").equals("success")) {
+			return null;
+		}
+		JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));		
+		return jsonArray;
+		
+	}
+    
     /**
      * 写入报告
      * @param instutionId

+ 19 - 9
DataFusion/src/com/zskk/task/DataTask.java

@@ -21,14 +21,17 @@ public class DataTask implements ITask {
 	public void run() {
 		// TODO Auto-generated method stub
 		DataService dService = ServiceFactory.getService(DataService.class);
-        JSONArray jsonArray = dService.getExamList(80);	
+        JSONArray jsonArray = dService.getExamList(200);	
         for (Object object : jsonArray) {
         	try {
 			JSONObject jsonObject = JSON.parseObject(object.toString());
-			Record record = Db.use("connected").findFirst("select * from reportinfo where studyuid=?", jsonObject.getString("studyuid"));
+			Record record = Db.use("connected").findFirst("select * from reportcheck where studyuid=?", jsonObject.getString("studyuid"));
 			if (record == null) {
 				continue;
 			}
+			if (parseStringToDate(record.getStr("checktime"))==Boolean.FALSE) {
+				continue;
+			}
 			if (record.getStr("impression").isBlank() && record.getStr("description").isBlank()) {
 				continue;
 			}
@@ -92,23 +95,30 @@ public class DataTask implements ITask {
 	 * @param dateStr
 	 * @return
 	 */
-	private String parseStringToDate(String dateStr) {
+	private Boolean parseStringToDate(String dateStr) {
 		if (dateStr == null) {
-			return "";
+			return Boolean.FALSE;
 		}
-		SimpleDateFormat sdf= new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
+		SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 	    Date date = null;
 	    String timeString = null;
 		try {
 			date = sdf.parse(dateStr);
-			SimpleDateFormat sdf2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
-			timeString = sdf2.format(date);
+			Long i=date.getTime();
+			Date datenewDate = new Date();
+			Long j =datenewDate.getTime();
+			Long k =j-i;
+			if (k<=14400000) {
+				return Boolean.FALSE;
+			}else {
+				return Boolean.TRUE;
+			}
+			
 		} catch (ParseException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
-        return timeString;
+		return Boolean.FALSE;
 	}
 
 }

+ 73 - 0
DataFusion/src/com/zskk/task/UpdateTask.java

@@ -1,12 +1,85 @@
 package com.zskk.task;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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;
 
 public class UpdateTask implements ITask {
 
 	@Override
 	public void run() {
 		// TODO Auto-generated method stub
+		DataService dService = ServiceFactory.getService(DataService.class);
+        JSONArray jsonArray = dService.getExamListConfirmed(80);
+		List<Record> records = Db.use("connected").find("select top 10 * from reportcheck order by checktime desc");
+
+        for (Object object : jsonArray) {
+        	try {
+			JSONObject jsonObject = JSON.parseObject(object.toString());
+			Record record = Db.use("connected").findFirst("select * from reportcheck where studyuid=?checktime", jsonObject.getString("studyuid"));
+			if (record == null) {
+				continue;
+			}
+			if (record.getStr("impression").isBlank() && record.getStr("description").isBlank()) {
+				continue;
+			}
+			Map<String, String> params = new HashMap<>();
+			params.put("exam_id", jsonObject.getString("id"));
+			//报告医生姓名
+			params.put("report_doctor_name", record.getStr("reportdoctor"));
+			//报告时间
+			params.put("report_datetime", record.getStr("reportdate"));
+			//审核医生姓名
+			params.put("review_doctor_name", record.getStr("reviewdoctor")==null?"":record.getStr("reviewdoctor"));
+			//审核时间
+			params.put("review_datetime", record.getStr("reportdate"));
+			//确认医生姓名
+			params.put("confirm_doctor_name", record.getStr("reviewdoctor")==null?"":record.getStr("reviewdoctor"));
+			//确认时间
+			params.put("confirm_datetime", record.getStr("reportdate"));
+			//意见建议
+			params.put("impression", record.getStr("impression"));
+			//影像所见
+			params.put("description", record.getStr("description"));
+			//exams表
+			//申请科室
+			params.put("application_department", record.getStr("department"));
+			//申请医生
+			params.put("application_doctor", record.getStr("clinicaldoctor"));
+			//临床诊断
+			params.put("clin_diag", "");
+			//症状
+			params.put("clin_symp", record.getStr("symptom"));
+			//patient_infos表
+			//患者姓名
+			params.put("name", record.getStr("patientname"));
+			//患者手机号
+			params.put("phone", record.getStr("phone"));
+			//患者身份证号
+			params.put("card_num", record.getStr("idcard"));
+			//检查结果1阴2阳
+			params.put("report_result", "0");
+			//门诊号住院号
+			params.put("hopitalized_no", "");
+			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
+			tService.execute(() -> {
+				dService.saveReport(params);
+			});	
+        	} catch (Exception e) {
+				// TODO: handle exception
+        		continue;
+			}
+        }
 
 	}