|
@@ -22,26 +22,26 @@ import okhttp3.RequestBody;
|
|
|
import okhttp3.Response;
|
|
|
|
|
|
public class DataService {
|
|
|
-
|
|
|
- private static String GET_EXAM_URL = "http://36.133.125.109:9601/ris_secret/getExams";
|
|
|
-
|
|
|
- private static String SAVE_REPORT_URL = "http://36.133.125.109:9601/ris_secret/saveReport";
|
|
|
-
|
|
|
- private static String UPDATE_PATIENT_URL = "http://36.133.125.109:9601/butt/saveExam";
|
|
|
-
|
|
|
- private static String FEE_URL = "https://risserver3.pacsonline.cn/film/callback";
|
|
|
-
|
|
|
- private static String GET_KEY_URL = "http://36.133.125.109:9601/ris_secret/getKey";
|
|
|
-
|
|
|
-
|
|
|
- private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
|
|
|
-
|
|
|
+
|
|
|
+// private static String GET_EXAM_URL = "http://36.133.125.109:9601/ris_secret/getExams";
|
|
|
+ private static String GET_EXAM_URL = "http://172.30.254.11:9601/ris_secret/getExams";
|
|
|
+
|
|
|
+ private static String SAVE_REPORT_URL = "http://172.30.254.11:9601/ris_secret/saveReport";
|
|
|
+
|
|
|
+ private static String UPDATE_PATIENT_URL = "http://172.30.254.11:9601/ris_secret/saveExam";
|
|
|
+
|
|
|
+ private static String FEE_URL = "https://risserver3.pacsonline.cn/film/callback";
|
|
|
+
|
|
|
+ private static String GET_KEY_URL = "http://172.30.254.11:9601/ris_secret/getKey";
|
|
|
+
|
|
|
+ private static final OkHttpClient OKHTTP_CLIENT = new OkHttpClient();
|
|
|
+
|
|
|
private static final MediaType JSON_TYPE = MediaType.parse("application/json; charset=utf-8");
|
|
|
|
|
|
- /**
|
|
|
- * 获取云端密钥
|
|
|
- */
|
|
|
- public String getCloudKey() {
|
|
|
+ /**
|
|
|
+ * 获取云端密钥
|
|
|
+ */
|
|
|
+ public String getCloudKey() {
|
|
|
String key = "";
|
|
|
try {
|
|
|
key = fileToString("./key.txt");
|
|
@@ -53,15 +53,15 @@ public class DataService {
|
|
|
return key;
|
|
|
}
|
|
|
return key;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新云端密钥
|
|
|
- */
|
|
|
- public void updateCloudKey() {
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", PropKit.get("institution_id"));
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新云端密钥
|
|
|
+ */
|
|
|
+ public void updateCloudKey() {
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("institution_id", PropKit.get("institution_id"));
|
|
|
String content = postWithParameters(GET_KEY_URL, map);
|
|
|
File file = new File("./key.txt");
|
|
|
try {
|
|
@@ -76,89 +76,94 @@ public class DataService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取未出报告的检查列表
|
|
|
- * @param jmstr
|
|
|
- */
|
|
|
- public String getExamList(String jmstr) {
|
|
|
- String cloudjmStr = localjm2cloudjm(jmstr);
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", "06300009");
|
|
|
- map.put("params", cloudjmStr);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取未出报告的检查列表
|
|
|
+ *
|
|
|
+ * @param jmstr
|
|
|
+ */
|
|
|
+ public String getExamList(String jmstr) {
|
|
|
+ String cloudjmStr = localjm2cloudjm(jmstr);
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ map.put("params", cloudjmStr);
|
|
|
String content = postWithParameters(GET_EXAM_URL, map);
|
|
|
String examlistStr = cloudjm2localjm(content);
|
|
|
return examlistStr;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取未出报告的检查列表
|
|
|
- * @param jmstr
|
|
|
- */
|
|
|
- public String saveReport(String jmstr) {
|
|
|
- String cloudjmStr = localjm2cloudjm(jmstr);
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", "06300009");
|
|
|
- map.put("params", cloudjmStr);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取未出报告的检查列表
|
|
|
+ *
|
|
|
+ * @param jmstr
|
|
|
+ */
|
|
|
+ public String saveReport(String jmstr) {
|
|
|
+ String cloudjmStr = localjm2cloudjm(jmstr);
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ map.put("params", cloudjmStr);
|
|
|
String content = postWithParameters(SAVE_REPORT_URL, map);
|
|
|
// JSONObject jsonObject = JSON.parseObject(content);
|
|
|
// String result = jsonObject.getString("msg");
|
|
|
- return content;
|
|
|
+ return content;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新检查信息
|
|
|
- * @param jmstr
|
|
|
- */
|
|
|
- public String updateExam(String jmstr) {
|
|
|
- String cloudjmStr = localjm2cloudjm(jmstr);
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", "06300009");
|
|
|
- map.put("params", cloudjmStr);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新检查信息
|
|
|
+ *
|
|
|
+ * @param jmstr
|
|
|
+ */
|
|
|
+ public String updateExam(String jmstr) {
|
|
|
+ String cloudjmStr = localjm2cloudjm(jmstr);
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ map.put("params", cloudjmStr);
|
|
|
String content = postWithParameters(UPDATE_PATIENT_URL, map);
|
|
|
JSONObject jsonObject = JSON.parseObject(content);
|
|
|
String result = jsonObject.getString("msg");
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 内网转外网加密
|
|
|
- * @param jmstr
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String localjm2cloudjm(String jmstr) {
|
|
|
- String IV = "0000000000000000";
|
|
|
- //解密内网数据
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 内网转外网加密
|
|
|
+ *
|
|
|
+ * @param jmstr
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String localjm2cloudjm(String jmstr) {
|
|
|
+ String IV = "0000000000000000";
|
|
|
+ // 解密内网数据
|
|
|
String aesDecodeStr = "";
|
|
|
try {
|
|
|
- aesDecodeStr = AESUtils.aesDecodeStr(jmstr,PropKit.get("nw_key"), IV);
|
|
|
+ aesDecodeStr = AESUtils.aesDecodeStr(jmstr, PropKit.get("nw_key"), IV);
|
|
|
} catch (Exception e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- //加密为云数据
|
|
|
+ // 加密为云数据
|
|
|
String aesEncryptStr = AESUtils.aesEncryptStr(aesDecodeStr, getCloudKey(), IV);
|
|
|
return aesEncryptStr;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 外网转内网加密
|
|
|
- * @param content
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String cloudjm2localjm(String content) {
|
|
|
- String IV = "0000000000000000";
|
|
|
- //解密云端数据
|
|
|
- JSONObject jsonObject = JSON.parseObject(content);
|
|
|
- String aesDecodeSt = "";
|
|
|
- String aesEncryptStr = "";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 外网转内网加密
|
|
|
+ *
|
|
|
+ * @param content
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String cloudjm2localjm(String content) {
|
|
|
+ String IV = "0000000000000000";
|
|
|
+ // 解密云端数据
|
|
|
+ JSONObject jsonObject = JSON.parseObject(content);
|
|
|
+ String aesDecodeSt = "";
|
|
|
+ String aesEncryptStr = "";
|
|
|
try {
|
|
|
- aesDecodeSt = AESUtils.aesDecodeStr(jsonObject.getString("data"), getCloudKey() ,IV);
|
|
|
-
|
|
|
- //加密为内网密文
|
|
|
- aesEncryptStr = AESUtils.aesEncryptStr(aesDecodeSt, PropKit.get("nw_key"),IV);
|
|
|
+ aesDecodeSt = AESUtils.aesDecodeStr(jsonObject.getString("data"), getCloudKey(), IV);
|
|
|
+
|
|
|
+ // 加密为内网密文
|
|
|
+ aesEncryptStr = AESUtils.aesEncryptStr(aesDecodeSt, PropKit.get("nw_key"), IV);
|
|
|
} catch (Exception e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
@@ -168,62 +173,59 @@ public class DataService {
|
|
|
return aesEncryptStr;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 写入报告
|
|
|
- * @param instutionId
|
|
|
- * @param number
|
|
|
- */
|
|
|
- public void saveReport(Map <String,String> map) {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 写入报告
|
|
|
+ *
|
|
|
+ * @param instutionId
|
|
|
+ * @param number
|
|
|
+ */
|
|
|
+ public void saveReport(Map<String, String> map) {
|
|
|
postWithParameters(SAVE_REPORT_URL, map);
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新患者信息
|
|
|
- *
|
|
|
- * @param instutionId
|
|
|
- * @param number
|
|
|
- */
|
|
|
- public void updatePatientInfo(Map<String, String> map) {
|
|
|
- postWithParameters(UPDATE_PATIENT_URL, map);
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- * 医院代收
|
|
|
- */
|
|
|
- public void fee(JSONObject jsonObject) {
|
|
|
- postWithJson(FEE_URL, jsonObject);
|
|
|
- }
|
|
|
-
|
|
|
- public static String postWithParameters(String url, Map<String, String> map) {
|
|
|
-
|
|
|
- FormBody.Builder formbody = new FormBody.Builder();
|
|
|
-
|
|
|
- for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
- formbody.add(entry.getKey(), entry.getValue());
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新患者信息
|
|
|
+ *
|
|
|
+ * @param instutionId
|
|
|
+ * @param number
|
|
|
+ */
|
|
|
+ public void updatePatientInfo(Map<String, String> map) {
|
|
|
+ postWithParameters(UPDATE_PATIENT_URL, map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 医院代收
|
|
|
+ */
|
|
|
+ public void fee(JSONObject jsonObject) {
|
|
|
+ postWithJson(FEE_URL, jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String postWithParameters(String url, Map<String, String> map) {
|
|
|
+
|
|
|
+ FormBody.Builder formbody = new FormBody.Builder();
|
|
|
+
|
|
|
+ for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
+ formbody.add(entry.getKey(), entry.getValue());
|
|
|
}
|
|
|
RequestBody requestBody = formbody.build();
|
|
|
-
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(url)
|
|
|
- .post(requestBody)
|
|
|
- .build();
|
|
|
-
|
|
|
- try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
- if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
|
|
|
- String content = response.body().string();
|
|
|
- System.out.println(content);
|
|
|
- return content;
|
|
|
- } catch (IOException e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- return null;
|
|
|
- }
|
|
|
+
|
|
|
+ Request request = new Request.Builder().url(url).post(requestBody).build();
|
|
|
+
|
|
|
+ try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
+ if (!response.isSuccessful())
|
|
|
+ throw new IOException("Unexpected code " + response);
|
|
|
+ String content = response.body().string();
|
|
|
+ System.out.println(content);
|
|
|
+ return content;
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- public String postWithJson(String url, JSONObject jsonObject) {
|
|
|
+
|
|
|
+ public String postWithJson(String url, JSONObject jsonObject) {
|
|
|
|
|
|
RequestBody requestBody = RequestBody.create(JSON_TYPE, jsonObject.toJSONString());
|
|
|
|
|
@@ -241,14 +243,14 @@ public class DataService {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public String fileToString(String path) throws IOException {
|
|
|
- return Files.readString(Path.of(path));
|
|
|
- }
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- Map <String,String> map = new HashMap<String,String>();
|
|
|
- map.put("institution_id", "06300009");
|
|
|
+
|
|
|
+ public String fileToString(String path) throws IOException {
|
|
|
+ return Files.readString(Path.of(path));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ Map<String, String> map = new HashMap<String, String>();
|
|
|
+ map.put("institution_id", "06300009");
|
|
|
// map.put("params", "JEFH7RsOVjqjyMH33cWxuBRUYqLnupUcn/As3sMG46IZSSOnGs1mhpJepTnOz3f/D9KdR3PI5ikvVQpqCkQa5KQbfqNKGvgmMAt5OxCQGMND0wICypOLM3xs9h4gUxgo9NqzeTYcD6SSaUDe+3BKKQvXPhiSm/BxByTZNPkTYK91EXF86zQvCFY1IVg0wQjiqqIxheF/tUUKI3nPb5hUCNNo3WpVGNvYCvaTCng+KIu3MZu9Pv7KE/mQ7DFf+i/SgSlJT1ONDxv+Ni+AqaJfS9HD7y5fy5Us60xHPrqXNcjSAyRIazQNV6KQE+1zbaM4y1sr3vVs3hACxJVKApK4yMQeS3VLDvOyuvqEszWudV//nToH/lzmV0vtgOs4UEYxTBI+OfL1PXq+U4eNL8sTH6MY/NiCkN6OpjuYKQlP3wzqHHdJzuTAEFe1Vw1eFerpatfUTLIMj3T51+9L7NMsgW4CE6aJpvH4l88gUi9adCSrkoHkcKBgNkmx9X6XCvfzQvdung/+YZOKlQ+kqktpeA4tyjT724VyDaMhgdodsm6q5yIXgk7mw+x8Gq/WDzg/Q8+JiHE4zbKBg1pKyEazS8lXCU1TJzPd85ythBal46VCwcTEB2+g9SM5p4yqOk0c6ZK2VLay+bgPDpBak9IZJaV5ZVbSr0XdhGZzo+jDckaMhLSrDFe/5+8wXGJZ7U80L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/qAFTTclSrMqym8xTaLuJRnwMS0oqUQfHF9mjiyPrU6higOfSzNjHuwTqAA0qr23upeqQTGXgDV5FwG7WRGM+MTNQuUKe6A+pizdA13VzJzy7E23ZgEDJbl1T02vax9Q54DwMA1v+JqjAlJ8TxekSLExxUD0SfutGi01gw8nc2DWQ=");
|
|
|
// map.put("createdAt", "2023-03-14 17:22:06,2023-03-14 17:22:06");
|
|
|
// map.put("exam_status", "3,7,8,9");
|
|
@@ -256,7 +258,7 @@ public class DataService {
|
|
|
// map.put("num", "10");
|
|
|
// postWithParameters(SAVE_REPORT_URL, map);
|
|
|
String content = postWithParameters(GET_KEY_URL, map);
|
|
|
-
|
|
|
+
|
|
|
// File file = new File("./key.txt");
|
|
|
// try {
|
|
|
// // 使用FileWriter不需要考虑原文件不存在的情况
|
|
@@ -272,9 +274,6 @@ public class DataService {
|
|
|
// String content = getCloudKey();
|
|
|
System.out.println(content);
|
|
|
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
}
|