Commit eb0ce0795f83bfbf55e65160f8180a08e08c015b
1 parent
9e2dda7dc5
Exists in
master
and in
8 other branches
update
Showing 4 changed files with 154 additions and 3 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FolicAcidController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ResidentsArchiveController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FolicAcidController.java
View file @
eb0ce07
| ... | ... | @@ -58,5 +58,15 @@ |
| 58 | 58 | return folicAcidFacade.queryFolicAcid(folicAcidQueryRequest); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | + // | |
| 62 | + @RequestMapping(value = "/folicAcidExport", method = RequestMethod.GET) | |
| 63 | + @ResponseBody | |
| 64 | +// @TokenRequired | |
| 65 | + public BaseListResponse folicAcidExport(@Valid FolicAcidQueryRequest folicAcidQueryRequest, | |
| 66 | + HttpServletRequest request) { | |
| 67 | + | |
| 68 | + return folicAcidFacade.queryFolicAcid(folicAcidQueryRequest); | |
| 69 | + } | |
| 70 | + | |
| 61 | 71 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ResidentsArchiveController.java
View file @
eb0ce07
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | import org.springframework.web.bind.annotation.*; |
| 16 | 16 | |
| 17 | 17 | import javax.servlet.http.HttpServletRequest; |
| 18 | +import javax.servlet.http.HttpServletResponse; | |
| 18 | 19 | import javax.validation.Valid; |
| 19 | 20 | |
| 20 | 21 | /** |
| ... | ... | @@ -81,6 +82,7 @@ |
| 81 | 82 | */ |
| 82 | 83 | @RequestMapping(value = "/queryResidentsArchiveById/{id}", method = RequestMethod.GET) |
| 83 | 84 | @ResponseBody |
| 85 | +// @TokenRequired | |
| 84 | 86 | public BaseObjectResponse queryResidentsArchiveById(@PathVariable("id")String id){ |
| 85 | 87 | BaseObjectResponse objectResponse = residentsArchiveFacade.queryResidentsArchiveById(id); |
| 86 | 88 | return objectResponse; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java
View file @
eb0ce07
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
View file @
eb0ce07
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 10 | 10 | import com.lyms.platform.common.result.BaseResponse; |
| 11 | 11 | import com.lyms.platform.common.utils.DateUtil; |
| 12 | +import com.lyms.platform.common.utils.ExcelUtil; | |
| 12 | 13 | import com.lyms.platform.common.utils.JsonUtil; |
| 13 | 14 | import com.lyms.platform.common.utils.SystemConfig; |
| 14 | 15 | import com.lyms.platform.operate.web.request.ResidentsArchiveAddRequest; |
| 15 | 16 | |
| ... | ... | @@ -21,8 +22,10 @@ |
| 21 | 22 | import com.lyms.platform.permission.model.Users; |
| 22 | 23 | import com.lyms.platform.permission.service.OrganizationService; |
| 23 | 24 | import com.lyms.platform.permission.service.UsersService; |
| 25 | +import com.lyms.platform.pojo.BasicConfig; | |
| 24 | 26 | import com.lyms.platform.pojo.PremaritalCheckup; |
| 25 | 27 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
| 28 | +import com.lyms.platform.query.BasicConfigQuery; | |
| 26 | 29 | import com.lyms.platform.query.PremaritalCheckupQuery; |
| 27 | 30 | import com.lyms.platform.query.ResidentsArchiveQuery; |
| 28 | 31 | import com.mongodb.util.JSON; |
| ... | ... | @@ -32,6 +35,8 @@ |
| 32 | 35 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | 36 | import org.springframework.stereotype.Component; |
| 34 | 37 | |
| 38 | +import javax.servlet.http.HttpServletResponse; | |
| 39 | +import java.io.OutputStream; | |
| 35 | 40 | import java.util.*; |
| 36 | 41 | |
| 37 | 42 | /** |
| 38 | 43 | |
| 39 | 44 | |
| 40 | 45 | |
| ... | ... | @@ -327,19 +332,54 @@ |
| 327 | 332 | return objectResponse; |
| 328 | 333 | } |
| 329 | 334 | |
| 335 | + ResidentsArchiveModel model = null; | |
| 336 | + | |
| 330 | 337 | ResidentsArchiveResult result = new ResidentsArchiveResult(); |
| 331 | 338 | |
| 332 | - | |
| 333 | 339 | ResidentsArchiveQuery query = new ResidentsArchiveQuery(); |
| 334 | 340 | query.setYn(YnEnums.YES.getId()); |
| 335 | 341 | query.setId(id); |
| 336 | 342 | List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(query); |
| 337 | 343 | if (CollectionUtils.isNotEmpty(modelList)){ |
| 338 | - ResidentsArchiveModel model = modelList.get(0); | |
| 344 | + model = modelList.get(0); | |
| 345 | + //建档详情 | |
| 339 | 346 | result = getResult(model); |
| 340 | 347 | } |
| 341 | 348 | |
| 342 | - objectResponse.setData(result); | |
| 349 | + List<ResidentsArchiveHistoryResult> historyResults = new ArrayList<>(); | |
| 350 | + | |
| 351 | + //历史记录 | |
| 352 | + if (model!=null){ | |
| 353 | + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 354 | + archiveQuery.setHospitalId(model.getHospitalId()); | |
| 355 | + archiveQuery.setYn(YnEnums.YES.getId()); | |
| 356 | + if (StringUtils.isNotEmpty(model.getCertificateNum())){ | |
| 357 | + archiveQuery.setCertificateNum(model.getCertificateNum()); | |
| 358 | + }else if (StringUtils.isNotEmpty(model.getVcCardNo())){ | |
| 359 | + archiveQuery.setVcCardNo(model.getVcCardNo()); | |
| 360 | + } | |
| 361 | + List<ResidentsArchiveModel> archiveModelList = residentsArchiveService.queryResident(archiveQuery); | |
| 362 | + if (CollectionUtils.isNotEmpty(archiveModelList)){ | |
| 363 | + for (ResidentsArchiveModel archiveModel : archiveModelList){ | |
| 364 | + ResidentsArchiveHistoryResult temp = new ResidentsArchiveHistoryResult(); | |
| 365 | + //查询医院机构 | |
| 366 | + if (StringUtils.isNotEmpty(archiveModel.getHospitalId())){ | |
| 367 | + Organization org = organizationService.getOrganization(Integer.valueOf(archiveModel.getHospitalId())); | |
| 368 | + if (org != null){ | |
| 369 | + temp.setBookBuildHospital(org.getName()); | |
| 370 | + temp.setHospitalId(String.valueOf(org.getId())); | |
| 371 | + } | |
| 372 | + } | |
| 373 | + temp.setBookBuildDate(archiveModel.getBuildDay()); | |
| 374 | + temp.setId(archiveModel.getId()); | |
| 375 | + historyResults.add(temp); | |
| 376 | + } | |
| 377 | + } | |
| 378 | + } | |
| 379 | + Map<String,Object> map = new HashMap<>(); | |
| 380 | + map.put("ResidentsArchiveResult",result); | |
| 381 | + map.put("historyResult",historyResults); | |
| 382 | + objectResponse.setData(map); | |
| 343 | 383 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 344 | 384 | objectResponse.setErrormsg("成功"); |
| 345 | 385 | return objectResponse; |
| ... | ... | @@ -470,5 +510,102 @@ |
| 470 | 510 | return response; |
| 471 | 511 | } |
| 472 | 512 | |
| 513 | + //数据导出 | |
| 514 | + public void residentsArchiveExport(ResidentsArchiveQueryRequest queryRequest,Integer userId,HttpServletResponse response){ | |
| 515 | + | |
| 516 | + OutputStream out = null; | |
| 517 | + | |
| 518 | + List<Map<String,Object>> list = new ArrayList<>(); | |
| 519 | + | |
| 520 | + try { | |
| 521 | + ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery(); | |
| 522 | + archiveQuery.setYn(YnEnums.YES.getId()); | |
| 523 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 524 | + archiveQuery.setSex(SystemConfig.WOMAN_ID); | |
| 525 | + archiveQuery.setHospitalId(hospital); | |
| 526 | + archiveQuery.setProvinceId(queryRequest.getProvinceId()); | |
| 527 | + archiveQuery.setCityId(queryRequest.getCityId()); | |
| 528 | + archiveQuery.setAreaId(queryRequest.getAreaId()); | |
| 529 | + archiveQuery.setUsername(queryRequest.getUsername()); | |
| 530 | + archiveQuery.setCertificateNum(queryRequest.getCardNo()); | |
| 531 | + archiveQuery.setPhone(queryRequest.getPhone()); | |
| 532 | + List<ResidentsArchiveModel> archiveModelList = residentsArchiveService.queryResident(archiveQuery); | |
| 533 | + if (CollectionUtils.isNotEmpty(archiveModelList)){ | |
| 534 | + for (ResidentsArchiveModel data : archiveModelList){ | |
| 535 | + Map<String,Object> map = new HashMap<>(); | |
| 536 | + map.put("username",data.getUsername()); | |
| 537 | + map.put("sex","女"); | |
| 538 | + map.put("birthday",getBirthday(data.getBirthday())); | |
| 539 | + map.put("countryId",getBaseicConfigByid(data.getCountryId())); | |
| 540 | + map.put("nationId",getBaseicConfigByid(data.getNationId())); | |
| 541 | + map.put("marriageId",getBaseicConfigByid(data.getMarriageId())); | |
| 542 | + map.put("certificateTypeId",getBaseicConfigByid(data.getCertificateTypeId())); | |
| 543 | + map.put("certificateNum",data.getCertificateNum()); | |
| 544 | + map.put("censusTypeId",getBaseicConfigByid(data.getCensusTypeId())); | |
| 545 | + map.put("liveTypeId",getBaseicConfigByid(data.getLiveTypeId())); | |
| 546 | + map.put("levelTypeId",getBaseicConfigByid(data.getLevelTypeId())); | |
| 547 | + map.put("professionTypeId", getBaseicConfigByid(data.getProfessionTypeId())); | |
| 548 | + if (StringUtils.isNotEmpty(data.getHospitalId())){ | |
| 549 | + Organization organization = organizationService.getOrganization(Integer.valueOf(data.getHospitalId())); | |
| 550 | + if (organization != null && organization.getYn()==YnEnums.YES.getId()){ | |
| 551 | + map.put("hospital", organization.getName()); | |
| 552 | + } | |
| 553 | + } | |
| 554 | + map.put("age",data.getAge()); | |
| 555 | + map.put("phone",data.getPhone()); | |
| 556 | + map.put("workUnit",data.getWorkUnit()); | |
| 557 | + map.put("residence",CommonsHelper.getResidence(data.getProvinceId(), data.getCityId(), | |
| 558 | + data.getAreaId(), data.getStreetId(), data.getAddress(), basicConfigService)); | |
| 559 | + map.put("residenceRegister",CommonsHelper.getResidence(data.getProvinceRegisterId(), data.getCityRegisterId(), | |
| 560 | + data.getAreaRegisterId(), data.getStreetRegisterId(), | |
| 561 | + data.getAddressRegister(), basicConfigService)); | |
| 562 | + | |
| 563 | + //病史 | |
| 564 | + map.put("pastHistory", data.getPastHistory()); | |
| 565 | + map.put("familyHistory", data.getFamilyHistory()); | |
| 566 | + map.put("personalHistory", data.getPersonalHistory()); | |
| 567 | + map.put("ywgmHistory", data.getYwgmHistory()); | |
| 568 | + map.put("presentHistory", data.getPresentHistory()); | |
| 569 | + | |
| 570 | + map.put("vcCardNo", data.getVcCardNo()); | |
| 571 | + map.put("buildDoctor", data.getBuildDoctor()); | |
| 572 | + map.put("buildDay", data.getBuildDay()); | |
| 573 | + } | |
| 574 | + } | |
| 575 | + out = response.getOutputStream(); | |
| 576 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
| 577 | + cnames.put("username","姓名"); | |
| 578 | + | |
| 579 | + | |
| 580 | + response.setContentType("application/octet-stream"); | |
| 581 | + response.setHeader("Content-Disposition", "attachment;fileName=" + "juming.xls"); | |
| 582 | + ExcelUtil.toExcel(out, list, cnames); | |
| 583 | + }catch (Exception e){ | |
| 584 | + e.printStackTrace(); | |
| 585 | + } | |
| 586 | + } | |
| 587 | + | |
| 588 | + //获取生日 | |
| 589 | + public String getBirthday(String b){ | |
| 590 | + if (b!=null){ | |
| 591 | + String year = b.substring(0,4); | |
| 592 | + String mouth = b.substring(5,7); | |
| 593 | + String day = b.substring(8,10); | |
| 594 | + return year + "年" + mouth + "月" + day + "日"; | |
| 595 | + } | |
| 596 | + return null; | |
| 597 | + } | |
| 598 | + | |
| 599 | + //获取基础基础名称 | |
| 600 | + public String getBaseicConfigByid(String id) { | |
| 601 | + | |
| 602 | + if (StringUtils.isNotEmpty(id)){ | |
| 603 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id); | |
| 604 | + if (basicConfig!=null && basicConfig.getYn()!=YnEnums.NO.getId()){ | |
| 605 | + return basicConfig.getName(); | |
| 606 | + } | |
| 607 | + } | |
| 608 | + return ""; | |
| 609 | + } | |
| 473 | 610 | } |