Commit 53a834a61f4218a8903c43be9e54a87d3f761636

Authored by liquanyu
1 parent 4788c911de

孕妇课程调查

Showing 11 changed files with 143 additions and 364 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CourseEvalService.java View file @ 53a834a
... ... @@ -30,7 +30,7 @@
30 30 courseEvalQuery.mysqlBuild(courseEvalDao.queryCourseEvalListCount(courseEvalQuery.convertToQuery()));
31 31 query.start(courseEvalQuery.getOffset()).end(courseEvalQuery.getLimit());
32 32 }
33   - return courseEvalDao.queryCourseEvalList(query.addOrder(Sort.Direction.DESC, "modified"));
  33 + return courseEvalDao.queryCourseEvalList(query.addOrder(Sort.Direction.DESC, "created"));
34 34 }
35 35  
36 36  
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterUsersMapper.java View file @ 53a834a
... ... @@ -25,5 +25,7 @@
25 25  
26 26  
27 27 void addUserScore(UserScore userScore);
  28 +
  29 + Integer findUserAvgScore(Integer userId);
28 30 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/UsersService.java View file @ 53a834a
... ... @@ -24,5 +24,7 @@
24 24 public Users getUsersByLoginCenterId(Integer id);
25 25  
26 26 void addUserScore(UserScore userScore);
  27 +
  28 + Integer findUserAvgScore(Integer i);
27 29 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/UsersServiceImpl.java View file @ 53a834a
... ... @@ -107,5 +107,10 @@
107 107 public void addUserScore(UserScore userScore) {
108 108 usersMapper.addUserScore(userScore);
109 109 }
  110 +
  111 + @Override
  112 + public Integer findUserAvgScore(Integer userId) {
  113 + return usersMapper.findUserAvgScore(userId);
  114 + }
110 115 }
platform-biz-service/src/main/resources/mainOrm/master/MasterUsers.xml View file @ 53a834a
... ... @@ -327,7 +327,10 @@
327 327 (#{userId},#{courseId},#{patientCourseId},#{score},#{created})
328 328 </insert>
329 329  
330   -
  330 + <select id="findUserAvgScore" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  331 + SELECT avg(score) as score from lyms_user_score
  332 + WHERE user_id=#{userId}
  333 + </select>
331 334  
332 335 </mapper>
platform-dal/src/main/java/com/lyms/platform/query/CourseEvalQuery.java View file @ 53a834a
... ... @@ -9,6 +9,7 @@
9 9  
10 10 import java.util.Date;
11 11 import java.util.List;
  12 +import java.util.Map;
12 13  
13 14 /**
14 15 * 孕妇课程评分查询
15 16  
16 17  
17 18  
18 19  
19 20  
20 21  
21 22  
22 23  
23 24  
24 25  
25 26  
26 27  
27 28  
28 29  
29 30  
... ... @@ -16,251 +17,51 @@
16 17 public class CourseEvalQuery extends BaseQuery implements IConvertToNativeQuery {
17 18  
18 19 private String id;
  20 + //课程id
  21 + private String courseId;
19 22  
20   - //课程名称
21   - private String courseName;
22 23  
23   - //课程主讲
24   - private String courseSpeaker;
  24 + //孕妇id
  25 + private String patientId;
  26 + //医院id
  27 + private String hospitalId;
25 28  
26   - //课程地址
27   - private String courseAddress;
28 29  
29   - //课程时间
30   - private Date courseTimeStart;
  30 + //孕妇预约课程id
  31 + private String patientCourseId;
31 32  
32   - private Date courseTimeEnd;
33   -
34   - //课程发布时间
35   - private Date publishTimeStart;
36   -
37   - private Date publishTimeEnd;
38   -
39   - //时长
40   - private String timeLong;
41   -
42   - //上线人数
43   - private Integer limitNum;
44   -
45   - //报名人数
46   - private Integer enrolmentNum;
47   -
48   - //签到人数
49   - private Integer signNum;
50   -
51   - //状态 1待发布,2 已发布,3已结束
52   - private Integer status;
53   -
54   - //课程描述
55   - private String courseDesc;
56   - //课程备注
57   - private String courseRemark;
58   -
59   - //课程类别id
60   - private String courseTypeId;
61   -
62   - //创建人id
63   - private String createUserId;
64   -
65   - //发布人id
66   - private String publishUserId;
67   -
68   - private Date createdStart;
69   - private Date createdEnd;
70   -
71   - private Date modifiedStart;
72   - private Date modifiedEnd;
73   -
74 33 private Integer yn;
75 34  
76   - private String hospitalId;
77   - private List<String> hospitalIds;
78 35  
79   - private Date courseEndTime;
80   - private String keyword;
81   -
82   - private boolean isSend;
83   -
84 36 @Override
85 37 public MongoQuery convertToQuery() {
86 38 MongoCondition condition = MongoCondition.newInstance();
87 39 if (null != id) {
88 40 condition = condition.and("id", id, MongoOper.IS);
89 41 }
90   -
91 42 if (null != yn) {
92 43 condition = condition.and("yn", yn, MongoOper.IS);
93 44 }
94   -
95   - if (null != courseName) {
96   - condition = condition.and("courseName", courseName, MongoOper.IS);
  45 + if (null != patientId) {
  46 + condition = condition.and("patientId", patientId, MongoOper.IS);
97 47 }
98   -
99   -
100   - if (null != courseTypeId) {
101   - condition = condition.and("courseTypeId", courseTypeId, MongoOper.IS);
102   - }
103   -
104   -
105   - if (null != courseSpeaker) {
106   - condition = condition.and("courseSpeaker", courseSpeaker, MongoOper.IS);
107   - }
108   -
109   -
110 48 if (null != hospitalId) {
111 49 condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
112 50 }
113   -
114   -
115   - if (null != createUserId) {
116   - condition = condition.and("createUserId", createUserId, MongoOper.IS);
  51 + if (null != courseId) {
  52 + condition = condition.and("courseId", courseId, MongoOper.IS);
117 53 }
118   -
119   - if (null != status) {
120   - condition = condition.and("status", status, MongoOper.IS);
  54 + if (null != patientCourseId) {
  55 + condition = condition.and("patientCourseId", patientCourseId, MongoOper.IS);
121 56 }
122   -
123   - if (isSend) {
124   - condition = condition.and("isSend", false, MongoOper.EXISTS);
125   - }
126   -
127   - if (null != courseEndTime) {
128   - condition = condition.and("courseEndTime", courseEndTime, MongoOper.LTE);
129   - }
130   -
131   - if (null != keyword)
132   - {
133   - MongoCondition con1 = MongoCondition.newInstance("courseSpeaker", keyword, MongoOper.LIKE);
134   - MongoCondition con = MongoCondition.newInstance("courseName", keyword, MongoOper.LIKE);
135   - condition = condition.orCondition(new MongoCondition[]{con1, con});
136   - }
137   -
138   - if (null != hospitalIds && hospitalIds.size() > 0) {
139   - condition = condition.and("hospitalId", hospitalIds, MongoOper.IN);
140   - }
141   -
142   -
143   -// if (null != keyword && null != hospitalIds && hospitalIds.size() > 0) {
144   -// MongoCondition con1 = MongoCondition.newInstance("courseSpeaker", keyword, MongoOper.LIKE);
145   -// MongoCondition con = MongoCondition.newInstance("courseName", keyword, MongoOper.LIKE);
146   -// MongoCondition condition2 = MongoCondition.newInstance("hospitalId", hospitalIds, MongoOper.IN);
147   -// condition = condition.orCondition(new MongoCondition[]{con1, con,condition2});
148   -// }
149   -// else if (null != keyword)
150   -// {
151   -// MongoCondition con1 = MongoCondition.newInstance("courseSpeaker", keyword, MongoOper.LIKE);
152   -// MongoCondition con = MongoCondition.newInstance("courseName", keyword, MongoOper.LIKE);
153   -// condition = condition.orCondition(new MongoCondition[]{con1, con});
154   -// }
155   -// else if (null != hospitalIds && hospitalIds.size() > 0) {
156   -// condition = condition.and("hospitalId", hospitalIds, MongoOper.IN);
157   -// }
158   -
159 57 Criteria c1 = null;
160 58  
161   - if (null != courseTimeStart) {
162   - if (null != c1) {
163   - c1 = c1.and("courseTime").gte(courseTimeStart);
164   - } else {
165   - c1 = Criteria.where("courseTime").gte(courseTimeStart);
166   - }
167   - }
168   -
169   - if (null != courseTimeEnd) {
170   - if (null != c1) {
171   - c1 = c1.lte(courseTimeEnd);
172   - } else {
173   - c1 = Criteria.where("courseTime").lte(courseTimeEnd);
174   - }
175   - }
176   -
177   -
178   - if (null != publishTimeStart) {
179   - if (null != c1) {
180   - c1 = c1.and("publishTime").gte(publishTimeStart);
181   - } else {
182   - c1 = Criteria.where("publishTime").gte(publishTimeStart);
183   - }
184   - }
185   -
186   - if (null != publishTimeEnd) {
187   - if (null != c1) {
188   - c1 = c1.lte(publishTimeEnd);
189   - } else {
190   - c1 = Criteria.where("publishTime").lte(publishTimeEnd);
191   - }
192   - }
193   -
194   - if (null != createdStart) {
195   - if (null != c1) {
196   - c1 = c1.and("created").gte(createdStart);
197   - } else {
198   - c1 = Criteria.where("created").gte(createdStart);
199   - }
200   - }
201   -
202   - if (null != createdEnd) {
203   - if (null != c1) {
204   - c1 = c1.lte(createdEnd);
205   - } else {
206   - c1 = Criteria.where("created").lte(createdEnd);
207   - }
208   - }
209   -
210 59 if (null != c1) {
211 60 condition = condition.andCondition(new MongoCondition(c1));
212 61 }
213 62 return condition.toMongoQuery();
214 63 }
215 64  
216   - public Date getPublishTimeStart() {
217   - return publishTimeStart;
218   - }
219   -
220   - public void setPublishTimeStart(Date publishTimeStart) {
221   - this.publishTimeStart = publishTimeStart;
222   - }
223   -
224   - public Date getPublishTimeEnd() {
225   - return publishTimeEnd;
226   - }
227   -
228   - public void setPublishTimeEnd(Date publishTimeEnd) {
229   - this.publishTimeEnd = publishTimeEnd;
230   - }
231   -
232   - public boolean isSend() {
233   - return isSend;
234   - }
235   -
236   - public void setIsSend(boolean isSend) {
237   - this.isSend = isSend;
238   - }
239   -
240   - public String getKeyword() {
241   - return keyword;
242   - }
243   -
244   - public void setKeyword(String keyword) {
245   - this.keyword = keyword;
246   - }
247   -
248   - public List<String> getHospitalIds() {
249   - return hospitalIds;
250   - }
251   -
252   - public void setHospitalIds(List<String> hospitalIds) {
253   - this.hospitalIds = hospitalIds;
254   - }
255   -
256   - public Date getCourseEndTime() {
257   - return courseEndTime;
258   - }
259   -
260   - public void setCourseEndTime(Date courseEndTime) {
261   - this.courseEndTime = courseEndTime;
262   - }
263   -
264 65 public String getId() {
265 66 return id;
266 67 }
267 68  
268 69  
269 70  
270 71  
271 72  
272 73  
273 74  
274 75  
275 76  
... ... @@ -269,172 +70,44 @@
269 70 this.id = id;
270 71 }
271 72  
272   - public String getCourseName() {
273   - return courseName;
  73 + public String getCourseId() {
  74 + return courseId;
274 75 }
275 76  
276   - public void setCourseName(String courseName) {
277   - this.courseName = courseName;
  77 + public void setCourseId(String courseId) {
  78 + this.courseId = courseId;
278 79 }
279 80  
280   - public String getCourseSpeaker() {
281   - return courseSpeaker;
  81 + public String getPatientId() {
  82 + return patientId;
282 83 }
283 84  
284   - public void setCourseSpeaker(String courseSpeaker) {
285   - this.courseSpeaker = courseSpeaker;
  85 + public void setPatientId(String patientId) {
  86 + this.patientId = patientId;
286 87 }
287 88  
288   - public String getCourseAddress() {
289   - return courseAddress;
  89 + public String getHospitalId() {
  90 + return hospitalId;
290 91 }
291 92  
292   - public void setCourseAddress(String courseAddress) {
293   - this.courseAddress = courseAddress;
  93 + public void setHospitalId(String hospitalId) {
  94 + this.hospitalId = hospitalId;
294 95 }
295 96  
296   - public Date getCourseTimeStart() {
297   - return courseTimeStart;
  97 + public String getPatientCourseId() {
  98 + return patientCourseId;
298 99 }
299 100  
300   - public void setCourseTimeStart(Date courseTimeStart) {
301   - this.courseTimeStart = courseTimeStart;
  101 + public void setPatientCourseId(String patientCourseId) {
  102 + this.patientCourseId = patientCourseId;
302 103 }
303 104  
304   - public Date getCourseTimeEnd() {
305   - return courseTimeEnd;
306   - }
307   -
308   - public void setCourseTimeEnd(Date courseTimeEnd) {
309   - this.courseTimeEnd = courseTimeEnd;
310   - }
311   -
312   - public String getTimeLong() {
313   - return timeLong;
314   - }
315   -
316   - public void setTimeLong(String timeLong) {
317   - this.timeLong = timeLong;
318   - }
319   -
320   - public Integer getLimitNum() {
321   - return limitNum;
322   - }
323   -
324   - public void setLimitNum(Integer limitNum) {
325   - this.limitNum = limitNum;
326   - }
327   -
328   - public Integer getEnrolmentNum() {
329   - return enrolmentNum;
330   - }
331   -
332   - public void setEnrolmentNum(Integer enrolmentNum) {
333   - this.enrolmentNum = enrolmentNum;
334   - }
335   -
336   - public Integer getSignNum() {
337   - return signNum;
338   - }
339   -
340   - public void setSignNum(Integer signNum) {
341   - this.signNum = signNum;
342   - }
343   -
344   - public Integer getStatus() {
345   - return status;
346   - }
347   -
348   - public void setStatus(Integer status) {
349   - this.status = status;
350   - }
351   -
352   - public String getCourseDesc() {
353   - return courseDesc;
354   - }
355   -
356   - public void setCourseDesc(String courseDesc) {
357   - this.courseDesc = courseDesc;
358   - }
359   -
360   - public String getCourseRemark() {
361   - return courseRemark;
362   - }
363   -
364   - public void setCourseRemark(String courseRemark) {
365   - this.courseRemark = courseRemark;
366   - }
367   -
368   - public String getCourseTypeId() {
369   - return courseTypeId;
370   - }
371   -
372   - public void setCourseTypeId(String courseTypeId) {
373   - this.courseTypeId = courseTypeId;
374   - }
375   -
376   - public String getCreateUserId() {
377   - return createUserId;
378   - }
379   -
380   - public void setCreateUserId(String createUserId) {
381   - this.createUserId = createUserId;
382   - }
383   -
384   - public String getPublishUserId() {
385   - return publishUserId;
386   - }
387   -
388   - public void setPublishUserId(String publishUserId) {
389   - this.publishUserId = publishUserId;
390   - }
391   -
392   - public Date getCreatedStart() {
393   - return createdStart;
394   - }
395   -
396   - public void setCreatedStart(Date createdStart) {
397   - this.createdStart = createdStart;
398   - }
399   -
400   - public Date getCreatedEnd() {
401   - return createdEnd;
402   - }
403   -
404   - public void setCreatedEnd(Date createdEnd) {
405   - this.createdEnd = createdEnd;
406   - }
407   -
408   - public Date getModifiedStart() {
409   - return modifiedStart;
410   - }
411   -
412   - public void setModifiedStart(Date modifiedStart) {
413   - this.modifiedStart = modifiedStart;
414   - }
415   -
416   - public Date getModifiedEnd() {
417   - return modifiedEnd;
418   - }
419   -
420   - public void setModifiedEnd(Date modifiedEnd) {
421   - this.modifiedEnd = modifiedEnd;
422   - }
423   -
424 105 public Integer getYn() {
425 106 return yn;
426 107 }
427 108  
428 109 public void setYn(Integer yn) {
429 110 this.yn = yn;
430   - }
431   -
432   - public String getHospitalId() {
433   - return hospitalId;
434   - }
435   -
436   - public void setHospitalId(String hospitalId) {
437   - this.hospitalId = hospitalId;
438 111 }
439 112 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java View file @ 53a834a
... ... @@ -206,5 +206,23 @@
206 206  
207 207 return courseFacade.addCoureseEval(model);
208 208 }
  209 +
  210 +
  211 + /**
  212 + * 院内系统查询课程评价列表
  213 + * @param courseId
  214 + * @param request
  215 + * @return
  216 + */
  217 + @RequestMapping(method = RequestMethod.GET, value = "/queryCourseEvalList")
  218 + @ResponseBody
  219 + public BaseResponse queryCourseEvalList(@RequestParam String courseId,
  220 + @RequestParam Integer page,
  221 + @RequestParam Integer limit,
  222 + HttpServletRequest request) {
  223 +
  224 + return courseFacade.queryCourseEvalList(courseId, page, limit);
  225 + }
  226 +
209 227 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java View file @ 53a834a
... ... @@ -2,10 +2,7 @@
2 2  
3 3  
4 4 import com.lyms.platform.beans.MsgRequest;
5   -import com.lyms.platform.biz.service.CourseEvalService;
6   -import com.lyms.platform.biz.service.CourseService;
7   -import com.lyms.platform.biz.service.CourseTypeService;
8   -import com.lyms.platform.biz.service.PatientCourseService;
  5 +import com.lyms.platform.biz.service.*;
9 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
10 7 import com.lyms.platform.common.enums.*;
11 8 import com.lyms.platform.common.result.BaseListResponse;
12 9  
... ... @@ -19,10 +16,12 @@
19 16 import com.lyms.platform.operate.web.utils.BabyListTask;
20 17 import com.lyms.platform.operate.web.utils.MessageCenterService;
21 18 import com.lyms.platform.operate.web.worker.CourseCountWorker;
  19 +import com.lyms.platform.permission.model.PatientService;
22 20 import com.lyms.platform.permission.model.UserScore;
23 21 import com.lyms.platform.permission.model.Users;
24 22 import com.lyms.platform.permission.service.UsersService;
25 23 import com.lyms.platform.pojo.*;
  24 +import com.lyms.platform.query.CourseEvalQuery;
26 25 import com.lyms.platform.query.CourseQuery;
27 26 import com.lyms.platform.query.CourseTypeQuery;
28 27 import com.lyms.platform.query.PatientCourseQuery;
... ... @@ -71,6 +70,9 @@
71 70 private CourseEvalService courseEvalService;
72 71  
73 72 @Autowired
  73 + private PatientsService patientsService;
  74 +
  75 + @Autowired
74 76 @Qualifier("commonThreadPool")
75 77 private ThreadPoolTaskExecutor commonThreadPool;
76 78  
77 79  
... ... @@ -186,10 +188,19 @@
186 188 if (CollectionUtils.isNotEmpty(typeModels))
187 189 {
188 190 courseType = typeModels.get(0).getCourseTypeName();
  191 + result.setCourseTypeAvg(typeModels.get(0).getAvg());
189 192 }
190 193 result.setCourseType(courseType);
191 194 result.setCourseTypeId(model.getCourseTypeId());
192 195  
  196 + Integer docAvg = null;
  197 + if (model.getCourseSpeaker() != null && StringUtils.isNumeric(model.getCourseSpeaker()))
  198 + {
  199 + docAvg = usersService.findUserAvgScore(Integer.parseInt(model.getCourseSpeaker()));
  200 + }
  201 +
  202 + result.setCourseDocAvg(docAvg);
  203 +
193 204 result.setCourseName(model.getCourseName());
194 205 String courseSpeakerName = model.getCourseSpeaker();
195 206 if (model.getCourseSpeaker() != null && StringUtils.isNumeric(model.getCourseSpeaker()))
... ... @@ -725,6 +736,42 @@
725 736 courseTypeModel.setAvg(courseTypeModel.getScore() == 0 ? null : courseTypeModel.getNumbers() / courseTypeModel.getScore());
726 737 courseTypeService.updateCourseType(courseTypeModel);
727 738 }
  739 + }
  740 +
  741 + public BaseResponse queryCourseEvalList(String courseId,Integer page,Integer limit) {
  742 +
  743 + CourseEvalQuery courseEvalQuery = new CourseEvalQuery();
  744 + courseEvalQuery.setYn(YnEnums.YES.getId());
  745 + courseEvalQuery.setCourseId(courseId);
  746 + courseEvalQuery.setNeed("true");
  747 + courseEvalQuery.setLimit(limit);
  748 + courseEvalQuery.setPage(page);
  749 + BaseListResponse objectResponse = new BaseListResponse();
  750 + List<Map> resultData = new ArrayList<>();
  751 + List<CourseEvaluateModel> courseEvaluateModels = courseEvalService.queryCourseEvalList(courseEvalQuery);
  752 + if (CollectionUtils.isNotEmpty(courseEvaluateModels))
  753 + {
  754 + for (CourseEvaluateModel eval : courseEvaluateModels)
  755 + {
  756 + Map map = new HashMap();
  757 + map.put("id",eval.getId());
  758 + map.put("courseScore",eval.getCourseTypeSocre());
  759 + map.put("docScore",eval.getCourseDocSocre());
  760 + map.put("evalDate",DateUtil.getyyyy_MM_dd_hms(eval.getEvaluateDate()));
  761 + String name = "";
  762 + Patients pat = patientsService.findOnePatientById(eval.getPatientId());
  763 + if (pat != null)
  764 + {
  765 + name = pat.getUsername();
  766 + }
  767 + map.put("name", name);
  768 + }
  769 + }
  770 + objectResponse.setData(resultData);
  771 + objectResponse.setPageInfo(courseEvalQuery.getPageInfo());
  772 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  773 + objectResponse.setErrormsg("成功");
  774 + return objectResponse;
728 775 }
729 776 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseTypeFacade.java View file @ 53a834a
... ... @@ -110,6 +110,7 @@
110 110 createUser = users.getName();
111 111 }
112 112 result.setCreateUser(createUser);
  113 + result.setAvg(model.getAvg());
113 114 results.add(result);
114 115 }
115 116 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CourseResult.java View file @ 53a834a
... ... @@ -53,6 +53,25 @@
53 53  
54 54 private Integer courseObjId;
55 55  
  56 + private Integer courseTypeAvg;
  57 + private Integer courseDocAvg;
  58 +
  59 + public Integer getCourseTypeAvg() {
  60 + return courseTypeAvg;
  61 + }
  62 +
  63 + public void setCourseTypeAvg(Integer courseTypeAvg) {
  64 + this.courseTypeAvg = courseTypeAvg;
  65 + }
  66 +
  67 + public Integer getCourseDocAvg() {
  68 + return courseDocAvg;
  69 + }
  70 +
  71 + public void setCourseDocAvg(Integer courseDocAvg) {
  72 + this.courseDocAvg = courseDocAvg;
  73 + }
  74 +
56 75 public Integer getCourseObjId() {
57 76 return courseObjId;
58 77 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CourseTypeResult.java View file @ 53a834a
... ... @@ -19,6 +19,15 @@
19 19 private String createUser;
20 20  
21 21 private String created;
  22 + private Integer avg;
  23 +
  24 + public Integer getAvg() {
  25 + return avg;
  26 + }
  27 +
  28 + public void setAvg(Integer avg) {
  29 + this.avg = avg;
  30 + }
22 31  
23 32 public String getId() {
24 33 return id;