刘韬 5 年之前
父节点
当前提交
75424978c7
共有 1 个文件被更改,包括 29 次插入17 次删除
  1. 29 17
      DataFusion/src/com/zskk/control/ViewController.java

+ 29 - 17
DataFusion/src/com/zskk/control/ViewController.java

@@ -14,6 +14,8 @@ import com.zskk.model.Exams;
 import com.zskk.model.PatientInfos;
 import com.zskk.model.Report;
 import com.zskk.model.Studies;
+import com.zskk.service.ServiceFactory;
+import com.zskk.service.WeixinService;
 
 public class ViewController extends Controller {
 
@@ -45,36 +47,46 @@ public class ViewController extends Controller {
 	public void testTask() {
 		try {
 			//List<Record>  d =  Db.use("connected").find(this.getPara("sqlStr"));
-			List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=73090001 order by createdAt desc limit 50");
-			List<Record> examds = new ArrayList<>();
+			List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=44000003 order by createdAt desc limit 100");
 			for (Exams exams2 : exams) {
 				Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
-				Record record = Db.use("connected").findFirst("select * from caller where STUDYUID=?",studies.getStudyuid());
+				Record recordTemp = Db.use("connected").findFirst("select * from v_all_img_idx@PACSINTERFACE where F_STU_UID=?",studies.getStudyuid());
+				if (recordTemp == null) {
+					continue;
+				}
+				Record record = Db.use("connected").findFirst("select * from yxjK where STUDYUID=?",recordTemp.getStr("F_STU_NO"));
 				if (record == null) {
 					continue;
 				}
-				examds.add(record);
 				Report report = new Report().use("zskk");
 				report.setId(creatId());
-				report.setReportDatetime(aaa(record.getStr("REPORTDATE")));
+				report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));
+				if (record.getStr("IMPRESSION") == null && record.getStr("DESCRIPTION") == null) {
+					continue;
+				}
 				report.setImpression(record.getStr("IMPRESSION"));
 				report.setDescription(record.getStr("DESCRIPTION"));
 				report.setExamId(exams2.getId());
 				report.setCreatedAt(new Date());
-				if (record.getStr("FITEM_RESULT_CODE") != null) {
-					//report.setReportResult(record.getStr("FITEM_RESULT_CODE").contains("阴")?"1":"2");
-				}
 				report.setReportDoctorId(getDoctorIdByName(record.getStr("REPORTDOCTOR")));
 				report.setReviewDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
-				report.setReviewDatetime(aaa(record.getStr("REPORTDATE")));
+				report.setReviewDatetime(parseStringToDate(record.getStr("REPORTDATE")));
 				report.setConfirmDoctorId(getDoctorIdByName(record.getStr("REVIEWDOCTOR")));
-				report.setConfirmDatetime(aaa(record.getStr("REPORTDATE")));
-//				report.save();
+				report.setConfirmDatetime(parseStringToDate(record.getStr("REPORTDATE")));
+				report.save();
 				PatientInfos patientInfos = PatientInfos.dao.use("zskk").findById(exams2.getPatientId());
 				patientInfos.setName(record.getStr("PATIENTNAME"));
-//				patientInfos.update();
+				patientInfos.setPhone(record.getStr("PHONE"));
+				patientInfos.setCardNum(record.getStr("IDCARD"));
+				patientInfos.update();
+				exams2.setApplicationDepartment(record.getStr("DEPATMENT"));
+				exams2.setApplicationDoctor(record.getStr("CLINICALDOCTOR"));
+				exams2.setExamStatus(9);
+				exams2.update();
+				WeixinService wService = ServiceFactory.getService(WeixinService.class);
+				wService.requestWeixinQrcode(report.getId());
 			}
-			this.renderJson(examds);
+			this.renderJson(exams);
 		} catch (Exception e) {
 			// TODO: handle exception
 			this.renderText(e.toString());
@@ -91,21 +103,21 @@ public class ViewController extends Controller {
 		if (name == null) {
 			return "1";
 		}
-		Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=73090001",name);
+		Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=44000003",name);
 		if (doctors == null) {
 			return "1";
 		}
 		return doctors.getId();
 	}
 	
-	private Date aaa(String timestr) {
-		if (timestr == null) {
+	private Date parseStringToDate(String dateStr) {
+		if (dateStr == null) {
 			return new Date();
 		}
 		SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 	    Date date = null;
 		try {
-			date = sdf.parse(timestr);
+			date = sdf.parse(dateStr);
 		} catch (ParseException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();