|
@@ -1,145 +1,45 @@
|
|
package com.zskk.task;
|
|
package com.zskk.task;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.jfinal.kit.HashKit;
|
|
import com.jfinal.kit.HashKit;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
import com.jfinal.plugin.cron4j.ITask;
|
|
-import com.zskk.model.Doctors;
|
|
|
|
-import com.zskk.model.Exams;
|
|
|
|
|
|
+import com.zskk.model.*;
|
|
import com.zskk.service.ThreadPoolService;
|
|
import com.zskk.service.ThreadPoolService;
|
|
import okhttp3.*;
|
|
import okhttp3.*;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
-import org.apache.http.client.config.RequestConfig;
|
|
|
|
-import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
|
-import org.apache.http.client.methods.HttpPost;
|
|
|
|
-import org.apache.http.entity.StringEntity;
|
|
|
|
-import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
-import org.apache.http.impl.client.HttpClients;
|
|
|
|
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
|
|
|
-import org.apache.log4j.Logger;
|
|
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
-import java.nio.charset.Charset;
|
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
public class DataTask implements ITask {
|
|
public class DataTask implements ITask {
|
|
- private static String GET_EXAM_URL = "https://risserver3.pacsonline.cn/butt/getExam";
|
|
|
|
-
|
|
|
|
- private static String SAVE_REPORT_URL = "https://risserver3.pacsonline.cn/butt/saveReport";
|
|
|
|
- private static CloseableHttpClient httpClient;
|
|
|
|
- static Logger logger = Logger.getLogger(DataTask.class);
|
|
|
|
-
|
|
|
|
- static {
|
|
|
|
- PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
|
|
|
- cm.setMaxTotal(100);
|
|
|
|
- cm.setDefaultMaxPerRoute(20);
|
|
|
|
- cm.setDefaultMaxPerRoute(50);
|
|
|
|
- httpClient = HttpClients.custom().setConnectionManager(cm).build();
|
|
|
|
- }
|
|
|
|
private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
|
|
private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|
|
try {
|
|
try {
|
|
- //List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=05400001 order by createdAt desc limit 30");
|
|
|
|
- JSONArray examList = getExamList("05400001", 30);
|
|
|
|
- List<Exams> exams = JSONObject.parseArray(examList.toJSONString(), Exams.class);
|
|
|
|
|
|
+ List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=05400001 order by createdAt desc limit 30");
|
|
for (Exams exams2 : exams) {
|
|
for (Exams exams2 : exams) {
|
|
try {
|
|
try {
|
|
- // Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
|
|
|
|
- Record record = Db.use("connected").findFirst("select * from REPORTINFO where STUDYUID=?",exams2.getStudyUid());
|
|
|
|
|
|
+ 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) {
|
|
if (record == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- logger.info(record.getStr("REPORTDOCTOR")+"&"+record.getStr("REPORTDATE")+"&");
|
|
|
|
- logger.info(record.getStr("REVIEWDOCTOR")+"&"+record.getStr("REPORTDATE")+"&");
|
|
|
|
- //logger.info(record.getStr("REVIEWDOCTOR")+"&"+record.getStr("REPORTDATE")+"&");
|
|
|
|
- logger.info(record.getStr("IMPRESSION")+"&"+record.getStr("DESCRIPTION")+"&");
|
|
|
|
- logger.info(record.getStr("DEPARTMENT")+"&"+record.getStr("CLINICALDOCTOR")+"&");
|
|
|
|
- logger.info(record.getStr("DIAGNOSIS")+"&"+record.getStr("PATIENTNAME")+"&");
|
|
|
|
- logger.info(record.getStr("PHONE")+"&"+record.getStr("IDCARD")+"&");
|
|
|
|
- /* Report report = new Report().use("zskk");
|
|
|
|
|
|
+ Report report = new Report().use("zskk");
|
|
report.setId(creatId());
|
|
report.setId(creatId());
|
|
- report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));*/
|
|
|
|
|
|
+ report.setReportDatetime(parseStringToDate(record.getStr("REPORTDATE")));
|
|
if (record.getStr("IMPRESSION") == null || record.getStr("DESCRIPTION") == null
|
|
if (record.getStr("IMPRESSION") == null || record.getStr("DESCRIPTION") == null
|
|
|| record.getStr("IMPRESSION").isBlank() || record.getStr("DESCRIPTION").isBlank()) {
|
|
|| record.getStr("IMPRESSION").isBlank() || record.getStr("DESCRIPTION").isBlank()) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
|
- //exams表
|
|
|
|
- params.put("exam_id",exams2.getId());
|
|
|
|
- //报告医生姓名
|
|
|
|
- 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"));
|
|
|
|
- if (record.getStr("IMPRESSION") == null && record.getStr("DESCRIPTION") == null) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- //意见建议
|
|
|
|
- params.put("impression",record.getStr("IMPRESSION"));
|
|
|
|
- //影像所见
|
|
|
|
- params.put("description",record.getStr("DESCRIPTION"));
|
|
|
|
- //exams表
|
|
|
|
- //申请科室
|
|
|
|
- if (record.getStr("PATIENTNAME")==null){
|
|
|
|
- params.put("application_department","");
|
|
|
|
- }else {
|
|
|
|
- params.put("application_department",record.getStr("PATIENTNAME"));
|
|
|
|
- }
|
|
|
|
- //params.put("application_department",record.getStr("department"));
|
|
|
|
- //申请医生
|
|
|
|
- if (record.getStr("CLINICALDOCTOR")==null){
|
|
|
|
- params.put("application_doctor","");
|
|
|
|
- }else {
|
|
|
|
- params.put("application_doctor",record.getStr("CLINICALDOCTOR"));
|
|
|
|
- }
|
|
|
|
- //params.put("application_doctor",record.getStr("CLINICALDOCTOR"));
|
|
|
|
- //临床诊断
|
|
|
|
- if (record.getStr("DIAGNOISI")==null){
|
|
|
|
- params.put("clin_diag","");
|
|
|
|
- }else {
|
|
|
|
- params.put("clin_diag",record.getStr("DIAGNOISI"));
|
|
|
|
- }
|
|
|
|
|
|
|
|
- //patient_infos表
|
|
|
|
- //患者姓名
|
|
|
|
- params.put("name",record.getStr("PATIENTNAME"));
|
|
|
|
- //患者手机号
|
|
|
|
- if (record.getStr("PHONE")==null){
|
|
|
|
- params.put("phone","");
|
|
|
|
- }else {
|
|
|
|
- params.put("phone",record.getStr("PHONE"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //params.put("phone","");
|
|
|
|
- //患者身份证号
|
|
|
|
- if (record.getStr("IDCARD")==null){
|
|
|
|
- params.put("card_num","");
|
|
|
|
- }else {
|
|
|
|
- params.put("card_num",record.getStr("IDCARD"));
|
|
|
|
- }
|
|
|
|
- //params.put("card_num",);
|
|
|
|
- params.put("report_result","1");
|
|
|
|
- String logs = posturl(SAVE_REPORT_URL, JSON.toJSONString(params));
|
|
|
|
- String s = JSON.toJSONString(params);
|
|
|
|
- logger.info(s);
|
|
|
|
- logger.error(logs);
|
|
|
|
- /* report.setImpression(record.getStr("IMPRESSION"));
|
|
|
|
|
|
+ report.setImpression(record.getStr("IMPRESSION"));
|
|
report.setDescription(record.getStr("DESCRIPTION"));
|
|
report.setDescription(record.getStr("DESCRIPTION"));
|
|
report.setExamId(exams2.getId());
|
|
report.setExamId(exams2.getId());
|
|
report.setCreatedAt(new Date());
|
|
report.setCreatedAt(new Date());
|
|
@@ -157,7 +57,7 @@ public class DataTask implements ITask {
|
|
exams2.setExamStatus(9);
|
|
exams2.setExamStatus(9);
|
|
exams2.setApplicationDepartment(record.getStr("DEPARTMENT"));
|
|
exams2.setApplicationDepartment(record.getStr("DEPARTMENT"));
|
|
exams2.setApplicationDoctor(record.getStr("CLINICALDOCTOR"));
|
|
exams2.setApplicationDoctor(record.getStr("CLINICALDOCTOR"));
|
|
- exams2.update();*/
|
|
|
|
|
|
+ exams2.update();
|
|
// 传云医康 数据
|
|
// 传云医康 数据
|
|
Map<String, String> data = new HashMap<String, String>();
|
|
Map<String, String> data = new HashMap<String, String>();
|
|
// 获取data数据
|
|
// 获取data数据
|
|
@@ -181,9 +81,9 @@ public class DataTask implements ITask {
|
|
// 手机号
|
|
// 手机号
|
|
data.put("phone", "");
|
|
data.put("phone", "");
|
|
// 患者生日
|
|
// 患者生日
|
|
- data.put("birthday", record.getStr("BIRTHDATE"));
|
|
|
|
|
|
+ data.put("birthday", patientInfos.getBirthday());
|
|
// 患者检查时年龄
|
|
// 患者检查时年龄
|
|
- data.put("patient_age", record.getStr("PATIENTAGE"));
|
|
|
|
|
|
+ data.put("patient_age", patientInfos.getAge());
|
|
// 阴阳性 1阴性 2阳性
|
|
// 阴阳性 1阴性 2阳性
|
|
data.put("report_result", "");
|
|
data.put("report_result", "");
|
|
// 报告时间 10位时间戳
|
|
// 报告时间 10位时间戳
|
|
@@ -330,61 +230,7 @@ public class DataTask implements ITask {
|
|
return String.valueOf(sdf.parse(data).getTime() / 1000);
|
|
return String.valueOf(sdf.parse(data).getTime() / 1000);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取未出报告的检查列表
|
|
|
|
- * @param instutionId
|
|
|
|
- * @param number
|
|
|
|
- */
|
|
|
|
- public static JSONArray getExamList(String instutionId, Integer number) {
|
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
|
- map.put("institution_id", instutionId);
|
|
|
|
- map.put("num", number.toString());
|
|
|
|
- String content = posturl(GET_EXAM_URL, JSON.toJSONString(map));
|
|
|
|
- JSONObject jsonObject = JSON.parseObject(content);
|
|
|
|
- if (!jsonObject.getString("msg").equals("success")) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));
|
|
|
|
- return jsonArray;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- public static String posturl(String url, String jsonString) {
|
|
|
|
- CloseableHttpResponse response = null;
|
|
|
|
- BufferedReader in = null;
|
|
|
|
- String result = "";
|
|
|
|
- try {
|
|
|
|
- HttpPost httpPost = new HttpPost(url);
|
|
|
|
- RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000).setSocketTimeout(30000).build();
|
|
|
|
- httpPost.setConfig(requestConfig);
|
|
|
|
- httpPost.setConfig(requestConfig);
|
|
|
|
- httpPost.addHeader("Content-type", "application/json; charset=utf-8");
|
|
|
|
- httpPost.setHeader("Accept", "application/json");
|
|
|
|
- httpPost.setEntity(new StringEntity(jsonString, Charset.forName("UTF-8")));
|
|
|
|
- response = httpClient.execute(httpPost);
|
|
|
|
- in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
|
|
|
- StringBuffer sb = new StringBuffer("");
|
|
|
|
- String line = "";
|
|
|
|
- String NL = System.getProperty("line.separator");
|
|
|
|
- while ((line = in.readLine()) != null) {
|
|
|
|
- sb.append(line + NL);
|
|
|
|
- }
|
|
|
|
- in.close();
|
|
|
|
- result = sb.toString();
|
|
|
|
- //logger.error(result);
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- } finally {
|
|
|
|
- try {
|
|
|
|
- if (null != response) {
|
|
|
|
- response.close();
|
|
|
|
- }
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void stop() {
|
|
public void stop() {
|
|
// TODO Auto-generated method stub
|
|
// TODO Auto-generated method stub
|