Browse Source

no message

刘韬 2 years ago
parent
commit
2f7913969d

+ 10 - 5
DataFusion/res/config.properties

@@ -1,7 +1,12 @@
 #DB-connected partners
 #DB-connected partners
-jdbcUrl_connected  = jdbc:sqlserver://196.196.100.251:1433;DatabaseName=PACS
-#jdbcUrl_connected  = jdbc:oracle:thin:@192.168.100.4:1521:pacs
-user_connected 	   = jk
-password_connected = jk
+#jdbcUrl_connected  = jdbc:sqlserver://196.196.100.251:1433;DatabaseName=PACS
+jdbcUrl_connected  = jdbc:oracle:thin:@//192.168.0.39:1521/PACS
+user_connected 	   = yunyingxiang
+password_connected = yunyingxiang
 #DATA-Parms
 #DATA-Parms
-institution_id     = 06300009
+institution_id     = 06300009
+nw_key             = 2c1db8e7eee65eeeebacb0afbec37096
+#DB-local partners
+jdbcUrl_local  = jdbc:mysql://127.0.0.1:3306/pacsonline?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
+user_local	   = root
+password_local = Gryy@1234

+ 24 - 8
DataFusion/src/com/zskk/config/ZskkConfig.java

@@ -18,6 +18,7 @@ import com.jfinal.template.Engine;
 import com.zskk.control.ViewController;
 import com.zskk.control.ViewController;
 import com.zskk.service.ServiceFactory;
 import com.zskk.service.ServiceFactory;
 import com.zskk.task.DataTask;
 import com.zskk.task.DataTask;
+import com.zskk.task.UpdateTask;
 
 
 public class ZskkConfig extends JFinalConfig {
 public class ZskkConfig extends JFinalConfig {
 
 
@@ -60,18 +61,37 @@ public class ZskkConfig extends JFinalConfig {
 
 
 		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() {
+
+		return new DruidPlugin(PropKit.get("jdbcUrl_local"), PropKit.get("user_local"),PropKit.get("password_local").trim());
+	}
 
 
 	@Override
 	@Override
 	public void configPlugin(Plugins me) {
 	public void configPlugin(Plugins me) {
 		// 配置数据库连接池插件
 		// 配置数据库连接池插件
 		DruidPlugin druidPluginConnected = createConnectedDruidPlugin();
 		DruidPlugin druidPluginConnected = createConnectedDruidPlugin();
 		me.add(druidPluginConnected);
 		me.add(druidPluginConnected);
+		
+		DruidPlugin druidPluginLocal = createLocalDruidPlugin();
+		me.add(druidPluginLocal);
 
 
-		// 配置ActiveRecord插件
-		ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
-		arpConnected.setDialect(new SqlServerDialect());
-		me.add(arpConnected);
 
 
+		// 配置ActiveRecord插件
+//		ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
+//		arpConnected.setDialect(new OracleDialect());
+//		me.add(arpConnected);
+		
+//		ActiveRecordPlugin arpLocal = new ActiveRecordPlugin("local", druidPluginLocal);
+//		arpLocal.setDialect(new MysqlDialect());
+//		me.add(arpLocal);
+
+		//获取待匹配列表
+		Cron4jPlugin upData = new Cron4jPlugin();
+		upData.addTask("*/2 * * * *", new UpdateTask());
+		me.add(upData);
+		
+		//获取报告
 		Cron4jPlugin cpData = new Cron4jPlugin();
 		Cron4jPlugin cpData = new Cron4jPlugin();
 		cpData.addTask("*/5 * * * *", new DataTask());
 		cpData.addTask("*/5 * * * *", new DataTask());
 		me.add(cpData);
 		me.add(cpData);
@@ -104,10 +124,6 @@ public class ZskkConfig extends JFinalConfig {
 //		cpData.addTask("*/5 * * * *", new DataTask());
 //		cpData.addTask("*/5 * * * *", new DataTask());
 //		me.add(cpData);
 //		me.add(cpData);
 		
 		
-//		Cron4jPlugin cpData = new Cron4jPlugin();
-//		cpData.addTask("*/5 * * * *", new DataTask());
-//		me.add(cpData);
-		
 //		Cron4jPlugin cpData = new Cron4jPlugin();
 //		Cron4jPlugin cpData = new Cron4jPlugin();
 //		cpData.addTask("*/5 * * * *", new DataTask());
 //		cpData.addTask("*/5 * * * *", new DataTask());
 //		me.add(cpData);
 //		me.add(cpData);

+ 20 - 1
DataFusion/src/com/zskk/control/ViewController.java

@@ -12,6 +12,7 @@ import com.jfinal.kit.PropKit;
 import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
 import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
 import com.jfinal.plugin.activerecord.Db;
 import com.jfinal.plugin.activerecord.Db;
 import com.jfinal.plugin.activerecord.Record;
 import com.jfinal.plugin.activerecord.Record;
+import com.jfinal.plugin.activerecord.dialect.OracleDialect;
 import com.jfinal.plugin.activerecord.dialect.SqlServerDialect;
 import com.jfinal.plugin.activerecord.dialect.SqlServerDialect;
 import com.jfinal.plugin.druid.DruidPlugin;
 import com.jfinal.plugin.druid.DruidPlugin;
 import okhttp3.FormBody;
 import okhttp3.FormBody;
@@ -47,7 +48,7 @@ public class ViewController extends Controller {
             druidPluginConnected.start();
             druidPluginConnected.start();
 			// 配置ActiveRecord插件
 			// 配置ActiveRecord插件
 			ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
 			ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
-			arpConnected.setDialect(new SqlServerDialect());
+			arpConnected.setDialect(new OracleDialect());
 			arpConnected.start();
 			arpConnected.start();
 
 
 		} catch (Exception e) {
 		} catch (Exception e) {
@@ -60,7 +61,25 @@ public class ViewController extends Controller {
 
 
 		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 void testConn2() {
+		try {
+			DruidPlugin druidPluginConnected = createConnectedDruidPlugin2(this.getPara("url"),this.getPara("name"),this.getPara("pass"));
+            druidPluginConnected.start();
+			// 配置ActiveRecord插件
+			ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
+			arpConnected.setDialect(new OracleDialect());
+			arpConnected.start();
+
+		} catch (Exception e) {
+			// TODO: handle exception
+			this.renderText(e.toString());
+		}
+	}
 	
 	
+	public static DruidPlugin createConnectedDruidPlugin2(String url,String name,String pass) {
+
+		return new DruidPlugin(url, name,pass.trim());
+	}
 	/**
 	/**
 	 * post请求
 	 * post请求
 	 * @param url-请求地址
 	 * @param url-请求地址

+ 21 - 6
DataFusion/src/com/zskk/service/DataService.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.jfinal.kit.PropKit;
 import com.jfinal.kit.PropKit;
+import com.zskk.tools.AESUtils;
 
 
 import okhttp3.FormBody;
 import okhttp3.FormBody;
 import okhttp3.MediaType;
 import okhttp3.MediaType;
@@ -37,15 +38,29 @@ public class DataService {
      * @param number
      * @param number
      */
      */
     public JSONArray getExamList(Integer number) {
     public JSONArray getExamList(Integer number) {
+        String IV = "0000000000000000";
     	Map <String,String> map = new HashMap<String,String>();
     	Map <String,String> map = new HashMap<String,String>();
-    	map.put("institution_id", PropKit.get("institution_id"));
+    	map.put("exam_status","3");
+    	map.put("createAt", "2023-06-01 00:00:00,2023-06-14 12:00:00");
     	map.put("num", number.toString());
     	map.put("num", number.toString());
-		String content = postWithParameters(GET_EXAM_URL, map);
-	    JSONObject jsonObject = JSON.parseObject(content);
-	    if (!jsonObject.getString("msg").equals("success")) {
+    	String aesEncryptStr = AESUtils.aesEncryptStr(JSON.toJSONString(map), PropKit.get("nw_key"),IV);
+    	Map <String,String> mapaes = new HashMap<String,String>();
+    	map.put("data",aesEncryptStr);
+		String content = postWithParameters(GET_EXAM_URL, mapaes);
+//	    JSONObject jsonObject = JSON.parseObject(content);
+//	    if (!jsonObject.getString("msg").equals("success")) {
+//			return null;
+//		}
+        String aesDecodeStr ="";
+		try {
+			aesDecodeStr = AESUtils.aesDecodeStr(content, PropKit.get("nw_key"),IV);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
 			return null;
 			return null;
 		}
 		}
-		JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));		
+
+		JSONArray jsonArray = JSON.parseArray(aesDecodeStr);		
 		return jsonArray;
 		return jsonArray;
 		
 		
 	}
 	}
@@ -124,7 +139,7 @@ public class DataService {
     public static void main(String[] args) {
     public static void main(String[] args) {
     	Map <String,String> map = new HashMap<String,String>();
     	Map <String,String> map = new HashMap<String,String>();
     	map.put("institution_id", "47600001");
     	map.put("institution_id", "47600001");
-    	map.put("num", "10");
+//    	map.put("num", "10");
 		postWithParameters(GET_EXAM_URL, map);
 		postWithParameters(GET_EXAM_URL, map);
 	}
 	}
 
 

+ 78 - 70
DataFusion/src/com/zskk/task/DataTask.java

@@ -4,6 +4,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
@@ -22,76 +23,83 @@ public class DataTask implements ITask {
 	public void run() {
 	public void run() {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
 		DataService dService = ServiceFactory.getService(DataService.class);
 		DataService dService = ServiceFactory.getService(DataService.class);
-        JSONArray jsonArray = dService.getExamList(50);	
-        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"));
-			if (record == null) {
-				continue;
-			}
-			if (record.getStr("IMPRESSION").isBlank() && record.getStr("DESCRIPTION").isBlank()) {
-				continue;
-			}
-			Map<String, String> params = new HashMap<>();
-			//1:exam_id 2:patient_num 3:accession_num 4:study_uid
-			params.put("type", "1");
-			
-			params.put("institution_id", PropKit.get("institution_id"));
-
-			params.put("code", 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", record.getStr("clin_diag")==null?"":record.getStr("clin_diag"));
-			//症状
-			params.put("clin_symp", record.getStr("clin_symp")==null?"":record.getStr("clin_symp"));
-			//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"));
-			//检查结果1阴2阳
-			params.put("report_result", record.getStr("result").contains("阳")?"2":"1");
-			//住院号
-//			params.put("hopitalized_no", record.getStr("patientNumber"));
-			//门诊号
-//			params.put("out_patient", record.getStr("patientNumber"));
-			//病人ID
-//			params.put("his_patient_id", record.getStr("patientNumber"));
-			//检查方法
-			params.put("exam_project", record.getStr("patientNumber"));
-
-			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
-			tService.execute(() -> {
-				dService.saveReport(params);
-			});	
-        	} catch (Exception e) {
-				// TODO: handle exception
-        		continue;
-			}
-        }
+		List<Record> studyidfinds = Db.use("local").find("select * from study where reportstatus =0 or reportstatus =1 limit 100");
+		if (studyidfinds == null) {
+			return;
+		}
+		
+		
+		
+//        JSONArray jsonArray = dService.getExamList(50);	
+//        for (Object object : jsonArray) {
+//        	try {
+//			JSONObject jsonObject = JSON.parseObject(object.toString());
+//			Record record = Db.use("local").findFirst("select * from study where studyuid=?", jsonObject.getString("studyuid"));
+//			if (record == null) {
+//				continue;
+//			}
+//			if (record.getStr("IMPRESSION").isBlank() && record.getStr("DESCRIPTION").isBlank()) {
+//				continue;
+//			}
+//			Map<String, String> params = new HashMap<>();
+//			//1:exam_id 2:patient_num 3:accession_num 4:study_uid
+//			params.put("type", "1");
+//			
+//			params.put("institution_id", PropKit.get("institution_id"));
+//
+//			params.put("code", 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", record.getStr("clin_diag")==null?"":record.getStr("clin_diag"));
+//			//症状
+//			params.put("clin_symp", record.getStr("clin_symp")==null?"":record.getStr("clin_symp"));
+//			//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"));
+//			//检查结果1阴2阳
+//			params.put("report_result", record.getStr("result").contains("阳")?"2":"1");
+//			//住院号
+////			params.put("hopitalized_no", record.getStr("patientNumber"));
+//			//门诊号
+////			params.put("out_patient", record.getStr("patientNumber"));
+//			//病人ID
+////			params.put("his_patient_id", record.getStr("patientNumber"));
+//			//检查方法
+//			params.put("exam_project", record.getStr("patientNumber"));
+//
+//			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
+//			tService.execute(() -> {
+//				dService.saveReport(params);
+//			});	
+//        	} catch (Exception e) {
+//				// TODO: handle exception
+//        		continue;
+//			}
+//        }
 	}
 	}
 
 
 	@Override
 	@Override

+ 21 - 33
DataFusion/src/com/zskk/task/UpdateTask.java

@@ -20,41 +20,15 @@ public class UpdateTask implements ITask {
 	public void run() {
 	public void run() {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
 		DataService dService = ServiceFactory.getService(DataService.class);
 		DataService dService = ServiceFactory.getService(DataService.class);
-        JSONArray jsonArray = dService.getExamList(30);
+        JSONArray jsonArray = dService.getExamList(200);
         for (Object object : jsonArray) {
         for (Object object : jsonArray) {
-        	try {
 			JSONObject jsonObject = JSON.parseObject(object.toString());
 			JSONObject jsonObject = JSON.parseObject(object.toString());
-			Record record = Db.use("connected").findFirst("select * from examinfo where studyuid=?", jsonObject.getString("studyuid"));
-			if (record == null) {
-				continue;
-			}
-			Map<String, String> params = new HashMap<>();
-			params.put("exam_id", jsonObject.getString("id"));
-			//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("diagnosis") == null ? "" : record.getStr("diagnosis"));
-			//症状
-			params.put("clin_symp", record.getStr("symptom") == null ? "" : record.getStr("symptom"));
-			//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"));
-			//门诊号住院号
-			params.put("hopitalized_no", "");
-			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
-			tService.execute(() -> {
-				dService.updatePatientInfo(params);
-			});	
-        	} catch (Exception e) {
-				// TODO: handle exception
-        		continue;
+			Record studyidfind = Db.use("local").findFirst("select * from study where studyuid = ?",
+					jsonObject.getString("studyuid"));
+			if (studyidfind == null) {
+				Record studyinfo = new Record().set("studyuid", jsonObject.getString("studyuid")).set("modalities", jsonObject.getString("exam_class"))
+						.set("patientNum", jsonObject.getString("patient_num")).set("accessionNumber", jsonObject.getString("accession_num")).set("examstatus", 0).set("reportstatus", 0).set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
+				Db.use("local").save("study", studyinfo);
 			}
 			}
         }
         }
 	}
 	}
@@ -76,6 +50,20 @@ public class UpdateTask implements ITask {
 	    String timeString = sdf.format(date);
 	    String timeString = sdf.format(date);
 	    return timeString;
 	    return timeString;
 	}
 	}
+	
+	/**
+	 * 日期字符串格式转换年月日时分秒
+	 * 
+	 * @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;
+
+	}
 
 
 
 
 }
 }