Commit 6869241373df5d7747f6bd5ef13861cb39c21a9e
Exists in
master
and in
3 other branches
Merge remote-tracking branch 'origin/master'
Showing 21 changed files
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Roles.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
- platform-biz-service/src/main/resources/mainOrm/Users.xml
- platform-common/src/main/java/com/lyms/platform/common/base/ExceptionHandlerController.java
- platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java
- 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/BasicConfigController.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/OrganizationController.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/controller/RolesController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AccessPermissionFacade.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-biz-service/src/main/java/com/lyms/platform/permission/model/Roles.java
View file @
6869241
1 | 1 | package com.lyms.platform.permission.model; |
2 | 2 | |
3 | 3 | import java.util.Date; |
4 | +import java.util.List; | |
4 | 5 | |
5 | 6 | public class Roles { |
6 | 7 | private Integer id; |
... | ... | @@ -16,6 +17,16 @@ |
16 | 17 | private String shortCode; |
17 | 18 | private String hospitalid; |
18 | 19 | private Integer permissiontype; |
20 | + | |
21 | + private List<Permissions> permissions; | |
22 | + | |
23 | + public List<Permissions> getPermissions() { | |
24 | + return permissions; | |
25 | + } | |
26 | + | |
27 | + public void setPermissions(List<Permissions> permissions) { | |
28 | + this.permissions = permissions; | |
29 | + } | |
19 | 30 | |
20 | 31 | public String getHospitalid() { |
21 | 32 | return hospitalid; |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java
View file @
6869241
... | ... | @@ -27,6 +27,7 @@ |
27 | 27 | private List<Roles> roles; |
28 | 28 | private Departments departmentses; |
29 | 29 | private Organization organization; |
30 | + private List<Organization> organizations; | |
30 | 31 | private String foreignId; |
31 | 32 | |
32 | 33 | private String roleStr; |
... | ... | @@ -70,6 +71,14 @@ |
70 | 71 | |
71 | 72 | public void setOrganization(Organization organization) { |
72 | 73 | this.organization = organization; |
74 | + } | |
75 | + | |
76 | + public List<Organization> getOrganizations() { | |
77 | + return organizations; | |
78 | + } | |
79 | + | |
80 | + public void setOrganizations(List<Organization> organizations) { | |
81 | + this.organizations = organizations; | |
73 | 82 | } |
74 | 83 | |
75 | 84 | public List<Roles> getRoles() { |
platform-biz-service/src/main/resources/mainOrm/Users.xml
View file @
6869241
platform-common/src/main/java/com/lyms/platform/common/base/ExceptionHandlerController.java
View file @
6869241
... | ... | @@ -7,7 +7,6 @@ |
7 | 7 | import com.lyms.platform.common.exception.TokenException; |
8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
9 | 9 | import com.lyms.platform.common.utils.ExceptionUtils; |
10 | -import com.lyms.platform.common.utils.JsonUtil; | |
11 | 10 | import org.springframework.aop.AopInvocationException; |
12 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
13 | 12 | import org.springframework.dao.DataAccessResourceFailureException; |
... | ... | @@ -56,6 +55,7 @@ |
56 | 55 | error.setErrormsg("้่ฏฏ"); |
57 | 56 | return error; |
58 | 57 | } |
58 | + | |
59 | 59 | @ExceptionHandler(org.springframework.aop.AopInvocationException.class) |
60 | 60 | @ResponseBody |
61 | 61 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | 68 | |
69 | 69 | |
70 | 70 | |
... | ... | @@ -70,102 +70,83 @@ |
70 | 70 | |
71 | 71 | @ExceptionHandler(MethodArgumentNotValidException.class) |
72 | 72 | @ResponseStatus(HttpStatus.OK) |
73 | - public void validationError(MethodArgumentNotValidException e, HttpServletResponse httpServletResponse) { | |
74 | - try { | |
75 | - setHttpResponseHeader(httpServletResponse); | |
73 | + public Map validationError(MethodArgumentNotValidException e, HttpServletResponse httpServletResponse) { | |
74 | + setHttpResponseHeader(httpServletResponse); | |
76 | 75 | |
77 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(createValidationResponse(e.getBindingResult()))); | |
78 | - } catch (Exception ex) { | |
79 | - } | |
76 | + return createValidationResponse(e.getBindingResult()); | |
77 | + | |
80 | 78 | } |
81 | 79 | |
82 | 80 | @ExceptionHandler(BindException.class) |
83 | 81 | @ResponseStatus(HttpStatus.OK) |
84 | - public void validationError(BindException e, HttpServletResponse httpServletResponse) { | |
85 | - try { | |
86 | - setHttpResponseHeader(httpServletResponse); | |
82 | + public Map validationError(BindException e, HttpServletResponse httpServletResponse) { | |
83 | + setHttpResponseHeader(httpServletResponse); | |
87 | 84 | |
88 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(createValidationResponse(e.getBindingResult()))); | |
89 | - } catch (Exception ex) { | |
90 | - } | |
85 | + return createValidationResponse(e.getBindingResult()); | |
86 | + | |
91 | 87 | } |
92 | 88 | |
93 | 89 | @ResponseStatus(HttpStatus.OK) |
94 | 90 | @ExceptionHandler(ParameterException.class) |
95 | - public void validationError(HttpServletResponse httpServletResponse) { | |
96 | - try { | |
97 | - setHttpResponseHeader(httpServletResponse); | |
98 | - Map<String, Object> resultMap = new HashMap<>(); | |
99 | - resultMap.put("errorcode", ErrorCodeConstants.PARAMETER_ERROR); | |
100 | - resultMap.put("errormsg", "ๅๆฐ้่ฏฏ."); | |
101 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(resultMap)); | |
102 | - } catch (Exception ex) { | |
103 | - ExceptionUtils.catchException(ex, "ExceptionHandlerController validationError."); | |
104 | - } | |
91 | + @ResponseBody | |
92 | + public Map validationError(HttpServletResponse httpServletResponse) { | |
93 | + setHttpResponseHeader(httpServletResponse); | |
94 | + Map<String, Object> resultMap = new HashMap<>(); | |
95 | + resultMap.put("errorcode", ErrorCodeConstants.PARAMETER_ERROR); | |
96 | + resultMap.put("errormsg", "ๅๆฐ้่ฏฏ."); | |
97 | + return resultMap; | |
105 | 98 | } |
106 | 99 | |
107 | 100 | @ResponseStatus(HttpStatus.OK) |
108 | 101 | @ExceptionHandler(TokenException.class) |
109 | - public void buildTokenExpire(HttpServletResponse httpServletResponse) { | |
110 | - try { | |
111 | - setHttpResponseHeader(httpServletResponse); | |
112 | - Map<String, Object> resultMap = new HashMap<>(); | |
113 | - resultMap.put("errorcode", ErrorCodeConstants.TOKEN_EXPIRE); | |
114 | - resultMap.put("errormsg", "ๆจๅฝๅ็จๆท็ปๅฝ็ถๆๅผๅธธ๏ผๆๆถๆ ๆณ่ฎฟ้ฎ๏ผ่ฏท้ๆฐ็ปๅฝ"); | |
115 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(resultMap)); | |
116 | - } catch (Exception ex) { | |
117 | - ExceptionUtils.catchException(ex, "ExceptionHandlerController buildTokenExpire."); | |
118 | - } | |
102 | + public Map buildTokenExpire(HttpServletResponse httpServletResponse) { | |
103 | + setHttpResponseHeader(httpServletResponse); | |
104 | + Map<String, Object> resultMap = new HashMap<>(); | |
105 | + resultMap.put("errorcode", ErrorCodeConstants.TOKEN_EXPIRE); | |
106 | + resultMap.put("errormsg", "ๆจๅฝๅ็จๆท็ปๅฝ็ถๆๅผๅธธ๏ผๆๆถๆ ๆณ่ฎฟ้ฎ๏ผ่ฏท้ๆฐ็ปๅฝ"); | |
107 | + return resultMap; | |
119 | 108 | } |
120 | 109 | |
121 | 110 | /** |
122 | 111 | * ๅค็spring mvc ็ผบๅฐ่ฏทๆฑๅๆฐ็ๅผๅธธๆ็คบ |
123 | - * | |
112 | + * | |
124 | 113 | * @param httpServletResponse |
125 | 114 | * @param missRequestParameter |
126 | 115 | */ |
127 | 116 | @ResponseStatus(HttpStatus.OK) |
128 | 117 | @ExceptionHandler(org.springframework.web.bind.MissingServletRequestParameterException.class) |
129 | - public void handlMissingServletRequestParameter(HttpServletResponse httpServletResponse, | |
130 | - MissingServletRequestParameterException missRequestParameter) { | |
131 | - try { | |
132 | - setHttpResponseHeader(httpServletResponse); | |
133 | - Map<String, Object> resultMap = new HashMap<>(); | |
134 | - resultMap.put("errorcode", ErrorCodeConstants.PARAMETER_ERROR); | |
135 | - resultMap.put("errormsg", missRequestParameter.getMessage()); | |
136 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(resultMap)); | |
137 | - } catch (Exception ex) { | |
138 | - ExceptionUtils.catchException(ex, "ExceptionHandlerController handlMissingServletRequestParameter."); | |
139 | - } | |
118 | + public Map handlMissingServletRequestParameter(HttpServletResponse httpServletResponse, | |
119 | + MissingServletRequestParameterException missRequestParameter, | |
120 | + HttpServletRequest httpServletRequest) { | |
121 | + setHttpResponseHeader(httpServletResponse); | |
122 | + Map<String, Object> resultMap = new HashMap<>(); | |
123 | + resultMap.put("errorcode", ErrorCodeConstants.PARAMETER_ERROR); | |
124 | + resultMap.put("errormsg", missRequestParameter.getMessage()); | |
125 | + ExceptionUtils.catchException(missRequestParameter, "ExceptionHandlerController handlMissingServletRequestParameter."+httpServletRequest.getRequestURI() + "?"+httpServletRequest.getQueryString()); | |
126 | + return resultMap; | |
140 | 127 | } |
141 | 128 | |
142 | 129 | @ResponseStatus(HttpStatus.OK) |
143 | 130 | @ExceptionHandler(BusinessException.class) |
144 | - public void handlBusinessException(HttpServletResponse httpServletResponse, BusinessException busExc) { | |
145 | - try { | |
146 | - setHttpResponseHeader(httpServletResponse); | |
147 | - Map<String, Object> resultMap = new HashMap<>(); | |
148 | - resultMap.put("errorcode", ErrorCodeConstants.BUSINESS_ERROR); | |
149 | - resultMap.put("errormsg", busExc.getMessage()); | |
150 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(resultMap)); | |
151 | - } catch (Exception ex) { | |
152 | - ExceptionUtils.catchException(ex, "ExceptionHandlerController Write response With handException."); | |
153 | - } | |
131 | + public Map handlBusinessException(HttpServletResponse httpServletResponse, BusinessException busExc) { | |
132 | + setHttpResponseHeader(httpServletResponse); | |
133 | + Map<String, Object> resultMap = new HashMap<>(); | |
134 | + resultMap.put("errorcode", ErrorCodeConstants.BUSINESS_ERROR); | |
135 | + resultMap.put("errormsg", busExc.getMessage()); | |
136 | + ExceptionUtils.catchException(busExc, "ExceptionHandlerController Write response With handException."); | |
137 | + return resultMap; | |
154 | 138 | } |
155 | 139 | |
156 | 140 | @ResponseStatus(HttpStatus.OK) |
157 | 141 | @ExceptionHandler(Exception.class) |
158 | - public void buildException(HttpServletResponse httpServletResponse, Exception e,HttpServletRequest httpServletRequest) { | |
159 | - try { | |
160 | - setHttpResponseHeader(httpServletResponse); | |
161 | - Map<String, Object> resultMap = new HashMap<>(); | |
162 | - resultMap.put("errorcode", ErrorCodeConstants.SYSTEM_ERROR); | |
163 | - resultMap.put("errormsg", "ๆๅกๅจๅผๅธธ."); | |
164 | - httpServletResponse.getWriter().print(JsonUtil.obj2JsonString(resultMap)); | |
165 | - ExceptionUtils.catchException(e, "ExceptionHandlerController Exception. queryStr: "+httpServletRequest.getQueryString()); | |
166 | - } catch (Exception ex) { | |
167 | - ExceptionUtils.catchException(ex, "ExceptionHandlerController Write response With handException."); | |
168 | - } | |
142 | + public Map<String, Object> buildException(HttpServletResponse httpServletResponse, Exception e, HttpServletRequest httpServletRequest) { | |
143 | + setHttpResponseHeader(httpServletResponse); | |
144 | + Map<String, Object> resultMap = new HashMap<>(); | |
145 | + resultMap.put("errorcode", ErrorCodeConstants.SYSTEM_ERROR); | |
146 | + resultMap.put("errormsg", "ๆๅกๅจๅผๅธธ."); | |
147 | + ExceptionUtils.catchException(e, "ExceptionHandlerController Exception. queryStr: " +httpServletRequest.getRequestURI() + "?"+httpServletRequest.getQueryString()); | |
148 | + | |
149 | + return resultMap; | |
169 | 150 | } |
170 | 151 | |
171 | 152 | private Map<String, Object> createValidationResponse(BindingResult bindingResult) { |
... | ... | @@ -173,7 +154,7 @@ |
173 | 154 | List<org.springframework.validation.FieldError> fieldErrors = bindingResult.getFieldErrors(); |
174 | 155 | for (org.springframework.validation.FieldError fieldError : fieldErrors) { |
175 | 156 | map.put("errorcode", ErrorCodeConstants.PARAMETER_ERROR); |
176 | - map.put("errormsg",messageResolver.getErrorMessage(fieldError | |
157 | + map.put("errormsg", messageResolver.getErrorMessage(fieldError | |
177 | 158 | .getDefaultMessage())); |
178 | 159 | break; |
179 | 160 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java
View file @
6869241
... | ... | @@ -17,12 +17,21 @@ |
17 | 17 | private Integer yn; |
18 | 18 | private String gxxq; //็ฎก่พๅฐๅบ |
19 | 19 | private List<String> areas; |
20 | + private List<BasicConfig> areasObj; | |
20 | 21 | private String areaNames; |
21 | 22 | |
22 | 23 | private String publishName; |
23 | 24 | private String publishId; |
24 | 25 | private Long createDate; |
25 | 26 | private Long modifiedDate; |
27 | + | |
28 | + public List<BasicConfig> getAreasObj() { | |
29 | + return areasObj; | |
30 | + } | |
31 | + | |
32 | + public void setAreasObj(List<BasicConfig> areasObj) { | |
33 | + this.areasObj = areasObj; | |
34 | + } | |
26 | 35 | |
27 | 36 | public String getPublishName() { |
28 | 37 | return publishName; |
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
6869241
... | ... | @@ -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 @
6869241
... | ... | @@ -38,6 +38,8 @@ |
38 | 38 | * ่ฎฟ่ง็ถๆ |
39 | 39 | */ |
40 | 40 | private int visitstatus=-1; |
41 | + | |
42 | + private String areaId; | |
41 | 43 | /** |
42 | 44 | * ไบงๅฆๆๆบๅท |
43 | 45 | */ |
... | ... | @@ -73,6 +75,14 @@ |
73 | 75 | */ |
74 | 76 | private Date birthEnd; |
75 | 77 | |
78 | + public String getAreaId() { | |
79 | + return areaId; | |
80 | + } | |
81 | + | |
82 | + public void setAreaId(String areaId) { | |
83 | + this.areaId = areaId; | |
84 | + } | |
85 | + | |
76 | 86 | public Date getBirthEnd() { |
77 | 87 | return birthEnd; |
78 | 88 | } |
... | ... | @@ -188,6 +198,9 @@ |
188 | 198 | } |
189 | 199 | if(null!=communityId&&!"-1".equals(communityId)){ |
190 | 200 | condition= condition.and("communityId", communityId, MongoOper.IS); |
201 | + } | |
202 | + if(null!=areaId){ | |
203 | + condition= condition.and("areaId", areaId, MongoOper.IS); | |
191 | 204 | } |
192 | 205 | if(null!=id){ |
193 | 206 | condition= condition.and("id", id, MongoOper.IS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyManageController.java
View file @
6869241
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/BasicConfigController.java
View file @
6869241
... | ... | @@ -44,7 +44,7 @@ |
44 | 44 | @ResponseBody |
45 | 45 | public FrontEndResult queryBasicConfig(@Valid BasicConfigQueryRequest basicConfigQueryRequest) { |
46 | 46 | BaseListResponse baseListResponse = basicConfigFacade.findBasicConfigList(basicConfigQueryRequest); |
47 | - return FrontEndResult.ini().setData(baseListResponse.getData()).setPageInfo(basicConfigQueryRequest.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("ๆๅ"); | |
47 | + return FrontEndResult.ini().setData(baseListResponse.getData()).setPageInfo(baseListResponse.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("ๆๅ"); | |
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java
View file @
6869241
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,24 +93,36 @@ |
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); | |
111 | - if(null != communityConfigList) { | |
112 | - for(CommunityConfig communityConfig : communityConfigList) { | |
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); | |
109 | + List<BasicConfig> basicConfigs = null; | |
110 | + | |
111 | + if (null != communityConfigList) { | |
112 | + for (CommunityConfig communityConfig : communityConfigList) { | |
113 | 113 | String areaNames = ""; |
114 | - for(String s : communityConfig.getAreas()) { | |
114 | + basicConfigs = new ArrayList<>(); | |
115 | + for (String s : communityConfig.getAreas()) { | |
115 | 116 | config = basicConfigService.getOneBasicConfigById(s); |
116 | - if(null != config) { | |
117 | + basicConfigs.add(config); | |
118 | + if (null != config) { | |
117 | 119 | areaNames += config.getName() + ", "; |
118 | 120 | } |
119 | 121 | } |
120 | - if(2 < areaNames.length()) { | |
121 | - communityConfig.setAreaNames(areaNames.substring(0, areaNames.length()-2)); | |
122 | + if (2 < areaNames.length()) { | |
123 | + communityConfig.setAreaNames(areaNames.substring(0, areaNames.length() - 2)); | |
122 | 124 | } |
125 | + communityConfig.setAreasObj(basicConfigs); | |
123 | 126 | } |
124 | 127 | |
125 | 128 | return FrontEndResult.ini().setData(communityConfigList).setPageInfo(communityQuery.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("ๆฅ่ฏขๆๅ"); |
126 | 129 | |
127 | 130 | |
128 | 131 | |
129 | 132 | |
... | ... | @@ -129,24 +132,23 @@ |
129 | 132 | } |
130 | 133 | |
131 | 134 | |
132 | - | |
133 | 135 | //ๆฐๅข็คพๅบ |
134 | 136 | @RequestMapping(value = "communityConfig", method = RequestMethod.POST) |
135 | 137 | @ResponseBody |
136 | 138 | @TokenRequired |
137 | 139 | public BaseResponse appendArea(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) { |
138 | - CommunityConfig communityConfig = null; | |
140 | + CommunityConfig communityConfig = null; | |
139 | 141 | BasicConfig basicConfig = null; |
140 | 142 | List<String> areaIds = new ArrayList<>(); |
141 | - for(String tmp : communityConfigRequest.getNames()) { | |
143 | + for (String tmp : communityConfigRequest.getNames()) { | |
142 | 144 | areaIds = new ArrayList<>(); |
143 | 145 | communityConfig = new CommunityConfig(); |
144 | 146 | communityConfig.setYn(YnEnums.YES.getId()); |
145 | 147 | communityConfig.setName(tmp); |
146 | 148 | basicConfig = basicConfigService.getOneBasicConfigById(communityConfigRequest.getAreaId()); |
147 | - while(null != basicConfig ) { | |
149 | + while (null != basicConfig) { | |
148 | 150 | areaIds.add(basicConfig.getId()); |
149 | - if(SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) break; | |
151 | + if (SystemConfig.CHINA_BASIC_ID.equals(basicConfig.getParentId())) break; | |
150 | 152 | basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); |
151 | 153 | } |
152 | 154 | Collections.reverse(areaIds); |
... | ... | @@ -166,8 +168,8 @@ |
166 | 168 | public BaseResponse deleteArea(@PathVariable String id) { |
167 | 169 | PatientsQuery patientsQuery = new PatientsQuery(); |
168 | 170 | patientsQuery.setCommunityId(id); |
169 | - List<Patients > q = patientsService.queryPatient(patientsQuery); | |
170 | - if(0 < q.size()) { | |
171 | + List<Patients> q = patientsService.queryPatient(patientsQuery); | |
172 | + if (0 < q.size()) { | |
171 | 173 | return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("่ฏฅ็คพๅบไธๆไบงๅฆๆฐๆฎไธ่ฝๅ ้ค๏ผ"); |
172 | 174 | } |
173 | 175 | |
... | ... | @@ -184,7 +186,7 @@ |
184 | 186 | @RequestMapping(value = "communityConfig/{id}", method = RequestMethod.PUT) |
185 | 187 | @ResponseBody |
186 | 188 | @TokenRequired |
187 | - public BaseResponse updateArea(@RequestParam(required=true) String name, @PathVariable String id) { | |
189 | + public BaseResponse updateArea(@RequestParam(required = true) String name, @PathVariable String id) { | |
188 | 190 | CommunityConfig communityConfig = new CommunityConfig(); |
189 | 191 | communityConfig.setId(id); |
190 | 192 | communityConfig.setName(name); |
... | ... | @@ -216,7 +218,6 @@ |
216 | 218 | // return FrontEndResult.ini(ErrorCodeConstants.NO_DATA, "ๆฒกๆๆฐๆฎ"); |
217 | 219 | // |
218 | 220 | // } |
219 | - | |
220 | 221 | |
221 | 222 | |
222 | 223 | // |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
6869241
... | ... | @@ -151,7 +151,7 @@ |
151 | 151 | @RequestParam(value = "provinceId") String provinceId, |
152 | 152 | @RequestParam(value = "cityId") String cityId, |
153 | 153 | @RequestParam(value = "areaId") String areaId, |
154 | - @RequestParam(value = "streetId") String streetId, | |
154 | + @RequestParam(value = "streetId",required = false) String streetId, | |
155 | 155 | @RequestParam(value = "address") String address, |
156 | 156 | @RequestParam(value = "description", required = false) String description, |
157 | 157 | @RequestParam(value = "shortCode", required = false) String shortCode) { |
... | ... | @@ -256,6 +256,35 @@ |
256 | 256 | List<Object> data = new ArrayList<>(); |
257 | 257 | boolean falg =StringUtils.isNotEmpty(f); |
258 | 258 | for(Organization organization : organizations) { |
259 | + if(null == organization.getAddress()) { | |
260 | + organization.setAddress(""); | |
261 | + } else { | |
262 | + organization.setAddress(", " + organization.getAddress()); | |
263 | + } | |
264 | + if(null != organization.getStreetId()) { | |
265 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getStreetId()); | |
266 | + if(null != basicConfig) { | |
267 | + organization.setAddress(basicConfig.getName() + organization.getAddress()); | |
268 | + } | |
269 | + } | |
270 | + if(null != organization.getAreaId()) { | |
271 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getAreaId()); | |
272 | + if(null != basicConfig) { | |
273 | + organization.setAddress(basicConfig.getName() + organization.getAddress()); | |
274 | + } | |
275 | + } | |
276 | + if(null != organization.getCityId()) { | |
277 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getCityId()); | |
278 | + if(null != basicConfig) { | |
279 | + organization.setAddress(basicConfig.getName() + organization.getAddress()); | |
280 | + } | |
281 | + } | |
282 | + if(null != organization.getProvinceId()) { | |
283 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getProvinceId()); | |
284 | + if(null != basicConfig) { | |
285 | + organization.setAddress(basicConfig.getName() + organization.getAddress()); | |
286 | + } | |
287 | + } | |
259 | 288 | organization.setTypeObj(OrganizationLevelEnum.getById(organization.getLevel())); |
260 | 289 | organization.setLevelObj(OrganizationTypeEnum.getById(organization.getType())); |
261 | 290 | if(null != organization.getProvinceId()) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
6869241
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/controller/RolesController.java
View file @
6869241
... | ... | @@ -330,7 +330,25 @@ |
330 | 330 | rolesQuery.setLimit(limit); |
331 | 331 | |
332 | 332 | List<Roles> roles = rolesService.queryRoles(rolesQuery); |
333 | + List<Permissions> permissionses = null; | |
334 | + for(Roles roles1 : roles) { | |
335 | + permissionses = new ArrayList<>(); | |
336 | + RolePermissionMapsQuery rolePermissionMapsQuery = new RolePermissionMapsQuery(); | |
337 | + rolePermissionMapsQuery.setYn(YnEnums.YES.getId()); | |
338 | + rolePermissionMapsQuery.setRoleId(roles1.getId()); | |
339 | + List<RolePermissionMaps> rolePermissionMapses = rolePermissionMapsService.queryRolePermissionMaps(rolePermissionMapsQuery); | |
333 | 340 | |
341 | + for(RolePermissionMaps rolePermissionMaps : rolePermissionMapses) { | |
342 | + Permissions permissions = permissionsService.getPermissions(rolePermissionMaps.getPermissionId()); | |
343 | + if(permissions.getYn().equals(YnEnums.NO.getId())) continue; | |
344 | + permissionses.add(permissions); | |
345 | + } | |
346 | + | |
347 | + roles1.setPermissions(permissionses); | |
348 | + } | |
349 | + | |
350 | + | |
351 | + | |
334 | 352 | FrontEndResult frontEndResult = new FrontEndResult(); |
335 | 353 | frontEndResult.setPageInfo(rolesQuery.getPageInfo()); |
336 | 354 | frontEndResult.setData(roles); |
... | ... | @@ -366,6 +384,24 @@ |
366 | 384 | rolesQuery.setLimit(limit); |
367 | 385 | |
368 | 386 | List<Roles> roles = rolesService.queryRoles(rolesQuery); |
387 | + | |
388 | + List<Permissions> permissionses = null; | |
389 | + for(Roles roles1 : roles) { | |
390 | + permissionses = new ArrayList<>(); | |
391 | + RolePermissionMapsQuery rolePermissionMapsQuery = new RolePermissionMapsQuery(); | |
392 | + rolePermissionMapsQuery.setYn(YnEnums.YES.getId()); | |
393 | + rolePermissionMapsQuery.setRoleId(roles1.getId()); | |
394 | + List<RolePermissionMaps> rolePermissionMapses = rolePermissionMapsService.queryRolePermissionMaps(rolePermissionMapsQuery); | |
395 | + | |
396 | + for(RolePermissionMaps rolePermissionMaps : rolePermissionMapses) { | |
397 | + Permissions permissions = permissionsService.getPermissions(rolePermissionMaps.getPermissionId()); | |
398 | + if(permissions.getYn().equals(YnEnums.NO.getId())) continue; | |
399 | + permissionses.add(permissions); | |
400 | + } | |
401 | + | |
402 | + roles1.setPermissions(permissionses); | |
403 | + } | |
404 | + | |
369 | 405 | |
370 | 406 | |
371 | 407 | FrontEndResult frontEndResult = new FrontEndResult(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
6869241
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
9 | 9 | import com.lyms.platform.common.enums.YnEnums; |
10 | 10 | import com.lyms.platform.common.utils.*; |
11 | +import com.lyms.platform.operate.web.facade.AccessPermissionFacade; | |
11 | 12 | import com.lyms.platform.operate.web.result.FrontEndResult; |
12 | 13 | import com.lyms.platform.permission.model.*; |
13 | 14 | import com.lyms.platform.permission.service.*; |
... | ... | @@ -21,6 +22,7 @@ |
21 | 22 | import javax.management.relation.Role; |
22 | 23 | import javax.servlet.http.HttpServletRequest; |
23 | 24 | import javax.servlet.http.HttpServletResponse; |
25 | +import javax.validation.constraints.Pattern; | |
24 | 26 | import java.util.*; |
25 | 27 | |
26 | 28 | /** |
... | ... | @@ -51,6 +53,8 @@ |
51 | 53 | private RolePermissionMapsService rolePermissionMapsService; |
52 | 54 | @Autowired |
53 | 55 | private PermissionsService permissionsService; |
56 | + @Autowired | |
57 | + private AccessPermissionFacade accessPermissionFacade; | |
54 | 58 | |
55 | 59 | private static final String LYMS = "้พๆบ็พ็"; |
56 | 60 | |
57 | 61 | |
... | ... | @@ -85,8 +89,10 @@ |
85 | 89 | //่ฎพ็ฝฎ็จๆท่ง่ฒไฟกๆฏ |
86 | 90 | for(Users user : users) { |
87 | 91 | user.setRoles(this.getUserRoles(user.getId())); |
88 | - user.setOrganization(organizationService.getOrganization(user.getOrgId())); | |
92 | + | |
89 | 93 | user.setDepartmentses(departmentsService.getDepartments(user.getDeptId())); |
94 | + | |
95 | + user.setOrganizations(accessPermissionFacade.findAccessPerminssionByUserId(user.getId())); | |
90 | 96 | } |
91 | 97 | |
92 | 98 | FrontEndResult frontEndResult = new FrontEndResult(); |
... | ... | @@ -94,7 +100,6 @@ |
94 | 100 | frontEndResult.setData(users); |
95 | 101 | frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS); |
96 | 102 | return frontEndResult; |
97 | -// ResultUtils.buildSuccessResultAndWrite(response, frontEndResult); | |
98 | 103 | } |
99 | 104 | |
100 | 105 | |
... | ... | @@ -211,6 +216,10 @@ |
211 | 216 | |
212 | 217 | if (StringUtils.isEmpty(phone)) { |
213 | 218 | ResultUtils.buildParameterErrorResultAndWrite(httpServletResponse); |
219 | + return; | |
220 | + } | |
221 | + if(!phone.matches("^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+d{8})$")) { | |
222 | + ResultUtils.buildParameterErrorResultAndWrite(httpServletResponse, "ๆๆบๅทไธๆญฃ็กฎ๏ผ"); | |
214 | 223 | return; |
215 | 224 | } |
216 | 225 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AccessPermissionFacade.java
View file @
6869241
... | ... | @@ -6,8 +6,10 @@ |
6 | 6 | import com.lyms.platform.common.result.BaseResponse; |
7 | 7 | import com.lyms.platform.common.utils.Assert; |
8 | 8 | import com.lyms.platform.operate.web.request.AccessPermissionAddRequest; |
9 | +import com.lyms.platform.permission.model.Organization; | |
9 | 10 | import com.lyms.platform.permission.model.Roles; |
10 | 11 | import com.lyms.platform.permission.model.Users; |
12 | +import com.lyms.platform.permission.service.OrganizationService; | |
11 | 13 | import com.lyms.platform.permission.service.RolesService; |
12 | 14 | import com.lyms.platform.permission.service.UserRoleMapsService; |
13 | 15 | import com.lyms.platform.permission.service.UsersService; |
... | ... | @@ -19,10 +21,7 @@ |
19 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
20 | 22 | import org.springframework.stereotype.Component; |
21 | 23 | |
22 | -import java.util.ArrayList; | |
23 | -import java.util.HashMap; | |
24 | -import java.util.List; | |
25 | -import java.util.Map; | |
24 | +import java.util.*; | |
26 | 25 | |
27 | 26 | /** |
28 | 27 | * |
... | ... | @@ -41,6 +40,8 @@ |
41 | 40 | private UserRoleMapsService userRoleMapsService; |
42 | 41 | @Autowired |
43 | 42 | private DataPermissionService dataPermissionService; |
43 | + @Autowired | |
44 | + private OrganizationService organizationService; | |
44 | 45 | |
45 | 46 | //ไฟฎๆน่ฎฟ้ฎๆ้ |
46 | 47 | public BaseResponse updateAccessPermission(){ |
47 | 48 | |
... | ... | @@ -84,11 +85,13 @@ |
84 | 85 | Assert.notNull(permissionTypeEnums, "ๆ้็ฑปๅไธๅญๅจ."); |
85 | 86 | |
86 | 87 | permission.setType(permissionTypeEnums.getId()); |
88 | + dataPermissionsModel.getData().clear(); | |
87 | 89 | dataPermissionsModel.addOnePer( roles.getHospitalid(), permission); |
88 | 90 | }else if(PermissionTypeEnums.Type.ADMIN.getId()==NumberUtils.toInt(accessPermissionAddRequest.getType())){ |
89 | 91 | //ๅฆๆๆฏ้ขๅค็ๆ้,ๅฐฑๅช้่ฆ่ฎพ็ฝฎๅป้ข็id |
90 | 92 | permission.setType(PermissionTypeEnums.ALL_HOSPITAL.getId()); |
91 | 93 | if(StringUtils.isNotEmpty(accessPermissionAddRequest.getBizId())){ |
94 | + dataPermissionsModel.getData().clear(); | |
92 | 95 | String[] hospitalIds= accessPermissionAddRequest.getBizId().split(","); |
93 | 96 | for(String id:hospitalIds){ |
94 | 97 | dataPermissionsModel.addOnePer(id, permission); |
... | ... | @@ -99,6 +102,31 @@ |
99 | 102 | dataPermissionsModel.setUserId(Integer.valueOf(accessPermissionAddRequest.getUserId())); |
100 | 103 | dataPermissionService.addOrUpdatePermission(dataPermissionsModel); |
101 | 104 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("ๆๅ."); |
105 | + } | |
106 | + | |
107 | + public List findAccessPerminssionByUserId(Integer userId){ | |
108 | + Users users =usersService.getUsers(userId); | |
109 | + | |
110 | + Assert.notNull(users, "็จๆทไฟกๆฏไธๅญๅจ."); | |
111 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
112 | + dataPermissionsModelQuery.setUserId(userId); | |
113 | + List<DataPermissionsModel> data =dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
114 | + List<Organization> dataList =new ArrayList<>(); | |
115 | + if(CollectionUtils.isNotEmpty(data)){ | |
116 | + Set<String > set = data.get(0).getData().keySet(); | |
117 | + Iterator<String> it = set.iterator(); | |
118 | + while(it.hasNext()){ | |
119 | + String id = it.next(); | |
120 | + try { | |
121 | + Organization organization = organizationService.getOrganization(Integer.valueOf(id)); | |
122 | + if(null!=organization){ | |
123 | + dataList.add(organization); | |
124 | + } | |
125 | + }catch (Exception e){ | |
126 | + } | |
127 | + } | |
128 | + } | |
129 | + return dataList; | |
102 | 130 | } |
103 | 131 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
View file @
6869241
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 @
6869241
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 @
6869241
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 @
6869241
... | ... | @@ -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 @
6869241
... | ... | @@ -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 @
6869241
... | ... | @@ -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); |