Commit d7bb06d4f64b2fb1c552800b900b0ce77a5f8d2d
1 parent
88596271e6
Exists in
master
and in
1 other branch
excel导出
Showing 5 changed files with 136 additions and 6 deletions
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ChildbirthManagerQueryModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/NewBabyManagerQueryModel.java
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
d7bb06d
... | ... | @@ -45,6 +45,8 @@ |
45 | 45 | |
46 | 46 | private String dueType; |
47 | 47 | |
48 | + private String pregnancyOut; | |
49 | + | |
48 | 50 | public Date getBuildDateStart() { |
49 | 51 | return buildDateStart; |
50 | 52 | } |
... | ... | @@ -433,6 +435,9 @@ |
433 | 435 | if (null != isNull) { |
434 | 436 | condition = condition.and("communityId", null, MongoOper.IS); |
435 | 437 | } |
438 | + if (null != pregnancyOut) { | |
439 | + condition = condition.and("pregnancyOut", pregnancyOut, MongoOper.IS); | |
440 | + } | |
436 | 441 | |
437 | 442 | if (!StringUtils.isEmpty(mcertNo)) { |
438 | 443 | condition = condition.and("mcertNo", mcertNo, MongoOper.IS); |
... | ... | @@ -642,6 +647,14 @@ |
642 | 647 | |
643 | 648 | public void setDueType(String dueType) { |
644 | 649 | this.dueType = dueType; |
650 | + } | |
651 | + | |
652 | + public String getPregnancyOut() { | |
653 | + return pregnancyOut; | |
654 | + } | |
655 | + | |
656 | + public void setPregnancyOut(String pregnancyOut) { | |
657 | + this.pregnancyOut = pregnancyOut; | |
645 | 658 | } |
646 | 659 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
View file @
d7bb06d
... | ... | @@ -6,13 +6,17 @@ |
6 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
7 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | +import com.lyms.platform.common.utils.BeanUtils; | |
10 | +import com.lyms.platform.common.utils.ExcelUtil; | |
9 | 11 | import com.lyms.platform.common.utils.ExceptionUtils; |
10 | 12 | import com.lyms.platform.operate.web.facade.MatDeliverFacade; |
11 | 13 | import com.lyms.platform.operate.web.request.ChildbirthManagerRequest; |
12 | 14 | import com.lyms.platform.operate.web.request.MatDeliverAddRequest; |
13 | 15 | import com.lyms.platform.operate.web.request.MatDeliverQueryRequest; |
14 | 16 | import com.lyms.platform.operate.web.request.NewBabyManagerRequest; |
17 | +import com.lyms.platform.operate.web.result.ChildbirthManagerQueryModel; | |
15 | 18 | import com.lyms.platform.operate.web.result.ChildbirthManagerResult; |
19 | +import com.lyms.platform.operate.web.result.NewBabyManagerQueryModel; | |
16 | 20 | import com.lyms.platform.operate.web.result.NewBabyManagerResult; |
17 | 21 | import org.apache.commons.lang.StringUtils; |
18 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
19 | 23 | |
... | ... | @@ -20,7 +24,12 @@ |
20 | 24 | import org.springframework.web.bind.annotation.*; |
21 | 25 | |
22 | 26 | import javax.servlet.http.HttpServletRequest; |
27 | +import javax.servlet.http.HttpServletResponse; | |
23 | 28 | import javax.validation.Valid; |
29 | +import java.util.ArrayList; | |
30 | +import java.util.HashMap; | |
31 | +import java.util.List; | |
32 | +import java.util.Map; | |
24 | 33 | |
25 | 34 | /** |
26 | 35 | * 产妇分娩记录 |
... | ... | @@ -128,6 +137,38 @@ |
128 | 137 | return baseListResponse; |
129 | 138 | } |
130 | 139 | |
140 | + @RequestMapping(value = "childbirthManagerExcel", method = RequestMethod.GET) | |
141 | + public void childbirthManagerExcel(HttpServletRequest httpServletRequest, @RequestBody ChildbirthManagerRequest childbirthManagerRequest, HttpServletResponse httpServletResponse) { | |
142 | + try { | |
143 | + childbirthManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId()); | |
144 | + // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据 | |
145 | + @SuppressWarnings("unchecked") | |
146 | + List<ChildbirthManagerQueryModel> childbirthManagerQueryModelList = matDeliverFacade.childbirthManager(childbirthManagerRequest).getData(); | |
147 | + List<Map<String, Object>> list = new ArrayList<>(); | |
148 | + for (ChildbirthManagerQueryModel childbirthManagerQueryModel : childbirthManagerQueryModelList) { | |
149 | + Map<String, Object> map = BeanUtils.objectToObjectMap(childbirthManagerQueryModel); | |
150 | + list.add(map); | |
151 | + } | |
152 | + Map<String, String> header = new HashMap<>(); | |
153 | + header.put("dueDate", "分娩日期"); | |
154 | + header.put("username", "姓名"); | |
155 | + header.put("age", "年龄"); | |
156 | + header.put("cardNo", "证件号"); | |
157 | + header.put("dueWeek", "分娩孕周"); | |
158 | + header.put("deliveryMode", "分娩方式"); | |
159 | + header.put("maternalInfo", "产妇情况"); | |
160 | + header.put("tireNumber", "胎数"); | |
161 | + header.put("livingNumber", "活产数"); | |
162 | + header.put("deliverDoctor", "接生医生"); | |
163 | + header.put("phone", "联系方式"); | |
164 | + httpServletResponse.setContentType("application/force-download"); | |
165 | + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("分娩管理).xls").getBytes("UTF-8"), "ISO-8859-1")); | |
166 | + ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header); | |
167 | + } catch (Exception e) { | |
168 | + ExceptionUtils.catchException(e, "childbirthManagerExcel异常"); | |
169 | + } | |
170 | + } | |
171 | + | |
131 | 172 | /** |
132 | 173 | * @auther HuJiaqi |
133 | 174 | * @createTime 2016年12月07日 17时50分 |
... | ... | @@ -151,6 +192,63 @@ |
151 | 192 | ExceptionUtils.catchException(e, "newBabyManager异常"); |
152 | 193 | } |
153 | 194 | return baseListResponse; |
195 | + } | |
196 | + | |
197 | + @RequestMapping(value = "newBabyManagerExcel", method = RequestMethod.GET) | |
198 | + public void newBabyManagerExcel(HttpServletRequest httpServletRequest, @RequestBody NewBabyManagerRequest newBabyManagerRequest, HttpServletResponse httpServletResponse) { | |
199 | + try { | |
200 | + newBabyManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId()); | |
201 | + // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据 | |
202 | + @SuppressWarnings("unchecked") | |
203 | + List<NewBabyManagerQueryModel> newBabyManagerQueryModelList = matDeliverFacade.newBabyManager(newBabyManagerRequest).getData(); | |
204 | + List<Map<String, Object>> list = new ArrayList<>(); | |
205 | + for (NewBabyManagerQueryModel newBabyManagerQueryModel : newBabyManagerQueryModelList) { | |
206 | + Map<String, Object> map = BeanUtils.objectToObjectMap(newBabyManagerQueryModel); | |
207 | + Integer sex = newBabyManagerQueryModel.getSex(); | |
208 | + if (sex == 0) { | |
209 | + map.put("sex", "女"); | |
210 | + } | |
211 | + if (sex == 1) { | |
212 | + map.put("sex", "男"); | |
213 | + } | |
214 | + Integer highRisk = newBabyManagerQueryModel.getHighRisk(); | |
215 | + if (highRisk == 0) { | |
216 | + map.put("highRisk", "健康"); | |
217 | + } | |
218 | + if (highRisk == 1) { | |
219 | + map.put("highRisk", "高危"); | |
220 | + } | |
221 | + String dueType = newBabyManagerQueryModel.getDueType(); | |
222 | + if ("1".equals(dueType)) { | |
223 | + map.put("dueType", "顺产"); | |
224 | + } | |
225 | + if ("2".equals(dueType)) { | |
226 | + map.put("dueType", "刨宫产"); | |
227 | + } | |
228 | + list.add(map); | |
229 | + } | |
230 | + Map<String, String> header = new HashMap<>(); | |
231 | + header.put("birthYMD", "分娩日期"); | |
232 | + header.put("birthHM", "娩出时间"); | |
233 | + header.put("name", "姓名"); | |
234 | + header.put("sex", "性别"); | |
235 | + header.put("birthDays", "出生天数"); | |
236 | + header.put("highRisk", "是否高危"); | |
237 | + header.put("dueWeek", "分娩孕周"); | |
238 | + header.put("dueType", "分娩方式"); | |
239 | + header.put("babyHeight", "出生身长/cm"); | |
240 | + header.put("babyWeight", "出生体重/g"); | |
241 | + header.put("mname", "母亲姓名"); | |
242 | + header.put("age", "母亲年龄"); | |
243 | + header.put("mcertNo", "母亲证件号"); | |
244 | + header.put("mphone", "联系方式"); | |
245 | + header.put("deliverDoctor", "接生医生"); | |
246 | + httpServletResponse.setContentType("application/force-download"); | |
247 | + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("新生儿管理).xls").getBytes("UTF-8"), "ISO-8859-1")); | |
248 | + ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header); | |
249 | + } catch (Exception e) { | |
250 | + ExceptionUtils.catchException(e, "childbirthManagerExcel异常"); | |
251 | + } | |
154 | 252 | } |
155 | 253 | |
156 | 254 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
d7bb06d
... | ... | @@ -928,7 +928,7 @@ |
928 | 928 | patientsQuery.setName(childbirthManagerRequest.getUserName()); |
929 | 929 | patientsQuery.setYn(YnEnums.YES.getId()); |
930 | 930 | patientsQuery.setType(3); |
931 | - // patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(childbirthManagerRequest.getOperatorId())); | |
931 | + patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(childbirthManagerRequest.getOperatorId())); | |
932 | 932 | patientsQuery.setCardNo(childbirthManagerRequest.getCardNo()); |
933 | 933 | patientsQuery.setPhone(childbirthManagerRequest.getPhone()); |
934 | 934 | patientsQuery.setHusbandPhone(childbirthManagerRequest.getHusbandPhone()); |
935 | 935 | |
... | ... | @@ -967,12 +967,23 @@ |
967 | 967 | ChildbirthManagerQueryModel childbirthManagerQueryModel = new ChildbirthManagerQueryModel(); |
968 | 968 | BeanUtils.copy(patients, childbirthManagerQueryModel); |
969 | 969 | BeanUtils.copy(maternalDeliverModel, childbirthManagerQueryModel); |
970 | + // 查询接生医生 | |
970 | 971 | try { |
971 | 972 | childbirthManagerQueryModel.setDeliverDoctor(usersService.getUsers(Integer.valueOf(maternalDeliverModel.getDeliverDoctor())).getName()); |
972 | 973 | } catch (Exception e) { |
973 | 974 | // 什么都不干 |
974 | 975 | } |
975 | 976 | childbirthManagerQueryModel.setAge(DateUtil.getAge(patients.getBirth())); |
977 | + // 查询活产数 | |
978 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
979 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
980 | + babyModelQuery.setParentId(patients.getId()); | |
981 | + babyModelQuery.setPregnancyOut(RenShenJieJuEnums.O.getId()); | |
982 | + try { | |
983 | + childbirthManagerQueryModel.setLivingNumber(babyService.queryBabyWithQuery(babyModelQuery).size()); | |
984 | + } catch (Exception e) { | |
985 | + // 什么都不干 | |
986 | + } | |
976 | 987 | childbirthManagerQueryModelList.add(childbirthManagerQueryModel); |
977 | 988 | } |
978 | 989 | } |
... | ... | @@ -999,7 +1010,7 @@ |
999 | 1010 | babyModelQuery.setDueType(newBabyManagerRequest.getDueType()); |
1000 | 1011 | babyModelQuery.setPage(newBabyManagerRequest.getPage()); |
1001 | 1012 | babyModelQuery.setLimit(newBabyManagerRequest.getLimit()); |
1002 | - // babyModelQuery.setHospitalId(autoMatchFacade.getHospitalId(newBabyManagerRequest.getOperatorId())); | |
1013 | + babyModelQuery.setHospitalId(autoMatchFacade.getHospitalId(newBabyManagerRequest.getOperatorId())); | |
1003 | 1014 | babyModelQuery.setNeed("Need"); |
1004 | 1015 | |
1005 | 1016 | List<BabyModel> babyModelList = babyService.queryBabyWithQuery(babyModelQuery); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ChildbirthManagerQueryModel.java
View file @
d7bb06d
... | ... | @@ -68,7 +68,7 @@ |
68 | 68 | * @createTime 2016年12月07日 16时39分 |
69 | 69 | * @discription 活产数 |
70 | 70 | */ |
71 | - // TODO 暂未确定 | |
71 | + private Integer livingNumber; | |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @auther HuJiaqi |
... | ... | @@ -162,6 +162,14 @@ |
162 | 162 | |
163 | 163 | public void setPhone(String phone) { |
164 | 164 | this.phone = phone; |
165 | + } | |
166 | + | |
167 | + public Integer getLivingNumber() { | |
168 | + return livingNumber; | |
169 | + } | |
170 | + | |
171 | + public void setLivingNumber(Integer livingNumber) { | |
172 | + this.livingNumber = livingNumber; | |
165 | 173 | } |
166 | 174 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/NewBabyManagerQueryModel.java
View file @
d7bb06d
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | /** |
18 | 18 | * @auther HuJiaqi |
19 | 19 | * @createTime 2016年12月08日 15时39分 |
20 | - * @discription | |
20 | + * @discription 娩出时间 | |
21 | 21 | */ |
22 | 22 | private String birthHM; |
23 | 23 | |
24 | 24 | |
... | ... | @@ -66,14 +66,14 @@ |
66 | 66 | /** |
67 | 67 | * @auther HuJiaqi |
68 | 68 | * @createTime 2016年12月08日 10时56分 |
69 | - * @discription 出生身长,单位厘米 | |
69 | + * @discription 出生身长/cm | |
70 | 70 | */ |
71 | 71 | private String babyHeight; |
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @auther HuJiaqi |
75 | 75 | * @createTime 2016年12月08日 10时57分 |
76 | - * @discription 出生体重,单位克 | |
76 | + * @discription 出生体重/g | |
77 | 77 | */ |
78 | 78 | private String babyWeight; |
79 | 79 |