Commit 5c755f054dcce40a729fcc17c0caf3df4002dfd2

Authored by hanshaofeng
1 parent 1211c2cfb6

qhdfy send msg in home

Showing 8 changed files with 179 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java View file @ 5c755f0
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3 import com.lyms.platform.biz.service.ArchiveDataServicer;
  4 +import com.lyms.platform.common.annotation.TokenRequired;
4 5 import com.lyms.platform.common.base.BaseController;
  6 +import com.lyms.platform.common.base.LoginContext;
  7 +import com.lyms.platform.common.utils.MessageUtil;
  8 +import com.lyms.platform.common.utils.PropertiesUtils;
5 9 import com.lyms.platform.pojo.ArchiveData;
6 10 import com.lyms.platform.query.ArchiveDataQuery;
  11 +import org.apache.commons.httpclient.HttpClient;
7 12 import org.springframework.beans.factory.annotation.Autowired;
8 13 import org.springframework.stereotype.Controller;
9 14 import org.springframework.web.bind.annotation.RequestMapping;
10 15 import org.springframework.web.bind.annotation.RequestMethod;
  16 +import org.springframework.web.bind.annotation.RequestParam;
11 17  
  18 +import javax.servlet.http.HttpServletRequest;
12 19 import javax.servlet.http.HttpServletResponse;
  20 +import java.io.IOException;
13 21 import java.util.List;
14 22  
15 23 /**
... ... @@ -21,6 +29,8 @@
21 29 @Autowired
22 30 private ArchiveDataServicer archiveDataServicer;
23 31  
  32 + public static final String center_statistics_url= PropertiesUtils.getPropertyValue("center_statistics_url");
  33 +
24 34 @RequestMapping(value = "/bookArchive",method = RequestMethod.GET)
25 35 public void queryBookArchive(HttpServletResponse response, String idCard, String hospitalId) {
26 36 ArchiveDataQuery query = new ArchiveDataQuery();
... ... @@ -44,6 +54,30 @@
44 54 data.setJsonData(jsonData);
45 55 archiveDataServicer.saveArchiveData(data);
46 56 writeString(response,"success");
  57 + }
  58 +
  59 + @RequestMapping(value = "/queryYunChanQiRenShu", method = RequestMethod.GET)
  60 + @TokenRequired
  61 + public void queryYunChanQiRenShu(HttpServletResponse response, @RequestParam(value = "hospitalId")String hospitalId, String dateRange) {
  62 + StringBuffer params = new StringBuffer();
  63 + params.append("hospitalId=");
  64 + params.append(hospitalId);
  65 + if (org.apache.commons.lang.StringUtils.isNotBlank(dateRange)) {
  66 + params.append("&dateRange=");
  67 + params.append(dateRange);
  68 + }
  69 + MessageUtil.UTF8GetMethod utf8GetMethod = new MessageUtil.UTF8GetMethod(center_statistics_url+"statistics/queryYunChanQiRenShu?" + params.toString());
  70 + HttpClient client = new HttpClient();
  71 + try {
  72 + client.executeMethod(utf8GetMethod);
  73 + int statusCode = utf8GetMethod.getStatusCode();
  74 + if (200 == statusCode) {
  75 + String json = new String(utf8GetMethod.getResponseBodyAsString());
  76 + writeJson(response, json);
  77 + }
  78 + } catch (IOException e) {
  79 + e.printStackTrace();
  80 + }
47 81 }
48 82  
49 83 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StatisticsController.java View file @ 5c755f0
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.common.annotation.TokenRequired;
4 4 import com.lyms.platform.common.base.BaseController;
5 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.utils.DateUtil;
6 7 import com.lyms.platform.common.utils.JsonUtil;
7 8 import com.lyms.platform.common.utils.ResultUtils;
8 9 import com.lymsh.platform.reportdata.model.AreaData;
... ... @@ -32,6 +33,8 @@
32 33 @Autowired
33 34 private StatisticsService statisticsService;
34 35  
  36 +
  37 +
35 38 @RequestMapping(value = "/countryData", method = RequestMethod.GET)
36 39 @TokenRequired
37 40 public void getCountryData(HttpServletResponse response, @RequestParam(value = "year", required = false)String year) {
... ... @@ -1128,6 +1131,28 @@
1128 1131 yAxis.setData(xData);
1129 1132 option.setxAxis(yAxis);
1130 1133 return option;
  1134 + }
  1135 +
  1136 + @RequestMapping(value = "/queryYunChanQiRenShu", method = RequestMethod.GET)
  1137 + public void queryYunChanQiRenShu(HttpServletResponse response, @RequestParam(value = "hospitalId")String hospitalId, String dateRange) {
  1138 + AreaDataQuery query = new AreaDataQuery();
  1139 + query.setLocalHospitalId(hospitalId);
  1140 + try {
  1141 + String[] dd = dateRange.split(" - ");
  1142 + query.setStart(DateUtil.getDayStartTime(DateUtil.parseYMD(dd[0])));
  1143 + query.setEnd(DateUtil.getDayStartTime(DateUtil.parseYMD(dd[1])));
  1144 + } catch (Exception e) {}
  1145 + List<AreaData> list = statisticsService.queryYunChanQiRenShu(query);
  1146 + Map<String,List<String>> map = new HashMap<>();
  1147 + List<String> xlist = new ArrayList<>();
  1148 + List<String> ylist = new ArrayList<>();
  1149 + for (AreaData data:list) {
  1150 + xlist.add(data.getVal().toString());
  1151 + ylist.add(DateUtil.getyyyy_MM_dd(data.getYmd()));
  1152 + }
  1153 + map.put("x", xlist);
  1154 + map.put("u", ylist);
  1155 + writeJson(response, JsonUtil.obj2JsonString(map));
1131 1156 }
1132 1157  
1133 1158 }
platform-reportData/src/main/java/com/lymsh/platform/reportdata/dao/StatisticsMapper.java View file @ 5c755f0
... ... @@ -105,5 +105,12 @@
105 105 */
106 106 public List<AreaData> queryDaysRisks(AreaDataQuery query);
107 107  
  108 + /**
  109 + * --ๅญ•ไบงๆœŸไบบๆ•ฐ็ปŸ่ฎก
  110 + * @param query
  111 + * @return
  112 + */
  113 + public List<AreaData> queryYunChanQiRenShu(AreaDataQuery query);
  114 +
108 115 }
platform-reportData/src/main/java/com/lymsh/platform/reportdata/model/AreaData.java View file @ 5c755f0
... ... @@ -19,6 +19,33 @@
19 19 private Integer val2;
20 20 private String year;
21 21 private Date ymd;
  22 + private String hospitalId;
  23 + private String hospitalName;
  24 + private String localHospitalId;
  25 +
  26 + public String getHospitalId() {
  27 + return hospitalId;
  28 + }
  29 +
  30 + public void setHospitalId(String hospitalId) {
  31 + this.hospitalId = hospitalId;
  32 + }
  33 +
  34 + public String getHospitalName() {
  35 + return hospitalName;
  36 + }
  37 +
  38 + public void setHospitalName(String hospitalName) {
  39 + this.hospitalName = hospitalName;
  40 + }
  41 +
  42 + public String getLocalHospitalId() {
  43 + return localHospitalId;
  44 + }
  45 +
  46 + public void setLocalHospitalId(String localHospitalId) {
  47 + this.localHospitalId = localHospitalId;
  48 + }
22 49  
23 50 public String getGroupName() {
24 51 return groupName;
platform-reportData/src/main/java/com/lymsh/platform/reportdata/model/AreaDataQuery.java View file @ 5c755f0
1 1 package com.lymsh.platform.reportdata.model;
2 2  
  3 +import java.util.Date;
  4 +
3 5 /**
4 6 * Created by Administrator on 2016/6/30 0030.
5 7 */
... ... @@ -10,6 +12,33 @@
10 12 private String areaId;
11 13 private String year;
12 14 private Integer days;
  15 + private String localHospitalId;
  16 + private Date start;
  17 + private Date end;
  18 +
  19 + public String getLocalHospitalId() {
  20 + return localHospitalId;
  21 + }
  22 +
  23 + public void setLocalHospitalId(String localHospitalId) {
  24 + this.localHospitalId = localHospitalId;
  25 + }
  26 +
  27 + public Date getStart() {
  28 + return start;
  29 + }
  30 +
  31 + public void setStart(Date start) {
  32 + this.start = start;
  33 + }
  34 +
  35 + public Date getEnd() {
  36 + return end;
  37 + }
  38 +
  39 + public void setEnd(Date end) {
  40 + this.end = end;
  41 + }
13 42  
14 43 public Integer getDays() {
15 44 return days;
platform-reportData/src/main/java/com/lymsh/platform/reportdata/service/StatisticsService.java View file @ 5c755f0
... ... @@ -105,5 +105,12 @@
105 105 */
106 106 public List<AreaData> queryDaysRisks(AreaDataQuery query);
107 107  
  108 + /**
  109 + * --ๅญ•ไบงๆœŸไบบๆ•ฐ็ปŸ่ฎก
  110 + * @param query
  111 + * @return
  112 + */
  113 + public List<AreaData> queryYunChanQiRenShu(AreaDataQuery query);
  114 +
108 115 }
platform-reportData/src/main/java/com/lymsh/platform/reportdata/service/impl/StatisticsServiceImpl.java View file @ 5c755f0
... ... @@ -92,5 +92,11 @@
92 92 public List<AreaData> queryDaysRisks(AreaDataQuery query) {
93 93 return statisticsMapper.queryDaysRisks(query);
94 94 }
  95 +
  96 + @Override
  97 + public List<AreaData> queryYunChanQiRenShu(AreaDataQuery query) {
  98 + return statisticsMapper.queryYunChanQiRenShu(query);
  99 + }
  100 +
95 101 }
platform-reportData/src/main/resources/reportOrm/StatisticsMapper.xml View file @ 5c755f0
... ... @@ -15,6 +15,9 @@
15 15 <result column="val" property="val" jdbcType="INTEGER"/>
16 16 <result column="val2" property="val2" jdbcType="INTEGER"/>
17 17 <result column="ymd" property="ymd" jdbcType="TIMESTAMP"/>
  18 + <result column="hospitalId" property="hospitalId" jdbcType="VARCHAR"/>
  19 + <result column="hospitalName" property="hospitalName" jdbcType="VARCHAR"/>
  20 + <result column="localHospitalId" property="localHospitalId" jdbcType="VARCHAR"/>
18 21 </resultMap>
19 22  
20 23 <select id="queryProvincePatientsByYear" resultMap="AreaDataResultMap" parameterType="java.lang.String">
... ... @@ -631,6 +634,47 @@
631 634 F.HIGH_RISK_GROUP,
632 635 E.DATE_2
633 636 ORDER BY F.HIGH_RISK_GROUP,E.DATE_2;
  637 + </select>
  638 +
  639 +
  640 + <select id="queryYunChanQiRenShu" resultMap="AreaDataResultMap"
  641 + parameterType="com.lymsh.platform.reportdata.model.AreaDataQuery">
  642 + SELECT
  643 + B.PROVINCE as province_name,
  644 + B.PROVINCE_ID as province_id,
  645 + B.CITY as city_name,
  646 + B.CITY_ID as city_id,
  647 + B.AREA_COUNTY as area_name,
  648 + B.AREA_COUNTY_ID as area_id,
  649 + B.HOSPITAL_NAME as hospitalName,
  650 + B.HOSPITAL_NO as hospitalId,
  651 + B.YCY_STSTEM_ID as localHospitalId,
  652 + A.EDD_DATE as ymd,
  653 + COUNT(*) AS val
  654 +FROM ODS_F_GRAVIDA_RECORD A,
  655 + ODS_D_HOSPITAL B
  656 +WHERE A.HOSPITAL_NO=B.HOSPITAL_NO
  657 + AND A.EDD_DATE IS NOT NULL
  658 + AND A.IS_CHILDBIRTH=1
  659 + AND B.YCY_STSTEM_ID={localHospitalId}
  660 + <if test="start != null">
  661 + <![CDATA[ and A.EDD_DATE >= #{start,jdbcType=TIMESTAMP} ]]>
  662 + </if>
  663 + <if test="end != null">
  664 + <![CDATA[ and A.EDD_DATE <= #{end,jdbcType=TIMESTAMP} ]]>
  665 + </if>
  666 +GROUP BY
  667 + B.PROVINCE,
  668 + B.PROVINCE_ID,
  669 + B.CITY,
  670 + B.CITY_ID,
  671 + B.AREA_COUNTY,
  672 + B.AREA_COUNTY_ID,
  673 + B.HOSPITAL_NAME,
  674 + B.HOSPITAL_NO,
  675 + B.YCY_STSTEM_ID,
  676 + A.EDD_DATE
  677 +ORDER BY A.EDD_DATE
634 678 </select>
635 679  
636 680 </mapper>