Commit 7abccdeebd6705ac0cf8a4d5cbeecae921757b07
1 parent
b70f413b01
Exists in
master
and in
6 other branches
诸城excel导出(母子保健手册导出) 20190522 wutaotao
Showing 3 changed files with 320 additions and 1 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
7abccde
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | import com.lyms.platform.operate.web.facade.PatientFacade; |
| 21 | 21 | import com.lyms.platform.operate.web.request.*; |
| 22 | 22 | import com.lyms.platform.operate.web.result.BasicConfigResult; |
| 23 | +import com.lyms.platform.operate.web.result.HealthHandbookExcelModel; | |
| 23 | 24 | import com.lyms.platform.operate.web.result.PatientManagerQueryModel; |
| 24 | 25 | import com.lyms.platform.operate.web.result.PatientManagerResult; |
| 25 | 26 | import org.apache.commons.collections.CollectionUtils; |
| ... | ... | @@ -385,6 +386,7 @@ |
| 385 | 386 | return baseListResponse; |
| 386 | 387 | } |
| 387 | 388 | |
| 389 | + | |
| 388 | 390 | @TokenRequired |
| 389 | 391 | @RequestMapping(value = "patientManagerExcel", method = RequestMethod.POST) |
| 390 | 392 | public void patientManagerExcel(HttpServletRequest httpServletRequest, @RequestBody PatientManagerRequest patientManagerRequest, HttpServletResponse httpServletResponse) { |
| ... | ... | @@ -431,5 +433,55 @@ |
| 431 | 433 | } |
| 432 | 434 | } |
| 433 | 435 | |
| 436 | + /** | |
| 437 | + * 母子保健手册导出 | |
| 438 | + * | |
| 439 | + * @param httpServletRequest | |
| 440 | + // * @param patientManagerRequest | |
| 441 | + * @param httpServletResponse | |
| 442 | + */ | |
| 443 | + @TokenRequired | |
| 444 | + @RequestMapping(value = "healthHandbookExcel", method = RequestMethod.POST) | |
| 445 | + public void healthHandbookExcel(HttpServletRequest httpServletRequest, @RequestBody PatientManagerRequest patientManagerRequest, HttpServletResponse httpServletResponse) { | |
| 446 | + | |
| 447 | + try { | |
| 448 | + patientManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId()); | |
| 449 | + patientManagerRequest.setExcel(true); | |
| 450 | + // 这里返回的结果必然是这个泛型,之所以query返回的结果集没有用泛型是为了更好的传递数据 | |
| 451 | + @SuppressWarnings("unchecked") | |
| 452 | + List<HealthHandbookExcelModel> healthHandbookExcelModelList = patientFacade.healthHandbookExcelManager(patientManagerRequest).getData(); | |
| 453 | + List<Map<String, Object>> list = new ArrayList<>(); | |
| 454 | + for (HealthHandbookExcelModel healthHandbookExcelModel : healthHandbookExcelModelList) { | |
| 455 | + Map<String, Object> map = BeanUtils.objectToObjectMap(healthHandbookExcelModel); | |
| 456 | + for (String key : map.keySet()) { | |
| 457 | + if (StringUtils.isEmpty(String.valueOf(map.get(key)))) { | |
| 458 | + map.put(key, " "); | |
| 459 | + } | |
| 460 | + } | |
| 461 | + list.add(map); | |
| 462 | + } | |
| 463 | + Map<String, String> header = new LinkedHashMap<>(); | |
| 464 | + header.put("username", "女方姓名"); | |
| 465 | + header.put("cardNo", "身份证号码"); | |
| 466 | + header.put("husbandName", "配偶姓名"); | |
| 467 | + header.put("organization", "发放机构"); | |
| 468 | + header.put("address", "镇街、村居或单位"); | |
| 469 | + header.put("childTime", "孩次"); | |
| 470 | + header.put("gestation", "孕期"); | |
| 471 | + header.put("bookbuildingDate", "发放时间"); | |
| 472 | + header.put("serial", "首次发放序号"); | |
| 473 | + header.put("issuer", "发放人"); | |
| 474 | + header.put("reissue1", "补发1"); | |
| 475 | + header.put("reissue2", "补发2"); | |
| 476 | + header.put("reissue3", "补发3"); | |
| 477 | + //String hospitalId = autoMatchFacade.getHospitalId(patientManagerRequest.getOperatorId()); | |
| 478 | + | |
| 479 | + httpServletResponse.setContentType("application/force-download"); | |
| 480 | + httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + new String(("母子保健手册.xls").getBytes("UTF-8"), "ISO-8859-1")); | |
| 481 | + ExcelUtil.toExcel(httpServletResponse.getOutputStream(), list, header); | |
| 482 | + } catch (Exception e) { | |
| 483 | + ExceptionUtils.catchException(e, "childbirthManagerExcel异常"); | |
| 484 | + } | |
| 485 | + } | |
| 434 | 486 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
7abccde
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | import com.lyms.platform.operate.web.worker.QuanChanPatientWorker; |
| 17 | 17 | import com.lyms.platform.operate.web.worker.QuanPatientWorker; |
| 18 | 18 | import com.lyms.platform.operate.web.worker.WorkHR; |
| 19 | +import com.lyms.platform.permission.dao.master.CouponMapper; | |
| 19 | 20 | import com.lyms.platform.permission.model.Organization; |
| 20 | 21 | import com.lyms.platform.permission.model.OrganizationQuery; |
| 21 | 22 | import com.lyms.platform.permission.model.Users; |
| ... | ... | @@ -107,7 +108,8 @@ |
| 107 | 108 | private DischargeAbstractMotherService dischargeAbstractMotherService; |
| 108 | 109 | @Autowired |
| 109 | 110 | private MatDeliverFollowService matDeliverFollowService; |
| 110 | - | |
| 111 | + @Autowired | |
| 112 | + private CouponMapper couponMapper; | |
| 111 | 113 | /** |
| 112 | 114 | * 修改产妇的社区 |
| 113 | 115 | * |
| ... | ... | @@ -1250,6 +1252,106 @@ |
| 1250 | 1252 | |
| 1251 | 1253 | patientManagerResult.setPageInfo(patientsQuery.getPageInfo()); |
| 1252 | 1254 | patientManagerResult.setData(patientManagerQueryModelList); |
| 1255 | + patientManagerResult.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1256 | + patientManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
| 1257 | + return patientManagerResult; | |
| 1258 | + } | |
| 1259 | + public PatientManagerResult healthHandbookExcelManager(PatientManagerRequest patientManagerRequest) { | |
| 1260 | + PatientManagerResult patientManagerResult = new PatientManagerResult(); | |
| 1261 | + | |
| 1262 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 1263 | + | |
| 1264 | + patientsQuery.setLiveType(patientManagerRequest.getLiveType()); | |
| 1265 | + patientsQuery.setAssistUserId(patientManagerRequest.getAssistUserId()); | |
| 1266 | + patientsQuery.setSendCareMan(patientManagerRequest.getSendCareMan()); | |
| 1267 | + if (patientManagerRequest.getBuildWeekStart() != null) { | |
| 1268 | + patientsQuery.setBuildDaysStart(patientManagerRequest.getBuildWeekStart() * 7); | |
| 1269 | + } | |
| 1270 | + | |
| 1271 | + if (patientManagerRequest.getBuildWeekEnd() != null) { | |
| 1272 | + patientsQuery.setBuildDaysEnd((patientManagerRequest.getBuildWeekEnd() + 1) * 7 - 1); | |
| 1273 | + } | |
| 1274 | + /* if (patientManagerRequest.getBuildWeekEnd() != null) { | |
| 1275 | + patientsQuery.setBookbuildingDateStart(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientManagerRequest.getBuildWeekEnd() * 7) - 6)); | |
| 1276 | + } | |
| 1277 | + | |
| 1278 | + if (patientManagerRequest.getBuildWeekStart() != null) { | |
| 1279 | + patientsQuery.setBookbuildingDateEnd(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientManagerRequest.getBuildWeekStart() * 7))); | |
| 1280 | + }*/ | |
| 1281 | + | |
| 1282 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 1283 | + if (!patientManagerRequest.isExcel()) { | |
| 1284 | + patientsQuery.setNeed("need"); | |
| 1285 | + patientsQuery.setLimit(patientManagerRequest.getLimit()); | |
| 1286 | + patientsQuery.setPage(patientManagerRequest.getPage()); | |
| 1287 | + } | |
| 1288 | + //排查本院隐藏建档 | |
| 1289 | + patientsQuery.setExtEnable(false); | |
| 1290 | + patientsQuery.setBuildTypeNot(1); | |
| 1291 | + patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(patientManagerRequest.getOperatorId())); | |
| 1292 | + patientsQuery.setProvinceId(StringUtils.isEmpty(patientManagerRequest.getProvinceRegisterId()) ? null : patientManagerRequest.getProvinceRegisterId()); | |
| 1293 | + patientsQuery.setCityId(StringUtils.isEmpty(patientManagerRequest.getCityRegisterId()) ? null : patientManagerRequest.getCityRegisterId()); | |
| 1294 | + patientsQuery.setAreaId(StringUtils.isEmpty(patientManagerRequest.getAreaRegisterId()) ? null : patientManagerRequest.getAreaRegisterId()); | |
| 1295 | + patientsQuery.setStreetId(StringUtils.isEmpty(patientManagerRequest.getStreetRegisterId()) ? null : patientManagerRequest.getStreetRegisterId()); | |
| 1296 | + patientsQuery.setStreetRegisterId(StringUtils.isEmpty(patientManagerRequest.getStreetId()) ? null : patientManagerRequest.getStreetId()); | |
| 1297 | + // UsersQuery usersQuery = new UsersQuery(); | |
| 1298 | + // usersQuery.setName(patientManagerRequest.getBookbuildingDoctor()); | |
| 1299 | + // usersQuery.setYn(YnEnums.YES.getId()); | |
| 1300 | + //List<Users> usersList = usersService.queryUsers(usersQuery); | |
| 1301 | + // if (CollectionUtils.isNotEmpty(usersList)) { | |
| 1302 | + // List<String> bookbuildingDoctorList = new ArrayList<>(); | |
| 1303 | + // for (Users users : usersList) { | |
| 1304 | + // bookbuildingDoctorList.add(users.getId().toString()); | |
| 1305 | + // } | |
| 1306 | + // patientsQuery.setBookbuildingDoctorList(bookbuildingDoctorList); | |
| 1307 | + // } | |
| 1308 | + patientsQuery.setBookbuildingDoctor(StringUtils.isEmpty(patientManagerRequest.getBookbuildingDoctor()) ? null : patientManagerRequest.getBookbuildingDoctor()); | |
| 1309 | + patientsQuery.setProvinceRegisterId(StringUtils.isEmpty(patientManagerRequest.getProvinceId()) ? null : patientManagerRequest.getProvinceId()); | |
| 1310 | + patientsQuery.setCityRegisterId(StringUtils.isEmpty(patientManagerRequest.getCityId()) ? null : patientManagerRequest.getCityId()); | |
| 1311 | + patientsQuery.setAreaRegisterId(StringUtils.isEmpty(patientManagerRequest.getAreaId()) ? null : patientManagerRequest.getAreaId()); | |
| 1312 | + if (StringUtils.isNotEmpty(patientManagerRequest.getBookBuildingDate())) { | |
| 1313 | + try { | |
| 1314 | + patientsQuery.setBookbuildingDateStart(DateUtil.getSNDate(patientManagerRequest.getBookBuildingDate())[0]); | |
| 1315 | + patientsQuery.setBookbuildingDateEnd(DateUtil.getSNDate(patientManagerRequest.getBookBuildingDate())[1]); | |
| 1316 | + } catch (Exception e) { | |
| 1317 | + // 什么都不做,这里是数据传入错误了 | |
| 1318 | + } | |
| 1319 | + } | |
| 1320 | + patientsQuery.setQueryNo(StringUtils.isEmpty(patientManagerRequest.getQueryNo()) ? null : patientManagerRequest.getQueryNo()); | |
| 1321 | + | |
| 1322 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
| 1323 | + List<HealthHandbookExcelModel> healthHandbookExcelModelList = new ArrayList<>(); | |
| 1324 | + if (CollectionUtils.isNotEmpty(patientsList)) { | |
| 1325 | + for (Patients patients : patientsList) { | |
| 1326 | + HealthHandbookExcelModel healthHandbookExcelModel = new HealthHandbookExcelModel(); | |
| 1327 | + BeanUtils.copy(patients, healthHandbookExcelModel); | |
| 1328 | + //女方姓名:孕妇姓名 ==username | |
| 1329 | + healthHandbookExcelModel.setUsername(patients.getUsername()); | |
| 1330 | + //身份证号码:孕妇身份证号码 ==cardNo | |
| 1331 | + healthHandbookExcelModel.setCardNo(patients.getCardNo()); | |
| 1332 | + //发放机构:当前机构名称== 当前机构名称 | |
| 1333 | + String hospitalName= couponMapper.getHospitalName(patients.getHospitalId()); | |
| 1334 | + healthHandbookExcelModel.setOrganization(hospitalName==null?"诸城市人民医院":hospitalName); | |
| 1335 | + //镇街、村居或单位:现住地址 | |
| 1336 | + healthHandbookExcelModel.setAddress(patients.getAddress()); | |
| 1337 | + //孩次:分娩儿童数 | |
| 1338 | + AntExChuModel data = antExService.findOne(patients.getId()); | |
| 1339 | + healthHandbookExcelModel.setChildTime(data==null?1:(data.getProdTime()==null ? 1:data.getProdTime()+1)); | |
| 1340 | + //孕期:当前使用有孕== 有孕 | |
| 1341 | + healthHandbookExcelModel.setGestation(healthHandbookExcelModel.getGestation()); | |
| 1342 | + //发放日期:当前日期 | |
| 1343 | + healthHandbookExcelModel.setBookbuildingDate(DateUtil.getyyyy_MM_dd(patients.getBookbuildingDate())); | |
| 1344 | + //首次发放序号:等待需求沟通 | |
| 1345 | + healthHandbookExcelModel.setSerial(" "); | |
| 1346 | + //发放人: 彭光芳 (写死)==彭光芳 | |
| 1347 | + healthHandbookExcelModel.setIssuer("彭光芳"); | |
| 1348 | + | |
| 1349 | + healthHandbookExcelModelList.add(healthHandbookExcelModel); | |
| 1350 | + } | |
| 1351 | + } | |
| 1352 | + | |
| 1353 | + patientManagerResult.setPageInfo(patientsQuery.getPageInfo()); | |
| 1354 | + patientManagerResult.setData(healthHandbookExcelModelList); | |
| 1253 | 1355 | patientManagerResult.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 1254 | 1356 | patientManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); |
| 1255 | 1357 | return patientManagerResult; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/HealthHandbookExcelModel.java
View file @
7abccde
| 1 | +package com.lyms.platform.operate.web.result; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * @auther wtt | |
| 5 | + * @discription Excel导出实体类 | |
| 6 | + */ | |
| 7 | +public class HealthHandbookExcelModel { | |
| 8 | + | |
| 9 | + /** | |
| 10 | + *女方姓名:孕妇姓名 | |
| 11 | + */ | |
| 12 | + private String username; | |
| 13 | + /** | |
| 14 | + *身份证号码:孕妇身份证号码 | |
| 15 | + */ | |
| 16 | + private String cardNo; | |
| 17 | + /* | |
| 18 | + 配偶姓名:配偶姓名 | |
| 19 | + */ | |
| 20 | + private String husbandName; | |
| 21 | + | |
| 22 | + /* | |
| 23 | + 发放机构:当前机构名称 | |
| 24 | + */ | |
| 25 | + private String organization; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + *镇街、村居或单位:现住地址 | |
| 29 | + */ | |
| 30 | + private String address; | |
| 31 | + | |
| 32 | + /* | |
| 33 | + 孩次:分娩儿童数 | |
| 34 | + */ | |
| 35 | + private Integer childTime; | |
| 36 | + /* | |
| 37 | + 孕期:当前使用有孕== 有孕 | |
| 38 | + */ | |
| 39 | + private String gestation="有孕"; | |
| 40 | + /* | |
| 41 | + 发放日期:当前日期 | |
| 42 | + */ | |
| 43 | + private String bookbuildingDate; | |
| 44 | + | |
| 45 | + /* | |
| 46 | + 首次发放序号:等待需求沟通==? | |
| 47 | + */ | |
| 48 | + private String serial; | |
| 49 | + | |
| 50 | + /* | |
| 51 | + 发放人: 彭光芳 (写死)==彭光芳,根据医院写死 | |
| 52 | + */ | |
| 53 | + | |
| 54 | + private String issuer; | |
| 55 | + /* | |
| 56 | + 补发1 | |
| 57 | + */ | |
| 58 | + private String reissue1; | |
| 59 | + private String reissue2; | |
| 60 | + private String reissue3; | |
| 61 | + | |
| 62 | + public String getReissue1() { | |
| 63 | + return reissue1; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setReissue1(String reissue1) { | |
| 67 | + this.reissue1 = reissue1; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getReissue2() { | |
| 71 | + return reissue2; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setReissue2(String reissue2) { | |
| 75 | + this.reissue2 = reissue2; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getReissue3() { | |
| 79 | + return reissue3; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setReissue3(String reissue3) { | |
| 83 | + this.reissue3 = reissue3; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public String getUsername() { | |
| 87 | + return username; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setUsername(String username) { | |
| 91 | + this.username = username; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getCardNo() { | |
| 95 | + return cardNo; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setCardNo(String cardNo) { | |
| 99 | + this.cardNo = cardNo; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public String getHusbandName() { | |
| 103 | + return husbandName; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setHusbandName(String husbandName) { | |
| 107 | + this.husbandName = husbandName; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public String getOrganization() { | |
| 111 | + return organization; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setOrganization(String organization) { | |
| 115 | + this.organization = organization; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getAddress() { | |
| 119 | + return address; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setAddress(String address) { | |
| 123 | + this.address = address; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public Integer getChildTime() { | |
| 127 | + return childTime; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setChildTime(Integer childTime) { | |
| 131 | + this.childTime = childTime; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public String getGestation() { | |
| 135 | + return gestation; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setGestation(String gestation) { | |
| 139 | + this.gestation = gestation; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public String getBookbuildingDate() { | |
| 143 | + return bookbuildingDate; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setBookbuildingDate(String bookbuildingDate) { | |
| 147 | + this.bookbuildingDate = bookbuildingDate; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public String getSerial() { | |
| 151 | + return serial; | |
| 152 | + } | |
| 153 | + | |
| 154 | + public void setSerial(String serial) { | |
| 155 | + this.serial = serial; | |
| 156 | + } | |
| 157 | + | |
| 158 | + public String getIssuer() { | |
| 159 | + return issuer; | |
| 160 | + } | |
| 161 | + | |
| 162 | + public void setIssuer(String issuer) { | |
| 163 | + this.issuer = issuer; | |
| 164 | + } | |
| 165 | +} |