刘韬 4 years ago
parent
commit
f75d94c5f9

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

@@ -76,13 +76,13 @@ public class ZskkConfig extends JFinalConfig {
 		me.add(druidPluginConnected);
 
 		// 配置ActiveRecord插件
-//		ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
-//		arpConnected.setDialect(new SqlServerDialect());
-//		me.add(arpConnected);
+		ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
+		arpConnected.setDialect(new SqlServerDialect());
+		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());

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

@@ -36,11 +36,11 @@ 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='02400006' order by createdAt desc limit 30");
+					"SELECT * FROM pacsonline.exams where exam_status=3 and institution_id='72300004' 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 his.reportinfo where studyuid=?",
+					Record record = Db.use("connected").findFirst("select * from reportinfo where studyuid=?",
 							studies.getStudyuid());
 					if (record == null) {
 						continue;
@@ -52,8 +52,8 @@ public class DataTask implements ITask {
 							|| record.getStr("description").isBlank()) {
 						continue;
 					}
-					report.setImpression(record.getStr("description"));
-					report.setDescription(record.getStr("impression"));
+					report.setImpression(record.getStr("impression"));
+					report.setDescription(record.getStr("description"));
 					report.setExamId(exams2.getId());
 					report.setCreatedAt(new Date());
 					report.setReportDoctorId(getDoctorIdByName(record.getStr("reportdoctor")==null?"":record.getStr("reportdoctor")));
@@ -64,8 +64,8 @@ public class DataTask implements ITask {
 					report.save();
 					PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
 					patientInfos.setName(record.getStr("patientname"));
-//					patientInfos.setPhone(record.getStr("PHONE"));
-//					patientInfos.setCardNum(record.getStr("IDCARD"));
+					patientInfos.setPhone(record.getStr("phone"));
+					patientInfos.setCardNum(record.getStr("idcard")==null?"":record.getStr("idcard"));
 					patientInfos.update();
 					exams2.setExamStatus(9);
 //					String patString = record.getStr("住院号");
@@ -74,14 +74,14 @@ public class DataTask implements ITask {
 //					exams2.setHopitalizedNo(patString);
 //					exams2.setClinDoctors(record.getStr("CLINICALDOCTOR"));
 					exams2.setApplicationDepartment(record.getStr("department"));
-					exams2.setApplicationDoctor(record.getStr("clinicaldoctor"));
+//					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", "02400006");
+					data.put("hospital_id", "72300004");
 					// 影像所见
 					data.put("description", record.getStr("description"));
 					// 意见建议
@@ -96,15 +96,15 @@ public class DataTask implements ITask {
 					// 患者性别
 					data.put("patient_sex", patientInfos.getSex());
 					// 身份证号
-					data.put("card_num", "");
+					data.put("card_num", patientInfos.getCardNum());
 					// 手机号
-					data.put("phone", "");
+					data.put("phone", patientInfos.getPhone());
 					// 患者生日
 					data.put("birthday", patientInfos.getBirthday()==null?"":patientInfos.getBirthday());
 					// 患者检查时年龄
 					data.put("patient_age", patientInfos.getAge()==null?"":patientInfos.getAge());
 					// 阴阳性 1阴性 2阳性
-					data.put("report_result", record.getStr("result").contains("阳")?"2":"1");
+					data.put("report_result", record.getStr("result").contains("否")?"1":"2");
 					// 报告时间 10位时间戳
 					data.put("report_datetime", returnSecondTimestamp(record.getStr("reportdate")));
 					// 报告医生id
@@ -285,14 +285,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='02400006' and realname <>''", name);
+				"SELECT * FROM doctors where instr(?,realname) and institution_id='72300004' 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("02400006");
+			newDoctors.setInstitutionId("72300004");
 			newDoctors.setCreatedAt(new Date());
 			newDoctors.setUpdatedAt(new Date());
 			newDoctors.save();