Commit b89b3253952db1572fd6a93d1f56edca6aa62475

Authored by rui.zhang
1 parent 338924db8b

platform permission

add return pageinfo

Showing 7 changed files with 129 additions and 161 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/param/CommunityQuery.java View file @ b89b325
... ... @@ -8,6 +8,15 @@
8 8 public class CommunityQuery extends BaseQuery {
9 9 private String keyword;
10 10 private String id;
  11 + private String level;
  12 +
  13 + public String getLevel() {
  14 + return level;
  15 + }
  16 +
  17 + public void setLevel(String level) {
  18 + this.level = level;
  19 + }
11 20  
12 21 public String getId() {
13 22 return id;
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java View file @ b89b325
... ... @@ -10,6 +10,7 @@
10 10 import org.springframework.beans.factory.annotation.Autowired;
11 11 import org.springframework.stereotype.Service;
12 12  
  13 +import javax.swing.plaf.synth.Region;
13 14 import java.util.List;
14 15  
15 16 /**
16 17  
17 18  
18 19  
19 20  
20 21  
21 22  
... ... @@ -20,38 +21,38 @@
20 21 @Autowired
21 22 private CommunityConfigDao communityConfigDao;
22 23  
23   - //添加小区
  24 +
  25 +
  26 + //添加社区
24 27 public void appendCommunity(CommunityConfig communityConfig) {
25   - communityConfig.setType(2);
26 28 communityConfigDao.addArea(communityConfig);
27 29 }
28 30  
29   - //添加区域
30   - public void appendArea(CommunityConfig communityConfig) {
31   - communityConfig.setType(1);
32   - communityConfigDao.addArea(communityConfig);
33   - }
34   -
35   - //删除区域
36   - public void deleteArea(CommunityConfig communityConfig) {
  31 + //删除社区
  32 + public void deleteCommunity(CommunityConfig communityConfig) {
37 33 communityConfig.setYn(YnEnums.NO.getId());
38 34 communityConfigDao.updateArea(MongoCondition.newInstance("id", communityConfig.getId(), MongoOper.IS).toMongoQuery(), communityConfig);
39 35 }
40 36  
41   - //更新区域
42   - public void updateArea(CommunityConfig communityConfig) {
  37 + //更新社区
  38 + public void updateCommunity(CommunityConfig communityConfig) {
43 39 communityConfigDao.updateArea(MongoCondition.newInstance("id", communityConfig.getId(), MongoOper.IS).toMongoQuery(), communityConfig);
44 40 }
45 41  
46   - //查询区域
47   - public List<CommunityConfig> queryArea(CommunityQuery communityQuery) {
  42 + //查询社区
  43 + public List<CommunityConfig> queryCommunity(CommunityQuery communityQuery) {
48 44 MongoCondition mongoCondition = MongoCondition.newInstance();
49 45 if(null != communityQuery.getKeyword()) {
50   - mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("parentId", communityQuery.getKeyword(), MongoOper.IS), new MongoCondition("id", communityQuery.getKeyword(), MongoOper.IS)});
  46 + mongoCondition = mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("gxxq", communityQuery.getKeyword(), MongoOper.LIKE)});
51 47 }
52   - mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS).and("type", 1, MongoOper.IS));
53   -
54   -
  48 + mongoCondition.and("yn", YnEnums.YES.getId(), MongoOper.IS);
  49 + if(null != communityQuery.getLevel() && communityQuery.getLevel().equals("3")) {
  50 + mongoCondition = mongoCondition.andCondition(new MongoCondition("areaId", Integer.parseInt(communityQuery.getId()), MongoOper.IS));
  51 + } else if(null != communityQuery.getLevel() && communityQuery.getLevel().equals("2")) {
  52 + mongoCondition = mongoCondition.andCondition(new MongoCondition("cityId", Integer.parseInt(communityQuery.getId()), MongoOper.IS));
  53 + } else if(null != communityQuery.getLevel() && communityQuery.getLevel().equals("1")) {
  54 + mongoCondition = mongoCondition.andCondition(new MongoCondition("provinceId", Integer.parseInt(communityQuery.getId()), MongoOper.IS));
  55 + }
55 56 MongoQuery mongoQuery = mongoCondition.toMongoQuery();
56 57  
57 58 if(null != communityQuery.getLimit()) {
58 59  
59 60  
60 61  
61 62  
... ... @@ -62,34 +63,13 @@
62 63 return communityConfigDao.queryArea(mongoQuery);
63 64 }
64 65  
65   - //查询小区
66   - public List<CommunityConfig> queryCommunity(CommunityQuery communityQuery) {
67   - MongoCondition mongoCondition = MongoCondition.newInstance();
68   - if(null != communityQuery.getKeyword()) {
69   - mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("gxxq", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("parentId", communityQuery.getKeyword(), MongoOper.IS), new MongoCondition("id", communityQuery.getKeyword(), MongoOper.IS)});
70   - }
71 66  
72   - if(null == communityQuery.getId()) {
73   - mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS).and("type", 1, MongoOper.IS));
74   - } else {
75   - mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS).and("type", 1, MongoOper.IS).and("id", communityQuery.getId(), MongoOper.IS));
76   - }
77 67  
78   - MongoQuery mongoQuery = mongoCondition.toMongoQuery();
79   - communityQuery.setNeed("true");
80   - if(communityQuery.getNeed().equals("true")) {
81   - communityQuery.mysqlBuild((int) communityConfigDao.queryCount(mongoQuery));
82   - mongoQuery.start(communityQuery.getOffset()).end(communityQuery.getLimit());
83   - }
84 68  
85   - return communityConfigDao.queryArea(mongoQuery);
86   - }
87   -
88   -
89 69 //查询小区根据ID
90 70 public CommunityConfig getCommunityById(String id) {
91 71 MongoCondition mongoCondition = MongoCondition.newInstance();
92   - mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS).and("type", 1, MongoOper.IS).and("id", id, MongoOper.IS));
  72 + mongoCondition.andCondition(new MongoCondition("yn", YnEnums.YES.getId(), MongoOper.IS).and("id", id, MongoOper.IS));
93 73 MongoQuery mongoQuery = mongoCondition.toMongoQuery();
94 74 List<CommunityConfig> communityConfigs = communityConfigDao.queryArea(mongoQuery);
95 75  
96 76  
... ... @@ -100,27 +80,6 @@
100 80 }
101 81  
102 82  
103   - //查询区域根据PID
104   - public List<CommunityConfig> queryAreaByParentId(String pid) {
105   - if(null == pid) return null;
106   - MongoCondition mongoCondition = MongoCondition.newInstance().and("parentId", pid, MongoOper.IS).and("yn", YnEnums.YES.getId(), MongoOper.IS);
107   - List<CommunityConfig> communityConfigs = communityConfigDao.queryArea(mongoCondition.toMongoQuery());
108 83  
109   - return communityConfigs;
110   - }
111   -
112   -
113   - //查询区域根据ID
114   - public CommunityConfig queryAreaById(String id) {
115   - if(null == id) return null;
116   -
117   - MongoCondition mongoCondition = MongoCondition.newInstance().and("id", id, MongoOper.IS).and("yn", YnEnums.YES.getId(), MongoOper.IS);
118   -
119   - List<CommunityConfig> communityConfigs = communityConfigDao.queryArea(mongoCondition.toMongoQuery());
120   - if(null != communityConfigs && 1 == communityConfigs.size()) {
121   - return communityConfigs.get(0);
122   - }
123   - return null;
124   - }
125 84 }
platform-dal/src/main/java/com/lyms/platform/pojo/CommunityConfig.java View file @ b89b325
1 1 package com.lyms.platform.pojo;
2 2  
3 3 import com.lyms.platform.common.enums.YnEnums;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
4 5  
5 6 import java.util.List;
6 7  
7 8  
8 9  
9 10  
10 11  
11 12  
12 13  
13 14  
14 15  
15 16  
16 17  
17 18  
18 19  
19 20  
... ... @@ -8,53 +9,50 @@
8 9 * Created by Zhang.Rui on 2016/3/18.
9 10 *
10 11 */
  12 +@Document(collection="lyms_communityConfig")
11 13 public class CommunityConfig {
12 14 private String id;
13 15 private String name;
14   - private String parentId;
15 16 private Integer yn;
16   - private Integer type; //1 地名, 2 社区
17   - private CommunityConfig parent;
18   - private List<CommunityConfig> nodes;
19 17 private String gxxq; //管辖小区
  18 + private Integer provinceId;
  19 + private Integer cityId;
  20 + private Integer areaId;
20 21  
21   - public String getGxxq() {
22   - return gxxq;
23   - }
24 22  
25   - public void setGxxq(String gxxq) {
26   - this.gxxq = gxxq;
  23 + public Integer getProvinceId() {
  24 + return provinceId;
27 25 }
28 26  
29   - public List<CommunityConfig> getNodes() {
30   - return nodes;
  27 + public void setProvinceId(Integer provinceId) {
  28 + this.provinceId = provinceId;
31 29 }
32 30  
33   - public void setNodes(List<CommunityConfig> nodes) {
34   - this.nodes = nodes;
  31 + public Integer getCityId() {
  32 + return cityId;
35 33 }
36 34  
37   - public CommunityConfig getParent() {
38   - return parent;
  35 + public void setCityId(Integer cityId) {
  36 + this.cityId = cityId;
39 37 }
40 38  
41   - public void setParent(CommunityConfig parent) {
42   - this.parent = parent;
  39 + public Integer getAreaId() {
  40 + return areaId;
43 41 }
44 42  
45   - public Integer getType() {
46   - return type;
  43 + public void setAreaId(Integer areaId) {
  44 + this.areaId = areaId;
47 45 }
48 46  
49   - public void setType(Integer type) {
50   - this.type = type;
  47 + public String getGxxq() {
  48 + return gxxq;
51 49 }
52 50  
53   - public CommunityConfig(String parentId, String tmp) {
54   - this.parentId = parentId;
55   - this.yn = YnEnums.YES.getId();
56   - this.name = tmp;
  51 + public void setGxxq(String gxxq) {
  52 + this.gxxq = gxxq;
57 53 }
  54 +
  55 +
58 56 public CommunityConfig() {}
59 57  
60 58  
61 59  
... ... @@ -74,13 +72,7 @@
74 72 this.name = name;
75 73 }
76 74  
77   - public String getParentId() {
78   - return parentId;
79   - }
80 75  
81   - public void setParentId(String parentId) {
82   - this.parentId = parentId;
83   - }
84 76  
85 77 public Integer getYn() {
86 78 return yn;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CommunityConfigController.java View file @ b89b325
... ... @@ -7,6 +7,7 @@
7 7 import com.lyms.platform.biz.param.CommunityQuery;
8 8 import com.lyms.platform.biz.service.PatientsService;
9 9 import com.lyms.platform.common.annotation.TokenRequired;
  10 +import com.lyms.platform.common.enums.YnEnums;
10 11 import com.lyms.platform.operate.web.facade.PuerperaManagerFacade;
11 12 import com.lyms.platform.operate.web.request.PuerperaManagerQueryRequest;
12 13 import com.lyms.platform.operate.web.result.FrontEndResult;
13 14  
... ... @@ -39,22 +40,10 @@
39 40 @Autowired
40 41 private PatientsService patientsService;
41 42  
42   -// //新增小区
43   -// @RequestMapping(value = "addCommunity", method = RequestMethod.POST)
44   -// @ResponseBody
45   -// public BaseResponse addCommunity(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) {
46   -// CommunityConfig communityConfig = null;
47   -// for(String tmp : communityConfigRequest.getNames()) {
48   -// communityConfig = new CommunityConfig(communityConfigRequest.getParentId(), tmp);
49   -// communityConfigService.appendCommunity(communityConfig);
50   -// }
51   -// return new BaseResponse()
52   -// .setErrorcode(ErrorCodeConstants.SUCCESS)
53   -// .setErrormsg("添加成功!");
54   -// }
55 43  
56 44  
57   - //新增小区
  45 +
  46 + //添加管辖区域
58 47 @RequestMapping(value = "addCommunity", method = RequestMethod.POST)
59 48 @ResponseBody
60 49 @TokenRequired
61 50  
62 51  
63 52  
... ... @@ -69,17 +58,22 @@
69 58 if(null == communityConfig) return null;
70 59  
71 60 communityConfig.setId(communityConfigRequest.getId());
72   - communityConfig.setGxxq(communityConfig.getGxxq() + ", " + names.substring(1, names.length()));
  61 + if(null != communityConfig.getGxxq() && 0 < communityConfig.getGxxq().length() ) {
  62 + communityConfig.setGxxq(communityConfig.getGxxq() + ", " + names.substring(1, names.length()));
  63 + } else {
  64 + communityConfig.setGxxq( names.substring(1, names.length()));
  65 + }
73 66  
74   - communityConfigService.updateArea(communityConfig);
75 67  
  68 + communityConfigService.updateCommunity(communityConfig);
  69 +
76 70 return new BaseResponse()
77 71 .setErrorcode(ErrorCodeConstants.SUCCESS)
78 72 .setErrormsg("添加成功!");
79 73 }
80 74  
81 75  
82   - //删除小区
  76 + //删除管辖区域
83 77 @RequestMapping(value = "delCommunity/{id}", method = RequestMethod.DELETE)
84 78 @ResponseBody
85 79 @TokenRequired
... ... @@ -87,7 +81,7 @@
87 81 CommunityConfig communityConfig = new CommunityConfig();
88 82 communityConfig.setId(id);
89 83 communityConfig.setGxxq("");
90   - communityConfigService.updateArea(communityConfig);
  84 + communityConfigService.updateCommunity(communityConfig);
91 85  
92 86 return new BaseResponse()
93 87 .setErrorcode(ErrorCodeConstants.SUCCESS)
... ... @@ -95,8 +89,8 @@
95 89 }
96 90  
97 91  
98   - //查询小区
99   - @RequestMapping(value = "queryCommunity", method = RequestMethod.GET)
  92 + //查询社区
  93 + @RequestMapping(value = "communityConfig", method = RequestMethod.GET)
100 94 @ResponseBody
101 95 @TokenRequired
102 96 public FrontEndResult queryCommunity(CommunityQuery communityQuery) {
... ... @@ -104,12 +98,7 @@
104 98  
105 99 if(null != communityConfigList) {
106 100 for(CommunityConfig communityConfig : communityConfigList) {
107   - communityConfig.setNodes(communityConfigService.queryAreaByParentId(communityConfig.getId()));
108   - if(null != communityConfig.getParentId()) {
109   - communityConfig.setParent(communityConfigService.queryAreaById(communityConfig.getParentId()));
110   - } else {
111   -// communityConfig.setParent(new CommunityConfig("0", "root"));
112   - }
  101 +
113 102 }
114 103 return FrontEndResult.ini().setData(communityConfigList).setPageInfo(communityQuery.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("查询成功");
115 104 }
116 105  
117 106  
... ... @@ -119,22 +108,27 @@
119 108  
120 109  
121 110  
122   - //新增区域
  111 + //新增社区
123 112 @RequestMapping(value = "communityConfig", method = RequestMethod.POST)
124 113 @ResponseBody
125 114 @TokenRequired
126 115 public BaseResponse appendArea(@RequestBody @Valid CommunityConfigRequest communityConfigRequest) {
127 116 CommunityConfig communityConfig = null;
128 117 for(String tmp : communityConfigRequest.getNames()) {
129   - communityConfig = new CommunityConfig(communityConfigRequest.getParentId(), tmp);
130   - communityConfigService.appendArea(communityConfig);
  118 + communityConfig = new CommunityConfig();
  119 + communityConfig.setYn(YnEnums.YES.getId());
  120 + communityConfig.setName(tmp);
  121 + communityConfig.setProvinceId(communityConfigRequest.getProvinceId());
  122 + communityConfig.setCityId(communityConfigRequest.getCityId());
  123 + communityConfig.setAreaId(communityConfigRequest.getAreaId());
  124 + communityConfigService.appendCommunity(communityConfig);
131 125 }
132 126 return new BaseResponse()
133 127 .setErrorcode(ErrorCodeConstants.SUCCESS)
134 128 .setErrormsg("添加成功!");
135 129 }
136 130  
137   - //删除区域
  131 + //删除社区
138 132 @RequestMapping(value = "communityConfig/{id}", method = RequestMethod.DELETE)
139 133 @ResponseBody
140 134 @TokenRequired
141 135  
142 136  
143 137  
144 138  
145 139  
146 140  
147 141  
148 142  
149 143  
... ... @@ -148,59 +142,55 @@
148 142  
149 143 CommunityConfig communityConfig = new CommunityConfig();
150 144 communityConfig.setId(id);
151   - communityConfigService.deleteArea(communityConfig);
  145 + communityConfigService.deleteCommunity(communityConfig);
152 146 return new BaseResponse()
153 147 .setErrorcode(ErrorCodeConstants.SUCCESS)
154 148 .setErrormsg("删除成功!");
155 149 }
156 150  
157   - //更新区域
  151 + //更新社区
158 152 @RequestMapping(value = "communityConfig/{id}", method = RequestMethod.PUT)
159 153 @ResponseBody
160 154 @TokenRequired
161   - public BaseResponse updateArea(@RequestParam(required=true) String name,@RequestParam(required=true) String parentId, @PathVariable String id) {
  155 + public BaseResponse updateArea(@RequestParam(required=true) String name, @PathVariable String id) {
162 156 CommunityConfig communityConfig = new CommunityConfig();
163   - communityConfig.setParentId(parentId);
164 157 communityConfig.setId(id);
165 158 communityConfig.setName(name);
166   - communityConfigService.updateArea(communityConfig);
  159 + communityConfigService.updateCommunity(communityConfig);
167 160 return new BaseResponse()
168 161 .setErrorcode(ErrorCodeConstants.SUCCESS)
169 162 .setErrormsg("更新成功!");
170 163 }
171 164  
172   - //查询区域
173   - @RequestMapping(value = "communityConfig", method = RequestMethod.GET)
174   - @ResponseBody
175   - @TokenRequired
176   - public FrontEndResult queryArea(CommunityQuery communityQuery) {
177   - List<CommunityConfig> communityConfigList = communityConfigService.queryArea(communityQuery);
  165 +// //查询区域
  166 +// @RequestMapping(value = "communityConfig", method = RequestMethod.GET)
  167 +// @ResponseBody
  168 +// @TokenRequired
  169 +// public FrontEndResult queryArea(CommunityQuery communityQuery) {
  170 +// List<CommunityConfig> communityConfigList = communityConfigService.queryArea(communityQuery);
  171 +//
  172 +// if(null != communityConfigList) {
  173 +// for(CommunityConfig communityConfig : communityConfigList) {
  174 +// communityConfig.setNodes(communityConfigService.queryAreaByParentId(communityConfig.getId()));
  175 +// if(null != communityConfig.getParentId()) {
  176 +// communityConfig.setParent(communityConfigService.queryAreaById(communityConfig.getParentId()));
  177 +// } else {
  178 +//// communityConfig.setParent(new CommunityConfig("0", "root"));
  179 +// }
  180 +// }
  181 +// return FrontEndResult.ini().setData(communityConfigList).setPageInfo(communityQuery.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  182 +// }
  183 +// return FrontEndResult.ini(ErrorCodeConstants.NO_DATA, "没有数据");
  184 +//
  185 +// }
178 186  
179   - if(null != communityConfigList) {
180   - for(CommunityConfig communityConfig : communityConfigList) {
181   - communityConfig.setNodes(communityConfigService.queryAreaByParentId(communityConfig.getId()));
182   - if(null != communityConfig.getParentId()) {
183   - communityConfig.setParent(communityConfigService.queryAreaById(communityConfig.getParentId()));
184   - } else {
185   -// communityConfig.setParent(new CommunityConfig("0", "root"));
186   - }
187   - }
188   - return FrontEndResult.ini().setData(communityConfigList).setPageInfo(communityQuery.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
189   - }
190   - return FrontEndResult.ini(ErrorCodeConstants.NO_DATA, "没有数据");
191 187  
192   - }
193 188  
194   -
195   -
196 189 //
197 190 @RequestMapping(value = "communityConfigTest", method = RequestMethod.GET)
198 191 @ResponseBody
199 192 public Integer communityConfigTest() {
200   - CommunityConfig communityConfig = new CommunityConfig(null, "河北省");
201   - communityConfigService.appendArea(communityConfig);
202   - communityConfig = new CommunityConfig(null, "四川省");
203   - communityConfigService.appendArea(communityConfig);
  193 +
204 194 return 1;
205 195 }
206 196  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java View file @ b89b325
... ... @@ -207,7 +207,7 @@
207 207 babyResult.setCommunityId(StringUtils.isEmpty(patients.getCommunityId()) ? "" : patients.getCommunityId());
208 208 String comm="未分配";
209 209 if(StringUtils.isNotEmpty(patients.getCommunityId())){
210   - CommunityConfig communityConfig = communityConfigService.queryAreaById(patients.getCommunityId());
  210 + CommunityConfig communityConfig = communityConfigService.getCommunityById(patients.getCommunityId());
211 211 if(null!=communityConfig){
212 212 comm= communityConfig.getName();
213 213 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ b89b325
... ... @@ -100,7 +100,7 @@
100 100 PuerperaResult result = new PuerperaResult();
101 101 String comm = "未分配";
102 102 if (StringUtils.isNotEmpty(model.getCommunityId())) {
103   - CommunityConfig communityConfig = communityConfigService.queryAreaById(model.getCommunityId());
  103 + CommunityConfig communityConfig = communityConfigService.getCommunityById(model.getCommunityId());
104 104 if (null != communityConfig) {
105 105 comm = communityConfig.getName();
106 106 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CommunityConfigRequest.java View file @ b89b325
... ... @@ -9,11 +9,13 @@
9 9 */
10 10 @Form
11 11 public class CommunityConfigRequest {
12   - @NotNull(message = "父ID不能为空")
13   - private String parentId;
  12 +
  13 + private String id;
  14 + private Integer provinceId;
  15 + private Integer cityId;
  16 + private Integer areaId;
14 17 @NotNull(message = "添加内容不能为空")
15 18 private String[] names;
16   - private String id;
17 19  
18 20 public String getId() {
19 21 return id;
20 22  
... ... @@ -23,12 +25,28 @@
23 25 this.id = id;
24 26 }
25 27  
26   - public String getParentId() {
27   - return parentId;
  28 + public Integer getProvinceId() {
  29 + return provinceId;
28 30 }
29 31  
30   - public void setParentId(String parentId) {
31   - this.parentId = parentId;
  32 + public void setProvinceId(Integer provinceId) {
  33 + this.provinceId = provinceId;
  34 + }
  35 +
  36 + public Integer getCityId() {
  37 + return cityId;
  38 + }
  39 +
  40 + public void setCityId(Integer cityId) {
  41 + this.cityId = cityId;
  42 + }
  43 +
  44 + public Integer getAreaId() {
  45 + return areaId;
  46 + }
  47 +
  48 + public void setAreaId(Integer areaId) {
  49 + this.areaId = areaId;
32 50 }
33 51  
34 52 public String[] getNames() {