Commit d5216d40d59f6e353d9d3d623d4ac3089c511151
1 parent
e433e10a9e
Exists in
master
and in
1 other branch
提交危急处理模块
Showing 1 changed file with 55 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/PatientRelateMemberUtil.java
View file @
d5216d4
1 | +package com.lyms.platform.operate.web.utils; | |
2 | + | |
3 | +import com.lyms.platform.common.utils.JsonUtil; | |
4 | +import com.lyms.platform.common.utils.MessageUtil; | |
5 | +import com.lyms.platform.operate.web.result.MommyBabyMemberIdsResult; | |
6 | +import org.apache.commons.httpclient.HttpClient; | |
7 | +import org.apache.commons.httpclient.NameValuePair; | |
8 | +import org.apache.commons.httpclient.methods.GetMethod; | |
9 | + | |
10 | +import java.util.ArrayList; | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * Created by Administrator on 2016/10/14 0014. | |
15 | + */ | |
16 | +public class PatientRelateMemberUtil { | |
17 | + | |
18 | + public static List<Integer> getMommyBabyMember(String id,String token){ | |
19 | + | |
20 | + HttpClient client = new HttpClient(); | |
21 | + GetMethod get = new MessageUtil.UTF8GetMethod("http://data.api.healthbaby.com.cn/v1/platformPatients.action"); | |
22 | + NameValuePair[] data = { | |
23 | + new NameValuePair("id", id), | |
24 | + }; | |
25 | + get.setQueryString(data); | |
26 | + get.setRequestHeader("Authorization", token); | |
27 | + | |
28 | + List<Integer> list = new ArrayList<>(); | |
29 | + | |
30 | + try { | |
31 | + client.executeMethod(get); | |
32 | + int statusCode = get.getStatusCode(); | |
33 | + | |
34 | + System.out.println("statusCode:" + statusCode); | |
35 | + | |
36 | + String result = new String(get.getResponseBodyAsString()); | |
37 | + | |
38 | + System.out.println("result:" + result); | |
39 | + | |
40 | + get.releaseConnection(); | |
41 | + if (result != null && result.indexOf("成功") > 0) { | |
42 | + MommyBabyMemberIdsResult ids = JsonUtil.str2Obj(result, MommyBabyMemberIdsResult.class); | |
43 | + if (ids!=null){ | |
44 | + list = ids.getList(); | |
45 | + return list; | |
46 | + } | |
47 | + return list; | |
48 | + } | |
49 | + } catch (Exception e) { | |
50 | + e.printStackTrace(); | |
51 | + } | |
52 | + return list; | |
53 | + } | |
54 | + | |
55 | +} |