|
@@ -8,6 +8,7 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfinal.core.Controller;
|
|
|
import com.jfinal.kit.PropKit;
|
|
@@ -45,14 +46,13 @@ public class ViewController extends Controller {
|
|
|
// TODO: handle exception
|
|
|
renderText(e.toString());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public void testConn() {
|
|
|
try {
|
|
|
DruidPlugin druidPluginConnected = createConnectedDruidPlugin();
|
|
|
- druidPluginConnected.start();
|
|
|
+ druidPluginConnected.start();
|
|
|
// 配置ActiveRecord插件
|
|
|
ActiveRecordPlugin arpConnected = new ActiveRecordPlugin("connected", druidPluginConnected);
|
|
|
arpConnected.setDialect(new OracleDialect());
|
|
@@ -63,32 +63,35 @@ public class ViewController extends Controller {
|
|
|
this.renderText(e.toString());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public void testpay() {
|
|
|
DataService dService = ServiceFactory.getService(DataService.class);
|
|
|
- List<Record> records = Db.use("connected").find("select * from(select * from paylist where ISFEE=1 order by PAYTIME desc)where rownum<1600");
|
|
|
+ List<Record> records = Db.use("connected")
|
|
|
+ .find("select * from(select * from paylist where ISFEE=1 order by PAYTIME desc)where rownum<1600");
|
|
|
for (Record record : records) {
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("institution_id", PropKit.get("institution_id"));
|
|
|
- jsonObject.put("patient_num", record.getStr("ACCESSIONNUMBER"));
|
|
|
- jsonObject.put("ins_type", "2");
|
|
|
- JSONObject pJsonObject = new JSONObject();
|
|
|
- pJsonObject.put("params", jsonObject.toJSONString());
|
|
|
- ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
- tService.execute(() -> {
|
|
|
- dService.fee(pJsonObject);
|
|
|
- });
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("institution_id", PropKit.get("institution_id"));
|
|
|
+ jsonObject.put("patient_num", record.getStr("ACCESSIONNUMBER"));
|
|
|
+ jsonObject.put("ins_type", "2");
|
|
|
+ JSONObject pJsonObject = new JSONObject();
|
|
|
+ pJsonObject.put("params", jsonObject.toJSONString());
|
|
|
+ ThreadPoolService tService = ServiceFactory.getService(ThreadPoolService.class);
|
|
|
+ tService.execute(() -> {
|
|
|
+ dService.fee(pJsonObject);
|
|
|
+ });
|
|
|
}
|
|
|
renderNull();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static DruidPlugin createConnectedDruidPlugin() {
|
|
|
|
|
|
- return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),PropKit.get("password_connected").trim());
|
|
|
+ return new DruidPlugin(PropKit.get("jdbcUrl_connected"), PropKit.get("user_connected"),
|
|
|
+ PropKit.get("password_connected").trim());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* post请求
|
|
|
+ *
|
|
|
* @param url-请求地址
|
|
|
* @param map-参数集合
|
|
|
* @return
|
|
@@ -102,9 +105,10 @@ public class ViewController extends Controller {
|
|
|
RequestBody formBody = builder.build();
|
|
|
|
|
|
Request request = new Request.Builder().url(url).post(formBody).build();
|
|
|
-
|
|
|
+
|
|
|
try (Response response = OKHTTP_CLIENT.newCall(request).execute()) {
|
|
|
- if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
|
|
|
+ if (!response.isSuccessful())
|
|
|
+ throw new IOException("Unexpected code " + response);
|
|
|
String content = response.body().string();
|
|
|
return content;
|
|
|
} catch (IOException e) {
|
|
@@ -113,9 +117,10 @@ public class ViewController extends Controller {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 日期字符串格式转换
|
|
|
+ *
|
|
|
* @param dateStr
|
|
|
* @return
|
|
|
*/
|
|
@@ -123,20 +128,20 @@ public class ViewController extends Controller {
|
|
|
if (dateStr == null) {
|
|
|
return new Date();
|
|
|
}
|
|
|
- SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Date date = null;
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ Date date = null;
|
|
|
try {
|
|
|
date = sdf.parse(dateStr);
|
|
|
} catch (ParseException e) {
|
|
|
// TODO Auto-generated catch block
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return date;
|
|
|
+ return date;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- Map<String,String> paramsMap=new HashMap<String,String>();
|
|
|
- paramsMap.put("institution_id", "44100001");
|
|
|
+ Map<String, String> paramsMap = new HashMap<String, String>();
|
|
|
+ paramsMap.put("institution_id", "44100001");
|
|
|
|
|
|
String contentString = doPost("https://risserver3.pacsonline.cn/butt/getExam/butt/getExam", paramsMap);
|
|
|
System.out.println(contentString);
|