Commit 9d1f09e1ddd4ed39cf5dfa4d7c63fb6e0aadaa7f
1 parent
6f48f3ebfb
Exists in
master
and in
6 other branches
改逻辑
Showing 2 changed files with 22 additions and 9 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/PlantformConfigModel.java
View file @
9d1f09e
... | ... | @@ -21,7 +21,9 @@ |
21 | 21 | */ |
22 | 22 | @Id |
23 | 23 | private ObjectId id; |
24 | - | |
24 | + | |
25 | + private String yn; | |
26 | + | |
25 | 27 | /** |
26 | 28 | * key名称 |
27 | 29 | */ |
... | ... | @@ -50,7 +52,15 @@ |
50 | 52 | * 备注 |
51 | 53 | */ |
52 | 54 | private String remark; |
53 | - | |
55 | + | |
56 | + public String getYn() { | |
57 | + return yn; | |
58 | + } | |
59 | + | |
60 | + public void setYn(String yn) { | |
61 | + this.yn = yn; | |
62 | + } | |
63 | + | |
54 | 64 | /** |
55 | 65 | * mongo的inr操作不支持 字符串 |
56 | 66 | * 用于记录每次自增之后的值 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PlantformConfigServiceImpl.java
View file @
9d1f09e
... | ... | @@ -43,6 +43,7 @@ |
43 | 43 | public BaseResponse listCustomType(String key, Integer page, Integer limit, Integer userId) { |
44 | 44 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
45 | 45 | Query query = new Query(); |
46 | + query.addCriteria(Criteria.where("yn").ne("0")); | |
46 | 47 | if(StringUtils.isNotEmpty(key)) { |
47 | 48 | query.addCriteria(Criteria.where("value").regex(key)); |
48 | 49 | } |
... | ... | @@ -65,8 +66,8 @@ |
65 | 66 | |
66 | 67 | @Override |
67 | 68 | public BaseResponse delCustomType(String id, Integer userId) { |
68 | - mongoTemplate.remove(Query.query(Criteria.where("id").is(id)), PlantformConfigModel.class); | |
69 | - mongoTemplate.remove(Query.query(Criteria.where("parentId").is(id)), PlantformConfigModel.class); | |
69 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(id)), Update.update("yn", "0"), PlantformConfigModel.class); | |
70 | + mongoTemplate.updateMulti(Query.query(Criteria.where("parentId").is(id)), Update.update("yn", "0"), PlantformConfigModel.class); | |
70 | 71 | return RespBuilder.buildSuccess(); |
71 | 72 | } |
72 | 73 | |
... | ... | @@ -92,6 +93,7 @@ |
92 | 93 | plantformConfigModel.setKey(hospitalId); |
93 | 94 | plantformConfigModel.setValue(name); |
94 | 95 | plantformConfigModel.setType(SequenceConstant.CUSTOM_TYPE); |
96 | + plantformConfigModel.setYn("1"); | |
95 | 97 | plantformConfigModel.setRemark("产检处理意见自定义类型"); |
96 | 98 | mongoTemplate.save(plantformConfigModel); |
97 | 99 | } else { |
98 | 100 | |
99 | 101 | |
... | ... | @@ -100,15 +102,17 @@ |
100 | 102 | return RespBuilder.buildSuccess(); |
101 | 103 | } |
102 | 104 | |
103 | - | |
104 | - | |
105 | 105 | @Override |
106 | 106 | public BaseResponse customContentList(String parentId, Date startDate, Date endDate, Integer page, Integer limit, Integer userId) { |
107 | 107 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
108 | 108 | Query query = new Query(); |
109 | + query.addCriteria(Criteria.where("yn").ne("0")); | |
109 | 110 | if(StringUtils.isNotEmpty(parentId)) { |
110 | 111 | query.addCriteria(Criteria.where("parentId").is(parentId)); |
111 | 112 | } |
113 | + if(startDate != null && endDate != null) { | |
114 | + query.addCriteria(Criteria.where("createDate").gte(startDate).lt(DateUtil.addDay(endDate, 1))); | |
115 | + } | |
112 | 116 | query.addCriteria(Criteria.where("key").is(hospitalId).and("type").is(SequenceConstant.CUSTOM_CONTENT)).with(new Sort(Sort.Direction.DESC,"createDate")); |
113 | 117 | PageResult pageResult = findMongoPage(PlantformConfigModel.class, query, page, limit); |
114 | 118 | |
115 | 119 | |
... | ... | @@ -124,11 +128,9 @@ |
124 | 128 | restList.add(map); |
125 | 129 | } |
126 | 130 | pageResult.setGrid(restList); |
127 | - | |
128 | 131 | return RespBuilder.buildSuccess(pageResult); |
129 | 132 | } |
130 | 133 | |
131 | - | |
132 | 134 | @Override |
133 | 135 | public BaseResponse addCustomContent(String parentId, String id, String content, String key, Integer userId) { |
134 | 136 | PlantformConfigModel plantformConfigModel = new PlantformConfigModel(); |
... | ... | @@ -139,6 +141,7 @@ |
139 | 141 | plantformConfigModel.setKey(hospitalId); |
140 | 142 | plantformConfigModel.setValue(content); |
141 | 143 | plantformConfigModel.setSerchKey(key); |
144 | + plantformConfigModel.setYn("1"); | |
142 | 145 | plantformConfigModel.setType(SequenceConstant.CUSTOM_CONTENT); |
143 | 146 | plantformConfigModel.setRemark("产检处理意见自定义内容"); |
144 | 147 | mongoTemplate.save(plantformConfigModel); |
... | ... | @@ -156,7 +159,7 @@ |
156 | 159 | |
157 | 160 | @Override |
158 | 161 | public BaseResponse delCustomContent(String id, Integer userId) { |
159 | - mongoTemplate.remove(Query.query(Criteria.where("id").is(id)), PlantformConfigModel.class); | |
162 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(id)), Update.update("yn", "0"), PlantformConfigModel.class); | |
160 | 163 | return RespBuilder.buildSuccess(); |
161 | 164 | } |
162 | 165 | } |