刘韬 2 years ago
parent
commit
82ee83898b
1 changed files with 74 additions and 65 deletions
  1. 74 65
      DataFusion/src/com/zskk/task/DataTask.java

+ 74 - 65
DataFusion/src/com/zskk/task/DataTask.java

@@ -8,6 +8,7 @@ import java.util.Map;
 import com.alibaba.fastjson.JSON;
 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.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.cron4j.ITask;
 import com.jfinal.plugin.cron4j.ITask;
@@ -21,71 +22,78 @@ 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("patient_num"));
-			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("DEPATMENT"));
-			//申请医生
-			params.put("application_doctor", record.getStr("CLINICALDOCTOR"));
-			//临床诊断
-			params.put("clin_diag", "");
-			//症状
-			params.put("clin_symp", record.getStr("SYMPOM")==null?"":record.getStr("SYMPOM"));
-			//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", "0");
-			//门诊号住院号
+		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("patient_num"));
+				if (record == null) {
+					continue;
+				}
+				if (record.getStr("IMPRESSION").isBlank() && record.getStr("DESCRIPTION").isBlank()) {
+					continue;
+				}
+				Map<String, String> params = new HashMap<>();
+				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("DEPATMENT"));
+				// 申请医生
+				params.put("application_doctor", record.getStr("CLINICALDOCTOR"));
+				// 临床诊断
+				params.put("clin_diag", "");
+				// 症状
+				params.put("clin_symp", record.getStr("SYMPOM") == null ? "" : record.getStr("SYMPOM"));
+				// 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", "0");
+				// 门诊号住院号
 //			params.put("hopitalized_no", record.getStr("HOPITALIZED_NO")==null?"":record.getStr("HOPITALIZED_NO"));
 //			params.put("hopitalized_no", record.getStr("HOPITALIZED_NO")==null?"":record.getStr("HOPITALIZED_NO"));
-			//门诊号
+				// 门诊号
 //			params.put("out_patient", record.getStr("PAT_NO")==null?"":record.getStr("PAT_NO"));
 //			params.put("out_patient", record.getStr("PAT_NO")==null?"":record.getStr("PAT_NO"));
-			//病人ID
-			params.put("his_patient_id", record.getStr("PATIENTID")==null?"":record.getStr("PATIENTID"));
-			//检查方法
+				// 病人ID
+				params.put("his_patient_id", record.getStr("PATIENTID") == null ? "" : record.getStr("PATIENTID"));
+				// 检查方法
 //			params.put("exam_project", record.getStr("patientNumber"));
 //			params.put("exam_project", record.getStr("patientNumber"));
 
 
-			ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
-			tService.execute(() -> {
-				dService.saveReport(params);
-			});	
-        	} catch (Exception e) {
+				ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
+				tService.execute(() -> {
+					dService.saveReport(params);
+				});
+			} catch (Exception e) {
 				// TODO: handle exception
 				// TODO: handle exception
-        		continue;
+				continue;
 			}
 			}
-        }
+		}
 	}
 	}
 
 
 	@Override
 	@Override
@@ -93,9 +101,10 @@ public class DataTask implements ITask {
 		// TODO Auto-generated method stub
 		// TODO Auto-generated method stub
 
 
 	}
 	}
-	
+
 	/**
 	/**
 	 * 日期字符串格式转换
 	 * 日期字符串格式转换
+	 * 
 	 * @param dateStr
 	 * @param dateStr
 	 * @return
 	 * @return
 	 */
 	 */
@@ -103,19 +112,19 @@ public class DataTask implements ITask {
 		if (dateStr == null) {
 		if (dateStr == null) {
 			return "";
 			return "";
 		}
 		}
-		SimpleDateFormat sdf= new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
-	    Date date = null;
-	    String timeString = null;
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
+		Date date = null;
+		String timeString = null;
 		try {
 		try {
 			date = sdf.parse(dateStr);
 			date = sdf.parse(dateStr);
-			SimpleDateFormat sdf2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+			SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
 
 			timeString = sdf2.format(date);
 			timeString = sdf2.format(date);
 		} catch (ParseException e) {
 		} catch (ParseException e) {
 			// TODO Auto-generated catch block
 			// TODO Auto-generated catch block
 			e.printStackTrace();
 			e.printStackTrace();
 		}
 		}
-        return timeString;
+		return timeString;
 	}
 	}
 
 
 }
 }