Add test code for uspih
Showing
5 changed files
with
150 additions
and
10 deletions
@@ -5,8 +5,8 @@ package com.xkl; | @@ -5,8 +5,8 @@ package com.xkl; | ||
5 | */ | 5 | */ |
6 | public interface Constants { | 6 | public interface Constants { |
7 | 7 | ||
8 | -// String URL_PREFIX = "http://127.0.0.1:8090"; | ||
9 | - String URL_PREFIX = "http://139.129.166.85:8090"; | 8 | + String URL_PREFIX = "http://127.0.0.1:8090"; |
9 | +// String URL_PREFIX = "http://139.129.166.85:8090"; | ||
10 | 10 | ||
11 | String KEY = "weixin"; | 11 | String KEY = "weixin"; |
12 | } | 12 | } |
1 | package com.xkl.upsoft; | 1 | package com.xkl.upsoft; |
2 | 2 | ||
3 | + | ||
4 | +import org.json.JSONArray; | ||
5 | +import org.json.JSONObject; | ||
6 | +import org.junit.Test; | ||
7 | + | ||
8 | +import java.text.DecimalFormat; | ||
9 | + | ||
3 | /** | 10 | /** |
4 | * Created by zhao yue on 2017/1/14. | 11 | * Created by zhao yue on 2017/1/14. |
5 | */ | 12 | */ |
6 | -public interface Data { | ||
7 | - public static final String ADMIN_ACCOUNT= "user1"; | ||
8 | - public static final String ADMIN_PWD= "pass1"; | ||
9 | - public static final String AMP_REPORT= "{\"ABD\":\"35.66\",\"LAC\":\"36.23\",\"LCA\":\"32.94\",\"RAC\":\"35.84\",\"RCA\":\"33.05\",\"age\":\"24\",\"atmospheric_pressure\":\"756.58\",\"basic_result\":\"初步检测结果(仅供参考):\\n\\n低渗性血管张力异常 \\n\\n有必要排除血凝异常 血凝升高 \\n\\n建议向胃肠病专家(精于胃十二指肠炎)进一步咨询 \\n\\n血管张力异常,静脉循环障碍 酒精性高血压 \\n\\n第三脑室宽度=6.42 \\n\\n建议向妇科医生进一步咨询 其它器官血流量占=4.1 \\n\\nTiffeneau指数持续减少83.6 (Tiffeneau测试) \\n\\n----------------------------------------------------------------------------------------------------------\\n\\n\\n\",\"detail\":{\"1\":\"117.54\",\"10\":\"01.29\",\"100\":\"5.06\",\"101\":\"250.60\",\"102\":\"8.61\",\"103\":\"0.319\",\"104\":\"370.02\",\"105\":\"45.98\",\"106\":\"62.96\",\"107\":\"325.68\",\"108\":\"3.750\",\"109\":\"71.52\",\"11\":\"02.13\",\"110\":\"0.136\",\"111\":\"0.392\",\"112\":\"0.079\",\"113\":\"67.78\",\"114\":\"113.66\",\"115\":\"71.55\",\"116\":\"6.42\",\"117\":\"0.91\",\"118\":\"78.4\",\"119\":\"66.0\",\"12\":\"245.28\",\"120\":\"31\",\"121\":\"90\",\"122\":\"340\",\"123\":\"0.93\",\"124\":\"0.97\",\"125\":\"15\",\"13\":\"2.45\",\"14\":\"0.86\",\"15\":\"4.06\",\"16\":\"134.78\",\"17\":\"1.56\",\"18\":\"7.33\",\"19\":\"5.18\",\"2\":\"3.81\",\"20\":\"42.62\",\"21\":\"5.21\",\"22\":\"0.26\",\"23\":\"0.26\",\"24\":\"13.12\",\"25\":\"14.87\",\"26\":\"1.01\",\"27\":\"10.52\",\"28\":\"2.83\",\"29\":\"7.69\",\"3\":\"36.87\",\"30\":\"61.82\",\"31\":\"82.57\",\"32\":\"28.00\",\"33\":\"1.41\",\"34\":\"5.53\",\"35\":\"5.00\",\"36\":\"38.19\",\"37\":\"4.01\",\"38\":\"2.34\",\"39\":\"0.30\",\"4\":\"7.34\",\"40\":\"1.13\",\"41\":\"0.80\",\"42\":\"4.77\",\"43\":\"14.55\",\"44\":\"21.39\",\"45\":\"40.28\",\"46\":\"56.21\",\"47\":\"8.04\",\"48\":\"162.71\",\"49\":\"75.6\",\"5\":\"46.70\",\"50\":\"25.41\",\"51\":\"86.24\",\"52\":\"251.45\",\"53\":\"0.0050\",\"54\":\"1.68\",\"55\":\"475.35\",\"56\":\"35.47\",\"57\":\"3.8396\",\"58\":\"1052.84\",\"59\":\"64.17\",\"6\":\"5.07\",\"60\":\"3.82\",\"61\":\"265.63\",\"62\":\"3953.54\",\"63\":\"58.44\",\"64\":\"4.52\",\"65\":\"18.93\",\"66\":\"14.01\",\"67\":\"25.61\",\"68\":\"26.05\",\"69\":\"6.66\",\"7\":\"5.36\",\"70\":\"4.08\",\"71\":\"261.67\",\"72\":\"1209.45\",\"73\":\"819.37\",\"74\":\"2134.08\",\"75\":\"1726.00\",\"76\":\"421.24\",\"77\":\"265.40\",\"78\":\"140.33\",\"79\":\"72.37\",\"8\":\"7.35\",\"80\":\"19.51\",\"81\":\"4.78\",\"82\":\"53.24\",\"83\":\"3.94\",\"84\":\"3.19\",\"85\":\"160.94\",\"86\":\"2.22\",\"87\":\"80.94\",\"88\":\"34.53\",\"89\":\"3607.41\",\"9\":\"3.72\",\"90\":\"7.38\",\"91\":\"1922.57\",\"92\":\"85.16\",\"93\":\"83.59\",\"94\":\"71.95\",\"95\":\"6.64\",\"96\":\"0.96\",\"97\":\"1135.53\",\"98\":\"2.48\",\"99\":\"96.97\"},\"id_card_number\":\"\",\"name\":\"测试\",\"number\":\"12345678901\",\"pulse\":\"79\",\"report_date\":\"2014-12-17 17:01:40\",\"respiratory_rate\":\"18\",\"sex\":0,\"stable\":\"99999\",\"total\":\"173.62\",\"weight\":\"45\",\"title\":\"AMP TITLE\",\"account\":\"user1\",\"machine_num\":\"machine_num\"}"; | 13 | +public class Data { |
14 | + public static final String ADMIN_ACCOUNT = "user1"; | ||
15 | + public static final String ADMIN_PWD = "pass1"; | ||
16 | + public static final String USR_ACCOUNT = "15211112222"; | ||
17 | + // "{\"ABD\":\"35.66\",\"LAC\":\"36.23\",\"LCA\":\"32.94\",\"RAC\":\"35.84\",\"RCA\":\"33.05\",\"age\":\"24\",\"atmospheric_pressure\":\"756.58\",\"basic_result\":\"初步检测结果(仅供参考):\\n\\n低渗性血管张力异常 \\n\\n有必要排除血凝异常 血凝升高 \\n\\n建议向胃肠病专家(精于胃十二指肠炎)进一步咨询 \\n\\n血管张力异常,静脉循环障碍 酒精性高血压 \\n\\n第三脑室宽度=6.42 \\n\\n建议向妇科医生进一步咨询 其它器官血流量占=4.1 \\n\\nTiffeneau指数持续减少83.6 (Tiffeneau测试) \\n\\n----------------------------------------------------------------------------------------------------------\\n\\n\\n\",\"basic_result_ids\":[1,2,3,4],\"detail\":{\"1\":\"117.54\",\"10\":\"01.29\",\"100\":\"5.06\",\"101\":\"250.60\",\"102\":\"8.61\",\"103\":\"0.319\",\"104\":\"370.02\",\"105\":\"45.98\",\"106\":\"62.96\",\"107\":\"325.68\",\"108\":\"3.750\",\"109\":\"71.52\",\"11\":\"02.13\",\"110\":\"0.136\",\"111\":\"0.392\",\"112\":\"0.079\",\"113\":\"67.78\",\"114\":\"113.66\",\"115\":\"71.55\",\"116\":\"6.42\",\"117\":\"0.91\",\"118\":\"78.4\",\"119\":\"66.0\",\"12\":\"245.28\",\"120\":\"31\",\"121\":\"90\",\"122\":\"340\",\"123\":\"0.93\",\"124\":\"0.97\",\"125\":\"15\",\"13\":\"2.45\",\"14\":\"0.86\",\"15\":\"4.06\",\"16\":\"134.78\",\"17\":\"1.56\",\"18\":\"7.33\",\"19\":\"5.18\",\"2\":\"3.81\",\"20\":\"42.62\",\"21\":\"5.21\",\"22\":\"0.26\",\"23\":\"0.26\",\"24\":\"13.12\",\"25\":\"14.87\",\"26\":\"1.01\",\"27\":\"10.52\",\"28\":\"2.83\",\"29\":\"7.69\",\"3\":\"36.87\",\"30\":\"61.82\",\"31\":\"82.57\",\"32\":\"28.00\",\"33\":\"1.41\",\"34\":\"5.53\",\"35\":\"5.00\",\"36\":\"38.19\",\"37\":\"4.01\",\"38\":\"2.34\",\"39\":\"0.30\",\"4\":\"7.34\",\"40\":\"1.13\",\"41\":\"0.80\",\"42\":\"4.77\",\"43\":\"14.55\",\"44\":\"21.39\",\"45\":\"40.28\",\"46\":\"56.21\",\"47\":\"8.04\",\"48\":\"162.71\",\"49\":\"75.6\",\"5\":\"46.70\",\"50\":\"25.41\",\"51\":\"86.24\",\"52\":\"251.45\",\"53\":\"0.0050\",\"54\":\"1.68\",\"55\":\"475.35\",\"56\":\"35.47\",\"57\":\"3.8396\",\"58\":\"1052.84\",\"59\":\"64.17\",\"6\":\"5.07\",\"60\":\"3.82\",\"61\":\"265.63\",\"62\":\"3953.54\",\"63\":\"58.44\",\"64\":\"4.52\",\"65\":\"18.93\",\"66\":\"14.01\",\"67\":\"25.61\",\"68\":\"26.05\",\"69\":\"6.66\",\"7\":\"5.36\",\"70\":\"4.08\",\"71\":\"261.67\",\"72\":\"1209.45\",\"73\":\"819.37\",\"74\":\"2134.08\",\"75\":\"1726.00\",\"76\":\"421.24\",\"77\":\"265.40\",\"78\":\"140.33\",\"79\":\"72.37\",\"8\":\"7.35\",\"80\":\"19.51\",\"81\":\"4.78\",\"82\":\"53.24\",\"83\":\"3.94\",\"84\":\"3.19\",\"85\":\"160.94\",\"86\":\"2.22\",\"87\":\"80.94\",\"88\":\"34.53\",\"89\":\"3607.41\",\"9\":\"3.72\",\"90\":\"7.38\",\"91\":\"1922.57\",\"92\":\"85.16\",\"93\":\"83.59\",\"94\":\"71.95\",\"95\":\"6.64\",\"96\":\"0.96\",\"97\":\"1135.53\",\"98\":\"2.48\",\"99\":\"96.97\"},\"name\":\"测试\",\"number\":\"12345678901\",\"pulse\":\"79\",\"report_date\":\"2014-12-17 17:01:40\",\"respiratory_rate\":\"18\",\"sex\":0,\"stable\":\"99999\",\"total\":\"173.62\",\"weight\":\"45\",\"title\":\"AMP TITLE\",\"account\":\"user1\",\"machine_num\":\"10311212\"}"; | ||
18 | + public static String AMP_REPORT = ""; | ||
19 | + | ||
20 | + | ||
21 | + static { | ||
22 | + Data data = new Data(); | ||
23 | + data.generateJsonFormatReport(); | ||
24 | + } | ||
25 | + | ||
26 | + @Test | ||
27 | + public void generateJsonFormatReport() { | ||
28 | + JSONObject report = new JSONObject(); | ||
29 | + report.put("ABD", 35.66); | ||
30 | + report.put("LAC", 36.23); | ||
31 | + report.put("LCA", 32.94); | ||
32 | + report.put("RAC", 35.84); | ||
33 | + report.put("RCA", 33.05); | ||
34 | + report.put("total", 173.62); // sum of the above 5 temperature | ||
35 | + report.put("age", 24); | ||
36 | + report.put("atmospheric_pressure", 756.58); | ||
37 | + // The conclusion string of the report. | ||
38 | + report.put("basic_result", "初步检测结果(仅供参考):\\n\\n低渗性血管张力异常 \\n\\n有必要排除血凝异常 血凝升高 \\n\\n建议向胃肠病专家(精于胃十二指肠炎)进一步咨询 \\n\\n血管张力异常,静脉循环障碍 酒精性高血压 \\n\\n第三脑室宽度=6.42 \\n\\n建议向妇科医生进一步咨询 其它器官血流量占=4.1 \\n\\nTiffeneau指数持续减少83.6 (Tiffeneau测试) \\n\\n----------------------------------------------------------------------------------------------------------\\n\\n\\n"); | ||
39 | + | ||
40 | + JSONObject details = new JSONObject(); | ||
41 | + DecimalFormat df = new java.text.DecimalFormat("######.00"); | ||
42 | + for (int i = 1; i <= 125; i++) { | ||
43 | + details.put(String.valueOf(i), df.format(Math.random() * 100)); // 125 items of the report. | ||
44 | + } | ||
45 | + report.put("detail", details); | ||
46 | + | ||
47 | + | ||
48 | + report.put("name", "user name"); // user name | ||
49 | + report.put("number", "report number"); //report number. Leave it empty if not exist. Such as : report.put("number", ""); | ||
50 | + report.put("pulse", 79); | ||
51 | + report.put("report_date", System.currentTimeMillis()); // physical examination time of this report | ||
52 | + report.put("respiratory_rate", 18); | ||
53 | + report.put("sex", 0); // 0 is male; 1 is female | ||
54 | + report.put("stable", "99999"); | ||
55 | + report.put("weight", 45); | ||
56 | + report.put("title", "AMP无创健康评估报告"); // report title | ||
57 | + report.put("account", "15211112222"); | ||
58 | + report.put("machine_num", "10311212");//machine serial | ||
59 | + | ||
60 | +// /* | ||
61 | +// * Some other temperature serial which not display on the report. | ||
62 | +// */ | ||
63 | +// report.put("T0", "{{{{{{{{{{{{{{{{{{{{{{"); | ||
64 | +// report.put("T1", "............"); | ||
65 | +// report.put("T2", "+++++++++++"); | ||
66 | +// report.put("T3", "@@@@@@@@@@@"); | ||
67 | +// report.put("T4", "!!!!!!!!!!!!"); | ||
68 | +// | ||
69 | +// /* | ||
70 | +// * The ID of the conclusion. | ||
71 | +// */ | ||
72 | +// JSONArray basicResIds = new JSONArray(); | ||
73 | +// basicResIds.put(1); | ||
74 | +// basicResIds.put(2); | ||
75 | +// basicResIds.put(3); | ||
76 | +// basicResIds.put(4); | ||
77 | +// report.put("basic_result_ids", basicResIds); | ||
10 | 78 | ||
79 | + AMP_REPORT = report.toString(); | ||
80 | + // use http://www.jsoneditoronline.org/ to view the json easily | ||
81 | + System.out.println(AMP_REPORT); | ||
82 | + } | ||
11 | } | 83 | } |
@@ -45,7 +45,7 @@ public class ReportTest { | @@ -45,7 +45,7 @@ public class ReportTest { | ||
45 | public void testDelReport() { | 45 | public void testDelReport() { |
46 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); | 46 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); |
47 | Map<String, String> params = new HashMap<String, String>(); | 47 | Map<String, String> params = new HashMap<String, String>(); |
48 | - params.put("report_id", "79"); | 48 | + params.put("report_id", "99"); |
49 | String response = HttpTools.requestByMapWithToken(URL_REPORT, "DELETE", params, token); | 49 | String response = HttpTools.requestByMapWithToken(URL_REPORT, "DELETE", params, token); |
50 | System.out.println("delete report:" + response); | 50 | System.out.println("delete report:" + response); |
51 | } | 51 | } |
1 | package com.xkl.uspih; | 1 | package com.xkl.uspih; |
2 | 2 | ||
3 | + | ||
3 | import org.json.JSONArray; | 4 | import org.json.JSONArray; |
5 | +import org.json.JSONObject; | ||
6 | +import org.junit.Test; | ||
7 | + | ||
8 | +import java.text.DecimalFormat; | ||
4 | 9 | ||
5 | /** | 10 | /** |
6 | * Created by zhao yue on 2017/1/14. | 11 | * Created by zhao yue on 2017/1/14. |
@@ -9,9 +14,71 @@ public class Data { | @@ -9,9 +14,71 @@ public class Data { | ||
9 | public static final String ADMIN_ACCOUNT = "user1"; | 14 | public static final String ADMIN_ACCOUNT = "user1"; |
10 | public static final String ADMIN_PWD = "pass1"; | 15 | public static final String ADMIN_PWD = "pass1"; |
11 | public static final String USR_ACCOUNT = "15211112222"; | 16 | public static final String USR_ACCOUNT = "15211112222"; |
12 | - public static final String AMP_REPORT = "{\"ABD\":\"35.66\",\"LAC\":\"36.23\",\"LCA\":\"32.94\",\"RAC\":\"35.84\",\"RCA\":\"33.05\",\"age\":\"24\",\"atmospheric_pressure\":\"756.58\",\"basic_result\":\"初步检测结果(仅供参考):\\n\\n低渗性血管张力异常 \\n\\n有必要排除血凝异常 血凝升高 \\n\\n建议向胃肠病专家(精于胃十二指肠炎)进一步咨询 \\n\\n血管张力异常,静脉循环障碍 酒精性高血压 \\n\\n第三脑室宽度=6.42 \\n\\n建议向妇科医生进一步咨询 其它器官血流量占=4.1 \\n\\nTiffeneau指数持续减少83.6 (Tiffeneau测试) \\n\\n----------------------------------------------------------------------------------------------------------\\n\\n\\n\",\"basic_result_ids\":[1,2,3,4],\"detail\":{\"1\":\"117.54\",\"10\":\"01.29\",\"100\":\"5.06\",\"101\":\"250.60\",\"102\":\"8.61\",\"103\":\"0.319\",\"104\":\"370.02\",\"105\":\"45.98\",\"106\":\"62.96\",\"107\":\"325.68\",\"108\":\"3.750\",\"109\":\"71.52\",\"11\":\"02.13\",\"110\":\"0.136\",\"111\":\"0.392\",\"112\":\"0.079\",\"113\":\"67.78\",\"114\":\"113.66\",\"115\":\"71.55\",\"116\":\"6.42\",\"117\":\"0.91\",\"118\":\"78.4\",\"119\":\"66.0\",\"12\":\"245.28\",\"120\":\"31\",\"121\":\"90\",\"122\":\"340\",\"123\":\"0.93\",\"124\":\"0.97\",\"125\":\"15\",\"13\":\"2.45\",\"14\":\"0.86\",\"15\":\"4.06\",\"16\":\"134.78\",\"17\":\"1.56\",\"18\":\"7.33\",\"19\":\"5.18\",\"2\":\"3.81\",\"20\":\"42.62\",\"21\":\"5.21\",\"22\":\"0.26\",\"23\":\"0.26\",\"24\":\"13.12\",\"25\":\"14.87\",\"26\":\"1.01\",\"27\":\"10.52\",\"28\":\"2.83\",\"29\":\"7.69\",\"3\":\"36.87\",\"30\":\"61.82\",\"31\":\"82.57\",\"32\":\"28.00\",\"33\":\"1.41\",\"34\":\"5.53\",\"35\":\"5.00\",\"36\":\"38.19\",\"37\":\"4.01\",\"38\":\"2.34\",\"39\":\"0.30\",\"4\":\"7.34\",\"40\":\"1.13\",\"41\":\"0.80\",\"42\":\"4.77\",\"43\":\"14.55\",\"44\":\"21.39\",\"45\":\"40.28\",\"46\":\"56.21\",\"47\":\"8.04\",\"48\":\"162.71\",\"49\":\"75.6\",\"5\":\"46.70\",\"50\":\"25.41\",\"51\":\"86.24\",\"52\":\"251.45\",\"53\":\"0.0050\",\"54\":\"1.68\",\"55\":\"475.35\",\"56\":\"35.47\",\"57\":\"3.8396\",\"58\":\"1052.84\",\"59\":\"64.17\",\"6\":\"5.07\",\"60\":\"3.82\",\"61\":\"265.63\",\"62\":\"3953.54\",\"63\":\"58.44\",\"64\":\"4.52\",\"65\":\"18.93\",\"66\":\"14.01\",\"67\":\"25.61\",\"68\":\"26.05\",\"69\":\"6.66\",\"7\":\"5.36\",\"70\":\"4.08\",\"71\":\"261.67\",\"72\":\"1209.45\",\"73\":\"819.37\",\"74\":\"2134.08\",\"75\":\"1726.00\",\"76\":\"421.24\",\"77\":\"265.40\",\"78\":\"140.33\",\"79\":\"72.37\",\"8\":\"7.35\",\"80\":\"19.51\",\"81\":\"4.78\",\"82\":\"53.24\",\"83\":\"3.94\",\"84\":\"3.19\",\"85\":\"160.94\",\"86\":\"2.22\",\"87\":\"80.94\",\"88\":\"34.53\",\"89\":\"3607.41\",\"9\":\"3.72\",\"90\":\"7.38\",\"91\":\"1922.57\",\"92\":\"85.16\",\"93\":\"83.59\",\"94\":\"71.95\",\"95\":\"6.64\",\"96\":\"0.96\",\"97\":\"1135.53\",\"98\":\"2.48\",\"99\":\"96.97\"},\"id_card_number\":\"\",\"name\":\"测试\",\"number\":\"12345678901\",\"pulse\":\"79\",\"report_date\":\"2014-12-17 17:01:40\",\"respiratory_rate\":\"18\",\"sex\":0,\"stable\":\"99999\",\"total\":\"173.62\",\"weight\":\"45\",\"title\":\"AMP TITLE\",\"account\":\"user1\",\"machine_num\":\"machine_num\"}"; | 17 | + // "{\"ABD\":\"35.66\",\"LAC\":\"36.23\",\"LCA\":\"32.94\",\"RAC\":\"35.84\",\"RCA\":\"33.05\",\"age\":\"24\",\"atmospheric_pressure\":\"756.58\",\"basic_result\":\"初步检测结果(仅供参考):\\n\\n低渗性血管张力异常 \\n\\n有必要排除血凝异常 血凝升高 \\n\\n建议向胃肠病专家(精于胃十二指肠炎)进一步咨询 \\n\\n血管张力异常,静脉循环障碍 酒精性高血压 \\n\\n第三脑室宽度=6.42 \\n\\n建议向妇科医生进一步咨询 其它器官血流量占=4.1 \\n\\nTiffeneau指数持续减少83.6 (Tiffeneau测试) \\n\\n----------------------------------------------------------------------------------------------------------\\n\\n\\n\",\"basic_result_ids\":[1,2,3,4],\"detail\":{\"1\":\"117.54\",\"10\":\"01.29\",\"100\":\"5.06\",\"101\":\"250.60\",\"102\":\"8.61\",\"103\":\"0.319\",\"104\":\"370.02\",\"105\":\"45.98\",\"106\":\"62.96\",\"107\":\"325.68\",\"108\":\"3.750\",\"109\":\"71.52\",\"11\":\"02.13\",\"110\":\"0.136\",\"111\":\"0.392\",\"112\":\"0.079\",\"113\":\"67.78\",\"114\":\"113.66\",\"115\":\"71.55\",\"116\":\"6.42\",\"117\":\"0.91\",\"118\":\"78.4\",\"119\":\"66.0\",\"12\":\"245.28\",\"120\":\"31\",\"121\":\"90\",\"122\":\"340\",\"123\":\"0.93\",\"124\":\"0.97\",\"125\":\"15\",\"13\":\"2.45\",\"14\":\"0.86\",\"15\":\"4.06\",\"16\":\"134.78\",\"17\":\"1.56\",\"18\":\"7.33\",\"19\":\"5.18\",\"2\":\"3.81\",\"20\":\"42.62\",\"21\":\"5.21\",\"22\":\"0.26\",\"23\":\"0.26\",\"24\":\"13.12\",\"25\":\"14.87\",\"26\":\"1.01\",\"27\":\"10.52\",\"28\":\"2.83\",\"29\":\"7.69\",\"3\":\"36.87\",\"30\":\"61.82\",\"31\":\"82.57\",\"32\":\"28.00\",\"33\":\"1.41\",\"34\":\"5.53\",\"35\":\"5.00\",\"36\":\"38.19\",\"37\":\"4.01\",\"38\":\"2.34\",\"39\":\"0.30\",\"4\":\"7.34\",\"40\":\"1.13\",\"41\":\"0.80\",\"42\":\"4.77\",\"43\":\"14.55\",\"44\":\"21.39\",\"45\":\"40.28\",\"46\":\"56.21\",\"47\":\"8.04\",\"48\":\"162.71\",\"49\":\"75.6\",\"5\":\"46.70\",\"50\":\"25.41\",\"51\":\"86.24\",\"52\":\"251.45\",\"53\":\"0.0050\",\"54\":\"1.68\",\"55\":\"475.35\",\"56\":\"35.47\",\"57\":\"3.8396\",\"58\":\"1052.84\",\"59\":\"64.17\",\"6\":\"5.07\",\"60\":\"3.82\",\"61\":\"265.63\",\"62\":\"3953.54\",\"63\":\"58.44\",\"64\":\"4.52\",\"65\":\"18.93\",\"66\":\"14.01\",\"67\":\"25.61\",\"68\":\"26.05\",\"69\":\"6.66\",\"7\":\"5.36\",\"70\":\"4.08\",\"71\":\"261.67\",\"72\":\"1209.45\",\"73\":\"819.37\",\"74\":\"2134.08\",\"75\":\"1726.00\",\"76\":\"421.24\",\"77\":\"265.40\",\"78\":\"140.33\",\"79\":\"72.37\",\"8\":\"7.35\",\"80\":\"19.51\",\"81\":\"4.78\",\"82\":\"53.24\",\"83\":\"3.94\",\"84\":\"3.19\",\"85\":\"160.94\",\"86\":\"2.22\",\"87\":\"80.94\",\"88\":\"34.53\",\"89\":\"3607.41\",\"9\":\"3.72\",\"90\":\"7.38\",\"91\":\"1922.57\",\"92\":\"85.16\",\"93\":\"83.59\",\"94\":\"71.95\",\"95\":\"6.64\",\"96\":\"0.96\",\"97\":\"1135.53\",\"98\":\"2.48\",\"99\":\"96.97\"},\"name\":\"测试\",\"number\":\"12345678901\",\"pulse\":\"79\",\"report_date\":\"2014-12-17 17:01:40\",\"respiratory_rate\":\"18\",\"sex\":0,\"stable\":\"99999\",\"total\":\"173.62\",\"weight\":\"45\",\"title\":\"AMP TITLE\",\"account\":\"user1\",\"machine_num\":\"10311212\"}"; |
18 | + public static String AMP_REPORT = ""; | ||
19 | + | ||
20 | + | ||
21 | + static { | ||
22 | + Data data = new Data(); | ||
23 | + data.generateJsonFormatReport(); | ||
24 | + } | ||
25 | + | ||
26 | + @Test | ||
27 | + public void generateJsonFormatReport() { | ||
28 | + JSONObject report = new JSONObject(); | ||
29 | + report.put("ABD", 35.66); | ||
30 | + report.put("LAC", 36.23); | ||
31 | + report.put("LCA", 32.94); | ||
32 | + report.put("RAC", 35.84); | ||
33 | + report.put("RCA", 33.05); | ||
34 | + report.put("total", 173.62); // sum of the above 5 temperature | ||
35 | + report.put("age", 24); | ||
36 | + report.put("atmospheric_pressure", 756.58); | ||
37 | + // The conclusion string of the report. | ||
38 | + report.put("basic_result", "初步检测结果(仅供参考):\\n\\n低渗性血管张力异常 \\n\\n有必要排除血凝异常 血凝升高 \\n\\n建议向胃肠病专家(精于胃十二指肠炎)进一步咨询 \\n\\n血管张力异常,静脉循环障碍 酒精性高血压 \\n\\n第三脑室宽度=6.42 \\n\\n建议向妇科医生进一步咨询 其它器官血流量占=4.1 \\n\\nTiffeneau指数持续减少83.6 (Tiffeneau测试) \\n\\n----------------------------------------------------------------------------------------------------------\\n\\n\\n"); | ||
39 | + | ||
40 | + JSONObject details = new JSONObject(); | ||
41 | + DecimalFormat df = new java.text.DecimalFormat("######.00"); | ||
42 | + for (int i = 1; i <= 125; i++) { | ||
43 | + details.put(String.valueOf(i), df.format(Math.random() * 100)); // 125 items of the report. | ||
44 | + } | ||
45 | + report.put("detail", details); | ||
46 | + | ||
47 | + | ||
48 | + report.put("name", "user name"); // user name | ||
49 | + report.put("number", "report number"); //report number. Leave it empty if not exist. Such as : report.put("number", ""); | ||
50 | + report.put("pulse", 79); | ||
51 | + report.put("report_date", System.currentTimeMillis()); // physical examination time of this report | ||
52 | + report.put("respiratory_rate", 18); | ||
53 | + report.put("sex", 0); // 0 is male; 1 is female | ||
54 | + report.put("stable", "99999"); | ||
55 | + report.put("weight", 45); | ||
56 | + report.put("title", "AMP无创健康评估报告"); // report title | ||
57 | + report.put("account", "15211112222");//user account | ||
58 | + report.put("machine_num", "10311212");//machine serial | ||
59 | + | ||
60 | + /* | ||
61 | + * Some other temperature serial which not display on the report. | ||
62 | + * They are stored into database in the current software. | ||
63 | + */ | ||
64 | + report.put("T0", "{{{{{{{{{{{{{{{{{{{{{{"); | ||
65 | + report.put("T1", "............"); | ||
66 | + report.put("T2", "+++++++++++"); | ||
67 | + report.put("T3", "@@@@@@@@@@@"); | ||
68 | + report.put("T4", "!!!!!!!!!!!!"); | ||
69 | + | ||
70 | + /* | ||
71 | + * The ID of the conclusion. | ||
72 | + */ | ||
73 | + JSONArray basicResIds = new JSONArray(); | ||
74 | + basicResIds.put(1); | ||
75 | + basicResIds.put(2); | ||
76 | + basicResIds.put(3); | ||
77 | + basicResIds.put(4); | ||
78 | + report.put("basic_result_ids", basicResIds); | ||
13 | 79 | ||
14 | - public static void main(String[] args) { | 80 | + AMP_REPORT = report.toString(); |
81 | + // use http://www.jsoneditoronline.org/ to view the json easily | ||
15 | System.out.println(AMP_REPORT); | 82 | System.out.println(AMP_REPORT); |
16 | } | 83 | } |
17 | } | 84 | } |
@@ -34,6 +34,7 @@ public class ReportTest { | @@ -34,6 +34,7 @@ public class ReportTest { | ||
34 | 34 | ||
35 | @Test | 35 | @Test |
36 | public void testAddReport() { | 36 | public void testAddReport() { |
37 | + // | ||
37 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); | 38 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); |
38 | Map<String, String> params = new HashMap<String, String>(); | 39 | Map<String, String> params = new HashMap<String, String>(); |
39 | params.put("json_report", Data.AMP_REPORT); | 40 | params.put("json_report", Data.AMP_REPORT); |
@@ -45,7 +46,7 @@ public class ReportTest { | @@ -45,7 +46,7 @@ public class ReportTest { | ||
45 | public void testDelReport() { | 46 | public void testDelReport() { |
46 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); | 47 | String token = loginAndGetToken(Data.ADMIN_ACCOUNT, Data.ADMIN_PWD); |
47 | Map<String, String> params = new HashMap<String, String>(); | 48 | Map<String, String> params = new HashMap<String, String>(); |
48 | - params.put("report_id", "85"); | 49 | + params.put("report_id", "101"); |
49 | String response = HttpTools.requestByMapWithToken(URL_REPORT, "DELETE", params, token); | 50 | String response = HttpTools.requestByMapWithToken(URL_REPORT, "DELETE", params, token); |
50 | System.out.println("delete report:" + response); | 51 | System.out.println("delete report:" + response); |
51 | } | 52 | } |
-
Please register or login to post a comment