Commit 54441d7ec7a80438aa3b34a5980212b4c8834152
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 17 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/DepartmentsQuery.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/OrganizationQuery.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java
- platform-biz-service/src/main/resources/mainOrm/Departments.xml
- platform-biz-service/src/main/resources/mainOrm/Organization.xml
- platform-biz-service/src/main/resources/mainOrm/Users.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DepartmentsController.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/RegionController.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/AutoMatchFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasicConfigUpdateRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyVisitResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/VisitResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyService.java
View file @
54441d7
platform-biz-service/src/main/java/com/lyms/platform/permission/model/DepartmentsQuery.java
View file @
54441d7
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.dao.BaseQuery; |
5 | 5 | |
6 | 6 | import java.util.Date; |
7 | +import java.util.List; | |
7 | 8 | |
8 | 9 | |
9 | 10 | public class DepartmentsQuery extends BaseQuery { |
... | ... | @@ -21,6 +22,15 @@ |
21 | 22 | private String shortCode; |
22 | 23 | private String keyword; |
23 | 24 | private String foreignId; |
25 | + private List<Integer> orgList; | |
26 | + | |
27 | + public List<Integer> getOrgList() { | |
28 | + return orgList; | |
29 | + } | |
30 | + | |
31 | + public void setOrgList(List<Integer> orgList) { | |
32 | + this.orgList = orgList; | |
33 | + } | |
24 | 34 | |
25 | 35 | public String getForeignId() { |
26 | 36 | return foreignId; |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/OrganizationQuery.java
View file @
54441d7
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.dao.BaseQuery; |
5 | 5 | |
6 | 6 | import java.util.Date; |
7 | +import java.util.List; | |
7 | 8 | |
8 | 9 | |
9 | 10 | public class OrganizationQuery extends BaseQuery { |
10 | 11 | |
... | ... | @@ -26,7 +27,33 @@ |
26 | 27 | private String shortCode; |
27 | 28 | private String keyword; |
28 | 29 | private String foreignId; |
30 | + private List<String> provinceIds; | |
31 | + private List<Integer> typeList; | |
32 | + private List<Integer> idList; | |
29 | 33 | |
34 | + public List<String> getProvinceIds() { | |
35 | + return provinceIds; | |
36 | + } | |
37 | + | |
38 | + public void setProvinceIds(List<String> provinceIds) { | |
39 | + this.provinceIds = provinceIds; | |
40 | + } | |
41 | + | |
42 | + public List<Integer> getIdList() { | |
43 | + return idList; | |
44 | + } | |
45 | + | |
46 | + public void setIdList(List<Integer> idList) { | |
47 | + this.idList = idList; | |
48 | + } | |
49 | + | |
50 | + public List<Integer> getTypeList() { | |
51 | + return typeList; | |
52 | + } | |
53 | + | |
54 | + public void setTypeList(List<Integer> typeList) { | |
55 | + this.typeList = typeList; | |
56 | + } | |
30 | 57 | |
31 | 58 | public String getStreetId() { |
32 | 59 | return streetId; |
platform-biz-service/src/main/java/com/lyms/platform/permission/model/UsersQuery.java
View file @
54441d7
... | ... | @@ -29,8 +29,7 @@ |
29 | 29 | private String keyword; |
30 | 30 | private Integer roleId; |
31 | 31 | private String foreignId; |
32 | - private Integer otherAccount; //µÚÈý·½ÕʺÅ, 1Ò½ÔºÕʺŠ| |
33 | - | |
32 | + private Integer otherAccount; //第三方å¸å·, 1医院å¸å· | |
34 | 33 | public Integer getOtherAccount() { |
35 | 34 | return otherAccount; |
36 | 35 | } |
platform-biz-service/src/main/resources/mainOrm/Departments.xml
View file @
54441d7
... | ... | @@ -135,6 +135,12 @@ |
135 | 135 | <if test="keyword != null and keyword != ''"> |
136 | 136 | and name like CONCAT(#{keyword}, '%') |
137 | 137 | </if> |
138 | + <if test="orgList != null and orgList.size() > 0"> | |
139 | + and org_id in | |
140 | + <foreach collection="orgList" index="index" item="item" open="(" separator="," close=")"> | |
141 | + #{item} | |
142 | + </foreach> | |
143 | + </if> | |
138 | 144 | </where> |
139 | 145 | </sql> |
140 | 146 |
platform-biz-service/src/main/resources/mainOrm/Organization.xml
View file @
54441d7
... | ... | @@ -117,6 +117,12 @@ |
117 | 117 | <if test="id != null and id >= 0"> |
118 | 118 | and id = #{id,jdbcType=INTEGER} |
119 | 119 | </if> |
120 | + <if test="idList !=null and idList.size() >0"> | |
121 | + and id in | |
122 | + <foreach collection="idList" index="index" item="item" open="(" separator="," close=")"> | |
123 | + #{item} | |
124 | + </foreach> | |
125 | + </if> | |
120 | 126 | <if test="foreignId != null and foreignId != ''"> |
121 | 127 | and foreign_id = #{foreignId,jdbcType=VARCHAR} |
122 | 128 | </if> |
... | ... | @@ -170,6 +176,18 @@ |
170 | 176 | </if> |
171 | 177 | <if test="keyword != null and keyword != ''"> |
172 | 178 | and name like CONCAT(#{keyword}, '%') |
179 | + </if> | |
180 | + <if test="typeList != null and typeList.size() > 0"> | |
181 | + and type in | |
182 | + <foreach collection="typeList" index="index" item="item" open="(" separator="," close=")"> | |
183 | + #{item} | |
184 | + </foreach> | |
185 | + </if> | |
186 | + <if test="provinceIds != null and provinceIds.size() > 0"> | |
187 | + and province_id in | |
188 | + <foreach collection="provinceIds" index="index" item="item" open="(" separator="," close=")"> | |
189 | + #{item} | |
190 | + </foreach> | |
173 | 191 | </if> |
174 | 192 | </where> |
175 | 193 | </sql> |
platform-biz-service/src/main/resources/mainOrm/Users.xml
View file @
54441d7
... | ... | @@ -181,7 +181,7 @@ |
181 | 181 | <if test="lastLoginTime != null"> |
182 | 182 | and last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP} |
183 | 183 | </if> |
184 | - <if test="other_account != null and other_account >= 0"> | |
184 | + <if test="otherAccount != null and otherAccount >= 0"> | |
185 | 185 | and other_account = #{otherAccount,jdbcType=INTEGER} |
186 | 186 | </if> |
187 | 187 | </where> |
... | ... | @@ -191,7 +191,7 @@ |
191 | 191 | <select id="queryUsers" resultMap="UsersResultMap" parameterType="com.lyms.platform.permission.model.UsersQuery"> |
192 | 192 | select |
193 | 193 | id,logincenter_id,type,org_id,dept_id,name,account,pwd,phone,publish_id,publish_name,yn,enable,modified,created,remarks,last_login_time, |
194 | - ks_id,foreign_id,otherAccount | |
194 | + ks_id,foreign_id,other_account | |
195 | 195 | from users |
196 | 196 | <include refid="UsersCondition"/> |
197 | 197 | <include refid="orderAndLimit"/> |
198 | 198 | |
... | ... | @@ -222,10 +222,14 @@ |
222 | 222 | </if> |
223 | 223 | <if test="yn != null"> |
224 | 224 | and u.yn = #{yn,jdbcType=INTEGER} |
225 | + and ur.yn = #{yn,jdbcType=INTEGER} | |
225 | 226 | </if> |
226 | 227 | <if test="type != null"> |
227 | 228 | and u.type = #{type,jdbcType=INTEGER} |
228 | 229 | </if> |
230 | + <if test="otherAccount != null"> | |
231 | + and u.other_account = #{otherAccount,jdbcType=INTEGER} | |
232 | + </if> | |
229 | 233 | <include refid="orderAndLimit"/> |
230 | 234 | </select> |
231 | 235 | |
232 | 236 | |
... | ... | @@ -252,9 +256,13 @@ |
252 | 256 | </if> |
253 | 257 | <if test="yn != null and yn != ''"> |
254 | 258 | and u.yn = #{yn,jdbcType=INTEGER} |
259 | + and ur.yn = #{yn,jdbcType=INTEGER} | |
255 | 260 | </if> |
256 | 261 | <if test="type != null "> |
257 | 262 | and u.type = #{type,jdbcType=INTEGER} |
263 | + </if> | |
264 | + <if test="otherAccount != null"> | |
265 | + and u.other_account = #{otherAccount,jdbcType=INTEGER} | |
258 | 266 | </if> |
259 | 267 | </select> |
260 | 268 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
View file @
54441d7
1 | +package com.lyms.platform.operate.web; | |
2 | + | |
3 | + | |
4 | +import org.springframework.util.StopWatch; | |
5 | + | |
6 | +/** | |
7 | + * Created by Administrator on 2016/5/3 0003. | |
8 | + */ | |
9 | +public class Test { | |
10 | + public static void main(String[] args){ | |
11 | + StopWatch stopWatch= new StopWatch("doctor-api-patient"); | |
12 | + stopWatch.start("query patients"); | |
13 | + add(); | |
14 | + stopWatch.stop(); | |
15 | + stopWatch.start("query patients1"); | |
16 | + add(); | |
17 | + stopWatch.stop(); | |
18 | + stopWatch.start("query patients2"); | |
19 | + add(); | |
20 | + stopWatch.stop(); | |
21 | + System.out.print(stopWatch); | |
22 | + } | |
23 | + private static void add(){ | |
24 | + int a=0; | |
25 | + for(int i =0;i<100000;i++){ | |
26 | + a +=i; | |
27 | + } | |
28 | + System.out.println(a); | |
29 | + } | |
30 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DepartmentsController.java
View file @
54441d7
... | ... | @@ -7,9 +7,11 @@ |
7 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
8 | 8 | import com.lyms.platform.common.enums.YnEnums; |
9 | 9 | import com.lyms.platform.common.utils.ResultUtils; |
10 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
10 | 11 | import com.lyms.platform.operate.web.result.FrontEndResult; |
11 | 12 | import com.lyms.platform.permission.model.*; |
12 | 13 | import com.lyms.platform.permission.service.*; |
14 | +import org.apache.commons.lang.StringUtils; | |
13 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
14 | 16 | import org.springframework.stereotype.Controller; |
15 | 17 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -38,6 +40,8 @@ |
38 | 40 | private RolePermissionMapsService rolePermissionMapsService; |
39 | 41 | @Autowired |
40 | 42 | private OrganizationService organizationService; |
43 | + @Autowired | |
44 | + private AutoMatchFacade autoMatchFacade; | |
41 | 45 | |
42 | 46 | |
43 | 47 | |
... | ... | @@ -73,11 +77,11 @@ |
73 | 77 | @TokenRequired |
74 | 78 | public void addDepartments(HttpServletResponse response, |
75 | 79 | @PathVariable(value = "id") Integer id, |
76 | - @RequestParam(value = "pid") Integer pid, | |
77 | - @RequestParam(value = "name") String name, | |
78 | - @RequestParam(value = "orgId") Integer orgId, | |
79 | - @RequestParam(value = "description") String description, | |
80 | - @RequestParam(value = "shortCode") String shortCode) { | |
80 | + @RequestParam(value = "pid", required = false) Integer pid, | |
81 | + @RequestParam(value = "name", required = false) String name, | |
82 | + @RequestParam(value = "orgId", required = false) Integer orgId, | |
83 | + @RequestParam(value = "description", required = false) String description, | |
84 | + @RequestParam(value = "shortCode", required = false) String shortCode) { | |
81 | 85 | |
82 | 86 | if (null == name || null == id) { |
83 | 87 | ResultUtils.buildParameterErrorResultAndWrite(response); |
... | ... | @@ -163,7 +167,7 @@ |
163 | 167 | @RequestMapping(value = "/departments", method = RequestMethod.GET) |
164 | 168 | @ResponseBody |
165 | 169 | @TokenRequired |
166 | - public FrontEndResult getPermissions(HttpServletResponse response, | |
170 | + public FrontEndResult getPermissions(HttpServletRequest request, | |
167 | 171 | @RequestParam(value = "keyword", required = false) String keyword, |
168 | 172 | @RequestParam(value = "page", required = false) Integer page, |
169 | 173 | @RequestParam(value = "limit", required = false) Integer limit, |
170 | 174 | |
... | ... | @@ -172,12 +176,18 @@ |
172 | 176 | limit = limit == null ? 10 : limit; |
173 | 177 | page = page == null ? 1 : page; |
174 | 178 | |
175 | - | |
179 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
176 | 180 | DepartmentsQuery departmentsQuery = new DepartmentsQuery(); |
177 | 181 | departmentsQuery.setNeed("true"); |
178 | 182 | departmentsQuery.setSort("id desc"); |
179 | 183 | departmentsQuery.setYn(YnEnums.YES.getId()); |
180 | - departmentsQuery.setOrgId(orgId); | |
184 | + List<Integer> orgId1 = autoMatchFacade.matchOrgId(loginState.getId()); | |
185 | + if(null!=orgId){ | |
186 | + departmentsQuery.setOrgId(orgId); | |
187 | + }else{ | |
188 | + departmentsQuery.setOrgList(orgId1); | |
189 | + } | |
190 | + | |
181 | 191 | departmentsQuery.setPage(page); |
182 | 192 | departmentsQuery.setKeyword(keyword); |
183 | 193 | departmentsQuery.setLimit(limit); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
54441d7
... | ... | @@ -11,11 +11,14 @@ |
11 | 11 | import com.lyms.platform.common.enums.YnEnums; |
12 | 12 | import com.lyms.platform.common.utils.ResultUtils; |
13 | 13 | import com.lyms.platform.common.utils.SystemConfig; |
14 | +import com.lyms.platform.operate.web.facade.AccessPermissionFacade; | |
15 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
14 | 16 | import com.lyms.platform.operate.web.result.FrontEndResult; |
15 | 17 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
16 | 18 | import com.lyms.platform.permission.model.*; |
17 | 19 | import com.lyms.platform.permission.service.*; |
18 | 20 | import com.lyms.platform.pojo.BasicConfig; |
21 | +import org.apache.commons.collections.CollectionUtils; | |
19 | 22 | import org.apache.commons.lang.StringUtils; |
20 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
21 | 24 | import org.springframework.stereotype.Controller; |
... | ... | @@ -40,6 +43,12 @@ |
40 | 43 | private BasicConfigService basicConfigService; |
41 | 44 | @Autowired |
42 | 45 | private DepartmentsService departmentsService; |
46 | + @Autowired | |
47 | + private AutoMatchFacade autoMatchFacade; | |
48 | + @Autowired | |
49 | + private UserOrganizationMapsService userOrganizationMapsService; | |
50 | + @Autowired | |
51 | + private AccessPermissionFacade accessPermissionFacade; | |
43 | 52 | |
44 | 53 | |
45 | 54 | /** |
46 | 55 | |
... | ... | @@ -48,14 +57,14 @@ |
48 | 57 | @RequestMapping(value = "/organization/{id}", method = RequestMethod.DELETE) |
49 | 58 | @TokenRequired |
50 | 59 | public void updateOrganization(HttpServletResponse response, @PathVariable(value = "id") Integer id) { |
51 | - if (id == null ) { | |
60 | + if (id == null) { | |
52 | 61 | ResultUtils.buildParameterErrorResultAndWrite(response); |
53 | 62 | return; |
54 | 63 | } |
55 | 64 | |
56 | 65 | //判断ID是否存在 |
57 | 66 | Organization organization = organizationService.getOrganization(id); |
58 | - if(null == organization) { | |
67 | + if (null == organization) { | |
59 | 68 | ResultUtils.buildParameterErrorResultAndWrite(response, "id不存在!"); |
60 | 69 | return; |
61 | 70 | } |
... | ... | @@ -64,7 +73,7 @@ |
64 | 73 | UsersQuery usersQuery = new UsersQuery(); |
65 | 74 | usersQuery.setOrgId(organization.getId()); |
66 | 75 | usersQuery.setYn(YnEnums.YES.getId()); |
67 | - if(0 < usersService.queryUsersCount(usersQuery)) { | |
76 | + if (0 < usersService.queryUsersCount(usersQuery)) { | |
68 | 77 | ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.DONT_DELETE, "机构下有用户信息,不能删除!"); |
69 | 78 | return; |
70 | 79 | } |
... | ... | @@ -72,7 +81,7 @@ |
72 | 81 | DepartmentsQuery departmentsQuery = new DepartmentsQuery(); |
73 | 82 | departmentsQuery.setYn(YnEnums.YES.getId()); |
74 | 83 | departmentsQuery.setOrgId(organization.getId()); |
75 | - if(0 < departmentsService.queryDepartmentsCount(departmentsQuery)) { | |
84 | + if (0 < departmentsService.queryDepartmentsCount(departmentsQuery)) { | |
76 | 85 | ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.DONT_DELETE, "机构下有部门信息,不能删除!"); |
77 | 86 | return; |
78 | 87 | } |
79 | 88 | |
80 | 89 | |
... | ... | @@ -92,28 +101,28 @@ |
92 | 101 | @RequestMapping(value = "/organization/{id}", method = RequestMethod.PUT) |
93 | 102 | @TokenRequired |
94 | 103 | public void updateOrganization(HttpServletResponse response, |
95 | - @PathVariable(value = "id") Integer id, | |
96 | - @RequestParam(value = "name", required = false) String name, | |
97 | - @RequestParam(value = "type", required = false) Integer type, | |
98 | - @RequestParam(value = "level", required = false) Integer level, | |
99 | - @RequestParam(value = "areaManage", required = false) Integer areaManage, | |
100 | - @RequestParam(value = "provinceId", required = false) String provinceId, | |
101 | - @RequestParam(value = "cityId", required = false) String cityId, | |
102 | - @RequestParam(value = "areaId", required = false) String areaId, | |
103 | - @RequestParam(value = "streetId", required = false) String streetId, | |
104 | - @RequestParam(value = "address", required = false) String address, | |
105 | - @RequestParam(value = "description", required = false) String description, | |
106 | - @RequestParam(value = "shortCode", required = false) String shortCode) { | |
104 | + @PathVariable(value = "id") Integer id, | |
105 | + @RequestParam(value = "name", required = false) String name, | |
106 | + @RequestParam(value = "type", required = false) Integer type, | |
107 | + @RequestParam(value = "level", required = false) Integer level, | |
108 | + @RequestParam(value = "areaManage", required = false) Integer areaManage, | |
109 | + @RequestParam(value = "provinceId", required = false) String provinceId, | |
110 | + @RequestParam(value = "cityId", required = false) String cityId, | |
111 | + @RequestParam(value = "areaId", required = false) String areaId, | |
112 | + @RequestParam(value = "streetId", required = false) String streetId, | |
113 | + @RequestParam(value = "address", required = false) String address, | |
114 | + @RequestParam(value = "description", required = false) String description, | |
115 | + @RequestParam(value = "shortCode", required = false) String shortCode) { | |
107 | 116 | |
108 | 117 | |
109 | - if (type == null || StringUtils.isBlank(name) ) { | |
118 | + if (type == null || StringUtils.isBlank(name)) { | |
110 | 119 | ResultUtils.buildParameterErrorResultAndWrite(response); |
111 | 120 | return; |
112 | 121 | } |
113 | 122 | |
114 | 123 | //判断ID是否存在 |
115 | 124 | Organization organization = organizationService.getOrganization(id); |
116 | - if(null == organization) { | |
125 | + if (null == organization) { | |
117 | 126 | ResultUtils.buildParameterErrorResultAndWrite(response, "id不存在!"); |
118 | 127 | return; |
119 | 128 | } |
... | ... | @@ -136,7 +145,6 @@ |
136 | 145 | } |
137 | 146 | |
138 | 147 | |
139 | - | |
140 | 148 | /** |
141 | 149 | * 添加机构 |
142 | 150 | */ |
143 | 151 | |
... | ... | @@ -147,11 +155,11 @@ |
147 | 155 | @RequestParam(value = "name") String name, |
148 | 156 | @RequestParam(value = "type") Integer type, |
149 | 157 | @RequestParam(value = "level") Integer level, |
150 | - @RequestParam(value = "areaManage",required = false) Integer areaManage, | |
158 | + @RequestParam(value = "areaManage", required = false) Integer areaManage, | |
151 | 159 | @RequestParam(value = "provinceId") String provinceId, |
152 | 160 | @RequestParam(value = "cityId") String cityId, |
153 | 161 | @RequestParam(value = "areaId") String areaId, |
154 | - @RequestParam(value = "streetId",required = false) String streetId, | |
162 | + @RequestParam(value = "streetId", required = false) String streetId, | |
155 | 163 | @RequestParam(value = "address") String address, |
156 | 164 | @RequestParam(value = "description", required = false) String description, |
157 | 165 | @RequestParam(value = "shortCode", required = false) String shortCode) { |
... | ... | @@ -168,8 +176,8 @@ |
168 | 176 | OrganizationQuery organizationQuery = new OrganizationQuery(); |
169 | 177 | organizationQuery.setYn(YnEnums.YES.getId()); |
170 | 178 | organizationQuery.setName(name); |
171 | - if(0 < organizationService.queryOrganizationCount(organizationQuery)) { | |
172 | - ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.NAME_EXIST,"机构名称已存在!"); | |
179 | + if (0 < organizationService.queryOrganizationCount(organizationQuery)) { | |
180 | + ResultUtils.buildResultAndWrite(response, ErrorCodeConstants.NAME_EXIST, "机构名称已存在!"); | |
173 | 181 | return; |
174 | 182 | } |
175 | 183 | |
176 | 184 | |
177 | 185 | |
178 | 186 | |
179 | 187 | |
180 | 188 | |
... | ... | @@ -195,25 +203,60 @@ |
195 | 203 | ResultUtils.buildSuccessResultAndWrite(response); |
196 | 204 | } |
197 | 205 | |
206 | + /** | |
207 | + * 根据当前登录的权限去获取下属的医院 | |
208 | + */ | |
209 | + @RequestMapping(value = "/organization1", method = RequestMethod.GET) | |
210 | + @ResponseBody | |
211 | + @TokenRequired | |
212 | + public FrontEndResult getOrganization(HttpServletRequest request) { | |
213 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
198 | 214 | |
215 | + List<Integer> areaId = autoMatchFacade.matchOrgId(loginState.getId()); | |
216 | + List<Map> data = new ArrayList<>(); | |
217 | + List<Organization> organizations; | |
218 | + if (CollectionUtils.isNotEmpty(areaId)) { | |
219 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
220 | + organizationQuery.setIdList(areaId); | |
221 | + List<Integer> list = new ArrayList<>(); | |
222 | + list.add(3); | |
223 | + list.add(4); | |
224 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
225 | +// organizationQuery.setTypeList(list); | |
226 | + organizations = organizationService.queryOrganization(organizationQuery); | |
199 | 227 | |
228 | + } else { | |
229 | + UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery(); | |
230 | + userOrganizationMapsQuery.setYn(YnEnums.YES.getId()); | |
231 | + userOrganizationMapsQuery.setUserId(loginState.getId()); | |
232 | + organizations = accessPermissionFacade.findAccessPerminssionByUserId(loginState.getId()); | |
200 | 233 | |
234 | + } | |
235 | + if (CollectionUtils.isNotEmpty(organizations)) { | |
236 | + for (Organization organization : organizations) { | |
237 | + Map<String, Object> map = new HashMap<>(); | |
238 | + map.put("id", organization.getId()); | |
239 | + map.put("name", organization.getName()); | |
240 | + data.add(map); | |
241 | + } | |
242 | + } | |
243 | + return new FrontEndResult().setData(data).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); | |
244 | + } | |
201 | 245 | |
202 | 246 | |
203 | - | |
204 | 247 | /** |
205 | 248 | * 获取列表 |
206 | 249 | */ |
207 | 250 | @RequestMapping(value = "/organization", method = RequestMethod.GET) |
208 | 251 | @ResponseBody |
209 | 252 | @TokenRequired |
210 | - public FrontEndResult getOrganization( | |
211 | - @RequestParam(value = "id", required = false) Integer id, | |
212 | - @RequestParam(value = "keyword", required = false) String keyword, | |
213 | - @RequestParam(value = "page", required = false) Integer page, | |
214 | - @RequestParam(value = "limit", required = false) Integer limit, | |
215 | - @RequestParam(value = "areaId", required = false) String areaId, | |
216 | - @RequestParam(value = "lite", required = false) String f) { | |
253 | + public FrontEndResult getOrganization(HttpServletRequest request, | |
254 | + @RequestParam(value = "id", required = false) Integer id, | |
255 | + @RequestParam(value = "keyword", required = false) String keyword, | |
256 | + @RequestParam(value = "page", required = false) Integer page, | |
257 | + @RequestParam(value = "limit", required = false) Integer limit, | |
258 | + @RequestParam(value = "areaId", required = false) String areaId, | |
259 | + @RequestParam(value = "lite", required = false) String f) { | |
217 | 260 | |
218 | 261 | limit = limit == null ? 10 : limit; |
219 | 262 | page = page == null ? 1 : page; |
... | ... | @@ -228,7 +271,7 @@ |
228 | 271 | organizationQuery.setKeyword(keyword); |
229 | 272 | |
230 | 273 | BasicConfig config = null; |
231 | - if(null != areaId) { | |
274 | + if (null != areaId) { | |
232 | 275 | config = basicConfigService.getOneBasicConfigById(areaId); |
233 | 276 | } |
234 | 277 | if (config != null) { |
235 | 278 | |
236 | 279 | |
237 | 280 | |
... | ... | @@ -245,34 +288,45 @@ |
245 | 288 | } else { |
246 | 289 | // BasicConfig p3 = basicConfigService.getOneBasicConfigById(p1.getParentId()); |
247 | 290 | // if (p2 != null && SystemConfig.CHINA_BASIC_ID.equals(p3.getParentId())) { |
248 | - organizationQuery.setStreetId(areaId); | |
291 | + organizationQuery.setStreetId(areaId); | |
249 | 292 | // } |
250 | 293 | } |
251 | 294 | } |
252 | 295 | } |
296 | + } else if ("0".equals(areaId) ||null==areaId) { | |
297 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
298 | + List<Integer> list = autoMatchFacade.matchOrgId(loginState.getId()); | |
299 | + List<String> a = new ArrayList<>(); | |
300 | + for (Integer integer : list) { | |
301 | + Organization organization = organizationService.getOrganization(integer); | |
302 | + if (null != organization) { | |
303 | + a.add(organization.getProvinceId()); | |
304 | + } | |
305 | + } | |
306 | + organizationQuery.setProvinceIds(a); | |
253 | 307 | } |
254 | 308 | |
255 | 309 | List<Organization> organizations = organizationService.queryOrganization(organizationQuery); |
256 | 310 | List<Object> data = new ArrayList<>(); |
257 | - boolean falg =StringUtils.isNotEmpty(f); | |
258 | - for(Organization organization : organizations) { | |
311 | + boolean falg = StringUtils.isNotEmpty(f); | |
312 | + for (Organization organization : organizations) { | |
259 | 313 | |
260 | 314 | organization.setTypeObj(OrganizationLevelEnum.getById(organization.getLevel())); |
261 | 315 | organization.setLevelObj(OrganizationTypeEnum.getById(organization.getType())); |
262 | - if(null != organization.getProvinceId()) { | |
263 | - organization.setProvince(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getProvinceId()),falg)); | |
264 | - } | |
265 | - if(null != organization.getCityId()) { | |
266 | - organization.setCity(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getCityId()), falg)); | |
267 | - } | |
268 | - if(null != organization.getAreaId()) { | |
269 | - organization.setArea(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getAreaId()), falg)); | |
270 | - } | |
271 | - if(null != organization.getStreetId()) { | |
272 | - organization.setStreet(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getStreetId()),falg)); | |
273 | - } | |
274 | - Object obj = organization; | |
275 | - if(falg){ | |
316 | + if (null != organization.getProvinceId()) { | |
317 | + organization.setProvince(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getProvinceId()), falg)); | |
318 | + } | |
319 | + if (null != organization.getCityId()) { | |
320 | + organization.setCity(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getCityId()), falg)); | |
321 | + } | |
322 | + if (null != organization.getAreaId()) { | |
323 | + organization.setArea(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getAreaId()), falg)); | |
324 | + } | |
325 | + if (null != organization.getStreetId()) { | |
326 | + organization.setStreet(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getStreetId()), falg)); | |
327 | + } | |
328 | + Object obj = organization; | |
329 | + if (falg) { | |
276 | 330 | obj = convert(organization); |
277 | 331 | } |
278 | 332 | data.add(obj); |
279 | 333 | |
... | ... | @@ -283,9 +337,10 @@ |
283 | 337 | frontEndResult.setPageInfo(organizationQuery.getPageInfo()); |
284 | 338 | frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS); |
285 | 339 | |
286 | - return frontEndResult; | |
340 | + return frontEndResult; | |
287 | 341 | } |
288 | - private Map<String,Object> convert(Organization organization) { | |
342 | + | |
343 | + private Map<String, Object> convert(Organization organization) { | |
289 | 344 | Map<String, Object> map = new HashMap<>(); |
290 | 345 | map.put("id", organization.getId()); |
291 | 346 | map.put("name", organization.getName()); |
... | ... | @@ -295,8 +350,8 @@ |
295 | 350 | map.put("cityId", organization.getCityId()); |
296 | 351 | map.put("province", organization.getProvince()); |
297 | 352 | map.put("provinceId", organization.getProvinceId()); |
298 | - map.put("foreignId",organization.getForeignId()); | |
299 | - map.put("code",organization.getShortCode()); | |
353 | + map.put("foreignId", organization.getForeignId()); | |
354 | + map.put("code", organization.getShortCode()); | |
300 | 355 | return map; |
301 | 356 | } |
302 | 357 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RegionController.java
View file @
54441d7
... | ... | @@ -54,35 +54,48 @@ |
54 | 54 | ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SYSTEM_ERROR, "not find login user!"); |
55 | 55 | return; |
56 | 56 | } |
57 | + BasicConfigQuery query = new BasicConfigQuery(); | |
58 | + query.setYn(YnEnums.YES.getId()); | |
57 | 59 | |
58 | 60 | if(user.getType().equals(1)) { |
59 | - if(null != user.getOrgId()) { | |
60 | - ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SYSTEM_ERROR, "user data error!"); | |
61 | + if(null == user.getOrgId()) { | |
62 | + ResultUtils.buildResultAndWrite(httpServletResponse, ErrorCodeConstants.SYSTEM_ERROR, "user not defined orgId error!"); | |
61 | 63 | return; |
62 | 64 | } |
63 | 65 | Organization organization = organizationService.getOrganization(user.getOrgId()); |
64 | - if(null != organization.getStreetId()) { | |
65 | - parentId = organization.getStreetId(); | |
66 | - } else if(null != organization.getAreaId()) { | |
67 | - parentId = organization.getAreaId(); | |
68 | - } else if(null != organization.getCityId()) { | |
69 | - parentId = organization.getCityId(); | |
70 | - } else if (null != organization.getProvinceId()) { | |
66 | + if("0".equals(parentId)){ | |
67 | + parentId=null; | |
68 | + } | |
69 | + if (null != organization.getProvinceId() && null==parentId) { | |
71 | 70 | parentId = organization.getProvinceId(); |
71 | + query.setId(parentId); | |
72 | + }else if(StringUtils.isNotEmpty(organization.getCityId())&&null!=parentId &&parentId.equals(organization.getProvinceId())) { | |
73 | + parentId = organization.getCityId(); | |
74 | + query.setId(parentId); | |
75 | + }else if(StringUtils.isNotEmpty(organization.getAreaId())&&null!=parentId &&parentId.equals(organization.getCityId())) { | |
76 | + parentId = organization.getAreaId(); | |
77 | + query.setId(parentId); | |
72 | 78 | } |
79 | + else if(StringUtils.isNotEmpty(organization.getStreetId())&&null!=parentId &&parentId.equals(organization.getAreaId())) { | |
80 | + parentId = organization.getStreetId(); | |
81 | + query.setId(parentId); | |
82 | + }else { | |
83 | + query.setParentId(parentId); | |
84 | + } | |
85 | + }else{ | |
86 | + query.setParentId(parentId); | |
73 | 87 | } |
74 | 88 | |
75 | 89 | |
76 | 90 | if (user.getType().equals(0) && ("0".equals(parentId) || StringUtils.isBlank(parentId))) { |
77 | 91 | parentId = SystemConfig.CHINA_BASIC_ID; |
92 | + query.setParentId(parentId); | |
78 | 93 | } |
79 | 94 | |
80 | - BasicConfigQuery query = new BasicConfigQuery(); | |
81 | - query.setYn(YnEnums.YES.getId()); | |
82 | - query.setParentId(parentId); | |
95 | + | |
83 | 96 | List<BasicConfig> configList = basicConfigService.queryBasicConfig(query); |
84 | 97 | List<Map<String,Object>> list =new ArrayList<Map<String, Object>>(); |
85 | - if(CollectionUtils.isNotEmpty(configList)){ | |
98 | + if (CollectionUtils.isNotEmpty(configList)){ | |
86 | 99 | for (BasicConfig config :configList){ |
87 | 100 | Map<String,Object> region=new HashMap<String, Object>(); |
88 | 101 | region.put("id",config.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
54441d7
... | ... | @@ -329,7 +329,8 @@ |
329 | 329 | @RequestParam(value = "keyword",required = false) String keyword, |
330 | 330 | @RequestParam(value = "page",required = false) Integer page, |
331 | 331 | @RequestParam(value = "limit",required = false) Integer limit, |
332 | - @RequestParam(value = "orgId", required = false) Integer orgId) { | |
332 | + @RequestParam(value = "orgId", required = false) Integer orgId, | |
333 | + @RequestParam(value = "enable", required = false) Integer enable) { | |
333 | 334 | |
334 | 335 | limit = limit == null ? 10 : limit; |
335 | 336 | page = page == null ? 1 : page; |
... | ... | @@ -342,6 +343,7 @@ |
342 | 343 | rolesQuery.setKeyword(keyword); |
343 | 344 | rolesQuery.setPage(page); |
344 | 345 | rolesQuery.setLimit(limit); |
346 | + rolesQuery.setEnable(enable); | |
345 | 347 | |
346 | 348 | List<Roles> roles = rolesService.queryRoles(rolesQuery); |
347 | 349 | List<Permissions> permissionses = null; |
... | ... | @@ -383,7 +385,8 @@ |
383 | 385 | public FrontEndResult getAdminList(HttpServletResponse response, |
384 | 386 | @RequestParam(value = "keyword",required = false) String keyword, |
385 | 387 | @RequestParam(value = "page",required = false) Integer page, |
386 | - @RequestParam(value = "limit",required = false) Integer limit) { | |
388 | + @RequestParam(value = "limit",required = false) Integer limit, | |
389 | + @RequestParam(value = "enable",required = false) Integer enable) { | |
387 | 390 | |
388 | 391 | limit = limit == null ? 10 : limit; |
389 | 392 | page = page == null ? 1 : page; |
... | ... | @@ -396,6 +399,7 @@ |
396 | 399 | rolesQuery.setKeyword(keyword); |
397 | 400 | rolesQuery.setPage(page); |
398 | 401 | rolesQuery.setLimit(limit); |
402 | + rolesQuery.setEnable(enable); | |
399 | 403 | |
400 | 404 | List<Roles> roles = rolesService.queryRoles(rolesQuery); |
401 | 405 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java
View file @
54441d7
... | ... | @@ -243,7 +243,7 @@ |
243 | 243 | usersQuery.setPhone(phone); |
244 | 244 | usersQuery.setYn(YnEnums.YES.getId()); |
245 | 245 | List<Users> list = usersService.queryUsers(usersQuery); |
246 | - if(0 == list.size()) { | |
246 | + if(null == list || 0 == list.size()) { | |
247 | 247 | ResultUtils.buildParameterErrorResultAndWrite(httpServletResponse, "该账户不存在"); |
248 | 248 | return; |
249 | 249 | } |
... | ... | @@ -443,7 +443,6 @@ |
443 | 443 | //检查注册账户是否存在 |
444 | 444 | UsersQuery usersQuery = new UsersQuery(); |
445 | 445 | usersQuery.setPhone(phone); |
446 | - usersQuery.setType(0); | |
447 | 446 | usersQuery.setYn(YnEnums.YES.getId()); |
448 | 447 | List<Users> usersList = usersService.queryUsers(usersQuery); |
449 | 448 | if (usersList.size() != 0) { |
... | ... | @@ -548,7 +547,6 @@ |
548 | 547 | |
549 | 548 | //检查注册账户是否存在 |
550 | 549 | UsersQuery usersQuery = new UsersQuery(); |
551 | - usersQuery.setType(1); | |
552 | 550 | usersQuery.setPhone(phone); |
553 | 551 | usersQuery.setYn(YnEnums.YES.getId()); |
554 | 552 | List<Users> usersList = usersService.queryUsers(usersQuery); |
... | ... | @@ -742,7 +740,7 @@ |
742 | 740 | |
743 | 741 | |
744 | 742 | //修改了手机号,不能修改已存在的手机号 |
745 | - if(!users.getOtherAccount().equals(1) && !phone.equals(users.getPhone())) { | |
743 | + if(!new Integer(1).equals(users.getOtherAccount()) && !phone.equals(users.getPhone())) { | |
746 | 744 | //检查账户是否存在 |
747 | 745 | UsersQuery usersQuery = new UsersQuery(); |
748 | 746 | usersQuery.setPhone(phone); |
... | ... | @@ -808,6 +806,9 @@ |
808 | 806 | |
809 | 807 | UserRoleMaps userRoleMaps = new UserRoleMaps(); |
810 | 808 | for (String tmp : roleArrayIds) { |
809 | + if(StringUtils.isEmpty(tmp)){ | |
810 | + continue; | |
811 | + } | |
811 | 812 | Roles roles = rolesService.getRoles(Integer.valueOf(tmp)); |
812 | 813 | if (roles == null || roles.getYn() == YnEnums.NO.getId()) { |
813 | 814 | continue; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
View file @
54441d7
... | ... | @@ -4,10 +4,9 @@ |
4 | 4 | import com.lyms.platform.biz.service.CommunityConfigService; |
5 | 5 | import com.lyms.platform.biz.service.PatientsService; |
6 | 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; | |
7 | +import com.lyms.platform.permission.model.*; | |
10 | 8 | import com.lyms.platform.permission.service.OrganizationService; |
9 | +import com.lyms.platform.permission.service.UserOrganizationMapsService; | |
11 | 10 | import com.lyms.platform.permission.service.UsersService; |
12 | 11 | import com.lyms.platform.pojo.CommunityConfig; |
13 | 12 | import com.lyms.platform.pojo.Patients; |
... | ... | @@ -16,6 +15,7 @@ |
16 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
17 | 16 | import org.springframework.stereotype.Component; |
18 | 17 | |
18 | +import java.util.ArrayList; | |
19 | 19 | import java.util.List; |
20 | 20 | |
21 | 21 | /** |
... | ... | @@ -31,6 +31,10 @@ |
31 | 31 | private CommunityConfigService communityConfigService; |
32 | 32 | @Autowired |
33 | 33 | private PatientsService patientsService; |
34 | + @Autowired | |
35 | + private UserOrganizationMapsService userOrganizationMapsService; | |
36 | + @Autowired | |
37 | + private AccessPermissionFacade accessPermissionFacade; | |
34 | 38 | |
35 | 39 | public String match(int userId) { |
36 | 40 | UsersQuery usersQuery = new UsersQuery(); |
37 | 41 | |
... | ... | @@ -43,9 +47,47 @@ |
43 | 47 | if (list.get(0).getType() == 1) { |
44 | 48 | Organization organization = organizationService.getOrganization(list.get(0).getOrgId()); |
45 | 49 | return organization.getAreaId(); |
50 | + }else { | |
51 | + | |
46 | 52 | } |
47 | 53 | } |
48 | 54 | return null; |
55 | + } | |
56 | + | |
57 | + public List<Integer> matchOrgId(int userId){ | |
58 | + UsersQuery usersQuery = new UsersQuery(); | |
59 | + usersQuery.setId(userId); | |
60 | + | |
61 | + usersQuery.setYn(1); | |
62 | + List<Users> list = usersService.queryUsers(usersQuery); | |
63 | + List<Integer> data = new ArrayList<>(); | |
64 | + if (CollectionUtils.isNotEmpty(list)) { | |
65 | + //用户角色 | |
66 | + if (list.get(0).getType() == 1) { | |
67 | + for(Users users:list){ | |
68 | + if(null!=users.getOrgId()){ | |
69 | + data.add(users.getOrgId()); | |
70 | + } | |
71 | + } | |
72 | + } else{ | |
73 | + List<Organization> list2 =accessPermissionFacade.findAccessPerminssionByUserId(list.get(0).getId()); | |
74 | + if(CollectionUtils.isNotEmpty(list2)){ | |
75 | + for(Organization organization:list2){ | |
76 | + data.add(organization.getId()); | |
77 | + } | |
78 | + } | |
79 | + /*UserOrganizationMapsQuery userOrganizationMapsQuery = new UserOrganizationMapsQuery(); | |
80 | + userOrganizationMapsQuery.setUserId(list.get(0).getId()); | |
81 | + userOrganizationMapsQuery.setYn(YnEnums.YES.getId()); | |
82 | + List<UserOrganizationMaps> list1 = userOrganizationMapsService.queryUserOrganizationMaps(userOrganizationMapsQuery); | |
83 | + if(CollectionUtils.isNotEmpty(list1)){ | |
84 | + for(UserOrganizationMaps userOrganizationMaps:list1){ | |
85 | + data.add(userOrganizationMaps.getOrgId()); | |
86 | + } | |
87 | + }*/ | |
88 | + } | |
89 | + } | |
90 | + return data; | |
49 | 91 | } |
50 | 92 | |
51 | 93 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasicConfigUpdateRequest.java
View file @
54441d7
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyVisitResult.java
View file @
54441d7
... | ... | @@ -786,6 +786,11 @@ |
786 | 786 | setmCardNo(destModel.getCardNo()); |
787 | 787 | setmName(destModel.getUsername()); |
788 | 788 | setAddress(address); |
789 | + if(null!=destModel.getDueDate()){ | |
790 | + setBirth(DateUtil.getyyyy_MM_dd(destModel.getDueDate())); | |
791 | + } | |
792 | + setMphone(destModel.getPhone()); | |
793 | + setOrg(destModel.getDeliverOrg()); | |
789 | 794 | return this; |
790 | 795 | } |
791 | 796 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/VisitResult.java
View file @
54441d7
... | ... | @@ -137,9 +137,10 @@ |
137 | 137 | } catch (Exception e) { |
138 | 138 | } |
139 | 139 | try { |
140 | - setAge(DateUtil.getyyyy_MM_dd(model.getBirth())); | |
140 | + setAge(DateUtil.getyyyy_MM_dd(model.getMbirth())); | |
141 | 141 | }catch (Exception e){ |
142 | 142 | } |
143 | + setDeliverOrg(model.getOrg()); | |
143 | 144 | setPhone(model.getMphone()); |
144 | 145 | // setId(model.getId()); |
145 | 146 | setCardNo(null==model.getCardNo()?"":model.getCardNo()); |