Commit ec490669f76bbdd1b7dacbd1320cd621366744e6
1 parent
347ee38036
Exists in
master
and in
6 other branches
两癌
Showing 3 changed files with 116 additions and 0 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/CancersConfig.java
View file @
ec49066
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import com.lyms.platform.common.result.BaseModel; | |
4 | +import org.springframework.data.mongodb.core.mapping.Document; | |
5 | + | |
6 | +@Document(collection = "lyms_cancer_config") | |
7 | +public class CancersConfig extends BaseModel { | |
8 | + private String id; | |
9 | + private String areaId; | |
10 | + private Integer year; | |
11 | + private Integer quarter; | |
12 | + private Integer num; | |
13 | + | |
14 | + public String getId() { | |
15 | + return id; | |
16 | + } | |
17 | + | |
18 | + public void setId(String id) { | |
19 | + this.id = id; | |
20 | + } | |
21 | + | |
22 | + public String getAreaId() { | |
23 | + return areaId; | |
24 | + } | |
25 | + | |
26 | + public void setAreaId(String areaId) { | |
27 | + this.areaId = areaId; | |
28 | + } | |
29 | + | |
30 | + public Integer getYear() { | |
31 | + return year; | |
32 | + } | |
33 | + | |
34 | + public void setYear(Integer year) { | |
35 | + this.year = year; | |
36 | + } | |
37 | + | |
38 | + public Integer getQuarter() { | |
39 | + return quarter; | |
40 | + } | |
41 | + | |
42 | + public void setQuarter(Integer quarter) { | |
43 | + this.quarter = quarter; | |
44 | + } | |
45 | + | |
46 | + public Integer getNum() { | |
47 | + return num; | |
48 | + } | |
49 | + | |
50 | + public void setNum(Integer num) { | |
51 | + this.num = num; | |
52 | + } | |
53 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CancerScreeningController.java
View file @
ec49066
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | import com.lyms.platform.operate.web.request.CancerScreeningRequest; |
11 | 11 | import com.lyms.platform.pojo.BreastAfterVisitRecordModel; |
12 | 12 | import com.lyms.platform.pojo.CancerScreeningModel; |
13 | +import com.lyms.platform.pojo.CancersConfig; | |
13 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
14 | 15 | import org.springframework.stereotype.Controller; |
15 | 16 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -193,5 +194,28 @@ |
193 | 194 | return cancerScreenService.queryCancerScreeningCount(cancerScreeningRequest, loginState.getId()); |
194 | 195 | } |
195 | 196 | |
197 | + @ResponseBody | |
198 | + @RequestMapping(method = RequestMethod.POST,value = "/addCancersConfig") | |
199 | + @TokenRequired | |
200 | + public BaseResponse addCancersConfig(@RequestBody CancersConfig config, HttpServletRequest request) { | |
201 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
202 | + return cancerScreenService.addCancersConfig(config, loginState.getId()); | |
203 | + } | |
204 | + | |
205 | + @ResponseBody | |
206 | + @RequestMapping(method = RequestMethod.GET,value = "/queryCancersConfigs") | |
207 | + @TokenRequired | |
208 | + public BaseResponse queryCancersConfigs(HttpServletRequest request) { | |
209 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
210 | + return cancerScreenService.queryCancersConfigs(loginState.getId()); | |
211 | + } | |
212 | + | |
213 | + @ResponseBody | |
214 | + @RequestMapping(method = RequestMethod.DELETE,value = "/delCancersConfig/{id}") | |
215 | + @TokenRequired | |
216 | + public BaseResponse delCancersConfig(@PathVariable String id, HttpServletRequest request) { | |
217 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
218 | + return cancerScreenService.delCancersConfig(id, loginState.getId()); | |
219 | + } | |
196 | 220 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CancerScreeningFacade.java
View file @
ec49066
... | ... | @@ -989,5 +989,44 @@ |
989 | 989 | result.put("datas",list); |
990 | 990 | return new BaseObjectResponse().setData(result).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
991 | 991 | } |
992 | + | |
993 | + public BaseResponse addCancersConfig(CancersConfig config, Integer id) { | |
994 | + | |
995 | + if (StringUtils.isNotEmpty(config.getId())) | |
996 | + { | |
997 | + Update update=MongoConvertHelper | |
998 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(config)); | |
999 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(config.getId())), update, CancersConfig.class); | |
1000 | + } | |
1001 | + else | |
1002 | + { | |
1003 | + mongoTemplate.save(config); | |
1004 | + } | |
1005 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
1006 | + } | |
1007 | + | |
1008 | + public BaseResponse delCancersConfig(String id, Integer userId) { | |
1009 | + mongoTemplate.remove(Query.query(Criteria.where("id").is(id)),CancersConfig.class); | |
1010 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
1011 | + } | |
1012 | + | |
1013 | + public BaseResponse queryCancersConfigs(Integer id) { | |
1014 | + List<CancersConfig> list = mongoTemplate.find(Query.query(Criteria.where("id").exists(true)), CancersConfig.class); | |
1015 | + List<Map> datas = new ArrayList<>(); | |
1016 | + if (CollectionUtils.isNotEmpty(list)) | |
1017 | + { | |
1018 | + for (CancersConfig config : list) | |
1019 | + { | |
1020 | + Map data = new HashMap(); | |
1021 | + data.put("year",config.getYear()); | |
1022 | + data.put("num",config.getNum()); | |
1023 | + data.put("quarter",config.getQuarter()); | |
1024 | + data.put("areaName",basicConfigService.getOneBasicConfigById(config.getAreaId()).getName()); | |
1025 | + datas.add(data); | |
1026 | + } | |
1027 | + } | |
1028 | + | |
1029 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(list); | |
1030 | + } | |
992 | 1031 | } |