|
@@ -1,13 +1,85 @@
|
|
|
package com.zskk.task;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.jfinal.plugin.activerecord.Db;
|
|
|
+import com.jfinal.plugin.activerecord.Record;
|
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
|
+import com.zskk.service.DataService;
|
|
|
+import com.zskk.service.ServiceFactory;
|
|
|
+import com.zskk.service.ThreadPoolService;
|
|
|
|
|
|
public class UpdateTask implements ITask {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
+ JSONArray jsonArray = dService.getExamList(10);
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(object.toString());
|
|
|
+ Record record = Db.use("connected").findFirst("select * from examinfo where EXAMNO=?", jsonObject.getString("accession_num"));
|
|
|
+ if (record == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("exam_id", jsonObject.getString("id"));
|
|
|
+ //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("SYMPTOM")==null?"":record.getStr("SYMPTOM"));
|
|
|
+ //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"));
|
|
|
+ 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"));
|
|
|
+ //设备名称
|
|
|
+// params.put("device_name", record.getStr("DEVICE")==null?"":record.getStr("DEVICE"));
|
|
|
+ //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;
|
|
|
+ }
|
|
|
|
|
|
+ ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
+ tService.execute(() -> {
|
|
|
+ dService.updatePatientInfo(params);
|
|
|
+ });
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO: handle exception
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|