|
@@ -30,6 +30,7 @@ import com.jfinal.plugin.activerecord.dialect.SqlServerDialect;
|
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
|
import com.zskk.service.DataService;
|
|
|
import com.zskk.service.ServiceFactory;
|
|
|
+import com.zskk.service.ThreadPoolService;
|
|
|
|
|
|
import okhttp3.FormBody;
|
|
|
import okhttp3.MediaType;
|
|
@@ -76,9 +77,116 @@ public class ViewController extends Controller {
|
|
|
// TODO Auto-generated method stub
|
|
|
try {
|
|
|
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
+
|
|
|
List<Record> records = Db.use("connected").find("select top 10 * from reportinfo_NEW where modality = 'US' order by reviewdate desc");
|
|
|
- this.renderJson(records);
|
|
|
+ for (Record record : records) {
|
|
|
+ Record recordus = Db.use("local").findFirst("select * from usexam where code = ?", record.getStr("studyuid"));
|
|
|
+ if (recordus != null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ //创建登记
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+
|
|
|
+ params.put("institution_id", PropKit.get("institution_id"));
|
|
|
+
|
|
|
+ params.put("name", record.getStr("patientname"));
|
|
|
+
|
|
|
+ params.put("exam_class", record.getStr("modality"));
|
|
|
+
|
|
|
+ params.put("application_department", record.getStr("department")==null?"":record.getStr("department"));
|
|
|
+
|
|
|
+ params.put("phone", record.getStr("phone")==null?"":record.getStr("phone"));
|
|
|
+
|
|
|
+ params.put("is_dcm", "2");
|
|
|
+
|
|
|
+ params.put("exam_datetime", record.getStr("reviewdate"));
|
|
|
|
|
|
+ params.put("patient_num", record.getStr("patientid"));
|
|
|
+
|
|
|
+ params.put("accession_num", record.getStr("accessionNumber"));
|
|
|
+
|
|
|
+ String examid = dService.createRegisterInfo(params);
|
|
|
+
|
|
|
+ if (examid == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //匹配报告
|
|
|
+ Map<String, String> paramsreport = new HashMap<>();
|
|
|
+ paramsreport.put("type", "1");
|
|
|
+
|
|
|
+ paramsreport.put("institution_id", PropKit.get("institution_id"));
|
|
|
+
|
|
|
+ paramsreport.put("code", examid);
|
|
|
+ //报告医生姓名
|
|
|
+ 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"));
|
|
|
+ //申请医生
|
|
|
+ params.put("application_doctor", record.getStr("clinicaldoctor"));
|
|
|
+ //临床诊断
|
|
|
+ params.put("clin_diag", record.getStr("diagnosis"));
|
|
|
+ //症状
|
|
|
+ params.put("clin_symp", record.getStr("symptom"));
|
|
|
+ //patient_infos表
|
|
|
+ //患者姓名
|
|
|
+ params.put("name", record.getStr("patientname"));
|
|
|
+ //患者手机号
|
|
|
+ params.put("phone", record.getStr("phone"));
|
|
|
+ //患者身份证号
|
|
|
+ params.put("card_num", record.getStr("idcard"));
|
|
|
+ //检查结果1阴2阳
|
|
|
+ params.put("report_result", record.getStr("result").contains("阳")?"2":"1");
|
|
|
+ //住院号
|
|
|
+ params.put("hopitalized_no", record.getStr("inPatientNum"));
|
|
|
+ //门诊号
|
|
|
+ params.put("out_patient", record.getStr("outPatientNum"));
|
|
|
+ //检查方法
|
|
|
+ params.put("exam_project", record.getStr("project"));
|
|
|
+ //病人ID
|
|
|
+ params.put("his_patient_id", record.getStr("patientid"));
|
|
|
+ ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
+ tService.execute(() -> {
|
|
|
+ dService.saveReport(params);
|
|
|
+ });
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO: handle exception
|
|
|
+// continue;
|
|
|
+ this.renderText(e.toString());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //上传报告附件
|
|
|
+ Map<String, String> annex_params = new HashMap<>();
|
|
|
+ annex_params.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ annex_params.put("type", "4");
|
|
|
+ annex_params.put("code", record.getStr("studyuid"));
|
|
|
+ //附件类型1.mp4 2.pdf 3.jpeg
|
|
|
+ annex_params.put("annex_class_code", "3");
|
|
|
+ dService.saveAnnex(annex_params, record.getStr("report_url"));
|
|
|
+
|
|
|
+ Record usinfo = new Record().set("code", record.getStr("studyuid"))
|
|
|
+ .set("createAt", parseStringToDateTime()).set("updateAt", parseStringToDateTime());
|
|
|
+ Db.use("local").save("usexam", usinfo);
|
|
|
+ }
|
|
|
+
|
|
|
// DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
// Map<String, String> annex_params = new HashMap<>();
|
|
|
// annex_params.put("institution_id", PropKit.get("institution_id"));
|
|
@@ -100,7 +208,19 @@ public class ViewController extends Controller {
|
|
|
|
|
|
return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 日期字符串格式转换年月日时分秒
|
|
|
+ *
|
|
|
+ * @param dateStr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String parseStringToDateTime() {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = new Date();
|
|
|
+ String daString = sdf.format(date);
|
|
|
+ return daString;
|
|
|
+
|
|
|
+ }
|
|
|
/**
|
|
|
* post请求
|
|
|
* @param url-请求地址
|