|
@@ -8,6 +8,8 @@ import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.jfinal.core.Controller;
|
|
import com.jfinal.core.Controller;
|
|
import com.jfinal.kit.PropKit;
|
|
import com.jfinal.kit.PropKit;
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
@@ -16,6 +18,9 @@ import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
|
import com.jfinal.plugin.activerecord.dialect.SqlServerDialect;
|
|
import com.jfinal.plugin.activerecord.dialect.SqlServerDialect;
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
import com.jfinal.plugin.druid.DruidPlugin;
|
|
|
|
+import com.zskk.service.DataService;
|
|
|
|
+import com.zskk.service.ServiceFactory;
|
|
|
|
+
|
|
import okhttp3.FormBody;
|
|
import okhttp3.FormBody;
|
|
import okhttp3.MediaType;
|
|
import okhttp3.MediaType;
|
|
import okhttp3.OkHttpClient;
|
|
import okhttp3.OkHttpClient;
|
|
@@ -45,6 +50,68 @@ public class ViewController extends Controller {
|
|
this.renderJson(d);
|
|
this.renderJson(d);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void tt() {
|
|
|
|
+ DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
|
+ Map<String, String> dateparams = new HashMap<>();
|
|
|
|
+ dateparams.put("datetime", parseStringToDate());
|
|
|
|
+ JSONArray jsonArray = dService.getReport(dateparams);
|
|
|
|
+ for (Object object : jsonArray) {
|
|
|
|
+ try {
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(object.toString());
|
|
|
|
+ Record record = Db.use("crb").findFirst("select * from DC_PACS_REPORT where ID=?", jsonObject.getString("ID"));
|
|
|
|
+ if (record == null) {
|
|
|
|
+ Record DC_PACS_REPORT = new Record()
|
|
|
|
+ .set("ID", jsonObject.getString("ID"))
|
|
|
|
+ .set("REPORT_ID", jsonObject.getString("REPORT_ID"))
|
|
|
|
+ .set("PAT_FROM_TYPE", "门诊")
|
|
|
|
+ .set("PAT_NUM", jsonObject.getString("PAT_NUM")==null?"":jsonObject.getString("PAT_NUM"))
|
|
|
|
+ .set("TESTLIST", jsonObject.getString("TESTLIST")==null?"":jsonObject.getString("TESTLIST"))
|
|
|
|
+ .set("NAME", jsonObject.getString("NAME"))
|
|
|
|
+ .set("SEX",jsonObject.getString("SEX").contains("M")?"男":"女")
|
|
|
|
+ .set("BIRTHDAY", jsonObject.getString("BIRTHDAY")==null?"":jsonObject.getString("BIRTHDAY"))
|
|
|
|
+ .set("ADDRESS", jsonObject.getString("ADDRESS"))
|
|
|
|
+ .set("TEL", jsonObject.getString("TEL"))
|
|
|
|
+ .set("ORG_CODE", "371728007")
|
|
|
|
+ .set("ORG_NAME", "东明县第二人民医院")
|
|
|
|
+ .set("DEP_NAME", jsonObject.getString("DEP_NAME"))
|
|
|
|
+ .set("DEP_CODE", jsonObject.getString("DEP_CODE"))
|
|
|
|
+ .set("DUTY_DOCTOR_NAME", jsonObject.getString("DUTY_DOCTOR_NAME"))
|
|
|
|
+ .set("DUTY_DOCTOR_ID", jsonObject.getString("DUTY_DOCTOR_ID"))
|
|
|
|
+ .set("CHIEF_COMPLAINT", jsonObject.getString("CHIEF_COMPLAINT"))
|
|
|
|
+ .set("DIAGNOSIS", jsonObject.getString("DIAGNOSIS"))
|
|
|
|
+ .set("STUDY_BODYPART", jsonObject.getString("STUDY_BODYPART"))
|
|
|
|
+ .set("IMAGE_TYPE_NAME", jsonObject.getString("IMAGE_TYPE_NAME"))
|
|
|
|
+ .set("FINDING", jsonObject.getString("FINDING"))
|
|
|
|
+ .set("CONCLUSION", jsonObject.getString("CONCLUSION"))
|
|
|
|
+ .set("FLAG_DIAGNOSTIC_ACCORDANCE", "1")
|
|
|
|
+ .set("HAPPEN_TIME", jsonObject.getString("HAPPEN_TIME"))
|
|
|
|
+ .set("SYSTEMTIME", jsonObject.getString("SYSTEMTIME"))
|
|
|
|
+ .set("HOSPITAL_CODE", "371728007")
|
|
|
|
+ .set("UPDATE_TIME", jsonObject.getString("UPDATE_TIME"))
|
|
|
|
+ .set("STATE", "0");
|
|
|
|
+ Db.use("crb").save("DC_PACS_REPORT", DC_PACS_REPORT);
|
|
|
|
+ }
|
|
|
|
+ Record record2 = Db.use("crb").findFirst("select * from DC_PACS_XML where REPORT_ID=?", jsonObject.getString("REPORT_ID"));
|
|
|
|
+ if (record2 == null) {
|
|
|
|
+ Record DC_PACS_XML = new Record()
|
|
|
|
+ .set("REPORT_ID", jsonObject.getString("REPORT_ID"))
|
|
|
|
+ .set("PAT_FROM_TYPE", "门诊")
|
|
|
|
+ .set("PAT_NUM", jsonObject.getString("PAT_NUM")==null?"":jsonObject.getString("PAT_NUM"))
|
|
|
|
+ .set("ORG_CODE", "371728007")
|
|
|
|
+ .set("ORG_NAME", "东明县第二人民医院")
|
|
|
|
+ .set("REPORT_XML", jsonObject.getString("FINDING")+jsonObject.getString("CONCLUSION"))
|
|
|
|
+ .set("SYSTEMTIME", jsonObject.getString("SYSTEMTIME"));
|
|
|
|
+ Db.use("crb").save("study", DC_PACS_XML);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ // TODO: handle exception
|
|
|
|
+ this.renderText(e.toString());
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.renderJson(jsonArray);
|
|
|
|
+ }
|
|
|
|
+
|
|
public void testus() {
|
|
public void testus() {
|
|
try {
|
|
try {
|
|
List<Record> records = Db.use("connected").find("select * from View_PACS where CHECK_TYPE='US1'");
|
|
List<Record> records = Db.use("connected").find("select * from View_PACS where CHECK_TYPE='US1'");
|
|
@@ -112,6 +179,23 @@ public class ViewController extends Controller {
|
|
return new DruidPlugin(PropKit.get("jdbcUrl_local"), PropKit.get("user_local"),PropKit.get("password_local").trim());
|
|
return new DruidPlugin(PropKit.get("jdbcUrl_local"), PropKit.get("user_local"),PropKit.get("password_local").trim());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 日期字符串格式转换
|
|
|
|
+ * @param dateStr
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String parseStringToDate() {
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ //start
|
|
|
|
+ long dInteger = date.getTime() - 86400000;
|
|
|
|
+ String daString = sdf.format(new Date(dInteger));
|
|
|
|
+ //end
|
|
|
|
+ long eInteger = date.getTime() - 600000;
|
|
|
|
+ String endString = sdf.format(new Date(eInteger));
|
|
|
|
+
|
|
|
|
+ return daString+","+endString;
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* post请求
|
|
* post请求
|
|
* @param url-请求地址
|
|
* @param url-请求地址
|