ReportTest.java
4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package com.xkl;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static com.xkl.TokenTest.loginAndGetToken;
/**
* Created by win7 on 2016/12/26.
* 报告相关
*/
public class ReportTest {
private static final String URL_REPORT_LIST = Constants.URL_PREFIX + "/report/list";
private static final String URL_REPORT_DETAIL = Constants.URL_PREFIX + "/report/detail";
private static final String URL_REPORT_SCORE = Constants.URL_PREFIX + "/report/score";
private static final String URL_ITEM_INFO = Constants.URL_PREFIX + "/report/itemInfo";
private static final String URL_ITEM_GRAPH = Constants.URL_PREFIX + "/report/itemGraph";
private static final String URL_COMPARE = Constants.URL_PREFIX + "/report/compare";
private static String token;
@BeforeClass
public static void init(){
token = loginAndGetToken("user1","pass1");
// String token =OpenIdTest.bindWithOpenIdAndLoginAndGetToken("abcdefghijklmnopqrstuvwxyz123456","0");
}
/**
* 体检报告列表查询接口
*/
@Test
public void testList(){
Map<String,String> params = new HashMap<String, String>();
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_REPORT_LIST,"GET",params,token);
System.out.println(response);
}
/**
* 体检报告详情查询接口
*/
@Test
public void testDetail(){
Map<String,String> params = new HashMap<String, String>();
params.put("report_id","77");
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_REPORT_DETAIL,"GET",params,token);
System.out.println(response);
}
/**
* 健康评分接口
*/
@Test
public void testScore(){
Map<String,String> params = new HashMap<String, String>();
params.put("report_id","77");
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMap(URL_REPORT_SCORE,"GET",params);
System.out.println(response);
}
/**
* 体检报告指标解释查询接口
*/
@Test
public void testItemInfo(){
Map<String,String> params = new HashMap<String, String>();
params.put("itemId","10");
params.put("status","0");
params.put("isPureHtml","false");
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_ITEM_INFO,"GET",params,token);
System.out.println(response);
}
/**
* 体检报告指标解释查询接口(过滤html标签)
*/
@Test
public void testItemInfoPureHtml(){
Map<String,String> params = new HashMap<String, String>();
params.put("itemId","10");
params.put("status","1");
params.put("isPureHtml","true");
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_ITEM_INFO,"GET",params,token);
System.out.println(response);
}
/**
* 体检报告指标曲线查询接口
*/
@Test
public void testItemGraph(){
Map<String,String> params = new HashMap<String, String>();
params.put("itemId","10");
params.put("stime","2010-01-01 10:32:00");
params.put("etime","2019-12-22 10:32:00");
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_ITEM_GRAPH,"GET",params,token);
System.out.println(response);
}
/**
* 微信端体检报告分年龄比较接口
*/
@Test
public void testCompare(){
Map<String,String> params = new HashMap<String, String>();
params.put("report_id","77");
params.put("t",HttpTools.getNow());
params.put("type","1");
params.put("sign",HttpTools.getSign(params));
String response = HttpTools.requestByMapWithToken(URL_COMPARE,"POST",params,token);
System.out.println(response);
}
}