|
@@ -25,70 +25,85 @@ public class ExamTask implements ITask {
|
|
|
// TODO Auto-generated method stub
|
|
|
DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
|
|
|
- List<Record> records = Db.use("local").find("select * from report_xml order by createdAt desc limit 80");
|
|
|
+ List<Record> records = Db.use("connected").find("SELECT * FROM (select * from reportinfo where STUDYSTATUS = '诊断完成' and REVIEWDATE>to_date(?,'YYYY-MM-DD HH24:MI:SS')and rownum < 80)ORDER BY REVIEWDATE DESC", getNowDate());
|
|
|
for (Record record : records) {
|
|
|
try {
|
|
|
- String contString = record.getStr("report_xml");
|
|
|
- XmlHelper xmlHelper = XmlHelper.of(contString);
|
|
|
+ if (record.getStr("IMPRESSION") == null && record.getStr("DESCRIPTION") == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("type", "4");
|
|
|
+
|
|
|
+ params.put("institution_id", PropKit.get("institution_id"));
|
|
|
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
- params.put("type", "2");
|
|
|
+ params.put("code", record.getStr("STUDYUID"));
|
|
|
+ //报告医生姓名
|
|
|
+ params.put("report_doctor_name", record.getStr("REPORTDOCTOR"));
|
|
|
+ //报告时间
|
|
|
+ params.put("report_datetime", record.getStr("REPORTDATE"));
|
|
|
+ //审核医生姓名
|
|
|
+ params.put("review_doctor_name", record.getStr("REVIEWDOCTOR"));
|
|
|
+ //审核时间
|
|
|
+ params.put("review_datetime", record.getStr("REVIEWDATE"));
|
|
|
+ //确认医生姓名
|
|
|
+ params.put("confirm_doctor_name", record.getStr("REVIEWDOCTOR"));
|
|
|
+ //确认时间
|
|
|
+ params.put("confirm_datetime", record.getStr("REVIEWDATE"));
|
|
|
+ //意见建议
|
|
|
+ params.put("impression", record.getStr("IMPRESSION"));
|
|
|
+ //影像所见
|
|
|
+ params.put("description", record.getStr("DESCRIPTION"));
|
|
|
+ //exams表
|
|
|
+ //申请科室
|
|
|
+ params.put("application_department", record.getStr("DEPARTMENT")==null?"":record.getStr("DEPARTMENT"));
|
|
|
+ //申请医生
|
|
|
+ params.put("application_doctor", record.getStr("CLINICALDOCTOR")==null?"":record.getStr("CLINICALDOCTOR"));
|
|
|
+ //临床诊断
|
|
|
+ params.put("clin_diag", record.getStr("DIAGNOSIS")==null?"":record.getStr("DIAGNOSIS"));
|
|
|
+ //症状
|
|
|
+ params.put("clin_symp", record.getStr("ILLNESS")==null?"":record.getStr("ILLNESS"));
|
|
|
+ //patient_infos表
|
|
|
+ //患者姓名
|
|
|
+ params.put("name", record.getStr("PATIENTNAME"));
|
|
|
+ //患者手机号
|
|
|
+ params.put("phone", record.getStr("PHONE")==null?"":record.getStr("PHONE"));
|
|
|
+ //患者身份证号
|
|
|
+ params.put("card_num", record.getStr("IDCARD")==null?"":record.getStr("IDCARD"));
|
|
|
+ //检查结果1阴2阳
|
|
|
+ params.put("report_result", "0");
|
|
|
+ //门诊号住院号
|
|
|
+ params.put("hopitalized_no", record.getStr("INPATIENTNUM")==null?"":record.getStr("INPATIENTNUM"));
|
|
|
+ params.put("out_patient", record.getStr("OUTPATIENTNUM")==null?"":record.getStr("OUTPATIENTNUM"));
|
|
|
+ //病人ID
|
|
|
+ params.put("his_patient_id", record.getStr("PATIENTID")==null?"":record.getStr("PATIENTID"));
|
|
|
+ //检查方法
|
|
|
+ params.put("exam_project", record.getStr("PROJECT")==null?"":record.getStr("PROJECT"));
|
|
|
+ //1急诊 (out_patient)2住院(hopitalized_no)3门诊(out_patient)4体检(out_patient)
|
|
|
+ switch (record.getStr("SOURCE")) {
|
|
|
+ case "门诊":
|
|
|
+ params.put("patient_source", "3");
|
|
|
+ break;
|
|
|
+ case "体检":
|
|
|
+ params.put("patient_source", "4");
|
|
|
+ break;
|
|
|
+ case "住院":
|
|
|
+ params.put("patient_source", "2");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- params.put("institution_id", PropKit.get("institution_id"));
|
|
|
-
|
|
|
- params.put("code", record.getStr("number"));
|
|
|
- // 报告医生姓名
|
|
|
- params.put("report_doctor_name", xmlHelper.getString("/Request/Body/CheckReportDoctor"));
|
|
|
- // 报告时间
|
|
|
- params.put("report_datetime", parseStringToDate(xmlHelper.getString("/Request/Body/CheckReportDate")));
|
|
|
- // 审核医生姓名
|
|
|
- params.put("review_doctor_name", xmlHelper.getString("/Request/Body/ReviewDoctorSign"));
|
|
|
- // 审核时间
|
|
|
- params.put("review_datetime", parseStringToDate(xmlHelper.getString("/Request/Body/CheckReportDate")));
|
|
|
- // 确认医生姓名
|
|
|
- params.put("confirm_doctor_name", xmlHelper.getString("/Request/Body/ReviewDoctorSign"));
|
|
|
- // 确认时间
|
|
|
- params.put("confirm_datetime", parseStringToDate(xmlHelper.getString("/Request/Body/CheckReportDate")));
|
|
|
- // 意见建议
|
|
|
- params.put("impression", xmlHelper.getString("/Request/Body/CheckResultSub"));
|
|
|
- // 影像所见
|
|
|
- params.put("description", xmlHelper.getString("/Request/Body/CheckReportObj"));
|
|
|
- // exams表
|
|
|
- // 申请科室
|
|
|
- params.put("application_department", xmlHelper.getString("/Request/Body/CheckApplyDept"));
|
|
|
- // 申请医生
|
|
|
- params.put("application_doctor", "");
|
|
|
- // 临床诊断
|
|
|
- params.put("clin_diag", "");
|
|
|
- // 症状
|
|
|
- params.put("clin_symp", "");
|
|
|
- // patient_infos表
|
|
|
- // 患者姓名
|
|
|
- params.put("name", xmlHelper.getString("/Request/Body/PatientName"));
|
|
|
- // 患者手机号
|
|
|
- params.put("phone", xmlHelper.getString("/Request/Body/Phone"));
|
|
|
- // 患者身份证号
|
|
|
- params.put("card_num", xmlHelper.getString("/Request/Body/PatientIDCard"));
|
|
|
- // 检查结果1阴2阳
|
|
|
- params.put("report_result", "0");
|
|
|
- // 门诊号住院号
|
|
|
- params.put("hopitalized_no", xmlHelper.getString("/Request/Body/InPatientNO"));
|
|
|
- params.put("out_patient", xmlHelper.getString("/Request/Body/OutPatientNO"));
|
|
|
- // 病人ID
|
|
|
- params.put("his_patient_id", xmlHelper.getString("/Request/Body/PatientID"));
|
|
|
- // 检查方法
|
|
|
- params.put("exam_project", xmlHelper.getString("/Request/Body/CheckProjectName"));
|
|
|
- ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
- tService.execute(() -> {
|
|
|
- dService.saveReport(params);
|
|
|
- });
|
|
|
+ ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
+ tService.execute(() -> {
|
|
|
+ dService.saveReport(params);
|
|
|
+ });
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -98,28 +113,32 @@ public class ExamTask implements ITask {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 日期字符串格式转换
|
|
|
+ * 日期字符串格式转换年月日时分秒
|
|
|
*
|
|
|
* @param dateStr
|
|
|
* @return
|
|
|
*/
|
|
|
- private String parseStringToDate(String dateStr) {
|
|
|
- if (dateStr == null) {
|
|
|
- return "";
|
|
|
- }
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
- Date date = null;
|
|
|
- String timeString = null;
|
|
|
- try {
|
|
|
- date = sdf.parse(dateStr);
|
|
|
- SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ private String parseStringToDateTime() {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ String daString = sdf.format(date);
|
|
|
+ return daString;
|
|
|
|
|
|
- timeString = sdf2.format(date);
|
|
|
- } catch (ParseException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return timeString;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取当前时间
|
|
|
+ * @param dateStr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getNowDate() {
|
|
|
+ SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ //4小时
|
|
|
+ Date lastDate = new Date(date.getTime()-3600000);
|
|
|
+ String timeString = null;
|
|
|
+ timeString = sdf.format(lastDate);
|
|
|
+ return timeString;
|
|
|
}
|
|
|
|
|
|
}
|