刘韬 před 5 roky
rodič
revize
413570ad3d

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

@@ -68,9 +68,9 @@ public class ZskkConfig extends JFinalConfig {
 		me.add(arpConnected);
 
 		
-//		Cron4jPlugin cpData = new Cron4jPlugin();
-//		cpData.addTask("*/5 * * * *", new DataTask());
-//		me.add(cpData);
+		Cron4jPlugin cpData = new Cron4jPlugin();
+		cpData.addTask("*/10 * * * *", new DataTask());
+		me.add(cpData);
 
 //		Cron4jPlugin cp2 = new Cron4jPlugin();
 //		cp2.addTask("*/3 * * * *", new SyncTask2());

+ 21 - 19
DataFusion/src/com/zskk/task/DataTask.java

@@ -19,39 +19,41 @@ public class DataTask implements ITask {
 	public void run() {
 		// 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=81069903 order by createdAt desc limit 30");
+			List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=24100002 order by createdAt desc limit 30");
 			for (Exams exams2 : exams) {
 				try {
-					Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
+//					Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
 
-					Record record = Db.use("connected").findFirst("SELECT * FROM HC_US.HC_V_PACSONLINE_INTERFACE where STUDYUID=?",studies.getStudyuid());
+					Record record = Db.use("connected").findFirst("SELECT * FROM report where StudyNum=?",exams2.getAccessionNum());
 					if (record == null) {
 						continue;
 					}
 					Report report = new Report().use("zskk");
 					report.setId(creatId());
-					report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));
-					if (record.getStr("IMPRESSION") == null && record.getStr("DESCRIPTION") == null) {
+					report.setReportDatetime(parseStringToDate(record.getStr("ReportDate")));
+					if (record.getStr("Impression") == null && record.getStr("Finding_text") == null) {
 						continue;
 					}
-					report.setImpression(record.getStr("IMPRESSION"));
-					report.setDescription(record.getStr("DESCRIPTION"));
+					report.setImpression(record.getStr("Impression"));
+					report.setDescription(record.getStr("Finding_text"));
 					report.setExamId(exams2.getId());
 					report.setCreatedAt(new Date());
-					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.setReportDoctorId(getDoctorIdByName(record.getStr("studyinfo_ReportDr")));
+					report.setReviewDoctorId(getDoctorIdByName(record.getStr("studyinfo_ReportDr")));
+					report.setReviewDatetime(parseStringToDate(record.getStr("ReportDate")));
+					report.setConfirmDoctorId(getDoctorIdByName(record.getStr("studyinfo_ReportDr")));
+					report.setConfirmDatetime(parseStringToDate(record.getStr("ReportDate")));
 					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.setName(record.getStr("Name"));
+//					patientInfos.setPhone(record.getStr("PHONE"));
+//					patientInfos.setCardNum(record.getStr("IDCARD"));
 					patientInfos.update();
 					exams2.setExamStatus(9);
-					exams2.setApplicationDepartment(record.getStr("DEPARTMENT"));
-					exams2.setApplicationDoctor(record.getStr("CLINICALDOCTOR"));
+					exams2.setApplicationDepartment(record.getStr("ReqDept"));
+					exams2.setApplicationDoctor(record.getStr("ReqDrName"));
+					exams2.setBedNo(record.getStr("Bed"));
+					exams2.setHopitalizedNo(record.getStr("AdmissionNum"));
 					exams2.setClinDiag(record.getStr("DIAGNOSIS"));
 					exams2.update();
 					WeixinService wService = ServiceFactory.getService(WeixinService.class);
@@ -86,7 +88,7 @@ public class DataTask implements ITask {
 		if (name == null) {
 			return null;
 		}
-		Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=81069903 and realname<>''",name);
+		Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=24100002 and realname<>''",name);
 
 		if (doctors == null) {
 			Doctors newDoctors = new Doctors().use("zskk");
@@ -94,7 +96,7 @@ public class DataTask implements ITask {
 			newDoctors.setUsername("none");
 			newDoctors.setRealname(name);
 			newDoctors.setPassword("123456");
-			newDoctors.setInstitutionId("81069903");
+			newDoctors.setInstitutionId("24100002");
 			newDoctors.setCreatedAt(new Date());
 			newDoctors.setUpdatedAt(new Date());
 			newDoctors.save();