|
@@ -3,62 +3,75 @@ package com.zskk.task;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
+
|
|
|
+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 DataTask implements ITask {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
// TODO Auto-generated method stub
|
|
|
-<<<<<<< HEAD
|
|
|
- try {
|
|
|
- List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=47300001 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 zskk 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(record.getStr("impression"));
|
|
|
- report.setDescription(record.getStr("description"));
|
|
|
- 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.dao.use("zskk").findById(exams2.getPatientId());
|
|
|
- patientInfos.setName(record.getStr("patientname"));
|
|
|
-// patientInfos.setPhone(record.getStr("phone"));
|
|
|
-// patientInfos.setCardNum(record.getStr("IDCARD"));
|
|
|
- patientInfos.update();
|
|
|
- exams2.setExamStatus(9);
|
|
|
- exams2.update();
|
|
|
- WeixinService wService = ServiceFactory.getService(WeixinService.class);
|
|
|
- wService.requestWeixinQrcode(report.getId());;
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- // TODO: handle exception
|
|
|
- }
|
|
|
-
|
|
|
-=======
|
|
|
DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
- dService.getExamList(30);
|
|
|
->>>>>>> origin/master
|
|
|
+ JSONArray jsonArray = dService.getExamList(30);
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject = JSON.parseObject(object.toString());
|
|
|
+ Record record = Db.use("connected").findFirst("select * from zskk where studyuid=?", jsonObject.getString("studyuid"));
|
|
|
+ if (record == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (record.getStr("impression") == null && record.getStr("description") == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("exam_id", jsonObject.getString("id"));
|
|
|
+ //报告医生姓名
|
|
|
+ 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("reportdate"));
|
|
|
+ //确认医生姓名
|
|
|
+ params.put("confirm_doctor_name",record.getStr("reviewdoctor"));
|
|
|
+ //确认时间
|
|
|
+ params.put("confirm_datetime",record.getStr("reportdate"));
|
|
|
+ //意见建议
|
|
|
+ params.put("impression",record.getStr("impression"));
|
|
|
+ //影像所见
|
|
|
+ params.put("description",record.getStr("description"));
|
|
|
+ //exams表
|
|
|
+ //申请科室
|
|
|
+ params.put("application_department", "");
|
|
|
+ //申请医生
|
|
|
+ params.put("application_doctor", "");
|
|
|
+ //临床诊断
|
|
|
+ params.put("clin_diag", "");
|
|
|
+ //patient_infos表
|
|
|
+ //患者姓名
|
|
|
+ params.put("name",record.getStr("patientname"));
|
|
|
+ //患者手机号
|
|
|
+ params.put("phone", "");
|
|
|
+ //患者身份证号
|
|
|
+ params.put("card_num", "");
|
|
|
+ params.put("report_result", "1");
|
|
|
+ ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
+ tService.execute(() -> {
|
|
|
+ dService.saveReport(params);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -74,27 +87,6 @@ public class DataTask implements ITask {
|
|
|
return idd[0]+idd[1]+idd[2];
|
|
|
}
|
|
|
|
|
|
- private String getDoctorIdByName(String name) {
|
|
|
- if (name == null || name.isBlank()) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- name = name.replace(" ", "");
|
|
|
- Doctors doctors = Doctors.dao.use("zskk").findFirst("SELECT * FROM doctors where instr(?,realname) and institution_id=47300001 and realname is not null",name);
|
|
|
- if (doctors == null) {
|
|
|
- Doctors newDoctors = new Doctors().use("zskk");
|
|
|
- newDoctors.setId(creatId());
|
|
|
- newDoctors.setUsername("none");
|
|
|
- newDoctors.setRealname(name);
|
|
|
- newDoctors.setPassword("123456");
|
|
|
- newDoctors.setInstitutionId("47300001");
|
|
|
- newDoctors.setCreatedAt(new Date());
|
|
|
- newDoctors.setUpdatedAt(new Date());
|
|
|
- newDoctors.save();
|
|
|
- return newDoctors.getId();
|
|
|
- }
|
|
|
- return doctors.getId();
|
|
|
- }
|
|
|
-
|
|
|
private Date parseStringToDate(String dateStr) {
|
|
|
if (dateStr == null) {
|
|
|
return new Date();
|