Commit 562a3ba1b9a307298bc3f089816952003b4c8419
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 6 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CourseService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientCourseService.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientCourseQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CourseService.java
View file @
562a3ba
... | ... | @@ -39,6 +39,12 @@ |
39 | 39 | return courseDao.queryCourseList(query.addOrder(Sort.Direction.DESC, "modified")); |
40 | 40 | } |
41 | 41 | |
42 | + | |
43 | + public int queryCourseCount(CourseQuery courseQuery) { | |
44 | + return courseDao.queryCourseListCount(courseQuery.convertToQuery()); | |
45 | + } | |
46 | + | |
47 | + | |
42 | 48 | public void addCourse(CourseModel model) { |
43 | 49 | courseDao.addCourse(model); |
44 | 50 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientCourseService.java
View file @
562a3ba
... | ... | @@ -29,6 +29,11 @@ |
29 | 29 | return patientCourseDao.queryPatientCourseList(query.addOrder(Sort.Direction.DESC, "modified")); |
30 | 30 | } |
31 | 31 | |
32 | + public int queryPatientCourseCount(PatientCourseQuery patientCourseQuery) | |
33 | + { | |
34 | + return patientCourseDao.queryPatientCourseListCount(patientCourseQuery.convertToQuery()); | |
35 | + } | |
36 | + | |
32 | 37 | public List<PatientCourseModel> queryPatientCourseList(PatientCourseQuery patientCourseQuery,String sort) |
33 | 38 | { |
34 | 39 | MongoQuery query = patientCourseQuery.convertToQuery(); |
platform-dal/src/main/java/com/lyms/platform/query/PatientCourseQuery.java
View file @
562a3ba
... | ... | @@ -66,6 +66,10 @@ |
66 | 66 | |
67 | 67 | private String queryNo; |
68 | 68 | |
69 | + private Date createdStart; | |
70 | + private Date createdEnd; | |
71 | + | |
72 | + | |
69 | 73 | @Override |
70 | 74 | public MongoQuery convertToQuery() { |
71 | 75 | MongoCondition condition = MongoCondition.newInstance(); |
72 | 76 | |
... | ... | @@ -134,12 +138,45 @@ |
134 | 138 | } |
135 | 139 | |
136 | 140 | |
141 | + if (null != createdStart) { | |
142 | + if (null != c1) { | |
143 | + c1 = c1.and("created").gte(createdStart); | |
144 | + } else { | |
145 | + c1 = Criteria.where("created").gte(createdStart); | |
146 | + } | |
147 | + } | |
148 | + | |
149 | + if (null != createdEnd) { | |
150 | + if (null != c1) { | |
151 | + c1 = c1.lte(createdEnd); | |
152 | + } else { | |
153 | + c1 = Criteria.where("created").lte(createdEnd); | |
154 | + } | |
155 | + } | |
156 | + | |
157 | + | |
137 | 158 | if (null != c1) { |
138 | 159 | condition = condition.andCondition(new MongoCondition(c1)); |
139 | 160 | |
140 | 161 | } |
141 | 162 | |
142 | 163 | return condition.toMongoQuery(); |
164 | + } | |
165 | + | |
166 | + public Date getCreatedStart() { | |
167 | + return createdStart; | |
168 | + } | |
169 | + | |
170 | + public void setCreatedStart(Date createdStart) { | |
171 | + this.createdStart = createdStart; | |
172 | + } | |
173 | + | |
174 | + public Date getCreatedEnd() { | |
175 | + return createdEnd; | |
176 | + } | |
177 | + | |
178 | + public void setCreatedEnd(Date createdEnd) { | |
179 | + this.createdEnd = createdEnd; | |
143 | 180 | } |
144 | 181 | |
145 | 182 | public List<String> getPatientIds() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
View file @
562a3ba
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | |
4 | 4 | import com.lyms.platform.common.annotation.TokenRequired; |
5 | 5 | import com.lyms.platform.common.base.BaseController; |
6 | +import com.lyms.platform.common.base.LoginContext; | |
6 | 7 | import com.lyms.platform.common.result.BaseResponse; |
7 | 8 | import com.lyms.platform.operate.web.facade.CourseFacade; |
8 | 9 | import com.lyms.platform.operate.web.request.CourseRequest; |
... | ... | @@ -157,7 +158,22 @@ |
157 | 158 | @TokenRequired |
158 | 159 | public BaseResponse validateCourseName(HttpServletRequest request, @RequestParam(required = true) String courseName |
159 | 160 | , @RequestParam(required = false) String courseId) { |
160 | - return courseFacade.validateCourseName(courseName,getUserId(request),courseId); | |
161 | + return courseFacade.validateCourseName(courseName, getUserId(request), courseId); | |
162 | + } | |
163 | + | |
164 | + | |
165 | + /** | |
166 | + * 孕妇课程统计 | |
167 | + * @param request | |
168 | + * @param time | |
169 | + * @return | |
170 | + */ | |
171 | + @RequestMapping(method = RequestMethod.GET, value = "/getCourseCount") | |
172 | + @ResponseBody | |
173 | + @TokenRequired | |
174 | + public BaseResponse getCourseCount(HttpServletRequest request, @RequestParam(required = true) String time) { | |
175 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
176 | + return courseFacade.getCourseCount(time,loginState.getId()); | |
161 | 177 | } |
162 | 178 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
562a3ba
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | import com.lyms.platform.common.utils.DateUtil; |
15 | 15 | import com.lyms.platform.operate.web.request.CourseRequest; |
16 | 16 | import com.lyms.platform.operate.web.result.CourseResult; |
17 | +import com.lyms.platform.operate.web.result.CourseTypeResult; | |
17 | 18 | import com.lyms.platform.permission.model.Users; |
18 | 19 | import com.lyms.platform.permission.service.UsersService; |
19 | 20 | import com.lyms.platform.pojo.CourseModel; |
... | ... | @@ -27,9 +28,8 @@ |
27 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
28 | 29 | import org.springframework.stereotype.Component; |
29 | 30 | |
30 | -import java.util.ArrayList; | |
31 | -import java.util.Date; | |
32 | -import java.util.List; | |
31 | +import java.text.DecimalFormat; | |
32 | +import java.util.*; | |
33 | 33 | |
34 | 34 | |
35 | 35 | /** |
... | ... | @@ -344,6 +344,125 @@ |
344 | 344 | } |
345 | 345 | |
346 | 346 | } |
347 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
348 | + objectResponse.setErrormsg("成功"); | |
349 | + return objectResponse; | |
350 | + } | |
351 | + | |
352 | + /** | |
353 | + * 孕妇课程统计 | |
354 | + * @param time | |
355 | + * @param userId | |
356 | + * @return | |
357 | + */ | |
358 | + public BaseResponse getCourseCount(String time, Integer userId) { | |
359 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
360 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
361 | + Map resultData = new HashMap(); | |
362 | + | |
363 | + Map totalData = new HashMap(); | |
364 | + | |
365 | + CourseQuery query = new CourseQuery(); | |
366 | + query.setYn(YnEnums.YES.getId()); | |
367 | + query.setHospitalId(hospitalId); | |
368 | + | |
369 | + int allSends = 0; //TODO | |
370 | + | |
371 | + PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | |
372 | + patientCourseQuery.setYn(YnEnums.YES.getId()); | |
373 | + patientCourseQuery.setHospitalId(hospitalId); | |
374 | + | |
375 | + int allCourses = courseService.queryCourseCount(query); | |
376 | + | |
377 | + int allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
378 | + | |
379 | + //状态 1预约,2签到 | |
380 | + patientCourseQuery.setStatus(1); | |
381 | + | |
382 | + int allOrders = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
383 | + | |
384 | + patientCourseQuery.setStatus(2); | |
385 | + | |
386 | + | |
387 | + int allSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
388 | + | |
389 | + DecimalFormat df = new DecimalFormat("0.00"); | |
390 | + | |
391 | + resultData.put("allCourses",allCourses); //课程数 | |
392 | + resultData.put("allSends",allSends); //总推送数 | |
393 | + resultData.put("allOrders",allOrders); //总预约数 | |
394 | + resultData.put("allOrderRate",allCourses == 0 ? 0 : df.format((double) allOrders / allPatientCourses * 100) + "%"); //总预约率 | |
395 | + resultData.put("allSigns",allSigns);//总签到数 | |
396 | + resultData.put("allSignRate",allCourses == 0 ? 0 : df.format((double) allSigns / allPatientCourses * 100) + "%");//总签到率 | |
397 | + | |
398 | + CourseTypeQuery courseTypeQuery = new CourseTypeQuery(); | |
399 | + courseTypeQuery.setHospitalId(hospitalId); | |
400 | + courseTypeQuery.setYn(YnEnums.YES.getId()); | |
401 | + | |
402 | + if (StringUtils.isNotEmpty(time)) { | |
403 | + String[] dates = time.split(" - "); | |
404 | + patientCourseQuery.setCreatedStart(DateUtil.parseYMD(dates[0])); | |
405 | + if (dates.length == 2) { | |
406 | + patientCourseQuery.setCreatedEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
407 | + } | |
408 | + } | |
409 | + | |
410 | + allPatientCourses = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
411 | + | |
412 | + List<Map> tableData = new ArrayList<>(); | |
413 | + | |
414 | + Map chartData = new HashMap(); | |
415 | + List<CourseModel> courseModelList = courseService.queryCourseList(query); | |
416 | + if (CollectionUtils.isNotEmpty(courseModelList)) | |
417 | + { | |
418 | + List titles = new ArrayList(); | |
419 | + List sends = new ArrayList(); | |
420 | + List orders = new ArrayList(); | |
421 | + List signs = new ArrayList(); | |
422 | + for (CourseModel courseModel : courseModelList) | |
423 | + { | |
424 | + patientCourseQuery.setCourseId(courseModel.getId()); | |
425 | + titles.add(courseModel.getCourseName()); | |
426 | + | |
427 | + patientCourseQuery.setStatus(1); | |
428 | + int courseOrders = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
429 | + orders.add(courseOrders); | |
430 | + | |
431 | + patientCourseQuery.setStatus(2); | |
432 | + int courseSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); | |
433 | + signs.add(courseSigns); | |
434 | + | |
435 | + int courseSends = 0; //TODO | |
436 | + sends.add(courseSends); | |
437 | + | |
438 | + courseTypeQuery.setId(courseModel.getCourseTypeId()); | |
439 | + List<CourseTypeModel> typeModels = courseTypeService.queryCourseTypeList(courseTypeQuery); | |
440 | + | |
441 | + Map tableMap = new HashMap(); | |
442 | + | |
443 | + tableMap.put("courseTypeId",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getId() : ""); | |
444 | + tableMap.put("courseTypeName",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getCourseTypeName() : ""); | |
445 | + tableMap.put("courseName",courseModel.getCourseName()); | |
446 | + | |
447 | + tableMap.put("sends",0);//TODO | |
448 | + tableMap.put("orders",courseOrders); | |
449 | + tableMap.put("ordersRate",allCourses == 0 ? "0" : df.format((double) courseOrders / allPatientCourses * 100) + "%"); | |
450 | + tableMap.put("signs",courseSigns); | |
451 | + tableMap.put("signsRate",allCourses == 0 ? "0" : df.format((double) courseSigns / allPatientCourses * 100) + "%"); | |
452 | + tableData.add(tableMap); | |
453 | + } | |
454 | + | |
455 | + chartData.put("titles",titles); | |
456 | + chartData.put("sends",sends); | |
457 | + chartData.put("orders",orders); | |
458 | + chartData.put("signs",signs); | |
459 | + } | |
460 | + | |
461 | + resultData.put("totalData",totalData); | |
462 | + resultData.put("chartData",chartData); | |
463 | + resultData.put("tableData",tableData); | |
464 | + | |
465 | + objectResponse.setData(resultData); | |
347 | 466 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
348 | 467 | objectResponse.setErrormsg("成功"); |
349 | 468 | return objectResponse; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
562a3ba
... | ... | @@ -222,6 +222,7 @@ |
222 | 222 | Date fmDate = DateUtil.parseYMD(deliverAddRequest.getDueDate()); |
223 | 223 | |
224 | 224 | Patients patientsLocal = new Patients(); |
225 | + patientsLocal.setModified(new Date()); | |
225 | 226 | patientsLocal.setId(deliverAddRequest.getParentId()); |
226 | 227 | patientsLocal.setFmDate(fmDate); |
227 | 228 | // HuJiaqi添加开始,这里冗余了分娩分娩医院,分娩年龄,分娩孕周,分娩方式,并将状态更改为产妇 |
... | ... | @@ -352,6 +353,7 @@ |
352 | 353 | Patients patients = patientsService.findOnePatientById(deliverAddRequest.getParentId()); |
353 | 354 | |
354 | 355 | Patients patients1 = new Patients(); |
356 | + patients1.setModified(new Date()); | |
355 | 357 | patients1.setId(deliverAddRequest.getParentId()); |
356 | 358 | patients1.setFmDate(fmDate); |
357 | 359 | // HuJiaqi添加开始,这里冗余了分娩分娩医院,分娩年龄,分娩孕周,分娩方式,并将状态更改为产妇 |
... | ... | @@ -458,6 +460,7 @@ |
458 | 460 | patients.setBuildType(0); |
459 | 461 | } |
460 | 462 | patients.setType(3); |
463 | + patients.setModified(new Date()); | |
461 | 464 | patientsService.updatePatient(patients); |
462 | 465 | } |
463 | 466 | } |