Commit bdd54f24e4fd3c42182ce4521899d02ddce2b08f
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java
View file @
bdd54f2
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | 3 | |
4 | +import com.lyms.platform.common.annotation.TokenRequired; | |
4 | 5 | import com.lyms.platform.common.base.BaseController; |
6 | +import com.lyms.platform.common.base.LoginContext; | |
5 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
6 | 8 | import com.lyms.platform.common.result.BaseListResponse; |
7 | 9 | import com.lyms.platform.common.result.BaseObjectResponse; |
... | ... | @@ -13,6 +15,7 @@ |
13 | 15 | import org.springframework.stereotype.Controller; |
14 | 16 | import org.springframework.web.bind.annotation.*; |
15 | 17 | |
18 | +import javax.servlet.http.HttpServletRequest; | |
16 | 19 | import javax.validation.Valid; |
17 | 20 | import java.io.UnsupportedEncodingException; |
18 | 21 | |
19 | 22 | |
... | ... | @@ -97,12 +100,14 @@ |
97 | 100 | */ |
98 | 101 | @RequestMapping(value = "/queryBabyBuildRecord", method = RequestMethod.GET) |
99 | 102 | @ResponseBody |
100 | - public BaseObjectResponse queryBabyBuildRecord(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo,@RequestParam(required = false)String hospitalId){ | |
103 | + @TokenRequired | |
104 | + public BaseObjectResponse queryBabyBuildRecord(HttpServletRequest request,@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo,@RequestParam(required = false)String hospitalId){ | |
101 | 105 | BookbuildingQueryRequest param = new BookbuildingQueryRequest(); |
102 | 106 | param.setCardNo(cardNo); |
103 | 107 | param.setVcCardNo(vcCardNo); |
104 | 108 | param.setHospitalId(hospitalId); |
105 | - return babyBookbuildingFacade.queryBabyBuildRecord(param); | |
109 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
110 | + return babyBookbuildingFacade.queryBabyBuildRecord(param,loginState.getId()); | |
106 | 111 | } |
107 | 112 | |
108 | 113 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
bdd54f2
... | ... | @@ -11,7 +11,9 @@ |
11 | 11 | import com.lyms.platform.operate.web.result.*; |
12 | 12 | import com.lyms.platform.permission.model.Organization; |
13 | 13 | import com.lyms.platform.permission.model.OrganizationQuery; |
14 | +import com.lyms.platform.permission.model.Users; | |
14 | 15 | import com.lyms.platform.permission.service.OrganizationService; |
16 | +import com.lyms.platform.permission.service.UsersService; | |
15 | 17 | import com.lyms.platform.pojo.*; |
16 | 18 | import com.lyms.platform.query.*; |
17 | 19 | import org.apache.commons.collections.CollectionUtils; |
... | ... | @@ -62,6 +64,8 @@ |
62 | 64 | @Autowired |
63 | 65 | private BabyCheckService babyCheckService; |
64 | 66 | |
67 | + @Autowired | |
68 | + private UsersService usersService; | |
65 | 69 | |
66 | 70 | @Autowired |
67 | 71 | private SmsConfigService smsConfigService; |
68 | 72 | |
... | ... | @@ -815,8 +819,19 @@ |
815 | 819 | * @param param |
816 | 820 | * @return |
817 | 821 | */ |
818 | - public BaseObjectResponse queryBabyBuildRecord(BookbuildingQueryRequest param) { | |
822 | + public BaseObjectResponse queryBabyBuildRecord(BookbuildingQueryRequest param,Integer userId) { | |
819 | 823 | |
824 | + if (userId != null) | |
825 | + { | |
826 | + Users dbuser = usersService.getUsers(userId); | |
827 | + if (dbuser != null) { | |
828 | + Integer hospitalId = dbuser.getOrgId(); | |
829 | + param.setHospitalId(String.valueOf(hospitalId)); | |
830 | + } | |
831 | + } | |
832 | + | |
833 | + | |
834 | + | |
820 | 835 | Map<String,Object> map = new HashMap<>(); |
821 | 836 | |
822 | 837 | List<BabyInfoResult> results = new ArrayList<>(); |
... | ... | @@ -825,6 +840,7 @@ |
825 | 840 | List<BabyModel> models = null; |
826 | 841 | if (!StringUtils.isEmpty(param.getCardNo())) { |
827 | 842 | babyQuery.setCardId(param.getCardNo()); |
843 | + babyQuery.setHospitalId(param.getHospitalId()); | |
828 | 844 | |
829 | 845 | //通过查询孕妇 |
830 | 846 | PatientsQuery puerperaQuery = new PatientsQuery(); |
831 | 847 | |
832 | 848 | |
... | ... | @@ -861,23 +877,35 @@ |
861 | 877 | for (BabyModel model : models) { |
862 | 878 | |
863 | 879 | if (id.equals(model.getId())) { |
864 | - Map<String, String> buildRecords = new HashMap<>(); | |
865 | - buildRecords.put("id", model.getId()); | |
866 | - buildRecords.put("buildDate", DateUtil.getyyyy_MM_dd(model.getBuildDate())); | |
867 | 880 | |
868 | - //查询建档医院 | |
869 | - Organization org = organizationService.getOrganization(Integer.valueOf(model.getHospitalId())); | |
870 | - if (org != null) { | |
871 | - buildRecords.put("buildHospital", org.getName()); | |
872 | - } else { | |
873 | - buildRecords.put("buildHospital", ""); | |
874 | - } | |
881 | + BabyModelQuery hospBuildRecordsQuery = new BabyModelQuery(); | |
882 | + hospBuildRecordsQuery.setYn(YnEnums.YES.getId()); | |
883 | + hospBuildRecordsQuery.setMcertNo(model.getMcertNo()); | |
884 | + List<BabyModel> builds = babyBookbuildingService.queryBabyBuildByCond(hospBuildRecordsQuery); | |
885 | + if (CollectionUtils.isNotEmpty(builds)) | |
886 | + { | |
887 | + for(BabyModel build: builds) | |
888 | + { | |
889 | + Map<String, String> buildRecords = new HashMap<>(); | |
890 | + buildRecords.put("id", build.getId()); | |
891 | + buildRecords.put("buildDate", DateUtil.getyyyy_MM_dd(build.getBuildDate())); | |
875 | 892 | |
876 | - result.setId(model.getId()); | |
877 | - result.setCardNo(model.getCardNo()); | |
878 | - result.setName(model.getName()); | |
879 | - result.setMonthAge(DateUtil.getBabyMonthAge(model.getBirth(), new Date())); | |
880 | - list.add(buildRecords); | |
893 | + //查询建档医院 | |
894 | + Organization org = organizationService.getOrganization(Integer.valueOf(build.getHospitalId())); | |
895 | + if (org != null) { | |
896 | + buildRecords.put("buildHospital", org.getName()); | |
897 | + } else { | |
898 | + buildRecords.put("buildHospital", ""); | |
899 | + } | |
900 | + | |
901 | + result.setId(build.getId()); | |
902 | + result.setCardNo(build.getCardNo()); | |
903 | + result.setName(build.getName()); | |
904 | + result.setMonthAge(DateUtil.getBabyMonthAge(build.getBirth(), new Date())); | |
905 | + list.add(buildRecords); | |
906 | + } | |
907 | + | |
908 | + } | |
881 | 909 | |
882 | 910 | } |
883 | 911 | result.setBuildRecords(list); |