Commit 1401dbf90f8d2939218962882c6a78722a87c27f
1 parent
8ebd6141ca
Exists in
master
and in
6 other branches
服务同步
Showing 11 changed files with 203 additions and 17 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IMatdeliverFollowModelDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/MatdeliverFollowModelDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverFollowService.java
- platform-biz-service/src/main/resources/mainOrm/master/PatientService.xml
- platform-dal/src/main/java/com/lyms/platform/pojo/MatdeliverFollowModel.java
- platform-dal/src/main/java/com/lyms/platform/query/MatDeliverFollowQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatdeliverFollowController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatdeliverFollowFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MatDeliverFollowAddRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MatDeliverFollowQueryRequest.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IMatdeliverFollowModelDao.java
View file @
1401dbf
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/MatdeliverFollowModelDaoImpl.java
View file @
1401dbf
... | ... | @@ -7,6 +7,10 @@ |
7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
8 | 8 | import com.lyms.platform.common.dao.operator.Page; |
9 | 9 | import com.lyms.platform.pojo.MatdeliverFollowModel; |
10 | +import org.springframework.data.mongodb.core.aggregation.Aggregation; | |
11 | +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; | |
12 | +import org.springframework.data.mongodb.core.aggregation.AggregationResults; | |
13 | +import org.springframework.data.mongodb.core.query.Criteria; | |
10 | 14 | import org.springframework.stereotype.Repository; |
11 | 15 | |
12 | 16 | import java.util.List; |
... | ... | @@ -41,5 +45,14 @@ |
41 | 45 | public Page<MatdeliverFollowModel> findPage(MongoQuery query) { |
42 | 46 | return findPage(query.convertToMongoQuery()); |
43 | 47 | } |
48 | + | |
49 | + public List<MatdeliverFollowModel> queryByPidsGoup(List pids) { | |
50 | + AggregationOperation match = Aggregation.match(Criteria.where("patientId").in(pids)); | |
51 | + AggregationOperation group = Aggregation.group("patientId").max("updateDate").as("updateDate"); | |
52 | + Aggregation aggregation = Aggregation.newAggregation(match, group); | |
53 | + AggregationResults<MatdeliverFollowModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_matdeliver_follow", MatdeliverFollowModel.class); | |
54 | + return result.getMappedResults(); | |
55 | + } | |
56 | + | |
44 | 57 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverFollowService.java
View file @
1401dbf
... | ... | @@ -31,11 +31,12 @@ |
31 | 31 | } |
32 | 32 | |
33 | 33 | public List<MatdeliverFollowModel> query(MatDeliverFollowQuery deliverQuery){ |
34 | - return iMatdeliverFollowModelDao.queryMatdeliverFollowModel(deliverQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
34 | + return iMatdeliverFollowModelDao.queryMatdeliverFollowModel(deliverQuery.convertToQuery().addOrder(Sort.Direction.DESC, "updateDate")); | |
35 | 35 | } |
36 | 36 | public void deleteOne(String id){ |
37 | 37 | iMatdeliverFollowModelDao.deleteMatdeliverFollowModel(id); |
38 | 38 | } |
39 | + | |
39 | 40 | public void updateOne(MatdeliverFollowModel deliverModel,String id){ |
40 | 41 | iMatdeliverFollowModelDao.updateMatdeliverFollowModel(deliverModel, id); |
41 | 42 | } |
... | ... | @@ -51,7 +52,11 @@ |
51 | 52 | MongoQuery mongoQuery = matDeliverQuery.convertToQuery(); |
52 | 53 | matDeliverQuery.mysqlBuild(iMatdeliverFollowModelDao.queryMatdeliverFollowModelCount(matDeliverQuery.convertToQuery())); |
53 | 54 | mongoQuery.start(matDeliverQuery.getOffset()).end(matDeliverQuery.getLimit()); |
54 | - return iMatdeliverFollowModelDao.queryMatdeliverFollowModel(mongoQuery.addOrder(Sort.Direction.DESC, "dueDate1")); | |
55 | + return iMatdeliverFollowModelDao.queryMatdeliverFollowModel(mongoQuery.addOrder(Sort.Direction.DESC, "updateDate")); | |
56 | + } | |
57 | + | |
58 | + public List<MatdeliverFollowModel> queryByPidsGoup(List pids){ | |
59 | + return iMatdeliverFollowModelDao.queryByPidsGoup(pids); | |
55 | 60 | } |
56 | 61 | } |
platform-biz-service/src/main/resources/mainOrm/master/PatientService.xml
View file @
1401dbf
... | ... | @@ -37,6 +37,8 @@ |
37 | 37 | update patient_service |
38 | 38 | <set> |
39 | 39 | ser_doct = #{serDoct,jdbcType=VARCHAR}, |
40 | + create_user = #{createUser,jdbcType=VARCHAR}, | |
41 | + update_user = #{updateUser,jdbcType=VARCHAR}, | |
40 | 42 | <if test="parentid != null and parentid != ''"> |
41 | 43 | parentid = #{parentid,jdbcType=VARCHAR}, |
42 | 44 | </if> |
... | ... | @@ -53,9 +55,6 @@ |
53 | 55 | <if test="createUserName != null and createUserName != ''"> |
54 | 56 | create_user_name = #{createUserName,jdbcType=VARCHAR}, |
55 | 57 | </if> |
56 | - <if test="createUser != null and createUser != ''"> | |
57 | - create_user = #{createUser,jdbcType=VARCHAR}, | |
58 | - </if> | |
59 | 58 | <if test="serStatus != null and serStatus >= 0"> |
60 | 59 | ser_status = #{serStatus,jdbcType=INTEGER}, |
61 | 60 | </if> |
... | ... | @@ -64,9 +63,6 @@ |
64 | 63 | </if> |
65 | 64 | <if test="updateUserName != null and updateUserName != ''"> |
66 | 65 | update_user_name = #{updateUserName,jdbcType=VARCHAR}, |
67 | - </if> | |
68 | - <if test="updateUser != null and updateUser != ''"> | |
69 | - update_user = #{updateUser,jdbcType=VARCHAR}, | |
70 | 66 | </if> |
71 | 67 | <if test="hospitalId != null and hospitalId != ''"> |
72 | 68 | hospital_id = #{hospitalId,jdbcType=VARCHAR}, |
platform-dal/src/main/java/com/lyms/platform/pojo/MatdeliverFollowModel.java
View file @
1401dbf
... | ... | @@ -183,6 +183,31 @@ |
183 | 183 | */ |
184 | 184 | private String referHospital; |
185 | 185 | |
186 | + /** | |
187 | + * 修改时间 | |
188 | + */ | |
189 | + private Date updateDate; | |
190 | + /** | |
191 | + * 修改人 | |
192 | + */ | |
193 | + private String updateUser; | |
194 | + | |
195 | + public Date getUpdateDate() { | |
196 | + return updateDate; | |
197 | + } | |
198 | + | |
199 | + public void setUpdateDate(Date updateDate) { | |
200 | + this.updateDate = updateDate; | |
201 | + } | |
202 | + | |
203 | + public String getUpdateUser() { | |
204 | + return updateUser; | |
205 | + } | |
206 | + | |
207 | + public void setUpdateUser(String updateUser) { | |
208 | + this.updateUser = updateUser; | |
209 | + } | |
210 | + | |
186 | 211 | public String getId() { |
187 | 212 | return id; |
188 | 213 | } |
platform-dal/src/main/java/com/lyms/platform/query/MatDeliverFollowQuery.java
View file @
1401dbf
... | ... | @@ -187,12 +187,21 @@ |
187 | 187 | * 科室及机构 |
188 | 188 | */ |
189 | 189 | private String referHospital; |
190 | + /** | |
191 | + * 修改时间 | |
192 | + */ | |
193 | + private Date updateDate; | |
194 | + /** | |
195 | + * 修改人 | |
196 | + */ | |
197 | + private String updateUser; | |
190 | 198 | |
191 | 199 | /** |
192 | 200 | * @return |
193 | 201 | */ |
194 | 202 | @Override |
195 | 203 | public MongoQuery convertToQuery() { |
204 | + | |
196 | 205 | MongoCondition condition = MongoCondition.newInstance(); |
197 | 206 | if (StringUtils.isNotBlank(id)) { |
198 | 207 | condition = condition.and("id", id, MongoOper.IS); |
199 | 208 | |
200 | 209 | |
... | ... | @@ -212,11 +221,36 @@ |
212 | 221 | if (contactResult!=null) { |
213 | 222 | condition = condition.and("contactResult",contactResult , MongoOper.IS); |
214 | 223 | } |
224 | + if (contactReason!=null) { | |
225 | + condition = condition.and("contactReason",contactReason , MongoOper.IS); | |
226 | + } | |
227 | + if (visitStatus!=null) { | |
228 | + condition = condition.and("visitStatus", visitStatus, MongoOper.IS); | |
229 | + } | |
215 | 230 | if (visitResult!=null) { |
216 | 231 | condition = condition.and("visitResult", visitResult, MongoOper.IS); |
217 | 232 | } |
233 | + if (visitAffirm!=null) { | |
234 | + condition = condition.and("visitAffirm", visitAffirm, MongoOper.IS); | |
235 | + } | |
218 | 236 | |
219 | 237 | return condition.toMongoQuery(); |
238 | + } | |
239 | + | |
240 | + public Date getUpdateDate() { | |
241 | + return updateDate; | |
242 | + } | |
243 | + | |
244 | + public void setUpdateDate(Date updateDate) { | |
245 | + this.updateDate = updateDate; | |
246 | + } | |
247 | + | |
248 | + public String getUpdateUser() { | |
249 | + return updateUser; | |
250 | + } | |
251 | + | |
252 | + public void setUpdateUser(String updateUser) { | |
253 | + this.updateUser = updateUser; | |
220 | 254 | } |
221 | 255 | |
222 | 256 | public String getId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatdeliverFollowController.java
View file @
1401dbf
... | ... | @@ -53,9 +53,10 @@ |
53 | 53 | @ResponseBody |
54 | 54 | @TokenRequired |
55 | 55 | @RequestMapping(value = "/addPostpartumInfo", method = RequestMethod.POST) |
56 | - public BaseResponse addPostpartumInfo(HttpServletRequest request, MatDeliverFollowAddRequest matDeliverFollowAddRequest) { | |
56 | + public BaseResponse addPostpartumInfo(MatDeliverFollowAddRequest matDeliverFollowAddRequest, HttpServletRequest request) { | |
57 | + System.out.println(matDeliverFollowAddRequest); | |
57 | 58 | Integer userId = getUserId(request); |
58 | - return matdeliverFollowFacade.addMatDeliverFollow(matDeliverFollowAddRequest, userId); | |
59 | + return matdeliverFollowFacade.addOrUpdateMatDeliverFollow(matDeliverFollowAddRequest, userId); | |
59 | 60 | } |
60 | 61 | |
61 | 62 | // /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatdeliverFollowFacade.java
View file @
1401dbf
... | ... | @@ -16,13 +16,11 @@ |
16 | 16 | import com.lyms.platform.pojo.MatdeliverFollowModel; |
17 | 17 | import com.lyms.platform.pojo.MaternalDeliverModel; |
18 | 18 | import com.lyms.platform.query.MatDeliverFollowQuery; |
19 | +import org.apache.commons.lang.StringUtils; | |
19 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
20 | 21 | import org.springframework.stereotype.Component; |
21 | 22 | |
22 | -import java.util.ArrayList; | |
23 | -import java.util.HashMap; | |
24 | -import java.util.List; | |
25 | -import java.util.Map; | |
23 | +import java.util.*; | |
26 | 24 | |
27 | 25 | /** |
28 | 26 | * @auther yangfei |
29 | 27 | |
30 | 28 | |
... | ... | @@ -113,14 +111,32 @@ |
113 | 111 | patientIds.add(pf.getPatientId()); |
114 | 112 | } |
115 | 113 | //根据In查询,进行grunp by patientId,进行排序 |
116 | - | |
114 | + List<MatdeliverFollowModel> matdeliverFollowModels = matDeliverFollowService.queryByPidsGoup(patientIds); | |
115 | + System.out.println("产检随访长度:"+matdeliverFollowModels.size()); | |
117 | 116 | //返回结果,进行前端开发 |
118 | 117 | } |
119 | 118 | return baseListResponse; |
120 | 119 | } |
121 | 120 | |
122 | - public BaseResponse addMatDeliverFollow(MatDeliverFollowAddRequest matDeliverFollowAddRequest, Integer userId) { | |
121 | + | |
122 | + /** | |
123 | + * 添加一条访视记录 | |
124 | + * @param matDeliverFollowAddRequest | |
125 | + * @param userId | |
126 | + * @return | |
127 | + */ | |
128 | + public BaseResponse addOrUpdateMatDeliverFollow(MatDeliverFollowAddRequest matDeliverFollowAddRequest, Integer userId) { | |
123 | 129 | BaseResponse baseResponse = new BaseResponse(); |
130 | + matDeliverFollowAddRequest.setUpdateDate(new Date()); | |
131 | + matDeliverFollowAddRequest.setUpdateUser(String.valueOf(userId)); | |
132 | + | |
133 | + if(StringUtils.isNotEmpty(matDeliverFollowAddRequest.getId())){//修改 | |
134 | + matDeliverFollowService.updateOne(matDeliverFollowAddRequest.convertToDataModel(), matDeliverFollowAddRequest.getId()); | |
135 | + }else{//新增 | |
136 | + matDeliverFollowService.addMatDeliverFollow(matDeliverFollowAddRequest.convertToDataModel()); | |
137 | + } | |
138 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
139 | + baseResponse.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
124 | 140 | return baseResponse; |
125 | 141 | } |
126 | 142 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
View file @
1401dbf
... | ... | @@ -258,6 +258,9 @@ |
258 | 258 | ps.setSynStatus(1); |
259 | 259 | |
260 | 260 | PatientService before = patientServiceService.getPatientService(ps.getId()); |
261 | + //开通人为上一次的数据,因为系统端不能修改,但是小程序可以修改 | |
262 | + ps.setCreateUser(before.getCreateUser()); | |
263 | + | |
261 | 264 | if(before.getSerStatus()==PatientSerEnums.SerStatusEnums.td.getId()){//如果上一次是退订状态,重新开通,开通时间为当前时间 |
262 | 265 | ps.setCreateDate(new Date()); |
263 | 266 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MatDeliverFollowAddRequest.java
View file @
1401dbf
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | */ |
34 | 34 | private String parentid; |
35 | 35 | /** |
36 | - * pid | |
36 | + * 建档pid | |
37 | 37 | */ |
38 | 38 | private String pid; |
39 | 39 | /** |
... | ... | @@ -186,6 +186,14 @@ |
186 | 186 | private String referHospital; |
187 | 187 | |
188 | 188 | /** |
189 | + * 修改时间 | |
190 | + */ | |
191 | + private Date updateDate; | |
192 | + /** | |
193 | + * 修改人 | |
194 | + */ | |
195 | + private String updateUser; | |
196 | + /** | |
189 | 197 | * 具体转换实现 |
190 | 198 | * |
191 | 199 | * @return 转换后的model |
... | ... | @@ -195,6 +203,22 @@ |
195 | 203 | MatdeliverFollowModel matdeliverFollowModel = new MatdeliverFollowModel(); |
196 | 204 | BeanUtils.copyProperties(this,matdeliverFollowModel); |
197 | 205 | return matdeliverFollowModel; |
206 | + } | |
207 | + | |
208 | + public Date getUpdateDate() { | |
209 | + return updateDate; | |
210 | + } | |
211 | + | |
212 | + public void setUpdateDate(Date updateDate) { | |
213 | + this.updateDate = updateDate; | |
214 | + } | |
215 | + | |
216 | + public String getUpdateUser() { | |
217 | + return updateUser; | |
218 | + } | |
219 | + | |
220 | + public void setUpdateUser(String updateUser) { | |
221 | + this.updateUser = updateUser; | |
198 | 222 | } |
199 | 223 | |
200 | 224 | public String getId() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MatDeliverFollowQueryRequest.java
View file @
1401dbf
... | ... | @@ -6,5 +6,72 @@ |
6 | 6 | * @discription |
7 | 7 | */ |
8 | 8 | public class MatDeliverFollowQueryRequest { |
9 | + /** | |
10 | + * 预约联系结果(1-成功、2-失败) | |
11 | + */ | |
12 | + private Integer contactResult; | |
13 | + | |
14 | + /** | |
15 | + * 预约失败理由 1-无人接听电话、2-拒绝访视、3-其他 | |
16 | + */ | |
17 | + private Integer contactReason; | |
18 | + | |
19 | + /** | |
20 | + * 访视结果(1-成功、2-失败) | |
21 | + */ | |
22 | + private Integer visitResult; | |
23 | + | |
24 | + /** | |
25 | + * 访视状态(1-待访视、2-已访视) | |
26 | + */ | |
27 | + private Integer visitStatus; | |
28 | + | |
29 | + /** | |
30 | + * 产妇随访确认 | |
31 | + */ | |
32 | + private Integer visitAffirm; | |
33 | + | |
34 | + | |
35 | + | |
36 | + | |
37 | + public Integer getContactResult() { | |
38 | + return contactResult; | |
39 | + } | |
40 | + | |
41 | + public void setContactResult(Integer contactResult) { | |
42 | + this.contactResult = contactResult; | |
43 | + } | |
44 | + | |
45 | + public Integer getContactReason() { | |
46 | + return contactReason; | |
47 | + } | |
48 | + | |
49 | + public void setContactReason(Integer contactReason) { | |
50 | + this.contactReason = contactReason; | |
51 | + } | |
52 | + | |
53 | + public Integer getVisitResult() { | |
54 | + return visitResult; | |
55 | + } | |
56 | + | |
57 | + public void setVisitResult(Integer visitResult) { | |
58 | + this.visitResult = visitResult; | |
59 | + } | |
60 | + | |
61 | + public Integer getVisitStatus() { | |
62 | + return visitStatus; | |
63 | + } | |
64 | + | |
65 | + public void setVisitStatus(Integer visitStatus) { | |
66 | + this.visitStatus = visitStatus; | |
67 | + } | |
68 | + | |
69 | + public Integer getVisitAffirm() { | |
70 | + return visitAffirm; | |
71 | + } | |
72 | + | |
73 | + public void setVisitAffirm(Integer visitAffirm) { | |
74 | + this.visitAffirm = visitAffirm; | |
75 | + } | |
9 | 76 | } |