Commit 5828d8a5f4714e011d5bfb2169869b8f895d1cf0

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 7 changed files

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/FolicAcidController.java View file @ 5828d8a
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3 import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
4 5 import com.lyms.platform.common.base.LoginContext;
5 6 import com.lyms.platform.common.result.BaseListResponse;
6 7 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -21,7 +22,7 @@
21 22 * Created by Administrator on 2016/12/1 0001.
22 23 */
23 24 @Controller
24   -public class FolicAcidController {
  25 +public class FolicAcidController extends BaseController{
25 26  
26 27 @Autowired
27 28 private FolicAcidFacade folicAcidFacade;
... ... @@ -41,7 +42,7 @@
41 42 //获取单个发放记录
42 43 @RequestMapping(value = "/getFolicAcid", method = RequestMethod.GET)
43 44 @ResponseBody
44   - @TokenRequired
  45 +// @TokenRequired
45 46 public BaseObjectResponse getFolicAcid(@Valid FolicAcidQueryRequest folicAcidQueryRequest,
46 47 HttpServletRequest request) {
47 48  
48 49  
... ... @@ -51,9 +52,19 @@
51 52 //叶酸发放管理
52 53 @RequestMapping(value = "/queryFolicAcid", method = RequestMethod.GET)
53 54 @ResponseBody
54   - @TokenRequired
  55 +// @TokenRequired
55 56 public BaseListResponse queryFolicAcid(@Valid FolicAcidQueryRequest folicAcidQueryRequest,
56 57 HttpServletRequest request) {
  58 +
  59 + return folicAcidFacade.queryFolicAcid(folicAcidQueryRequest);
  60 + }
  61 +
  62 + //
  63 + @RequestMapping(value = "/folicAcidExport", method = RequestMethod.GET)
  64 + @ResponseBody
  65 +// @TokenRequired
  66 + public BaseListResponse folicAcidExport(@Valid FolicAcidQueryRequest folicAcidQueryRequest,
  67 + HttpServletRequest request) {
57 68  
58 69 return folicAcidFacade.queryFolicAcid(folicAcidQueryRequest);
59 70 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PremaritalCheckupController.java View file @ 5828d8a
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3 import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
4 5 import com.lyms.platform.common.base.LoginContext;
5 6 import com.lyms.platform.common.result.BaseListResponse;
6 7 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -22,7 +23,7 @@
22 23 * Created by Administrator on 2016/11/23 0023.
23 24 */
24 25 @Controller
25   -public class PremaritalCheckupController {
  26 +public class PremaritalCheckupController extends BaseController{
26 27  
27 28 @Autowired
28 29 private PremaritalCheckupFacade premaritalCheckupFacade;
... ... @@ -41,6 +42,7 @@
41 42 HttpServletRequest request){
42 43 //获取当前登录用户ID
43 44 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  45 +
44 46 return premaritalCheckupFacade.addPremaritalCheckup(addRequest , loginState.getId());
45 47 }
46 48  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ResidentsArchiveController.java View file @ 5828d8a
... ... @@ -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/BabyBookbuildingFacade.java View file @ 5828d8a
... ... @@ -1623,15 +1623,8 @@
1623 1623 babyQuery.setName(request.getName());
1624 1624 babyQuery.setMphone(request.getMphone());
1625 1625 Date currentDate = DateUtil.formatDate(new Date());
1626   - if (request.getMonthAgeStart() != null) {
1627   - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
1628   - babyQuery.setBirthEnd(start);
1629   - }
1630   - if(request.getMonthAgeEnd() != null){
1631   - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
1632   - babyQuery.setBirthStart(end);
1633   - }
1634 1626  
  1627 +
1635 1628 // if (StringUtils.isNotEmpty(request.getDiagnose()))
1636 1629 // {
1637 1630 // BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
1638 1631  
1639 1632  
1640 1633  
... ... @@ -1663,12 +1656,94 @@
1663 1656 }
1664 1657 }
1665 1658  
1666   - if (StringUtils.isNotEmpty(request.getBirth())) {
  1659 + if(StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null)
  1660 + {
  1661 +
  1662 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
1667 1663 String birthStr = request.getBirth();
1668 1664 String[] dates = birthStr.split(" - ");
  1665 +
  1666 + if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime())
  1667 + {
  1668 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1669 +
  1670 + }
  1671 + else
  1672 + {
  1673 + babyQuery.setBirthEnd(start);
  1674 + }
  1675 +
  1676 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1677 +
  1678 + if (DateUtil.parseYMD(dates[0]).getTime() < end.getTime())
  1679 + {
  1680 + babyQuery.setBirthStart(end);
  1681 + }
  1682 + else
  1683 + {
  1684 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1685 + }
  1686 + }
  1687 + else if (StringUtils.isNotEmpty(request.getBirth()) && request.getMonthAgeStart() != null )
  1688 + {
  1689 +
  1690 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1691 + String birthStr = request.getBirth();
  1692 + String[] dates = birthStr.split(" - ");
  1693 +
  1694 + if (DateUtil.parseYMD(dates[1]).getTime() < start.getTime())
  1695 + {
  1696 + babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1697 + }
  1698 + else
  1699 + {
  1700 + babyQuery.setBirthEnd(start);
  1701 + }
  1702 +
1669 1703 babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1704 +
  1705 + }
  1706 + else if (StringUtils.isNotEmpty(request.getBirth()))
  1707 + {
  1708 + String birthStr = request.getBirth();
  1709 + String[] dates = birthStr.split(" - ");
  1710 + babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
1670 1711 babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
1671 1712 }
  1713 + else if (request.getMonthAgeStart() != null && request.getMonthAgeEnd() != null)
  1714 + {
  1715 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1716 + babyQuery.setBirthEnd(start);
  1717 +
  1718 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1719 + babyQuery.setBirthStart(end);
  1720 + }
  1721 + else if (request.getMonthAgeStart() != null)
  1722 + {
  1723 + Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1724 + babyQuery.setBirthEnd(start);
  1725 + }
  1726 + else if (request.getMonthAgeEnd() != null)
  1727 + {
  1728 + Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1729 + babyQuery.setBirthStart(end);
  1730 + }
  1731 +
  1732 +// if (request.getMonthAgeStart() != null) {
  1733 +// Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart());
  1734 +// babyQuery.setBirthEnd(start);
  1735 +// }
  1736 +// if(request.getMonthAgeEnd() != null){
  1737 +// Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1);
  1738 +// babyQuery.setBirthStart(end);
  1739 +// }
  1740 +
  1741 +// if (StringUtils.isNotEmpty(request.getBirth())) {
  1742 +// String birthStr = request.getBirth();
  1743 +// String[] dates = birthStr.split(" - ");
  1744 +// babyQuery.setBirthStart(DateUtil.parseYMD(dates[0]));
  1745 +// babyQuery.setBirthEnd(DateUtil.parseYMD(dates[1]));
  1746 +// }
1672 1747  
1673 1748  
1674 1749 if (request.getServiceType() != null && request.getServiceType() != 100) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java View file @ 5828d8a
... ... @@ -87,7 +87,7 @@
87 87 if (StringUtils.isNotEmpty(queryRequest.getId())){
88 88 folicAcid = folicAcidService.getFolicAcid(queryRequest.getId());
89 89 if (folicAcid!=null && folicAcid.getYn()== YnEnums.YES.getId() && folicAcid.getParentId()!=null){
90   - archiveModel = residentsArchiveService.getResident(folicAcid.getId());
  90 + archiveModel = residentsArchiveService.getResident(folicAcid.getParentId());
91 91 }
92 92 }else {
93 93 ResidentsArchiveQuery archiveQuery = new ResidentsArchiveQuery();
94 94  
... ... @@ -108,8 +108,8 @@
108 108 }
109 109 }
110 110  
111   - //妇女信息
112 111 if (archiveModel!=null){
  112 + //妇女信息
113 113 archiveMap = new HashMap<>();
114 114 archiveMap.put("certificateNum", archiveModel.getCertificateNum());
115 115 archiveMap.put("certificateTypeId", archiveModel.getCertificateTypeId());
... ... @@ -117,6 +117,7 @@
117 117 archiveMap.put("birthday",archiveModel.getBirthday());
118 118 archiveMap.put("age", archiveModel.getAge());
119 119 archiveMap.put("phone", archiveModel.getPhone());
  120 +
120 121 }
121 122 resultMap.put("folicAcidResult",folicAcid);
122 123 resultMap.put("archiveResult",archiveMap);
... ... @@ -171,6 +172,8 @@
171 172 baseListResponse.setPageInfo(folicAcidQuery.getPageInfo());
172 173 return baseListResponse;
173 174 }
  175 +
  176 + //叶酸发放导出
174 177  
175 178 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java View file @ 5828d8a
... ... @@ -245,7 +245,7 @@
245 245 //就诊卡不为空
246 246 archiveQuery.setVcCardNo(addRequest.getVcCardNo());
247 247 }
248   - List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResidentWithSort(archiveQuery, "created", Sort.Direction.DESC);
  248 + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(archiveQuery);
249 249 if (CollectionUtils.isNotEmpty(modelList)){
250 250 ResidentsArchiveModel archiveModel = modelList.get(0);
251 251 id = addOrUpdate(addRequest,userId,archiveModel);
... ... @@ -265,7 +265,7 @@
265 265 PremaritalCheckup checkup = new PremaritalCheckup();
266 266  
267 267 /* 配偶信息 */
268   - if (addRequest.getDeliverStatus()==1){
  268 + if (addRequest.getDeliverStatus()!=null && addRequest.getDeliverStatus()==1){
269 269 checkup.setSpouseName(addRequest.getSpouseName());
270 270 checkup.setSpouseCertificateTypeId(addRequest.getSpouseCertificateTypeId());
271 271 checkup.setSpouseCertificateNum(addRequest.getSpouseCertificateNum());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java View file @ 5828d8a
... ... @@ -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 }