Commit 33b194f3a50ad013a065af8df5feac55d4ed277b
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 22 changed files
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterLisMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/LisReportModel.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/LisService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml
- platform-common/pom.xml
- platform-common/src/main/java/com/lyms/platform/common/base/BaseController.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java
- platform-operate-api/pom.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/IBaseDao.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/IReportDao.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/impl/BaseDaoImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/impl/ReportDaoImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/HttpClientUtil.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MathUtil.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SystemDataSource.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterLisMapper.java
View file @
33b194f
platform-biz-service/src/main/java/com/lyms/platform/permission/model/LisReportModel.java
View file @
33b194f
... | ... | @@ -51,6 +51,18 @@ |
51 | 51 | //检验项集合 |
52 | 52 | private List<LisReportItemModel> items; |
53 | 53 | |
54 | + | |
55 | + //检验明细json | |
56 | + private String itemJson; | |
57 | + | |
58 | + public String getItemJson() { | |
59 | + return itemJson; | |
60 | + } | |
61 | + | |
62 | + public void setItemJson(String itemJson) { | |
63 | + this.itemJson = itemJson; | |
64 | + } | |
65 | + | |
54 | 66 | public String getPhone() { |
55 | 67 | return phone; |
56 | 68 | } |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/LisService.java
View file @
33b194f
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
View file @
33b194f
... | ... | @@ -40,11 +40,11 @@ |
40 | 40 | if (CollectionUtils.isEmpty(dbLis)) |
41 | 41 | { |
42 | 42 | masterLisMapper.saveLisData(model); |
43 | - List<LisReportItemModel> items = model.getItems(); | |
44 | - if (CollectionUtils.isNotEmpty(items)) | |
45 | - { | |
46 | - masterLisMapper.saveLisItemsData(items); | |
47 | - } | |
43 | +// List<LisReportItemModel> items = model.getItems(); | |
44 | +// if (CollectionUtils.isNotEmpty(items)) | |
45 | +// { | |
46 | +// masterLisMapper.saveLisItemsData(items); | |
47 | +// } | |
48 | 48 | } |
49 | 49 | |
50 | 50 | } |
... | ... | @@ -70,6 +70,11 @@ |
70 | 70 | public List<LisReportItemModel> queryLisItemByModel(LisReportItemModel query) { |
71 | 71 | |
72 | 72 | return masterLisMapper.queryLisItemByModel(query); |
73 | + } | |
74 | + | |
75 | + @Override | |
76 | + public List<LisReportModel> queryListItems(LisReportModel query) { | |
77 | + return masterLisMapper.queryListItems(query); | |
73 | 78 | } |
74 | 79 | } |
platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml
View file @
33b194f
... | ... | @@ -21,7 +21,8 @@ |
21 | 21 | MODIFIED, |
22 | 22 | CREATED, |
23 | 23 | HOSPITAL_ID, |
24 | - PHONE | |
24 | + PHONE, | |
25 | + ITEM_JSON | |
25 | 26 | ) VALUES ( |
26 | 27 | #{lisId}, |
27 | 28 | #{title}, |
... | ... | @@ -40,7 +41,8 @@ |
40 | 41 | #{modified}, |
41 | 42 | #{created}, |
42 | 43 | #{hospitalId}, |
43 | - #{phone} | |
44 | + #{phone}, | |
45 | + #{itemJson} | |
44 | 46 | ) |
45 | 47 | |
46 | 48 | </insert> |
... | ... | @@ -138,5 +140,80 @@ |
138 | 140 | AND HOSPITAL_ID = #{hospitalId} |
139 | 141 | </if> |
140 | 142 | </select> |
143 | + | |
144 | + | |
145 | + <select id="queryListItems" parameterType="com.lyms.platform.permission.model.LisReportModel" resultMap="queryListItemsMap"> | |
146 | + SELECT | |
147 | + LR.LIS_ID, | |
148 | + LR.TITLE, | |
149 | + LR.TYPE, | |
150 | + LR.VCCARDNO, | |
151 | + LR.NAME, | |
152 | + LR.BHNUM, | |
153 | + LR.AGE, | |
154 | + LR.SEX, | |
155 | + LR.APPLY_TIME, | |
156 | + LR.CHECK_TIME, | |
157 | + LR.PUBLISH_TIME, | |
158 | + LR.APPLY_DOCTOR, | |
159 | + LR.APPLY_DEPT, | |
160 | + LR.CHECKER, | |
161 | + LR.MODIFIED, | |
162 | + LR.CREATED, | |
163 | + LR.HOSPITAL_ID, | |
164 | + LR.PHONE, | |
165 | + LI.LIS_ID AS ITEM_LIS_ID, | |
166 | + LI.CODE, | |
167 | + LI.NAME AS ITEM_NAME, | |
168 | + LI.RESULT, | |
169 | + LI.RESULT_FLAG, | |
170 | + LI.REF, | |
171 | + LI.RESULT_TYPE, | |
172 | + LI.UNIT, | |
173 | + LI.PRINT_ORDER | |
174 | + FROM LIS_REPORT_ITEM_TBL LI | |
175 | + LEFT JOIN LIS_REPORT_TBL LR | |
176 | + ON LR.LIS_ID = LI.LIS_ID | |
177 | + WHERE | |
178 | + LR.VCCARDNO=#{vcCardNo} | |
179 | + AND | |
180 | + LR.HOSPITAL_ID=#{hospitalId} | |
181 | + AND | |
182 | + LI.HOSPITAL_ID=#{hospitalId} | |
183 | + </select> | |
184 | + | |
185 | + | |
186 | + <resultMap id="queryListItemsMap" type="com.lyms.platform.permission.model.LisReportModel" > | |
187 | + <id property="lisId" column="LIS_ID"/> | |
188 | + <result property="title" column="TITLE"/> | |
189 | + <result property="type" column="TYPE"/> | |
190 | + <result property="vcCardNo" column="VCCARDNO"/> | |
191 | + <result property="name" column="NAME"/> | |
192 | + <result property="bhnum" column="BHNUM"/> | |
193 | + <result property="age" column="AGE"/> | |
194 | + <result property="sex" column="SEX"/> | |
195 | + <result property="applyTime" column="APPLY_TIME"/> | |
196 | + <result property="checkTime" column="CHECK_TIME"/> | |
197 | + <result property="publishTime" column="PUBLISH_TIME"/> | |
198 | + <result property="applyDoctor" column="APPLY_DOCTOR"/> | |
199 | + <result property="applyDept" column="APPLY_DEPT"/> | |
200 | + <result property="checker" column="CHECKER"/> | |
201 | + <result property="modified" column="MODIFIED"/> | |
202 | + <result property="created" column="CREATED"/> | |
203 | + <result property="hospitalId" column="HOSPITAL_ID"/> | |
204 | + <result property="phone" column="PHONE"/> | |
205 | + <collection property="items" column="ITEM_LIS_ID" ofType="com.lyms.platform.permission.model.LisReportItemModel"> | |
206 | + <id property="lisId" column="ITEM_LIS_ID"/> | |
207 | + <result property="code" column="CODE"/> | |
208 | + <result property="name" column="ITEM_NAME"/> | |
209 | + <result property="result" column="RESULT"/> | |
210 | + <result property="resultFlag" column="RESULT_FLAG"/> | |
211 | + <result property="ref" column="REF"/> | |
212 | + <result property="resultType" column="RESULT_TYPE"/> | |
213 | + <result property="unit" column="UNIT"/> | |
214 | + <result property="printOrder" column="PRINT_ORDER"/> | |
215 | + <result property="hospitalId" column="HOSPITAL_ID"/> | |
216 | + </collection> | |
217 | + </resultMap> | |
141 | 218 | </mapper> |
platform-common/pom.xml
View file @
33b194f
... | ... | @@ -34,6 +34,11 @@ |
34 | 34 | <version>2.6.12</version> |
35 | 35 | </dependency> |
36 | 36 | <!-- end Execl --> |
37 | + <dependency> | |
38 | + <groupId>org.apache.commons</groupId> | |
39 | + <artifactId>commons-lang3</artifactId> | |
40 | + <version>3.4</version> | |
41 | + </dependency> | |
37 | 42 | </dependencies> |
38 | 43 | <build> |
39 | 44 | <plugins> |
platform-common/src/main/java/com/lyms/platform/common/base/BaseController.java
View file @
33b194f
1 | 1 | package com.lyms.platform.common.base; |
2 | 2 | |
3 | 3 | |
4 | +import com.lyms.platform.common.utils.DateUtil; | |
5 | +import org.springframework.web.bind.WebDataBinder; | |
6 | +import org.springframework.web.bind.annotation.InitBinder; | |
7 | + | |
4 | 8 | import javax.servlet.http.HttpServletRequest; |
5 | 9 | import javax.servlet.http.HttpServletResponse; |
10 | +import java.beans.PropertyEditorSupport; | |
6 | 11 | import java.io.IOException; |
7 | 12 | import java.io.PrintWriter; |
13 | +import java.sql.Timestamp; | |
14 | +import java.util.Date; | |
8 | 15 | import java.util.HashMap; |
9 | 16 | import java.util.Map; |
10 | 17 | |
... | ... | @@ -81,6 +88,28 @@ |
81 | 88 | ip = request.getRemoteAddr(); |
82 | 89 | } |
83 | 90 | return ip; |
91 | + } | |
92 | + | |
93 | + @InitBinder | |
94 | + public void initBinder(WebDataBinder binder) { | |
95 | + // Date 类型转换 | |
96 | + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() { | |
97 | + | |
98 | + @Override | |
99 | + public void setAsText(String text) { | |
100 | + setValue(DateUtil.parseDate(text)); | |
101 | + } | |
102 | + }); | |
103 | + | |
104 | + // Timestamp 类型转换 | |
105 | + binder.registerCustomEditor(Timestamp.class, new PropertyEditorSupport() { | |
106 | + | |
107 | + @Override | |
108 | + public void setAsText(String text) { | |
109 | + Date date = DateUtil.parseDate(text); | |
110 | + setValue(date == null ? null : new Timestamp(date.getTime())); | |
111 | + } | |
112 | + }); | |
84 | 113 | } |
85 | 114 | } |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
33b194f
... | ... | @@ -19,6 +19,8 @@ |
19 | 19 | public static SimpleDateFormat m_d = new SimpleDateFormat("MM/dd"); |
20 | 20 | public static SimpleDateFormat y_m_d_h_m_s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
21 | 21 | public static SimpleDateFormat y_m_d_h_m1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
22 | + public static String[] parsePatterns = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", | |
23 | + "yyyy/MM/dd HH:mm" }; | |
22 | 24 | |
23 | 25 | public static SimpleDateFormat y_m_d_h_m = new SimpleDateFormat("yyyyMMddHHmm"); |
24 | 26 | public static SimpleDateFormat yyyyMMddHHmmssSSS = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
... | ... | @@ -819,5 +821,20 @@ |
819 | 821 | return new Date[]{parseYMD(snDateString.substring(0, 10)), parseYMDEnd(snDateString.substring(13, 23))}; |
820 | 822 | } |
821 | 823 | |
824 | + /** | |
825 | + * 日期型字符串转化为日期 格式 | |
826 | + * { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", | |
827 | + * "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm" } | |
828 | + */ | |
829 | + public static Date parseDate(Object str) { | |
830 | + if (str == null) { | |
831 | + return null; | |
832 | + } | |
833 | + try { | |
834 | + return org.apache.commons.lang3.time.DateUtils.parseDate(str.toString(), parsePatterns); | |
835 | + } catch (ParseException e) { | |
836 | + return null; | |
837 | + } | |
838 | + } | |
822 | 839 | } |
platform-common/src/main/java/com/lyms/platform/common/utils/HttpClientUtil.java
View file @
33b194f
... | ... | @@ -90,8 +90,11 @@ |
90 | 90 | |
91 | 91 | public static void main(String[] args) throws Exception { |
92 | 92 | |
93 | + Map<String,String> map = new HashMap<String, String>(); | |
94 | + map.put("vcCardNo","C40064690"); | |
95 | + map.put("sortType","1"); | |
93 | 96 | long start = System.currentTimeMillis(); |
94 | - String s = doPost("https://area-qhd-api.healthbaby.com.cn:18019/findSyncData", new HashMap<String, String>(), "utf-8"); | |
97 | + String s = doGet("https://area-qhd-api.healthbaby.com.cn:18019/getLisAndRisData", map, "utf-8","luc805966f6591ff8a51e5186cfee32e58e"); | |
95 | 98 | long end = System.currentTimeMillis(); |
96 | 99 | System.out.print(end -start); |
97 | 100 | System.out.println(s); |
platform-operate-api/pom.xml
View file @
33b194f
... | ... | @@ -71,6 +71,17 @@ |
71 | 71 | <artifactId>activemq-pool</artifactId> |
72 | 72 | <version>${org.activemq.version}</version> |
73 | 73 | </dependency> |
74 | + <dependency> | |
75 | + <groupId>org.apache.commons</groupId> | |
76 | + <artifactId>commons-lang3</artifactId> | |
77 | + <version>3.4</version> | |
78 | + </dependency> | |
79 | + <dependency> | |
80 | + <groupId>org.eclipse.jetty</groupId> | |
81 | + <artifactId>jetty-servlets</artifactId> | |
82 | + <version>9.3.8.v20160314</version> | |
83 | + </dependency> | |
84 | + | |
74 | 85 | </dependencies> |
75 | 86 | <build> |
76 | 87 | <resources> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java
View file @
33b194f
... | ... | @@ -5,10 +5,13 @@ |
5 | 5 | import com.lyms.platform.common.base.LoginContext; |
6 | 6 | import com.lyms.platform.common.result.BaseResponse; |
7 | 7 | import com.lyms.platform.common.utils.DateUtil; |
8 | +import com.lyms.platform.common.utils.JsonUtil; | |
8 | 9 | import com.lyms.platform.operate.web.facade.LisFacade; |
9 | 10 | import com.lyms.platform.operate.web.request.LisReportModelRequest; |
11 | +import com.lyms.platform.permission.model.LisReportItemModel; | |
10 | 12 | import com.lyms.platform.permission.model.LisReportModel; |
11 | 13 | import com.lyms.platform.permission.service.LisService; |
14 | +import org.apache.commons.collections.CollectionUtils; | |
12 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
13 | 16 | import org.springframework.stereotype.Controller; |
14 | 17 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -48,7 +51,19 @@ |
48 | 51 | for(LisReportModelRequest lisRequest : models) |
49 | 52 | { |
50 | 53 | LisReportModel model = new LisReportModel(); |
51 | - model.setItems(lisRequest.getItems()); | |
54 | + List<LisReportItemModel> items = lisRequest.getItems(); | |
55 | + if (CollectionUtils.isNotEmpty(items)) | |
56 | + { | |
57 | + System.out.println("====="+items.size()); | |
58 | + System.out.println("====="+JsonUtil.array2JsonString(items)); | |
59 | + | |
60 | + model.setItemJson(JsonUtil.array2JsonString(items)); | |
61 | + | |
62 | + | |
63 | + System.out.println(".................." + JsonUtil.array2JsonString(items)); | |
64 | + | |
65 | + } | |
66 | + | |
52 | 67 | model.setId(lisRequest.getId()); |
53 | 68 | model.setVcCardNo(lisRequest.getVcCardNo()); |
54 | 69 | model.setHospitalId(lisRequest.getHospitalId()); |
... | ... | @@ -73,6 +88,40 @@ |
73 | 88 | |
74 | 89 | } |
75 | 90 | } |
91 | + | |
92 | + | |
93 | + | |
94 | +// List<LisReportModel> list = new ArrayList<>(); | |
95 | +// if (models != null && models.size() > 0) | |
96 | +// { | |
97 | +// for(LisReportModelRequest lisRequest : models) | |
98 | +// { | |
99 | +// LisReportModel model = new LisReportModel(); | |
100 | +// model.setItems(lisRequest.getItems()); | |
101 | +// model.setId(lisRequest.getId()); | |
102 | +// model.setVcCardNo(lisRequest.getVcCardNo()); | |
103 | +// model.setHospitalId(lisRequest.getHospitalId()); | |
104 | +// model.setLisId(lisRequest.getLisId()); | |
105 | +// model.setAge(lisRequest.getAge()); | |
106 | +// model.setName(lisRequest.getName()); | |
107 | +// model.setBhnum(lisRequest.getBhnum()); | |
108 | +// model.setPhone(lisRequest.getPhone()); | |
109 | +// model.setSex(lisRequest.getSex()); | |
110 | +// model.setTitle(lisRequest.getTitle()); | |
111 | +// model.setType(lisRequest.getType()); | |
112 | +// model.setChecker(lisRequest.getChecker()); | |
113 | +// model.setApplyDept(lisRequest.getApplyDept()); | |
114 | +// model.setApplyDoctor(lisRequest.getApplyDoctor()); | |
115 | +// model.setApplyTime(DateUtil.parseYMDHMS(lisRequest.getApplyTime())); | |
116 | +// model.setPublishTime(DateUtil.parseYMDHMS(lisRequest.getPublishTime())); | |
117 | +// model.setModified(DateUtil.parseYMDHMS(lisRequest.getModified())); | |
118 | +// model.setCreated(DateUtil.parseYMDHMS(lisRequest.getCreated())); | |
119 | +// model.setCheckTime(DateUtil.parseYMDHMS(lisRequest.getCheckTime())); | |
120 | +// | |
121 | +// list.add(model); | |
122 | +// | |
123 | +// } | |
124 | +// } | |
76 | 125 | |
77 | 126 | return lisService.saveLisData(list); |
78 | 127 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java
View file @
33b194f
... | ... | @@ -34,9 +34,41 @@ |
34 | 34 | */ |
35 | 35 | @RequestMapping(method = RequestMethod.GET,value = "/getCheckStatistics") |
36 | 36 | @ResponseBody |
37 | - public BaseObjectResponse getCheckStatistics(Date startDate, Date endDate, | |
37 | + public BaseObjectResponse getCheckStatistics(String startDate, String endDate, | |
38 | 38 | Integer startWeek, Integer endWeek, Integer childBirth) { |
39 | 39 | return reportService.areaCountFacade(startDate, endDate, startWeek, endWeek, childBirth); |
40 | 40 | } |
41 | + | |
42 | + /** | |
43 | + * 孕产妇明细查看 | |
44 | + * @param startDate 建档开始时间 | |
45 | + * @param endDate 建档结束时间 | |
46 | + * @param startWeek 孕周开始时间 | |
47 | + * @param endWeek 孕周结束时间 | |
48 | + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
49 | + * @param number 检查次数 | |
50 | + * @param name 医生名称 | |
51 | + * @return | |
52 | + */ | |
53 | + @RequestMapping(method = RequestMethod.GET,value = "/checkInfo") | |
54 | + @ResponseBody | |
55 | + public BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, String name) { | |
56 | + return reportService.checkInfo(childBirth, startDate, endDate, startWeek, endWeek, number, name); | |
57 | + } | |
58 | + | |
59 | + /** | |
60 | + * 产检医生统计 | |
61 | + * @param startDate 建档开始时间 | |
62 | + * @param endDate 建档结束时间 | |
63 | + * @param childBirth 统计范围 1=孕妇 3=产妇 不传=全部 | |
64 | + * @return | |
65 | + */ | |
66 | + @RequestMapping(method = RequestMethod.GET,value = "/doctor") | |
67 | + @ResponseBody | |
68 | + public BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth) { | |
69 | + return reportService.doctorMedical | |
70 | + (startDate, endDate, childBirth); | |
71 | + } | |
72 | + | |
41 | 73 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/IBaseDao.java
View file @
33b194f
1 | +package com.lyms.platform.operate.web.dao; | |
2 | + | |
3 | +import java.util.List; | |
4 | +import java.util.Map; | |
5 | + | |
6 | +/** | |
7 | + * 公共dao的方法抽取 | |
8 | + * @Author: litao | |
9 | + * @Date: 2017/4/20 0020 10:03 | |
10 | + * @Version: V1.0 | |
11 | + */ | |
12 | +public interface IBaseDao { | |
13 | + /** | |
14 | + * 查询数据 封装到list中 list中的数据为map | |
15 | + * @param sql | |
16 | + * @param params | |
17 | + * @return | |
18 | + */ | |
19 | + List<Map<String, Object>> findList(String sql, List<Object> params); | |
20 | + | |
21 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/IReportDao.java
View file @
33b194f
platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/impl/BaseDaoImpl.java
View file @
33b194f
1 | +package com.lyms.platform.operate.web.dao.impl; | |
2 | + | |
3 | +import com.lyms.platform.operate.web.dao.IBaseDao; | |
4 | +import com.lyms.platform.operate.web.utils.SystemDataSource; | |
5 | +import org.apache.commons.dbutils.QueryRunner; | |
6 | +import org.apache.commons.dbutils.handlers.MapListHandler; | |
7 | +import org.slf4j.Logger; | |
8 | +import org.slf4j.LoggerFactory; | |
9 | +import org.springframework.beans.factory.annotation.Autowired; | |
10 | +import org.springframework.stereotype.Repository; | |
11 | + | |
12 | +import javax.annotation.PostConstruct; | |
13 | +import java.sql.SQLException; | |
14 | +import java.util.List; | |
15 | +import java.util.Map; | |
16 | + | |
17 | +/** | |
18 | + * @Author: litao | |
19 | + * @Date: 2017/4/20 0020 10:18 | |
20 | + * @Version: V1.0 | |
21 | + */ | |
22 | +@Repository | |
23 | +public class BaseDaoImpl implements IBaseDao { | |
24 | + | |
25 | + private Logger logger = LoggerFactory.getLogger(BaseDaoImpl.class); | |
26 | + | |
27 | + @Autowired | |
28 | + private SystemDataSource db; | |
29 | + | |
30 | + private QueryRunner qr; | |
31 | + | |
32 | + @PostConstruct | |
33 | + public void init() { | |
34 | + qr = new QueryRunner(db.getDataSource()); | |
35 | + } | |
36 | + @Override | |
37 | + public List<Map<String, Object>> findList(String sql, List<Object> params) { | |
38 | + try { | |
39 | + return qr.query(sql, new MapListHandler(), params.toArray()); | |
40 | + } catch (SQLException e) { | |
41 | + logger.error("查询出错: sql: {}, params: {}", sql, params); | |
42 | + } | |
43 | + return null; | |
44 | + } | |
45 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/dao/impl/ReportDaoImpl.java
View file @
33b194f
1 | +package com.lyms.platform.operate.web.dao.impl; | |
2 | + | |
3 | +import com.lyms.platform.operate.web.dao.IReportDao; | |
4 | +import org.springframework.stereotype.Repository; | |
5 | + | |
6 | +/** | |
7 | + * @Author: litao | |
8 | + * @Date: 2017/4/20 0020 10:18 | |
9 | + * @Version: V1.0 | |
10 | + */ | |
11 | +@Repository | |
12 | +public class ReportDaoImpl extends BaseDaoImpl implements IReportDao { | |
13 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java
View file @
33b194f
... | ... | @@ -303,7 +303,7 @@ |
303 | 303 | if (pat != null && StringUtils.isNotEmpty(pat.getVcCardNo()) && StringUtils.isNotEmpty(pat.getHospitalId())) |
304 | 304 | { |
305 | 305 | |
306 | - //获取lis记录中医院的名称 | |
306 | + //获取医院的名称 | |
307 | 307 | String hospitalName = hIdNames.get(pat.getHospitalId()); |
308 | 308 | if (!StringUtils.isNotEmpty(hospitalName)) |
309 | 309 | { |
... | ... | @@ -347,7 +347,13 @@ |
347 | 347 | query.setLisId(lis.getLisId()); |
348 | 348 | query.setHospitalId(lis.getHospitalId()); |
349 | 349 | //查询lis每项详情 |
350 | - List<LisReportItemModel> items = lisService.queryLisItemByModel(query); | |
350 | + List<LisReportItemModel> items = null; | |
351 | + if (StringUtils.isNotEmpty(lis.getItemJson())) | |
352 | + { | |
353 | + items = JsonUtil.toList(lis.getItemJson(),LisReportItemModel.class); | |
354 | + } | |
355 | + | |
356 | + //List<LisReportItemModel> items = lisService.queryLisItemByModel(query); | |
351 | 357 | if (CollectionUtils.isNotEmpty(items)) |
352 | 358 | { |
353 | 359 | for (LisReportItemModel checkItem : items) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java
View file @
33b194f
... | ... | @@ -2,8 +2,6 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.common.result.BaseObjectResponse; |
4 | 4 | |
5 | -import java.util.Date; | |
6 | - | |
7 | 5 | /** |
8 | 6 | * 报表service |
9 | 7 | * @Author: litao |
... | ... | @@ -21,6 +19,28 @@ |
21 | 19 | * @param childBirth |
22 | 20 | * @return |
23 | 21 | */ |
24 | - BaseObjectResponse areaCountFacade(Date startDate, Date endDate, Integer startWeek, Integer endWeek, Integer childBirth); | |
22 | + BaseObjectResponse areaCountFacade(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth); | |
23 | + | |
24 | + /** | |
25 | + * 产检医生统计 | |
26 | + * @param startDate | |
27 | + * @param endDate | |
28 | + * @param childBirth | |
29 | + * @return | |
30 | + */ | |
31 | + BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth); | |
32 | + | |
33 | + /** | |
34 | + * 孕产妇明细查看 | |
35 | + * @param childBirth | |
36 | + * @param startDate | |
37 | + * @param endDate | |
38 | + * @param startWeek | |
39 | + * @param endWeek | |
40 | + * @param number | |
41 | + * @param name | |
42 | + * @return | |
43 | + */ | |
44 | + BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, String name); | |
25 | 45 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
33b194f
1 | 1 | package com.lyms.platform.operate.web.service.impl; |
2 | 2 | |
3 | 3 | import com.lyms.platform.common.result.BaseObjectResponse; |
4 | +import com.lyms.platform.operate.web.dao.IReportDao; | |
4 | 5 | import com.lyms.platform.operate.web.service.IReportService; |
5 | -import com.lyms.platform.operate.web.utils.SystemDataSource; | |
6 | -import org.apache.commons.dbutils.QueryRunner; | |
7 | -import org.apache.commons.dbutils.handlers.MapListHandler; | |
6 | +import com.lyms.platform.operate.web.utils.MathUtil; | |
7 | +import org.apache.commons.lang.StringUtils; | |
8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 9 | import org.springframework.stereotype.Service; |
10 | -import scala.collection.mutable.StringBuilder; | |
11 | 10 | |
12 | -import java.sql.SQLException; | |
13 | -import java.util.Date; | |
14 | -import java.util.List; | |
15 | -import java.util.Map; | |
11 | +import java.util.*; | |
16 | 12 | |
17 | 13 | /** |
18 | 14 | * @Author: litao |
19 | 15 | |
20 | 16 | |
21 | 17 | |
... | ... | @@ -23,22 +19,127 @@ |
23 | 19 | public class ReportServiceImpl implements IReportService { |
24 | 20 | |
25 | 21 | @Autowired |
26 | - private SystemDataSource db; | |
22 | + private IReportDao reportDao; | |
27 | 23 | |
28 | 24 | @Override |
29 | - public BaseObjectResponse areaCountFacade(Date startDate, Date endDate, Integer startWeek, Integer endWeek, Integer childBirth) { | |
25 | + public BaseObjectResponse areaCountFacade(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth) { | |
30 | 26 | BaseObjectResponse rest = new BaseObjectResponse(); |
31 | - QueryRunner qr = new QueryRunner(db.getDataSource()); | |
32 | - try { | |
33 | - List<Map<String, Object>> mapList = qr.query(getAreaCountFacadeSql(startDate, endDate, startWeek, endWeek, childBirth), new MapListHandler()); | |
34 | - rest.setData(mapList); | |
35 | - } catch (SQLException e) { | |
36 | - e.printStackTrace(); | |
37 | - } | |
27 | + Map<String, Object> restMap = new HashMap<>(); | |
28 | + List<Object> params = new ArrayList<>(); | |
29 | + List<Map<String, Object>> mapList = reportDao.findList(getAreaCountFacadeSql(startDate, endDate, startWeek, endWeek, childBirth, params), params); | |
30 | + | |
31 | + List<Object> peopleList = createPeoples(mapList); | |
32 | + restMap.put("grid", createGrid( createPeoples(mapList), createProportion(peopleList))); | |
33 | + restMap.put("xAxis", Arrays.asList("1次", "2次", "3次", "4次", "5次", "6次", "7次", "8次", "9次", "10次", "11次", "12次", "≥13次")); /** x轴数据 */ | |
34 | + restMap.put("yAxis", createYData(peopleList)); | |
35 | + | |
36 | + rest.setData(restMap); | |
38 | 37 | return rest; |
39 | 38 | } |
40 | 39 | |
41 | - private String getAreaCountFacadeSql(Date startDate, Date endDate, Integer startWeek, Integer endWeek, Integer childBirth) { | |
40 | + @Override | |
41 | + public BaseObjectResponse doctorMedical(String startDate, String endDate, Integer childBirth) { | |
42 | + BaseObjectResponse rest = new BaseObjectResponse(); | |
43 | + Map<String, Object> restMap = new HashMap<>(); | |
44 | + List<Object> params = new ArrayList<>(); | |
45 | + List<Map<String, Object>> restList = reportDao.findList(getDoctorMedicalSql(startDate, endDate, childBirth, params), params); | |
46 | + return null; | |
47 | + } | |
48 | + | |
49 | + @Override | |
50 | + public BaseObjectResponse checkInfo(Integer childBirth, String startDate, String endDate, Integer startWeek, Integer endWeek, Integer number, String name) { | |
51 | + return null; | |
52 | + } | |
53 | + | |
54 | + | |
55 | + private List<Map<String, Object>> createGrid(List<Object> peopleList, List<Object> proportionList) { | |
56 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
57 | + Map<String, Object> peoples = new HashMap<>(); | |
58 | + peoples.put("desc", peopleList.get(0)); /** 产检人数 */ | |
59 | + peoples.put("count", peopleList.get(1));/** 总计 */ | |
60 | + peoples.put("once", peopleList.get(2)); | |
61 | + peoples.put("twice", peopleList.get(3)); | |
62 | + peoples.put("threeTimes", peopleList.get(4)); | |
63 | + peoples.put("fourTimes", peopleList.get(5)); | |
64 | + peoples.put("fiveTimes", peopleList.get(6)); | |
65 | + peoples.put("sixTimes", peopleList.get(7)); | |
66 | + peoples.put("sevenTimes", peopleList.get(8)); | |
67 | + peoples.put("eightTimes", peopleList.get(9)); | |
68 | + peoples.put("nineTimes", peopleList.get(10)); | |
69 | + peoples.put("tenTimes", peopleList.get(11)); | |
70 | + peoples.put("elevenTimes", peopleList.get(12)); | |
71 | + peoples.put("twelveTimes", peopleList.get(13)); | |
72 | + restList.add(peoples); | |
73 | + | |
74 | + Map<String, Object> proportion = new HashMap<>(); | |
75 | + proportion.put("desc", proportionList.get(0)); /** 占比 */ | |
76 | + proportion.put("count", proportionList.get(1));/** 总计 */ | |
77 | + proportion.put("once", proportionList.get(2)); | |
78 | + proportion.put("twice", proportionList.get(3)); | |
79 | + proportion.put("threeTimes", proportionList.get(4)); | |
80 | + proportion.put("fourTimes", proportionList.get(5)); | |
81 | + proportion.put("fiveTimes", proportionList.get(6)); | |
82 | + proportion.put("sixTimes", proportionList.get(7)); | |
83 | + proportion.put("sevenTimes", proportionList.get(8)); | |
84 | + proportion.put("eightTimes", proportionList.get(9)); | |
85 | + proportion.put("nineTimes", proportionList.get(10)); | |
86 | + proportion.put("tenTimes", proportionList.get(11)); | |
87 | + proportion.put("elevenTimes", proportionList.get(12)); | |
88 | + proportion.put("twelveTimes", proportionList.get(13)); | |
89 | + restList.add(proportion); | |
90 | + return restList; | |
91 | + } | |
92 | + | |
93 | + private List<Object> createProportion(List<Object> peopleList) { | |
94 | + List<Object> proportions = new ArrayList<>(); | |
95 | + proportions.add("占比"); | |
96 | + int countPeople = Integer.parseInt(peopleList.get(1).toString()); | |
97 | + proportions.add("100%"); | |
98 | + for (int i = 1; i < peopleList.size(); i++) { | |
99 | + proportions.add(MathUtil.doubleFormat(Double.parseDouble(MathUtil.division(Integer.valueOf(peopleList.get(i).toString()) * 100, countPeople))) + "%"); | |
100 | + } | |
101 | + return proportions; | |
102 | + } | |
103 | + | |
104 | + private List<Object> createPeoples(List<Map<String, Object>> mapList) { | |
105 | + List<Object> peoples = new ArrayList<>(); | |
106 | + peoples.add("产检人数"); | |
107 | + int countPeople = 0; /** 体检所有人数 */ | |
108 | + | |
109 | + /** 通过下标循环取map里面数据 有就设置value 没有就设置0 */ | |
110 | + for(int i = 1; i <= 30; i++) { | |
111 | + String count = null; | |
112 | + for (Map<String, Object> map : mapList) { | |
113 | + if(map.get("EXAMINE_HISTORY_NUM").toString().equals("" + i)) { | |
114 | + count = map.get("EXAMINE_CNT").toString(); | |
115 | + countPeople += Integer.valueOf(count); | |
116 | + } | |
117 | + } | |
118 | + if(i <= 13) { | |
119 | + if(StringUtils.isNotBlank(count)) { | |
120 | + peoples.add(count); | |
121 | + } else { | |
122 | + peoples.add("0"); | |
123 | + } | |
124 | + } else { | |
125 | + if(StringUtils.isNotBlank(count)) { | |
126 | + peoples.set(12, Integer.valueOf(peoples.get(12).toString()) + Integer.valueOf(count) + ""); | |
127 | + } | |
128 | + } | |
129 | + } | |
130 | + peoples.add(1, countPeople + ""); | |
131 | + return peoples; | |
132 | + } | |
133 | + | |
134 | + private List<Object> createYData(List<Object> list) { | |
135 | + List<Object> newList = new ArrayList<>(); | |
136 | + newList.addAll(list); | |
137 | + newList.remove(0); | |
138 | + newList.remove(0); | |
139 | + return newList; | |
140 | + } | |
141 | + | |
142 | + private String getAreaCountFacadeSql(String startDate, String endDate, Integer startWeek, Integer endWeek, Integer childBirth, List<Object> params) { | |
42 | 143 | StringBuilder sql = new StringBuilder(); |
43 | 144 | sql.append("SELECT B.EXAMINE_HISTORY_NUM, ") |
44 | 145 | .append("COUNT(B.EXAMINE_ID) AS EXAMINE_CNT ") |
45 | 146 | |
... | ... | @@ -47,9 +148,94 @@ |
47 | 148 | .append("ODS_D_HOSPITAL C ") |
48 | 149 | .append("WHERE A.RECORD_ID=B.RECORD_ID ") |
49 | 150 | .append("AND A.HOSPITAL_NO=C.HOSPITAL_NO ") |
50 | - .append("AND A.HOSPITAL_NO=B.HOSPITAL_NO ") | |
51 | - .append("GROUP BY B.EXAMINE_HISTORY_NUM"); | |
151 | + .append("AND A.HOSPITAL_NO=B.HOSPITAL_NO "); | |
152 | + | |
153 | + if(childBirth != null) { | |
154 | + sql.append("AND A.IS_CHILDBIRTH = ? "); | |
155 | + params.add(childBirth); | |
156 | + } | |
157 | + | |
158 | + if(startDate != null && endDate != null) { | |
159 | + sql.append("AND A.CREATE_DATE BETWEEN to_date(?,'yyyy-mm-dd') AND to_date(?,'yyyy-mm-dd') "); | |
160 | + params.add(startDate); | |
161 | + params.add(endDate); | |
162 | + } | |
163 | + | |
164 | + if(startWeek != null && endWeek != null) { | |
165 | + sql.append("AND A.NOW_WEEKS BETWEEN ? AND ? "); | |
166 | + params.add(startWeek); | |
167 | + params.add(endWeek); | |
168 | + } | |
169 | + | |
170 | + sql.append("GROUP BY B.EXAMINE_HISTORY_NUM ") | |
171 | + .append("ORDER BY EXAMINE_HISTORY_NUM"); | |
172 | + | |
52 | 173 | return sql.toString(); |
53 | 174 | } |
175 | + | |
176 | + private String getDoctorMedicalSql(String startDate, String endDate, Integer childBirth, List<Object> params) { | |
177 | + StringBuilder sql = new StringBuilder(); | |
178 | + sql.append("SELECT B.DOCTOR_NAME, ") | |
179 | + .append("COUNT(B.EXAMINE_ID) AS CJ_RC, ") | |
180 | + .append("COUNT(DISTINCT A.RECORD_ID) AS CJ_RS, ") | |
181 | + .append("COUNT(DISTINCT D.RECORD_ID) AS LIANGCI_RS, ") | |
182 | + .append("COUNT(DISTINCT E.RECORD_ID) AS WUCI_RS ") | |
183 | + .append("FROM ODS_F_GRAVIDA_RECORD A ") | |
184 | + .append("INNER JOIN ODS_F_EXAMINE_HISTORY_ASC B ON A.RECORD_ID=B.RECORD_ID AND A.HOSPITAL_NO=B.HOSPITAL_NO ") | |
185 | + .append("INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO ") | |
186 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC D ON B.EXAMINE_ID=D.EXAMINE_ID AND D.EXAMINE_HISTORY_NUM>1 ") | |
187 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC E ON B.EXAMINE_ID=E.EXAMINE_ID AND E.EXAMINE_HISTORY_NUM>4 ") | |
188 | + .append("WHERE C.YCY_STSTEM_ID='216' "); | |
189 | + | |
190 | + if(childBirth != null) { | |
191 | + sql.append("AND A.IS_CHILDBIRTH = ? "); | |
192 | + params.add(childBirth); | |
193 | + } | |
194 | + | |
195 | + if(startDate != null && endDate != null) { | |
196 | + sql.append("AND A.CREATE_DATE BETWEEN to_date(?,'yyyy-mm-dd') AND to_date(?,'yyyy-mm-dd') "); | |
197 | + params.add(startDate); | |
198 | + params.add(endDate); | |
199 | + } | |
200 | + | |
201 | + /* if(startWeek != null && endWeek != null) { | |
202 | + sql.append("AND A.NOW_WEEKS BETWEEN ? AND ? "); | |
203 | + params.add(startWeek); | |
204 | + params.add(endWeek); | |
205 | + }*/ | |
206 | + | |
207 | + | |
208 | + sql.append("GROUP BY B.DOCTOR_NAME,B.DOCTOR_NO ") | |
209 | + .append("UNION ALL ") | |
210 | + .append("SELECT '总计', ") | |
211 | + .append("COUNT(B.EXAMINE_ID) AS CJ_RC, ") | |
212 | + .append("COUNT(DISTINCT A.RECORD_ID) AS CJ_RS, ") | |
213 | + .append("COUNT(DISTINCT D.RECORD_ID) AS LIANGCI_RS, ") | |
214 | + .append("COUNT(DISTINCT E.RECORD_ID) AS WUCI_RS ") | |
215 | + .append("FROM ODS_F_GRAVIDA_RECORD A ") | |
216 | + .append("INNER JOIN ODS_F_EXAMINE_HISTORY_ASC B ON A.RECORD_ID=B.RECORD_ID AND A.HOSPITAL_NO=B.HOSPITAL_NO ") | |
217 | + .append("INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO ") | |
218 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC D ON B.EXAMINE_ID=D.EXAMINE_ID AND D.EXAMINE_HISTORY_NUM>1 ") | |
219 | + .append("LEFT JOIN ODS_F_EXAMINE_HISTORY_ASC E ON B.EXAMINE_ID=E.EXAMINE_ID AND E.EXAMINE_HISTORY_NUM>4 "); | |
220 | + | |
221 | + if(childBirth != null) { | |
222 | + sql.append("AND A.IS_CHILDBIRTH = ? "); | |
223 | + params.add(childBirth); | |
224 | + } | |
225 | + | |
226 | + if(startDate != null && endDate != null) { | |
227 | + sql.append("AND A.CREATE_DATE BETWEEN to_date(?,'yyyy-mm-dd') AND to_date(?,'yyyy-mm-dd') "); | |
228 | + params.add(startDate); | |
229 | + params.add(endDate); | |
230 | + } | |
231 | + | |
232 | + /*if(startWeek != null && endWeek != null) { | |
233 | + sql.append("AND A.NOW_WEEKS BETWEEN ? AND ? "); | |
234 | + params.add(startWeek); | |
235 | + params.add(endWeek); | |
236 | + }*/ | |
237 | + return sql.toString(); | |
238 | + } | |
239 | + | |
54 | 240 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/HttpClientUtil.java
View file @
33b194f
... | ... | @@ -5,6 +5,9 @@ |
5 | 5 | */ |
6 | 6 | import java.util.*; |
7 | 7 | import java.util.Map.Entry; |
8 | + | |
9 | +import com.lyms.platform.common.pojo.SyncDataModel; | |
10 | +import com.lyms.platform.common.utils.JsonUtil; | |
8 | 11 | import org.apache.http.HttpEntity; |
9 | 12 | import org.apache.http.HttpResponse; |
10 | 13 | import org.apache.http.NameValuePair; |
... | ... | @@ -54,6 +57,8 @@ |
54 | 57 | |
55 | 58 | long start = System.currentTimeMillis(); |
56 | 59 | String s = doPost("https://area-qhd-api.healthbaby.com.cn:18019/findSyncData", new HashMap<String, String>(), "utf-8"); |
60 | + | |
61 | + List<SyncDataModel> list = JsonUtil.toList(s, SyncDataModel.class); | |
57 | 62 | long end = System.currentTimeMillis(); |
58 | 63 | System.out.print(end -start); |
59 | 64 | System.out.println(s); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MathUtil.java
View file @
33b194f
1 | +package com.lyms.platform.operate.web.utils; | |
2 | + | |
3 | +import java.text.DecimalFormat; | |
4 | + | |
5 | +/** | |
6 | + * @Author: litao | |
7 | + * @Date: 2017/4/20 0020 14:40 | |
8 | + * @Version: V1.0 | |
9 | + */ | |
10 | +public class MathUtil { | |
11 | + | |
12 | + /** | |
13 | + * 整数相除 保留六位小数 | |
14 | + * @param a | |
15 | + * @param b | |
16 | + * @return | |
17 | + */ | |
18 | + public static String division(int a ,int b){ | |
19 | + float num =(float)a/b; | |
20 | + DecimalFormat df = new DecimalFormat("0.000000"); | |
21 | + return df.format(num); | |
22 | + } | |
23 | + | |
24 | + public static String division(String a ,String b){ | |
25 | + return division(Integer.valueOf(a), Integer.valueOf(b)); | |
26 | + } | |
27 | + | |
28 | + /** | |
29 | + * 格式化dubbo类型数据 保留2位 | |
30 | + * @param d | |
31 | + * @return | |
32 | + */ | |
33 | + public static String doubleFormat(Double d) { | |
34 | + DecimalFormat df = new DecimalFormat("######0.00"); | |
35 | + return df.format(d); | |
36 | + } | |
37 | + | |
38 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/SystemDataSource.java
View file @
33b194f