StatisticsController.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. package com.yihu.wlyy.web.statistic;
  2. import com.yihu.wlyy.entity.statistics.PopulationBase;
  3. import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
  4. import com.yihu.wlyy.service.app.statistics.StatisticsService;
  5. import com.yihu.wlyy.util.ValueComparator;
  6. import com.yihu.wlyy.web.BaseController;
  7. import io.swagger.annotations.Api;
  8. import org.apache.commons.lang3.StringUtils;
  9. import org.json.JSONArray;
  10. import org.json.JSONObject;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.data.redis.core.StringRedisTemplate;
  13. import org.springframework.http.MediaType;
  14. import org.springframework.stereotype.Controller;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RequestMethod;
  17. import org.springframework.web.bind.annotation.RequestParam;
  18. import org.springframework.web.bind.annotation.ResponseBody;
  19. import java.util.*;
  20. /**
  21. * Created by lyr on 2016/08/16.
  22. */
  23. @Controller
  24. @RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  25. @Api(description = "统计")
  26. public class StatisticsController extends BaseController {
  27. @Autowired
  28. StatisticsService statisticsService;
  29. @Autowired
  30. StatisticsAllService statisticsAllService;
  31. /**
  32. * 获取统计时间
  33. *
  34. * @return
  35. */
  36. @RequestMapping(value = "/time")
  37. @ResponseBody
  38. public String getStatisticsTime() {
  39. try {
  40. return write(200, "查询成功", "data", statisticsService.getStatisticsTime());
  41. } catch (Exception e) {
  42. return error(-1, "查询失败");
  43. }
  44. }
  45. /**
  46. * 指标按间隔统计
  47. *
  48. * @param startDate 起始日期
  49. * @param endDate 结束时间
  50. * @param interval 时间间隔
  51. * @param area 区域或机构
  52. * @param level 级别
  53. * @param index 指标
  54. * @return
  55. */
  56. @RequestMapping(value = "/interval")
  57. @ResponseBody
  58. public String indexInterval(@RequestParam(required = true) String startDate,
  59. @RequestParam(required = true) String endDate,
  60. @RequestParam(required = true) int interval,
  61. @RequestParam(required = true) String area,
  62. @RequestParam(required = true) int level,
  63. @RequestParam(required = true) String index,
  64. @RequestParam(required = false) String level2_type) {
  65. String tag = "";
  66. try {
  67. String[] indexes = index.split(",");
  68. JSONObject result = new JSONObject();
  69. if (index != null) {
  70. for (String idx : indexes) {
  71. result.put("index_" + idx, statisticsService.getDateIncrementDetail(startDate, endDate, interval, area, level, idx, level2_type));
  72. }
  73. }
  74. return write(200, "查询成功!", "data", result);
  75. } catch (Exception e) {
  76. return error(-1, tag + "查询失败!");
  77. }
  78. }
  79. /**
  80. * 指标期间增长量
  81. *
  82. * @param startDate
  83. * @param endDate
  84. * @param area
  85. * @param level
  86. * @param index
  87. * @return
  88. */
  89. @RequestMapping("/increment")
  90. @ResponseBody
  91. public String getIndexIncrement(@RequestParam(required = true) String startDate,
  92. @RequestParam(required = true) String endDate,
  93. @RequestParam(required = true) String area,
  94. @RequestParam(required = true) int level,
  95. @RequestParam(required = true) String index) {
  96. try {
  97. String[] indexes = index.split(",");
  98. JSONObject result = new JSONObject();
  99. for (String idx : indexes) {
  100. result.put("index_" + idx, statisticsService.getIntervalIncrement(startDate, endDate, area, level, idx));
  101. }
  102. return write(200, "查询成功", "data", result);
  103. } catch (Exception e) {
  104. e.printStackTrace();
  105. return error(-1, "查询失败");
  106. }
  107. }
  108. /**
  109. * 指标截止日期累积量
  110. *
  111. * @param endDate 结束时间
  112. * @param area 父code
  113. * @param level 等级 1 团队,2 机构,3 区,4 市
  114. * @param index 指标代码
  115. * @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
  116. * @return
  117. */
  118. @RequestMapping("/total")
  119. @ResponseBody
  120. public String getIndexTotal(@RequestParam(required = true) String endDate,
  121. @RequestParam(required = true) String area,
  122. @RequestParam(required = true) int level,
  123. @RequestParam(required = true) String index,
  124. @RequestParam(required = false) String level2_type) {
  125. try {
  126. String[] indexes = index.split(",");
  127. JSONObject result = new JSONObject();
  128. for (String idx : indexes) {
  129. result.put("index_" + idx, statisticsService.getTotalAmount(endDate, area, level, idx, level2_type));
  130. }
  131. return write(200, "查询成功", "data", result);
  132. } catch (Exception e) {
  133. return error(-1, "查询失败");
  134. }
  135. }
  136. /**
  137. * 指标期间增长量
  138. *
  139. * @param startDate
  140. * @param endDate
  141. * @param area
  142. * @param level
  143. * @param index
  144. * @return
  145. */
  146. @RequestMapping("/lowlevel_increment")
  147. @ResponseBody
  148. public String getIndexLowLevelIncrement(@RequestParam(required = true) String startDate,
  149. @RequestParam(required = true) String endDate,
  150. @RequestParam(required = true) String area,
  151. @RequestParam(required = true) int level,
  152. @RequestParam(required = true) String index,
  153. @RequestParam(required = true) int sort,
  154. @RequestParam(required = false) String lowLevel) {
  155. try {
  156. String[] indexes = index.split(",");
  157. JSONObject result = new JSONObject();
  158. for (String idx : indexes) {
  159. result.put("index_" + idx, statisticsService.getLowLevelIncrementDetail(startDate, endDate, area, level, idx, sort, lowLevel));
  160. }
  161. return write(200, "查询成功", "data", result);
  162. } catch (Exception e) {
  163. e.printStackTrace();
  164. return error(-1, "查询失败");
  165. }
  166. }
  167. /**
  168. * 指标截止日期增量
  169. *
  170. * @param endDate 结束时间
  171. * @param area 父code
  172. * @param level 等级 1 团队,2 机构,3 区,4 市
  173. * @param index 指标代码
  174. * @param sort 排序 1倒叙 2是 正序
  175. * @param lowLevel
  176. * @param level2_type 指标代码 例如性别 1 男 2 女 不传就返回男和女的总和
  177. * @return
  178. */
  179. @RequestMapping("/lowlevel_total")
  180. @ResponseBody
  181. public String getIndexLowLevelTotal(@RequestParam(required = true) String endDate,
  182. @RequestParam(required = true) String area,
  183. @RequestParam(required = true) int level,
  184. @RequestParam(required = true) String index,
  185. @RequestParam(required = true) int sort,
  186. @RequestParam(required = false) String lowLevel,
  187. @RequestParam(required = false) String level2_type) {
  188. try {
  189. String[] indexes = index.split(",");
  190. JSONObject result = new JSONObject();
  191. for (String idx : indexes) {
  192. result.put("index_" + idx, statisticsService.getLowLevelTotalDetail(endDate, area, level, idx, sort, lowLevel, level2_type));
  193. }
  194. return write(200, "查询成功", "data", result);
  195. } catch (Exception e) {
  196. return error(-1, "查询失败");
  197. }
  198. }
  199. /**
  200. * 指标截止日期累积量
  201. * 根据2个ID合并指标
  202. *
  203. * @param endDate
  204. * @param area
  205. * @param level
  206. * @param index
  207. * @return
  208. */
  209. @RequestMapping("/lowlevel_total_mesh")
  210. @ResponseBody
  211. public String getIndexLowLevelTotalMesh(@RequestParam(required = true) String endDate, // 2007-10-02
  212. @RequestParam(required = true) String area,//区域 350205
  213. @RequestParam(required = true) int level,//等级
  214. @RequestParam(required = true) String index,//指标code
  215. @RequestParam(required = true) int sort,//1是倒叙 0是正序
  216. @RequestParam(required = false) String lowLevel) {
  217. try {
  218. String[] indexes = index.split(",");
  219. JSONObject result = new JSONObject();
  220. JSONArray returnJa = new JSONArray();
  221. List<JSONArray> jsonArrays = new ArrayList<>();
  222. JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null);
  223. jsonArrays.add(jsonArray1);
  224. JSONArray jsonArray2 = statisticsService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
  225. jsonArrays.add(jsonArray2);
  226. //遍历合并2个指标中key值一样的
  227. if (jsonArrays.get(1).length() == 0) {
  228. //如果只有一个指标的时候 另外一个指标默认是0
  229. for (int i = 0; i < jsonArrays.get(0).length(); i++) {
  230. //未回复咨询不存在的时候默认是0
  231. JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
  232. String amount = map1.get("amount").toString() + ",0";
  233. map1.put("amount", amount);
  234. returnJa.put(map1);
  235. }
  236. } else {
  237. //如果是2个指标的时候,分别放入map中,以减少查询次数
  238. Map<String,JSONObject> in =new TreeMap<>();
  239. ValueComparator vc = new ValueComparator(in);
  240. Map<String,JSONObject> index2=new TreeMap<>();
  241. for (int i = 0; i < jsonArrays.get(0).length(); i++) {
  242. JSONObject map1 = jsonArrays.get(0).getJSONObject(i);
  243. in.put(map1.get("code").toString(),map1);
  244. }
  245. Map<String,JSONObject> index1 =new TreeMap<>(vc);
  246. index1.putAll(in);
  247. for (int i = 0; i < jsonArrays.get(1).length(); i++) {
  248. JSONObject map1 = jsonArrays.get(1).getJSONObject(i);
  249. index2.put(map1.get("code").toString(),map1);
  250. }
  251. for(Map.Entry<String , JSONObject> one:index1.entrySet()){
  252. JSONObject map1 = one.getValue();
  253. JSONObject map2 = index2.get(one.getKey());
  254. String amount = map1.get("amount").toString() + "," + map2.get("amount").toString();
  255. map1.put("amount", amount);
  256. returnJa.put(map1);
  257. }
  258. }
  259. result.put("index_" + indexes[0], returnJa);
  260. return write(200, "查询成功", "data", result);
  261. } catch (
  262. Exception e
  263. )
  264. {
  265. e.printStackTrace();
  266. return error(-1, "查询失败");
  267. }
  268. }
  269. /**
  270. * 指标期间增长量
  271. *
  272. * @param startDate
  273. * @param endDate
  274. * @param area
  275. * @param level
  276. * @param index
  277. * @return
  278. */
  279. @RequestMapping("/leveltwo_increment")
  280. @ResponseBody
  281. public String getIndexLevelTwoIncrement(@RequestParam(required = false) String startDate,
  282. @RequestParam(required = true) String endDate,
  283. @RequestParam(required = true) String area,
  284. @RequestParam(required = true) int level,
  285. @RequestParam(required = true) String index) {
  286. try {
  287. String[] indexes = index.split(",");
  288. JSONObject result = new JSONObject();
  289. for (String idx : indexes) {
  290. result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(endDate, area, level, idx));
  291. }
  292. return write(200, "查询成功", "data", result);
  293. } catch (Exception e) {
  294. e.printStackTrace();
  295. return error(-1, "查询失败");
  296. }
  297. }
  298. /**
  299. * 获取签约率、签约完成率
  300. *
  301. * @param endDate 截止日期
  302. * @param area 区域
  303. * @param level 区域级别 4:城市 3:区 2:社区 1:团队
  304. * @return
  305. */
  306. @RequestMapping(value = "/sign_info")
  307. @ResponseBody
  308. public String getAreaSignInfo(@RequestParam(required = true) String endDate,
  309. @RequestParam(required = true) String area,
  310. @RequestParam(required = true) int level,
  311. @RequestParam(required = false) String lowCode) {
  312. try {
  313. JSONObject result = new JSONObject();
  314. if (StringUtils.isEmpty(lowCode)) {
  315. long sign = statisticsAllService.getIndexTotal(endDate, area, level, "13");
  316. long weiJf = statisticsAllService.getWeiJiaoFei(endDate, area, level);
  317. JSONObject signRate = statisticsAllService.getSignRate(endDate, area, level);
  318. JSONObject signTaskRate = statisticsAllService.getSignTaskRate(endDate, area, level);
  319. result.put("sign", sign);
  320. result.put("expenses", weiJf);
  321. result.put("signRate", signRate);
  322. result.put("signTaskRate", signTaskRate);
  323. } else {
  324. result = statisticsAllService.getGroupInfo(endDate, lowCode, area, level);
  325. }
  326. return write(200, "查询成功", "data", result);
  327. } catch (Exception e) {
  328. return error(-1, "查询失败");
  329. }
  330. }
  331. /**
  332. * 获取三级指标增量
  333. *
  334. * @param startDate
  335. * @param endDate
  336. * @param area
  337. * @param level
  338. * @return
  339. */
  340. @RequestMapping(value = "/sixfive_statistics")
  341. @ResponseBody
  342. public String getSixFiveStatistics(@RequestParam(required = false) String startDate,
  343. @RequestParam(required = true) String endDate,
  344. @RequestParam(required = true) String area, int level) {
  345. try {
  346. JSONArray result = statisticsAllService.getSixFiveStatistics(endDate, area, level);
  347. return write(200, "查询成功", "data", result);
  348. } catch (Exception e) {
  349. e.printStackTrace();
  350. return error(-1, "查询失败");
  351. }
  352. }
  353. /**
  354. * 指标按间隔统计
  355. *
  356. * @param startDate 起始日期
  357. * @param endDate 结束时间
  358. * @param interval 时间间隔
  359. * @param area 区域或机构
  360. * @param level 级别
  361. * @param index 指标
  362. * @return
  363. */
  364. @RequestMapping(value = "/interval_total")
  365. @ResponseBody
  366. public String indexIntervalTotal(@RequestParam(required = true) String startDate,
  367. @RequestParam(required = true) String endDate,
  368. @RequestParam(required = true) int interval,
  369. @RequestParam(required = true) String area,
  370. @RequestParam(required = true) int level,
  371. @RequestParam(required = true) String index,
  372. @RequestParam(required = false) String lowCode) {
  373. try {
  374. String[] indexes = index.split(",");
  375. JSONObject result = new JSONObject();
  376. if (index != null) {
  377. for (String idx : indexes) {
  378. result.put("index_" + idx, statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode));
  379. }
  380. }
  381. return write(200, "查询成功!", "data", result);
  382. } catch (Exception e) {
  383. return error(-1, "查询失败!");
  384. }
  385. }
  386. /**
  387. * 指标截止日期累积量
  388. *
  389. * @param date
  390. * @param area
  391. * @param level level1_type等级 1:团队 2社区机构 3区级 4市级
  392. * @param index quotoCode 18/19两率
  393. * @param sort 1降序排列-1升序排列
  394. * @return
  395. */
  396. @RequestMapping("/lowlevel_all")
  397. @ResponseBody
  398. public String getIndexLowLevelTotalSign(@RequestParam(required = true) String date,
  399. @RequestParam(required = true) String area,
  400. @RequestParam(required = true) int level,
  401. @RequestParam(required = true) String index,
  402. @RequestParam(required = true) int sort,
  403. @RequestParam(required = false) String lowLevel,
  404. @RequestParam(required = false) String lowCode,
  405. @RequestParam(required = false) String startDate) {
  406. try {
  407. String[] indexes = index.split(",");
  408. JSONObject result = new JSONObject();
  409. if (StringUtils.isNotEmpty(lowCode)) {
  410. // 指定level下特定查询级别
  411. result.put("index_" + index, statisticsAllService.getLevelTwoLowLevelTotal(date, area, level, index, sort, lowLevel, lowCode));
  412. } else {
  413. // 未指定level下特定查询级别
  414. for (String idx : indexes) {
  415. if (idx.equals("18") || index.equals("19")) {
  416. result.put("index_" + idx, statisticsAllService.getLowLevelTotalSpecial(date, area, level, idx, sort, lowLevel));
  417. } else if (idx.equals("1") || index.equals("21")) {
  418. result.put("index_" + idx, statisticsAllService.getLowLevelTotal2(date, area, level, idx, sort, lowLevel));
  419. } else if (idx.equals("28")){
  420. result.put("index_" + idx, statisticsService.getAvgAllInfo(level,area,lowLevel));
  421. } else{
  422. result.put("index_" + idx, statisticsAllService.getLowLevelTotal(date, area, level, idx, sort, lowLevel));
  423. }
  424. }
  425. }
  426. return write(200, "查询成功", "data", result);
  427. } catch (Exception e) {
  428. e.printStackTrace();
  429. return error(-1, "查询失败");
  430. }
  431. }
  432. /**
  433. * 获取三师转签或高危人群
  434. *
  435. * @param endDate
  436. * @param area
  437. * @param level
  438. * @return
  439. */
  440. @RequestMapping(value = "/sszq_qwrq_info")
  441. @ResponseBody
  442. public String getSszqAndGwrq(@RequestParam(required = true) String endDate,
  443. @RequestParam(required = true) String area,
  444. @RequestParam(required = true) int level) {
  445. try {
  446. JSONObject result = new JSONObject();
  447. JSONObject sszq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "18");
  448. JSONObject gwrq = statisticsAllService.getSszqAndGwrq(endDate, area, level, "19");
  449. result.put("sszq", sszq);
  450. result.put("gwrq", gwrq);
  451. return write(200, "查询成功", "data", result);
  452. } catch (Exception e) {
  453. return error(-1, "查询失败");
  454. }
  455. }
  456. /**
  457. * 二级指标到达量
  458. *
  459. * @param date
  460. * @param area
  461. * @param level
  462. * @param index
  463. * @return
  464. */
  465. @RequestMapping(value = "/leveltwo_all")
  466. @ResponseBody
  467. public String getIndexLevelTwoTotal(@RequestParam(required = true) String date,
  468. @RequestParam(required = true) String area,
  469. @RequestParam(required = true) int level,
  470. @RequestParam(required = true) String index) {
  471. try {
  472. String[] indexes = index.split(",");
  473. JSONObject result = new JSONObject();
  474. for (String idx : indexes) {
  475. result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(date, area, level, idx));
  476. }
  477. return write(200, "查询成功", "data", result);
  478. } catch (Exception e) {
  479. e.printStackTrace();
  480. return error(-1, "查询失败");
  481. }
  482. }
  483. /**
  484. * 指标截止日期到达量
  485. *
  486. * @param endDate
  487. * @param area
  488. * @param level
  489. * @param index
  490. * @return
  491. */
  492. @RequestMapping("/index_all")
  493. @ResponseBody
  494. public String getIndexAll(@RequestParam(required = true) String endDate,
  495. @RequestParam(required = true) String area,
  496. @RequestParam(required = true) int level,
  497. @RequestParam(required = true) String index) {
  498. try {
  499. String[] indexes = index.split(",");
  500. JSONObject result = new JSONObject();
  501. for (String idx : indexes) {
  502. result.put("index_" + idx, statisticsAllService.getIndexTotal(endDate, area, level, idx));
  503. }
  504. return write(200, "查询成功", "data", result);
  505. } catch (Exception e) {
  506. return error(-1, "查询失败");
  507. }
  508. }
  509. /**
  510. * 咨询统计
  511. * 咨询分析页面具体交互与业务分析内一致,即按市、区、社区、机构有不同展示,可一级级进入查看
  512. * ①回复及时率------医生首次回复24小时内比例
  513. * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
  514. * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
  515. *
  516. * @param level 查询的等级,按市、区、机构
  517. * @param area 查询的等级对应Code
  518. * @return
  519. */
  520. @RequestMapping("/Consulting_Stat")
  521. @ResponseBody
  522. public String getConsultingStatistics(@RequestParam(required = true) Integer level,
  523. @RequestParam(required = true) String area) {
  524. try {
  525. return write(200, "查询成功", "data", statisticsService.getConsultingStatistics(level, area));
  526. } catch (Exception e) {
  527. return error(-1, "查询失败");
  528. }
  529. }
  530. /**
  531. * 咨询统计
  532. * 咨询分析页面具体交互与业务分析内一致,即按市、区、社区、机构有不同展示,可一级级进入查看
  533. * ①回复及时率------医生首次回复24小时内比例
  534. * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
  535. * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
  536. *
  537. * @param level 查询的等级,按市、区、机构
  538. * @return
  539. */
  540. @RequestMapping("/Consulting_StatList")
  541. @ResponseBody
  542. public String getConsultingStatisticsList(@RequestParam(required = true) Integer level,
  543. @RequestParam(required = true) String area,
  544. @RequestParam(required = false) String lowlevel) {
  545. try {
  546. JSONObject data = statisticsService.getConsultingStatisticsList(level, area, lowlevel);
  547. if (data != null) {
  548. return write(200, "查询成功", "data", data);
  549. } else {
  550. return error(-1, "查询失败");
  551. }
  552. } catch (Exception e) {
  553. return error(-1, "查询失败");
  554. }
  555. }
  556. /**
  557. * 咨询统计
  558. * 咨询分析页面具体交互与业务分析内一致,即按市、区、社区、机构有不同展示,可一级级进入查看
  559. * ①回复及时率------医生首次回复24小时内比例
  560. * ②未回复数(数、率)----------当前未回复咨询数、以及相应比例
  561. * ③处理咨询回复时间分布---------全部咨询的首次回复咨询时间分布
  562. *
  563. * @param level 查询的等级,按市、区、机构
  564. * @return
  565. */
  566. @RequestMapping("/Consulting_Title")
  567. @ResponseBody
  568. public String getConsultingTitle(@RequestParam(required = true) Integer level,
  569. @RequestParam(required = true) String area) {
  570. try {
  571. JSONObject data = statisticsService.getConsultingTitle(level, area);
  572. if (data != null) {
  573. return write(200, "查询成功", "data", data);
  574. } else {
  575. return error(-1, "查询失败");
  576. }
  577. } catch (Exception e) {
  578. return error(-1, "查询失败");
  579. }
  580. }
  581. /**
  582. * 获取回复数时间分布数
  583. *
  584. * @param level
  585. * @param area
  586. * @return
  587. */
  588. @RequestMapping("/getCoutListByTime")
  589. @ResponseBody
  590. public String getCoutListByTime(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
  591. try {
  592. return write(200, "查询成功", "data", statisticsService.getCoutListByTime(level, area));
  593. } catch (Exception e) {
  594. return error(-1, "查询失败");
  595. }
  596. }
  597. /**
  598. * 获取绑定率
  599. * 1、选定绑定微信指标,下面排行内,在绑定微信数后新增:"绑定率:xx.22%"
  600. * 2、绑定率=绑定数/已签约数
  601. *
  602. * @return
  603. */
  604. @RequestMapping("/bindingRate_stat")
  605. @ResponseBody
  606. public String getBindingRate() {
  607. try {
  608. return write(200, "查询成功", "data", statisticsService.getBindingRate());
  609. } catch (Exception e) {
  610. return error(-1, "查询失败");
  611. }
  612. }
  613. /**
  614. * 获取得分平均数
  615. * @param level
  616. * @param area
  617. * @return
  618. */
  619. @RequestMapping("/getAVGSocre")
  620. @ResponseBody
  621. public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
  622. try {
  623. return write(200, "查询成功", "data", statisticsService.getAVGSocre(level,area));
  624. } catch (Exception e) {
  625. return error(-1, "查询失败");
  626. }
  627. }
  628. /**
  629. * 获取得分平均数按月份
  630. * @return
  631. */
  632. @RequestMapping("/getAVGSocreByMonth")
  633. @ResponseBody
  634. public String getAVGSocreByMonth(@RequestParam(required = true)String level ,
  635. @RequestParam(required = true)String area,
  636. @RequestParam(required = true)String statDate,
  637. @RequestParam(required = true)String endDate){
  638. try {
  639. return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level,area,statDate,endDate));
  640. } catch (Exception e) {
  641. return error(-1, "查询失败");
  642. }
  643. }
  644. }