刘韬 4 years ago
parent
commit
7250c3668b

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

@@ -101,9 +101,9 @@ public class ZskkConfig extends JFinalConfig {
 		cpData.addTask("*/5 * * * *", new DataTask());
 		me.add(cpData);
 
-//		Cron4jPlugin cp2 = new Cron4jPlugin();
-//		cp2.addTask("*/16 * * * *", new UpdateTask());
-//	    me.add(cp2);
+		Cron4jPlugin cp2 = new Cron4jPlugin();
+		cp2.addTask("*/7 * * * *", new UpdateTask());
+	    me.add(cp2);
 	}
 
 	@Override

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

@@ -36,7 +36,7 @@ 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='03060001' order by createdAt desc limit 60");
+					"SELECT * FROM pacsonline.exams where exam_status=3 and institution_id='03060001' order by createdAt desc limit 50");
 			for (Exams exams2 : exams) {
 				try {
 //					Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());

+ 36 - 37
DataFusion/src/com/zskk/task/UpdateTask.java

@@ -43,36 +43,36 @@ public class UpdateTask 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='01700001' order by createdAt desc limit 100");
+					"SELECT * FROM pacsonline.exams where exam_status=3 and institution_id='03060001' order by createdAt desc limit 50");
 			for (Exams exams2 : exams) {
 				try {
-					Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
-					Record record = Db.use("connected").findFirst("select * from ReportInfoView where study_UID=?",
-							studies.getStudyuid());
+//					Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
+					Record record = Db.use("connected2").findFirst("select * from reportinfo where studyuid=?",
+							exams2.getPatientNum());
 					if (record == null) {
 						continue;
 					}
 					Report report = new Report().use("zskk");
 					report.setId(creatId());
-					report.setReportDatetime(parseStringToDate(record.getStr("Report_time")));
-					if (record.getStr("Image_evidences") == null || record.getStr("Image_diagnosis") == null
-							|| record.getStr("Image_evidences").isBlank()) {
+					report.setReportDatetime(parseStringToDate(record.getStr("reportdate")));
+					if (record.getStr("description") == null || record.getStr("impression") == null
+							|| record.getStr("description").isBlank()) {
 						continue;
 					}
-					report.setImpression(record.getStr("Image_evidences"));
-					report.setDescription(record.getStr("Image_diagnosis"));
+					report.setImpression(record.getStr("impression"));
+					report.setDescription(record.getStr("description"));
 					report.setExamId(exams2.getId());
 					report.setCreatedAt(new Date());
-					report.setReportDoctorId(getDoctorIdByName(record.getStr("Report_doc")));
-					report.setReviewDoctorId(getDoctorIdByName(record.getStr("Audit_doc")));
-					report.setReviewDatetime(parseStringToDate(record.getStr("Report_time")));
-					report.setConfirmDoctorId(getDoctorIdByName(record.getStr("Audit_doc")));
-					report.setConfirmDatetime(parseStringToDate(record.getStr("Report_time")));
+//					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("Patient_Name"));
-					patientInfos.setPhone(record.getStr("Mobile_phoe")==null?"":record.getStr("Mobile_phoe"));
-					patientInfos.setCardNum(record.getStr("ID_card_no")==null?"":record.getStr("ID_card_no"));
+					patientInfos.setName(record.getStr("patientname"));
+					patientInfos.setPhone(record.getStr("phone")==null?"":record.getStr("phone"));
+					patientInfos.setCardNum(record.getStr("idcard")==null?"":record.getStr("idcard"));
 					patientInfos.update();
 					exams2.setExamStatus(9);
 //					String patString = record.getStr("住院号");
@@ -80,30 +80,30 @@ public class UpdateTask implements ITask {
 //					patString = String.format("%0"+length+"d",Long.valueOf(patString));
 //					exams2.setHopitalizedNo(patString);
 //					exams2.setClinDoctors(record.getStr("CLINICALDOCTOR"));
-					exams2.setApplicationDepartment(record.getStr("Request_dept"));
-					exams2.setApplicationDoctor(record.getStr("Request_doc"));
+					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", "01700001");
+					data.put("hospital_id", "03060001");
 					// 影像所见
-					data.put("description", record.getStr("Image_evidences"));
+					data.put("description", record.getStr("description"));
 					// 意见建议
-					data.put("impression", record.getStr("Image_diagnosis"));
+					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("Patient_Name"));
+					data.put("patient_name", record.getStr("patientname"));
 					// 患者性别
 					data.put("patient_sex", patientInfos.getSex());
 					// 身份证号
-					data.put("card_num", record.getStr("ID_card_no")==null?"":record.getStr("ID_card_no"));
+					data.put("card_num", record.getStr("idcard")==null?"":record.getStr("idcard"));
 					// 手机号
 					data.put("phone", patientInfos.getPhone());
 					// 患者生日
@@ -111,25 +111,25 @@ public class UpdateTask implements ITask {
 					// 患者检查时年龄
 					data.put("patient_age", patientInfos.getAge()==null?"":patientInfos.getAge());
 					// 阴阳性 1阴性 2阳性
-					data.put("report_result", "");
+					data.put("report_result", record.getStr("result").contains("阴")?"1":"2");
 					// 报告时间 10位时间戳
-					data.put("report_datetime", returnSecondTimestamp(record.getStr("Report_time")));
+					data.put("report_datetime", returnSecondTimestamp(record.getStr("reportdate")));
 					// 报告医生id
-					data.put("report_doctor_id", record.getStr("Report_doc"));
+					data.put("report_doctor_id", record.getStr("reportdoctor")==null?"":record.getStr("reportdoctor"));
 					// 报告医生姓名
-					data.put("report_doctor_name", record.getStr("Report_doc"));
+					data.put("report_doctor_name", record.getStr("reportdoctor")==null?"":record.getStr("reportdoctor"));
 					// 审核时间
-					data.put("review_datetime", returnSecondTimestamp(record.getStr("Report_time")));
+					data.put("review_datetime", returnSecondTimestamp(record.getStr("reportdate")));
 					// 审核医生id
-					data.put("review_doctor_id", record.getStr("Audit_doc"));
+					data.put("review_doctor_id", record.getStr("reviewdoctor")==null?"":record.getStr("reviewdoctor"));
 					// 审核姓名
-					data.put("review_doctor_name", record.getStr("Audit_doc"));
+					data.put("review_doctor_name", record.getStr("reviewdoctor")==null?"":record.getStr("reviewdoctor"));
 					// 确认时间
-					data.put("confirm_datetime", returnSecondTimestamp(record.getStr("Report_time")));
+					data.put("confirm_datetime", returnSecondTimestamp(record.getStr("reportdate")));
 					// 确认医生id
-					data.put("confirm_doctor_id", record.getStr("Audit_doc"));
+					data.put("confirm_doctor_id", record.getStr("reviewdoctor")==null?"":record.getStr("reviewdoctor"));
 					// 确认医生姓名
-					data.put("confirm_doctor_name", record.getStr("Audit_doc"));
+					data.put("confirm_doctor_name", record.getStr("reviewdoctor")==null?"":record.getStr("reviewdoctor"));
 					data.put("patient_no", "");
 
 					ThreadPoolService tService = new com.zskk.service.ThreadPoolService();
@@ -284,14 +284,14 @@ public class UpdateTask implements ITask {
 		}
 		name = name.replace(" ", "");
 		Doctors doctors = Doctors.dao.use("zskk").findFirst(
-				"SELECT * FROM doctors where instr(?,realname) and institution_id='01700001' and realname <>''", name);
+				"SELECT * FROM doctors where instr(?,realname) and institution_id='03060001' 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("01700001");
+			newDoctors.setInstitutionId("03060001");
 			newDoctors.setCreatedAt(new Date());
 			newDoctors.setUpdatedAt(new Date());
 			newDoctors.save();
@@ -383,7 +383,6 @@ public class UpdateTask implements ITask {
 			}
 		}
 		return result;
-	
 	}
 
 }