|
@@ -9,11 +9,14 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
|
|
|
+import okhttp3.Call;
|
|
|
+import okhttp3.Callback;
|
|
|
import okhttp3.FormBody;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import okhttp3.Request;
|
|
|
import okhttp3.RequestBody;
|
|
|
import okhttp3.Response;
|
|
|
+import okhttp3.ResponseBody;
|
|
|
|
|
|
public class DataService {
|
|
|
|
|
@@ -24,6 +27,9 @@ public class DataService {
|
|
|
private static String GET_CONFIRM_EXAM_URL = "https://risserver3.pacsonline.cn/butt/getConfirmExam";
|
|
|
|
|
|
private static String UPDATE_PATIENT_URL = "https://risserver3.pacsonline.cn/butt/saveExam";
|
|
|
+
|
|
|
+ private static String RETURN_BIND_URL = "https://risserver3.pacsonline.cn/butt/getBindInfo";
|
|
|
+
|
|
|
|
|
|
private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
|
|
|
|
|
@@ -60,6 +66,21 @@ public class DataService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public JSONArray getBindList(String start,String finish) {
|
|
|
+ Map <String,String> map = new HashMap<String,String>();
|
|
|
+ map.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ map.put("start", start);
|
|
|
+ map.put("finish", finish);
|
|
|
+ String content = postWithParameters(RETURN_BIND_URL, map);
|
|
|
+ JSONObject jsonObject = JSON.parseObject(content);
|
|
|
+ if (!jsonObject.getString("msg").equals("success")) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ JSONArray jsonArray = JSON.parseArray(jsonObject.getString("data"));
|
|
|
+ return jsonArray;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 写入报告
|
|
|
* @param instutionId
|
|
@@ -106,11 +127,34 @@ public class DataService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static String getWithUrl(String url, Map<String, String> map) {
|
|
|
+ for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
+ String s = url.contains("?") ? "&" : "?";
|
|
|
+ url = url + s + entry.getKey() + "=" + entry.getValue();
|
|
|
+ }
|
|
|
+ Request request = new Request.Builder().url(url).build();
|
|
|
+ String content = "";
|
|
|
+ try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
+ if (!response.isSuccessful())
|
|
|
+ throw new IOException("Unexpected code " + response);
|
|
|
+ content = response.body().string();
|
|
|
+ return content;
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", "47600001");
|
|
|
- map.put("num", "10");
|
|
|
- postWithParameters(GET_EXAM_URL, map);
|
|
|
+ map.put("institution_id", "06300006");
|
|
|
+ map.put("start", "2022-02-01");
|
|
|
+ map.put("finish", "2022-03-01");
|
|
|
+ String content=getWithUrl(RETURN_BIND_URL, map);
|
|
|
+ System.out.println(content);
|
|
|
}
|
|
|
|
|
|
}
|