刘韬 il y a 5 ans
Parent
commit
66939b4978

+ 3 - 3
DataFusion/src/com/zskk/config/ZskkConfig.java

@@ -80,9 +80,9 @@ public class ZskkConfig extends JFinalConfig {
 		arpConnected.setDialect(new OracleDialect());
 		me.add(arpConnected);
 
-//		Cron4jPlugin cpData = new Cron4jPlugin();
-//		cpData.addTask("*/5 * * * *", new DataTask());
-//		me.add(cpData);
+		Cron4jPlugin cpData = new Cron4jPlugin();
+		cpData.addTask("*/5 * * * *", new DataTask());
+		me.add(cpData);
 
 //		Cron4jPlugin cp2 = new Cron4jPlugin();
 //		cp2.addTask("*/15 * * * *", new UpdateTask());

+ 39 - 39
DataFusion/src/com/zskk/task/DataTask.java

@@ -35,67 +35,67 @@ public class DataTask implements ITask {
 		// TODO Auto-generated method stub
 		try {
 			List<Exams> exams = Exams.dao.use("zskk").find(
-					"SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=62100002 order by createdAt desc limit 30");
+					"SELECT * FROM pacsonline.exams where exam_status=3 and institution_id='02400001' order by createdAt desc limit 30");
 			for (Exams exams2 : exams) {
 				try {
 					// Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
-					Record record = Db.use("connected").findFirst("select * from HH_Pacs_Reprot where 检查号=?",
-							exams2.getPatientNum());
+					Record record = Db.use("connected").findFirst("select * from third_view_zskk where STUDYUID=?",
+							exams2.getAccessionNum());
 					if (record == null) {
 						continue;
 					}
 					Report report = new Report().use("zskk");
 					report.setId(creatId());
-					report.setReportDatetime(parseStringToDate(record.getStr("报告日期")));
-					if (record.getStr("诊断及意见") == null || record.getStr("检查描述") == null
-							|| record.getStr("诊断及意见").isBlank() || record.getStr("检查描述").isBlank()) {
+					report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));
+					if (record.getStr("description") == null || record.getStr("IMPRESSION") == null
+							|| record.getStr("description").isBlank() || record.getStr("IMPRESSION").isBlank()) {
 						continue;
 					}
-					report.setImpression(record.getStr("诊断及意见"));
-					report.setDescription(record.getStr("检查描述"));
+					report.setImpression(record.getStr("description"));
+					report.setDescription(record.getStr("IMPRESSION"));
 					report.setExamId(exams2.getId());
 					report.setCreatedAt(new Date());
-					report.setReportDoctorId(getDoctorIdByName(record.getStr("报告医师")));
-					report.setReviewDoctorId(getDoctorIdByName(record.getStr("审核医师")));
-					report.setReviewDatetime(parseStringToDate(record.getStr("报告日期")));
-					report.setConfirmDoctorId(getDoctorIdByName(record.getStr("审核医师")));
-					report.setConfirmDatetime(parseStringToDate(record.getStr("报告日期")));
+					report.setReportDoctorId(getDoctorIdByName(record.getStr("REPORTDOCTOR")));
+					report.setReviewDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
+					report.setReviewDatetime(parseStringToDate(record.getStr("REPORTDATE")));
+					report.setConfirmDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
+					report.setConfirmDatetime(parseStringToDate(record.getStr("REPORTDATE")));
 					report.save();
 					PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
-					patientInfos.setName(record.getStr("姓名"));
+					patientInfos.setName(record.getStr("PATIENTNAME"));
 //					patientInfos.setPhone(record.getStr("phone"));
-//					patientInfos.setCardNum(record.getStr("idcard"));
+					patientInfos.setCardNum(record.getStr("IDCARD"));
 					patientInfos.update();
 					exams2.setExamStatus(9);
-					String patString = record.getStr("住院号");
+//					String patString = record.getStr("住院号");
 //					Integer length = patString.length();
 //					patString = String.format("%0"+length+"d",Long.valueOf(patString));
-					exams2.setHopitalizedNo(patString);
-//					exams2.setClinDoctors(record.getStr("clinicaldoctor"));
-					exams2.setApplicationDepartment(record.getStr("科别"));
-//					exams2.setApplicationDoctor(record.getStr("clinicaldoctor"));
+//					exams2.setHopitalizedNo(patString);
+//					exams2.setClinDoctors(record.getStr("CLINICALDOCTOR"));
+					exams2.setApplicationDepartment(record.getStr("DEPARTMENT"));
+					exams2.setApplicationDoctor(record.getStr("CLINICALDOCTOR"));
 //					exams2.setClinDiag(record.getStr("diagnosis"));
 					exams2.update();
 					// 传云医康 数据
 					Map<String, String> data = new HashMap<String, String>();
 					// 获取data数据
 					// 医院id
-					data.put("hospital_id", "62100002");
+					data.put("hospital_id", "02400001");
 					// 影像所见
-					data.put("description", record.getStr("检查描述"));
+					data.put("description", record.getStr("description"));
 					// 意见建议
-					data.put("impression", record.getStr("诊断及意见"));
+					data.put("impression", record.getStr("IMPRESSION"));
 					// 检查id
 					data.put("exam_id", exams2.getId());
 					data.put("study_id", exams2.getStudyId());
 					// 患者id
 					data.put("patient_id", exams2.getPatientId());
 					// 患者姓名
-					data.put("patient_name", record.getStr("姓名"));
+					data.put("patient_name", record.getStr("PATIENTNAME"));
 					// 患者性别
 					data.put("patient_sex", patientInfos.getSex());
 					// 身份证号
-					data.put("card_num", "");
+					data.put("card_num", record.getStr("IDCARD"));
 					// 手机号
 					data.put("phone", "");
 					// 患者生日
@@ -105,24 +105,24 @@ public class DataTask implements ITask {
 					// 阴阳性 1阴性 2阳性
 					data.put("report_result", "");
 					// 报告时间 10位时间戳
-					data.put("report_datetime", returnSecondTimestamp(record.getStr("报告日期")));
+					data.put("report_datetime", returnSecondTimestamp(record.getStr("REPORTDATE")));
 					// 报告医生id
-					data.put("report_doctor_id", record.getStr("报告医师"));
+					data.put("report_doctor_id", record.getStr("REPORTDOCTOR"));
 					// 报告医生姓名
-					data.put("report_doctor_name", record.getStr("报告医师"));
+					data.put("report_doctor_name", record.getStr("REPORTDOCTOR"));
 					// 审核时间
-					data.put("review_datetime", returnSecondTimestamp(record.getStr("报告日期")));
+					data.put("review_datetime", returnSecondTimestamp(record.getStr("REPORTDATE")));
 					// 审核医生id
-					data.put("review_doctor_id", record.getStr("审核医师"));
+					data.put("review_doctor_id", record.getStr("REVIEWDOCTOR"));
 					// 审核姓名
-					data.put("review_doctor_name", record.getStr("审核医师"));
+					data.put("review_doctor_name", record.getStr("REVIEWDOCTOR"));
 					// 确认时间
-					data.put("confirm_datetime", returnSecondTimestamp(record.getStr("报告日期")));
+					data.put("confirm_datetime", returnSecondTimestamp(record.getStr("REPORTDATE")));
 					// 确认医生id
-					data.put("confirm_doctor_id", record.getStr("审核医师"));
+					data.put("confirm_doctor_id", record.getStr("REVIEWDOCTOR"));
 					// 确认医生姓名
-					data.put("confirm_doctor_name", record.getStr("审核医师"));
-					data.put("patient_no", patString);
+					data.put("confirm_doctor_name", record.getStr("REVIEWDOCTOR"));
+					data.put("patient_no", "");
 
 
 					ThreadPoolService tService = new com.zskk.service.ThreadPoolService();
@@ -253,7 +253,7 @@ public class DataTask implements ITask {
 	 * @date: 2019/12/26 18:26
 	 */
 	public String returnSecondTimestamp(String data) throws ParseException {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 
 		return String.valueOf(sdf.parse(data).getTime() / 1000);
 	}
@@ -276,14 +276,14 @@ public class DataTask implements ITask {
 		}
 		name = name.replace(" ", "");
 		Doctors doctors = Doctors.dao.use("zskk").findFirst(
-				"SELECT * FROM doctors where instr(?,realname) and institution_id=62100002 and realname <>''", name);
+				"SELECT * FROM doctors where instr(?,realname) and institution_id='02400001' and realname <>''", name);
 		if (doctors == null) {
 			Doctors newDoctors = new Doctors().use("zskk");
 			newDoctors.setId(creatId());
 			newDoctors.setUsername("none");
 			newDoctors.setRealname(name);
 			newDoctors.setPassword("123456");
-			newDoctors.setInstitutionId("62100002");
+			newDoctors.setInstitutionId("02400001");
 			newDoctors.setCreatedAt(new Date());
 			newDoctors.setUpdatedAt(new Date());
 			newDoctors.save();
@@ -296,7 +296,7 @@ public class DataTask implements ITask {
 		if (dateStr == null) {
 			return new Date();
 		}
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 		Date date = null;
 		try {
 			date = sdf.parse(dateStr);