Commit 10afb37dec4d2c3d108b3620c17ec8ed1f8a5cfb
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 11 changed files
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyManageController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyManagerQueryRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PuerperaResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
10afb37
... | ... | @@ -44,6 +44,16 @@ |
44 | 44 | this.mphone = mphone; |
45 | 45 | } |
46 | 46 | |
47 | + private String areaId; | |
48 | + | |
49 | + public String getAreaId() { | |
50 | + return areaId; | |
51 | + } | |
52 | + | |
53 | + public void setAreaId(String areaId) { | |
54 | + this.areaId = areaId; | |
55 | + } | |
56 | + | |
47 | 57 | /** |
48 | 58 | * 母亲的id |
49 | 59 | */ |
... | ... | @@ -148,6 +158,9 @@ |
148 | 158 | } |
149 | 159 | if(-1!=yn){ |
150 | 160 | condition = condition.and("yn", yn, MongoOper.IS); |
161 | + } | |
162 | + if(null!=areaId){ | |
163 | + condition = condition.and("areaId", areaId, MongoOper.IS); | |
151 | 164 | } |
152 | 165 | /* |
153 | 166 | * if(null!=keyword){ if(null!=keyword){ MongoCondition con1= MongoCondition.newInstance("phone", keyword, MongoOper.LIKE); MongoCondition con |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
10afb37
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | */ |
40 | 40 | private int visitstatus=-1; |
41 | 41 | |
42 | - private int areaId=-1; | |
42 | + private String areaId; | |
43 | 43 | /** |
44 | 44 | * 产妇手机号 |
45 | 45 | */ |
46 | 46 | |
... | ... | @@ -75,11 +75,11 @@ |
75 | 75 | */ |
76 | 76 | private Date birthEnd; |
77 | 77 | |
78 | - public int getAreaId() { | |
78 | + public String getAreaId() { | |
79 | 79 | return areaId; |
80 | 80 | } |
81 | 81 | |
82 | - public void setAreaId(int areaId) { | |
82 | + public void setAreaId(String areaId) { | |
83 | 83 | this.areaId = areaId; |
84 | 84 | } |
85 | 85 | |
... | ... | @@ -199,7 +199,7 @@ |
199 | 199 | if(null!=communityId&&!"-1".equals(communityId)){ |
200 | 200 | condition= condition.and("communityId", communityId, MongoOper.IS); |
201 | 201 | } |
202 | - if(-1!=areaId){ | |
202 | + if(null!=areaId){ | |
203 | 203 | condition= condition.and("areaId", areaId, MongoOper.IS); |
204 | 204 | } |
205 | 205 | if(null!=id){ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyManageController.java
View file @
10afb37
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | +import javax.servlet.http.HttpServletRequest; | |
3 | 4 | import javax.validation.Valid; |
4 | 5 | |
5 | 6 | import com.lyms.platform.common.annotation.TokenRequired; |
6 | 7 | import com.lyms.platform.common.base.BaseController; |
8 | +import com.lyms.platform.common.base.LoginContext; | |
7 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
8 | 10 | import org.springframework.stereotype.Controller; |
9 | 11 | import org.springframework.web.bind.annotation.PathVariable; |
... | ... | @@ -45,8 +47,9 @@ |
45 | 47 | @RequestMapping(value = "/babymanage", method = RequestMethod.GET) |
46 | 48 | @ResponseBody |
47 | 49 | @TokenRequired |
48 | - public BaseListResponse findBabyDataList(@Valid BabyManagerQueryRequest babyManagerRequest){ | |
49 | - return babyManagerFacade.findBabyList(babyManagerRequest); | |
50 | + public BaseListResponse findBabyDataList(@Valid BabyManagerQueryRequest babyManagerRequest,HttpServletRequest request){ | |
51 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
52 | + return babyManagerFacade.findBabyList(babyManagerRequest,loginState.getId()); | |
50 | 53 | } |
51 | 54 | |
52 | 55 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
View file @
10afb37
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | -import java.util.ArrayList; | |
4 | -import java.util.Collections; | |
5 | -import java.util.List; | |
6 | - | |
7 | -import javax.validation.Valid; | |
8 | - | |
9 | 3 | import com.lyms.platform.biz.param.CommunityQuery; |
10 | 4 | import com.lyms.platform.biz.service.BasicConfigService; |
5 | +import com.lyms.platform.biz.service.CommunityConfigService; | |
11 | 6 | import com.lyms.platform.biz.service.PatientsService; |
12 | 7 | import com.lyms.platform.common.annotation.TokenRequired; |
13 | 8 | import com.lyms.platform.common.base.BaseController; |
9 | +import com.lyms.platform.common.base.LoginContext; | |
10 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
14 | 11 | import com.lyms.platform.common.enums.YnEnums; |
12 | +import com.lyms.platform.common.result.BaseResponse; | |
15 | 13 | import com.lyms.platform.common.utils.SystemConfig; |
16 | -import com.lyms.platform.operate.web.facade.PuerperaManagerFacade; | |
17 | -import com.lyms.platform.operate.web.request.PuerperaManagerQueryRequest; | |
14 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
15 | +import com.lyms.platform.operate.web.request.CommunityConfigRequest; | |
18 | 16 | import com.lyms.platform.operate.web.result.FrontEndResult; |
19 | -import com.lyms.platform.permission.model.Regions; | |
20 | -import com.lyms.platform.permission.service.RegionsService; | |
21 | 17 | import com.lyms.platform.pojo.BasicConfig; |
18 | +import com.lyms.platform.pojo.CommunityConfig; | |
22 | 19 | import com.lyms.platform.pojo.Patients; |
23 | 20 | import com.lyms.platform.query.PatientsQuery; |
24 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
25 | 22 | import org.springframework.stereotype.Controller; |
26 | -import org.springframework.web.bind.annotation.PathVariable; | |
27 | -import org.springframework.web.bind.annotation.RequestBody; | |
28 | -import org.springframework.web.bind.annotation.RequestMapping; | |
29 | -import org.springframework.web.bind.annotation.RequestMethod; | |
30 | -import org.springframework.web.bind.annotation.RequestParam; | |
31 | -import org.springframework.web.bind.annotation.ResponseBody; | |
23 | +import org.springframework.web.bind.annotation.*; | |
32 | 24 | |
33 | -import com.lyms.platform.biz.service.CommunityConfigService; | |
34 | -import com.lyms.platform.common.constants.ErrorCodeConstants; | |
35 | -import com.lyms.platform.common.result.BaseListResponse; | |
36 | -import com.lyms.platform.common.result.BaseResponse; | |
37 | -import com.lyms.platform.operate.web.request.CommunityConfigRequest; | |
38 | -import com.lyms.platform.pojo.CommunityConfig; | |
25 | +import javax.servlet.http.HttpServletRequest; | |
26 | +import javax.validation.Valid; | |
27 | +import java.util.ArrayList; | |
28 | +import java.util.Collections; | |
29 | +import java.util.List; | |
39 | 30 | |
40 | 31 | /** |
41 | 32 | * 社区管理 |
42 | 33 | * Created by Zhang.Rui on 2016/3/18. |
43 | 34 | */ |
44 | 35 | @Controller |
45 | -public class CommunityConfigController extends BaseController { | |
36 | +public class CommunityConfigController extends BaseController { | |
46 | 37 | @Autowired |
47 | 38 | private CommunityConfigService communityConfigService; |
48 | 39 | @Autowired |
49 | 40 | private PatientsService patientsService; |
50 | 41 | @Autowired |
51 | 42 | private BasicConfigService basicConfigService; |
43 | + @Autowired | |
44 | + private AutoMatchFacade autoMatchFacade; | |
52 | 45 | |
53 | 46 | |
54 | - | |
55 | - | |
56 | 47 | //添加管辖区域 |
57 | 48 | @RequestMapping(value = "addCommunity", method = RequestMethod.POST) |
58 | 49 | @ResponseBody |
59 | 50 | @TokenRequired |
60 | 51 | public BaseResponse addCommunity(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) { |
61 | 52 | String names = ""; |
62 | - for(String tmp : communityConfigRequest.getNames()) { | |
53 | + for (String tmp : communityConfigRequest.getNames()) { | |
63 | 54 | names += ", " + tmp; |
64 | 55 | } |
65 | 56 | |
66 | 57 | |
67 | 58 | CommunityConfig communityConfig = communityConfigService.getCommunityById(communityConfigRequest.getId()); |
68 | - if(null == communityConfig) return null; | |
59 | + if (null == communityConfig) return null; | |
69 | 60 | |
70 | 61 | communityConfig.setId(communityConfigRequest.getId()); |
71 | - if(null != communityConfig.getGxxq() && 0 < communityConfig.getGxxq().length() ) { | |
62 | + if (null != communityConfig.getGxxq() && 0 < communityConfig.getGxxq().length()) { | |
72 | 63 | communityConfig.setGxxq(communityConfig.getGxxq() + ", " + names.substring(1, names.length())); |
73 | 64 | } else { |
74 | - communityConfig.setGxxq( names.substring(1, names.length())); | |
65 | + communityConfig.setGxxq(names.substring(1, names.length())); | |
75 | 66 | } |
76 | 67 | communityConfig.setCreateDate(System.currentTimeMillis()); |
77 | 68 | communityConfigService.updateCommunity(communityConfig); |
78 | 69 | |
79 | 70 | |
80 | 71 | |
81 | 72 | |
82 | 73 | |
... | ... | @@ -102,27 +93,34 @@ |
102 | 93 | @RequestMapping(value = "communityConfig", method = RequestMethod.GET) |
103 | 94 | @ResponseBody |
104 | 95 | @TokenRequired |
105 | - public FrontEndResult queryCommunity(CommunityQuery communityQuery) { | |
106 | - BasicConfig config = basicConfigService.getOneBasicConfigById(communityQuery.getId()); | |
107 | - if(null != communityQuery.getId() && null == config) { | |
96 | + public FrontEndResult queryCommunity(CommunityQuery communityQuery, HttpServletRequest request) { | |
97 | + BasicConfig config = basicConfigService.getOneBasicConfigById(communityQuery.getId()); | |
98 | + if (null != communityQuery.getId() && null == config) { | |
108 | 99 | communityQuery.setId(null); |
109 | 100 | } |
110 | - List<CommunityConfig> communityConfigList = communityConfigService.queryCommunity(communityQuery); | |
101 | + //获取登录用户 | |
102 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
103 | + String areaId = autoMatchFacade.match(loginState.getId()); | |
104 | + List<CommunityConfig> communityConfigList; | |
105 | + if (null != areaId) { | |
106 | + communityQuery.setId(areaId); | |
107 | + } | |
108 | + communityConfigList = communityConfigService.queryCommunity(communityQuery); | |
111 | 109 | List<BasicConfig> basicConfigs = null; |
112 | 110 | |
113 | - if(null != communityConfigList) { | |
114 | - for(CommunityConfig communityConfig : communityConfigList) { | |
111 | + if (null != communityConfigList) { | |
112 | + for (CommunityConfig communityConfig : communityConfigList) { | |
115 | 113 | String areaNames = ""; |
116 | - basicConfigs = new ArrayList<>(); | |
117 | - for(String s : communityConfig.getAreas()) { | |
114 | + basicConfigs = new ArrayList<>(); | |
115 | + for (String s : communityConfig.getAreas()) { | |
118 | 116 | config = basicConfigService.getOneBasicConfigById(s); |
119 | 117 | basicConfigs.add(config); |
120 | - if(null != config) { | |
118 | + if (null != config) { | |
121 | 119 | areaNames += config.getName() + ", "; |
122 | 120 | } |
123 | 121 | } |
124 | - if(2 < areaNames.length()) { | |
125 | - communityConfig.setAreaNames(areaNames.substring(0, areaNames.length()-2)); | |
122 | + if (2 < areaNames.length()) { | |
123 | + communityConfig.setAreaNames(areaNames.substring(0, areaNames.length() - 2)); | |
126 | 124 | } |
127 | 125 | communityConfig.setAreasObj(basicConfigs); |
128 | 126 | } |
129 | 127 | |
130 | 128 | |
131 | 129 | |
132 | 130 | |
... | ... | @@ -134,24 +132,23 @@ |
134 | 132 | } |
135 | 133 | |
136 | 134 | |
137 | - | |
138 | 135 | //新增社区 |
139 | 136 | @RequestMapping(value = "communityConfig", method = RequestMethod.POST) |
140 | 137 | @ResponseBody |
141 | 138 | @TokenRequired |
142 | 139 | public BaseResponse appendArea(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) { |
143 | - CommunityConfig communityConfig = null; | |
140 | + CommunityConfig communityConfig = null; | |
144 | 141 | BasicConfig basicConfig = null; |
145 | 142 | List<String> areaIds = new ArrayList<>(); |
146 | - for(String tmp : communityConfigRequest.getNames()) { | |
143 | + for (String tmp : communityConfigRequest.getNames()) { | |
147 | 144 | areaIds = new ArrayList<>(); |
148 | 145 | communityConfig = new CommunityConfig(); |
149 | 146 | communityConfig.setYn(YnEnums.YES.getId()); |
150 | 147 | communityConfig.setName(tmp); |
151 | 148 | basicConfig = basicConfigService.getOneBasicConfigById(communityConfigRequest.getAreaId()); |
152 | - while(null != basicConfig ) { | |
149 | + while (null != basicConfig) { | |
153 | 150 | areaIds.add(basicConfig.getId()); |
154 | - if(SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) break; | |
151 | + if (SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) break; | |
155 | 152 | basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); |
156 | 153 | } |
157 | 154 | Collections.reverse(areaIds); |
... | ... | @@ -171,8 +168,8 @@ |
171 | 168 | public BaseResponse deleteArea(@PathVariable String id) { |
172 | 169 | PatientsQuery patientsQuery = new PatientsQuery(); |
173 | 170 | patientsQuery.setCommunityId(id); |
174 | - List<Patients > q = patientsService.queryPatient(patientsQuery); | |
175 | - if(0 < q.size()) { | |
171 | + List<Patients> q = patientsService.queryPatient(patientsQuery); | |
172 | + if (0 < q.size()) { | |
176 | 173 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("该社区下有产妇数据不能删除!"); |
177 | 174 | } |
178 | 175 | |
... | ... | @@ -189,7 +186,7 @@ |
189 | 186 | @RequestMapping(value = "communityConfig/{id}", method = RequestMethod.PUT) |
190 | 187 | @ResponseBody |
191 | 188 | @TokenRequired |
192 | - public BaseResponse updateArea(@RequestParam(required=true) String name, @PathVariable String id) { | |
189 | + public BaseResponse updateArea(@RequestParam(required = true) String name, @PathVariable String id) { | |
193 | 190 | CommunityConfig communityConfig = new CommunityConfig(); |
194 | 191 | communityConfig.setId(id); |
195 | 192 | communityConfig.setName(name); |
... | ... | @@ -221,7 +218,6 @@ |
221 | 218 | // return FrontEndResult.ini(ErrorCodeConstants.NO_DATA, "没有数据"); |
222 | 219 | // |
223 | 220 | // } |
224 | - | |
225 | 221 | |
226 | 222 | |
227 | 223 | // |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
10afb37
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | +import javax.servlet.http.HttpServletRequest; | |
3 | 4 | import javax.validation.Valid; |
4 | 5 | |
5 | 6 | import com.lyms.platform.common.annotation.TokenRequired; |
6 | 7 | import com.lyms.platform.common.base.BaseController; |
8 | +import com.lyms.platform.common.base.LoginContext; | |
7 | 9 | import com.lyms.platform.operate.web.facade.PatientFacade; |
8 | 10 | import com.lyms.platform.operate.web.request.PuerperaMatcherCommunityRequest; |
9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -41,8 +43,9 @@ |
41 | 43 | @RequestMapping(value = "/puerperamanage", method = RequestMethod.GET) |
42 | 44 | @ResponseBody |
43 | 45 | @TokenRequired |
44 | - public BaseListResponse queryPuerperaList(@Valid PuerperaManagerQueryRequest managerRequest) { | |
45 | - return patientFacade.findPatientList(managerRequest); | |
46 | + public BaseListResponse queryPuerperaList(@Valid PuerperaManagerQueryRequest managerRequest,HttpServletRequest request) { | |
47 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
48 | + return patientFacade.findPatientList(managerRequest,loginState.getId()); | |
46 | 49 | } |
47 | 50 | |
48 | 51 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
View file @
10afb37
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.param.CommunityQuery; | |
4 | +import com.lyms.platform.biz.service.CommunityConfigService; | |
5 | +import com.lyms.platform.biz.service.PatientsService; | |
6 | +import com.lyms.platform.common.enums.YnEnums; | |
7 | +import com.lyms.platform.permission.model.Organization; | |
8 | +import com.lyms.platform.permission.model.Users; | |
9 | +import com.lyms.platform.permission.model.UsersQuery; | |
10 | +import com.lyms.platform.permission.service.OrganizationService; | |
11 | +import com.lyms.platform.permission.service.UsersService; | |
12 | +import com.lyms.platform.pojo.CommunityConfig; | |
13 | +import com.lyms.platform.pojo.Patients; | |
14 | +import com.lyms.platform.query.PatientsQuery; | |
15 | +import org.apache.commons.collections.CollectionUtils; | |
16 | +import org.springframework.beans.factory.annotation.Autowired; | |
17 | +import org.springframework.stereotype.Component; | |
18 | + | |
19 | +import java.util.List; | |
20 | + | |
21 | +/** | |
22 | + * Created by Administrator on 2016/5/3 0003. | |
23 | + */ | |
24 | +@Component | |
25 | +public class AutoMatchFacade { | |
26 | + @Autowired | |
27 | + private UsersService usersService; | |
28 | + @Autowired | |
29 | + private OrganizationService organizationService; | |
30 | + @Autowired | |
31 | + private CommunityConfigService communityConfigService; | |
32 | + @Autowired | |
33 | + private PatientsService patientsService; | |
34 | + | |
35 | + public String match(int userId) { | |
36 | + UsersQuery usersQuery = new UsersQuery(); | |
37 | + usersQuery.setId(userId); | |
38 | + | |
39 | + usersQuery.setYn(1); | |
40 | + List<Users> list = usersService.queryUsers(usersQuery); | |
41 | + if (CollectionUtils.isNotEmpty(list)) { | |
42 | + //用户角色 | |
43 | + if (list.get(0).getType() == 1) { | |
44 | + Organization organization = organizationService.getOrganization(list.get(0).getOrgId()); | |
45 | + return organization.getAreaId(); | |
46 | + } | |
47 | + } | |
48 | + return null; | |
49 | + } | |
50 | + | |
51 | + | |
52 | + public List<CommunityConfig> findCommunity(String areaId) { | |
53 | + CommunityQuery communityQuery = new CommunityQuery(); | |
54 | + communityQuery.setId(areaId); | |
55 | + return communityConfigService.queryCommunity(communityQuery); | |
56 | + } | |
57 | + | |
58 | + public List<Patients> findPatients(String areaId) { | |
59 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
60 | + patientsQuery.setAreaId(areaId); | |
61 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
62 | + patientsQuery.setType(3); | |
63 | + return patientsService.queryPatient(patientsQuery); | |
64 | + } | |
65 | + /*public List<BabyModel> findBaby(){ | |
66 | + | |
67 | + }*/ | |
68 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
View file @
10afb37
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | -import com.lyms.platform.biz.service.BabyService; | |
4 | -import com.lyms.platform.biz.service.CommunityConfigService; | |
5 | -import com.lyms.platform.biz.service.PatientsService; | |
6 | -import com.lyms.platform.biz.service.PuerperaService; | |
3 | +import com.lyms.platform.biz.service.*; | |
7 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | 5 | import com.lyms.platform.common.enums.YnEnums; |
9 | 6 | import com.lyms.platform.common.result.BaseListResponse; |
... | ... | @@ -12,6 +9,7 @@ |
12 | 9 | import com.lyms.platform.operate.web.request.BabyManagerQueryRequest; |
13 | 10 | import com.lyms.platform.operate.web.request.BabyManagerUpdateRequest; |
14 | 11 | import com.lyms.platform.operate.web.result.BabyResult; |
12 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
15 | 13 | import com.lyms.platform.pojo.BabyModel; |
16 | 14 | import com.lyms.platform.pojo.CommunityConfig; |
17 | 15 | import com.lyms.platform.pojo.Patients; |
... | ... | @@ -41,6 +39,10 @@ |
41 | 39 | private BabyService babyService; |
42 | 40 | @Autowired |
43 | 41 | private VisitFacade visitFacade; |
42 | + @Autowired | |
43 | + private BasicConfigService basicConfigService; | |
44 | + @Autowired | |
45 | + private AutoMatchFacade autoMatchFacade; | |
44 | 46 | |
45 | 47 | /** |
46 | 48 | * 根据条件查询符合条件的新生儿 |
... | ... | @@ -48,7 +50,7 @@ |
48 | 50 | * @param babyManagerRequest |
49 | 51 | * @return |
50 | 52 | */ |
51 | - public BaseListResponse findBabyList(BabyManagerQueryRequest babyManagerRequest) { | |
53 | + public BaseListResponse findBabyList(BabyManagerQueryRequest babyManagerRequest,int userId) { | |
52 | 54 | |
53 | 55 | /*PatientsQuery patientsQuery = new PatientsQuery(); |
54 | 56 | patientsQuery.setType(2); |
... | ... | @@ -93,8 +95,10 @@ |
93 | 95 | babyQuery.setMname(babyManagerRequest.getName()); |
94 | 96 | babyQuery.setLimit(babyManagerRequest.getLimit()); |
95 | 97 | babyQuery.setYn(YnEnums.YES.getId()); |
96 | - | |
97 | - | |
98 | + String areaid= autoMatchFacade.match(userId); | |
99 | + if(StringUtils.isNotEmpty(areaid)){ | |
100 | + babyQuery.setAreaId(areaid); | |
101 | + } | |
98 | 102 | List<BabyResult> data = new ArrayList<BabyResult>(); |
99 | 103 | // 根据关键字先查询产妇信息 |
100 | 104 | |
... | ... | @@ -190,7 +194,7 @@ |
190 | 194 | addr = ""; |
191 | 195 | } |
192 | 196 | }*/ |
193 | - babyResult.setAddress(patients.getAddress()); | |
197 | + babyResult.setAddress(CommonsHelper.getFullAddress(patients.getProvinceId(), patients.getCityId(), patients.getAreaId(), patients.getAddress(),basicConfigService)); | |
194 | 198 | |
195 | 199 | babyResult.setCommunityId(StringUtils.isEmpty(communityId) ? "" : communityId); |
196 | 200 | String comm = "未分配"; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
10afb37
1 | 1 | package com.lyms.platform.operate.web.facade; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.BabyService; |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
4 | 5 | import com.lyms.platform.biz.service.CommunityConfigService; |
5 | 6 | import com.lyms.platform.biz.service.PatientsService; |
6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
... | ... | @@ -13,6 +14,7 @@ |
13 | 14 | import com.lyms.platform.operate.web.request.PuerperaManagerUpdateRequest; |
14 | 15 | import com.lyms.platform.operate.web.request.PuerperaMatcherCommunityRequest; |
15 | 16 | import com.lyms.platform.operate.web.result.PuerperaResult; |
17 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
16 | 18 | import com.lyms.platform.pojo.BabyModel; |
17 | 19 | import com.lyms.platform.pojo.CommunityConfig; |
18 | 20 | import com.lyms.platform.pojo.Patients; |
19 | 21 | |
... | ... | @@ -41,8 +43,11 @@ |
41 | 43 | private VisitFacade visitFacade; |
42 | 44 | @Autowired |
43 | 45 | private BabyService babyService; |
46 | + @Autowired | |
47 | + private BasicConfigService basicConfigService; | |
48 | + @Autowired | |
49 | + private AutoMatchFacade autoMatchFacade; | |
44 | 50 | |
45 | - | |
46 | 51 | /** |
47 | 52 | * 修改产妇的社区 |
48 | 53 | * |
... | ... | @@ -107,7 +112,7 @@ |
107 | 112 | * @param managerRequest |
108 | 113 | * @return |
109 | 114 | */ |
110 | - public BaseListResponse findPatientList(PuerperaManagerQueryRequest managerRequest) { | |
115 | + public BaseListResponse findPatientList(PuerperaManagerQueryRequest managerRequest,int userId) { | |
111 | 116 | PatientsQuery puerperaQuery = new PatientsQuery(); |
112 | 117 | puerperaQuery.setLimit(managerRequest.getLimit()); |
113 | 118 | puerperaQuery.setPage(managerRequest.getPage()); |
... | ... | @@ -126,6 +131,10 @@ |
126 | 131 | puerperaQuery.setType(3); |
127 | 132 | puerperaQuery.setNeed("1"); |
128 | 133 | puerperaQuery.setYn(YnEnums.YES.getId()); |
134 | + String areaid= autoMatchFacade.match(userId); | |
135 | + if(StringUtils.isNotEmpty(areaid)){ | |
136 | + puerperaQuery.setAreaId(areaid); | |
137 | + } | |
129 | 138 | // 调用service查询 |
130 | 139 | |
131 | 140 | List<Patients> puerperaList = patientsService.queryPatient(puerperaQuery); |
... | ... | @@ -142,7 +151,8 @@ |
142 | 151 | } |
143 | 152 | } |
144 | 153 | String tips = visitFacade.getFindTips(model.getId(),Boolean.TRUE); |
145 | - data.add(result.convertToResult(model, comm, tips)); | |
154 | + String addr= CommonsHelper.getFullAddress(model.getProvinceId(), model.getCityId(), model.getAreaId(), model.getAddress(), basicConfigService); | |
155 | + data.add(result.convertToResult(model, comm, tips,addr)); | |
146 | 156 | } |
147 | 157 | } |
148 | 158 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyManagerQueryRequest.java
View file @
10afb37
... | ... | @@ -61,6 +61,16 @@ |
61 | 61 | */ |
62 | 62 | @FormParam("dend") |
63 | 63 | private String dEnd; |
64 | + //区id | |
65 | + private String areaId; | |
66 | + | |
67 | + public String getAreaId() { | |
68 | + return areaId; | |
69 | + } | |
70 | + | |
71 | + public void setAreaId(String areaId) { | |
72 | + this.areaId = areaId; | |
73 | + } | |
64 | 74 | |
65 | 75 | public String getKeyword() { |
66 | 76 | return keyword; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PuerperaResult.java
View file @
10afb37
... | ... | @@ -127,7 +127,7 @@ |
127 | 127 | return this; |
128 | 128 | } |
129 | 129 | |
130 | - public PuerperaResult convertToResult(Patients model,String comm,String tips) { | |
130 | + public PuerperaResult convertToResult(Patients model,String comm,String tips,String addr) { | |
131 | 131 | /* String addr = ""; |
132 | 132 | if (StringUtils.isNotEmpty(model.getAddress())) { |
133 | 133 | try { |
... | ... | @@ -137,7 +137,7 @@ |
137 | 137 | addr = ""; |
138 | 138 | } |
139 | 139 | }*/ |
140 | - setAddress(model.getAddress()); | |
140 | + setAddress(addr); | |
141 | 141 | setId(model.getId()); |
142 | 142 | setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate())); |
143 | 143 | setVisit(tips); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java
View file @
10afb37
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | import com.lyms.platform.pojo.BabyModel; |
7 | 7 | import com.lyms.platform.pojo.BasicConfig; |
8 | 8 | import com.lyms.platform.pojo.Patients; |
9 | +import org.apache.commons.lang.StringUtils; | |
9 | 10 | |
10 | 11 | import java.util.HashMap; |
11 | 12 | import java.util.Map; |
12 | 13 | |
13 | 14 | |
14 | 15 | |
15 | 16 | |
... | ... | @@ -13,20 +14,46 @@ |
13 | 14 | /** |
14 | 15 | * Created by Administrator on 2016/5/1 0001. |
15 | 16 | */ |
16 | -public final class CommonsHelper { | |
17 | +public final class CommonsHelper { | |
17 | 18 | |
18 | 19 | |
20 | + public static Object convterToMap(BasicConfig basicConfig, boolean sample) { | |
21 | + if (sample && null != basicConfig) { | |
22 | + Map<String, Object> map = new HashMap<>(); | |
23 | + map.put("id", basicConfig.getId()); | |
24 | + map.put("name", basicConfig.getName()); | |
25 | + map.put("code", basicConfig.getCode()); | |
26 | + return map; | |
27 | + } | |
28 | + return basicConfig; | |
29 | + } | |
19 | 30 | |
31 | + public static String getFullAddress(String provinceId, | |
32 | + String cityId, | |
33 | + String areaId, | |
34 | + String address, BasicConfigService basicConfigService) { | |
35 | + StringBuilder sb = new StringBuilder(); | |
36 | + if (StringUtils.isNotEmpty(provinceId)) { | |
37 | + sb.append(getName1(provinceId,basicConfigService)); | |
38 | + } | |
39 | + if (StringUtils.isNotEmpty(cityId)) { | |
40 | + sb.append(getName1(cityId,basicConfigService)); | |
41 | + } | |
42 | + if (StringUtils.isNotEmpty(areaId)) { | |
43 | + sb.append(getName1(areaId,basicConfigService)); | |
44 | + } | |
45 | + if (StringUtils.isNotEmpty(address)) { | |
46 | + sb.append(address); | |
47 | + } | |
48 | + return sb.toString(); | |
49 | + } | |
20 | 50 | |
21 | - public static Object convterToMap(BasicConfig basicConfig,boolean sample){ | |
22 | - if(sample&&null!=basicConfig){ | |
23 | - Map<String,Object> map = new HashMap<>(); | |
24 | - map.put("id",basicConfig.getId()); | |
25 | - map.put("name",basicConfig.getName()); | |
26 | - map.put("code",basicConfig.getCode()); | |
27 | - return map; | |
51 | + private static String getName1(String id, BasicConfigService basicConfigService) { | |
52 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id); | |
53 | + if (basicConfig != null) { | |
54 | + return basicConfig.getName(); | |
28 | 55 | } |
29 | - return basicConfig; | |
56 | + return ""; | |
30 | 57 | } |
31 | 58 | |
32 | 59 | /** |
33 | 60 | |
34 | 61 | |
35 | 62 | |
36 | 63 | |
... | ... | @@ -35,24 +62,25 @@ |
35 | 62 | * @param puerperaModel |
36 | 63 | * @return |
37 | 64 | */ |
38 | - public static Address fullAddress(Patients puerperaModel,BasicConfigService basicConfigService) { | |
65 | + public static Address fullAddress(Patients puerperaModel, BasicConfigService basicConfigService) { | |
39 | 66 | Address address = new Address(); |
40 | - address.setArea(getName(puerperaModel.getAreaId(),basicConfigService)); | |
41 | - address.setCity(getName(puerperaModel.getCityId(),basicConfigService)); | |
42 | - address.setProvince(getName(puerperaModel.getProvinceId(),basicConfigService)); | |
67 | + address.setArea(getName(puerperaModel.getAreaId(), basicConfigService)); | |
68 | + address.setCity(getName(puerperaModel.getCityId(), basicConfigService)); | |
69 | + address.setProvince(getName(puerperaModel.getProvinceId(), basicConfigService)); | |
43 | 70 | address.setAddress(puerperaModel.getAddress()); |
44 | 71 | return address; |
45 | 72 | } |
46 | 73 | |
47 | - public static Address fullAddress(BabyModel puerperaModel,BasicConfigService basicConfigService) { | |
74 | + public static Address fullAddress(BabyModel puerperaModel, BasicConfigService basicConfigService) { | |
48 | 75 | Address address = new Address(); |
49 | - address.setArea(getName(puerperaModel.getAreaId(),basicConfigService)); | |
50 | - address.setCity(getName(puerperaModel.getCityId(),basicConfigService)); | |
51 | - address.setProvince(getName(puerperaModel.getProvinceId(),basicConfigService)); | |
76 | + address.setArea(getName(puerperaModel.getAreaId(), basicConfigService)); | |
77 | + address.setCity(getName(puerperaModel.getCityId(), basicConfigService)); | |
78 | + address.setProvince(getName(puerperaModel.getProvinceId(), basicConfigService)); | |
52 | 79 | address.setAddress(puerperaModel.getAddress()); |
53 | 80 | return address; |
54 | 81 | } |
55 | - private static AddressInner getName(String id,BasicConfigService basicConfigService) { | |
82 | + | |
83 | + private static AddressInner getName(String id, BasicConfigService basicConfigService) { | |
56 | 84 | AddressInner addressInner = new AddressInner(); |
57 | 85 | addressInner.setId(id); |
58 | 86 | BasicConfig config = basicConfigService.getOneBasicConfigById(id); |