刘韬 5 years ago
parent
commit
1d75b5fc95
1 changed files with 67 additions and 54 deletions
  1. 67 54
      DataFusion/src/com/zskk/task/DataTask.java

+ 67 - 54
DataFusion/src/com/zskk/task/DataTask.java

@@ -23,62 +23,75 @@ public class DataTask implements ITask {
 			// exam_status 3 没有报告
 			List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=74300015 order by createdAt desc limit 30");
 			for (Exams exams2 : exams) {
-				Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
-				//对方数据库
-				Record record = Db.use("connected").findFirst("select * from reportinfo where STUDYUID=?",studies.getStudyuid());
-					if (record == null) {
+				try {
+					Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
+					//对方数据库
+					Record record = Db.use("connected").findFirst("select * from reportinfo where STUDYUID=?",studies.getStudyuid());
+						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) {
+						continue;
+					}
+					report.setImpression(new String(record.getStr("IMPRESSION").getBytes("windows-1252"),"GBK"));
+					//印象
+					report.setDescription(new String(record.getStr("DESCRIPTION").getBytes("windows-1252"),"GBK"));
+					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.save();
+					//PatientInfos 患者信息表
+					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.update();*/
+					report.setReportDoctorId(getDoctorIdByName(new String(record.getStr("REPORTDOCTOR").getBytes("windows-1252"),"GBK")));
+					if (record.getStr("REVIEWDOCTOR") != null) {
+						report.setReviewDoctorId(getDoctorIdByName(new String(record.getStr("REVIEWDOCTOR").getBytes("windows-1252"),"GBK")));
+						report.setConfirmDoctorId(getDoctorIdByName(new String(record.getStr("REVIEWDOCTOR").getBytes("windows-1252"),"GBK")));
+					}
+					report.setReviewDatetime(parseStringToDate(record.getStr("REPORTDATE")));
+					report.setConfirmDatetime(parseStringToDate(record.getStr("REPORTDATE")));
+					report.save();
+					PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
+					patientInfos.setName(new String(record.getStr("PATIENTNAME").getBytes("windows-1252"),"GBK"));
+//					patientInfos.setPhone(record.getStr("PHONE"));
+//					patientInfos.setCardNum(record.getStr("IDCARD"));
+					patientInfos.update();
+					if (record.getStr("CLINICALDOCTOR") != null) {
+						exams2.setApplicationDoctor(new String(record.getStr("CLINICALDOCTOR").getBytes("windows-1252"),"GBK"));
+					}
+					if (record.getStr("DEPARTMENT") != null) {
+						exams2.setApplicationDepartment(new String(record.getStr("DEPARTMENT").getBytes("windows-1252"),"GBK"));
+					}
+					//修改完成状态 9
+					exams2.setExamStatus(9);
+					exams2.update();
+					//获取微信二维码 公众号
+					WeixinService wService = new WeixinService();
+					wService.requestWeixinQrcode(report.getId());
+					
+				} catch (Exception e) {
+					// TODO: handle exception
 					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) {
-					continue;
-				}
-				report.setImpression(new String(record.getStr("IMPRESSION").getBytes("windows-1252"),"GBK"));
-				//印象
-				report.setDescription(new String(record.getStr("DESCRIPTION").getBytes("windows-1252"),"GBK"));
-				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.save();
-				//PatientInfos 患者信息表
-				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.update();*/
-				report.setReportDoctorId(getDoctorIdByName(new String(record.getStr("REPORTDOCTOR").getBytes("windows-1252"),"GBK")));
-				report.setReviewDoctorId(getDoctorIdByName(new String(record.getStr("REVIEWDOCTOR").getBytes("windows-1252"),"GBK")));
-				report.setReviewDatetime(parseStringToDate(record.getStr("REPORTDATE")));
-				report.setConfirmDoctorId(getDoctorIdByName(new String(record.getStr("REVIEWDOCTOR").getBytes("windows-1252"),"GBK")));
-				report.setConfirmDatetime(parseStringToDate(record.getStr("REPORTDATE")));
-				report.save();
-				PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
-				patientInfos.setName(new String(record.getStr("PATIENTNAME").getBytes("windows-1252"),"GBK"));
-//				patientInfos.setPhone(record.getStr("PHONE"));
-//				patientInfos.setCardNum(record.getStr("IDCARD"));
-				patientInfos.update();
-				exams2.setApplicationDoctor(new String(record.getStr("CLINICALDOCTOR").getBytes("windows-1252"),"GBK"));
-				exams2.setApplicationDepartment(new String(record.getStr("DEPARTMENT").getBytes("windows-1252"),"GBK"));
-				//修改完成状态 9
-				exams2.setExamStatus(9);
-				exams2.update();
-				//获取微信二维码 公众号
-				WeixinService wService = new WeixinService();
-				wService.requestWeixinQrcode(report.getId());
+				
 			}
 		} catch (Exception e) {
 			// TODO: handle exception