Commit 9537eaa5439ce843293c5a410dc7a3737ebdb863
1 parent
b65cf797f2
Exists in
master
and in
6 other branches
孕妇学校
Showing 8 changed files with 217 additions and 81 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
- platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/controller/MsgGenerateController.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/ChanAmsMsgGenerateWorker.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/CourseMsgGenerateWorker.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
View file @
9537eaa
| ... | ... | @@ -75,6 +75,18 @@ | 
| 75 | 75 | //是否发送过推送 字段不存在表示未推送,1已推送 | 
| 76 | 76 | private Integer isSend; | 
| 77 | 77 | |
| 78 | + //发布时间 | |
| 79 | + private Date publishTime; | |
| 80 | + | |
| 81 | + | |
| 82 | + public Date getPublishTime() { | |
| 83 | + return publishTime; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setPublishTime(Date publishTime) { | |
| 87 | + this.publishTime = publishTime; | |
| 88 | + } | |
| 89 | + | |
| 78 | 90 | public Integer getIsSend() { | 
| 79 | 91 | return isSend; | 
| 80 | 92 | } | 
platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
View file @
9537eaa
| ... | ... | @@ -32,6 +32,11 @@ | 
| 32 | 32 | |
| 33 | 33 | private Date courseTimeEnd; | 
| 34 | 34 | |
| 35 | + //课程发布时间 | |
| 36 | + private Date publishTimeStart; | |
| 37 | + | |
| 38 | + private Date publishTimeEnd; | |
| 39 | + | |
| 35 | 40 | //时长 | 
| 36 | 41 | private String timeLong; | 
| 37 | 42 | |
| 38 | 43 | |
| ... | ... | @@ -171,7 +176,22 @@ | 
| 171 | 176 | } | 
| 172 | 177 | |
| 173 | 178 | |
| 179 | + if (null != publishTimeStart) { | |
| 180 | + if (null != c1) { | |
| 181 | + c1 = c1.and("publishTime").gte(publishTimeStart); | |
| 182 | + } else { | |
| 183 | + c1 = Criteria.where("publishTime").gte(publishTimeStart); | |
| 184 | + } | |
| 185 | + } | |
| 174 | 186 | |
| 187 | + if (null != publishTimeEnd) { | |
| 188 | + if (null != c1) { | |
| 189 | + c1 = c1.lte(publishTimeEnd); | |
| 190 | + } else { | |
| 191 | + c1 = Criteria.where("publishTime").lte(publishTimeEnd); | |
| 192 | + } | |
| 193 | + } | |
| 194 | + | |
| 175 | 195 | if (null != createdStart) { | 
| 176 | 196 | if (null != c1) { | 
| 177 | 197 | c1 = c1.and("created").gte(createdStart); | 
| ... | ... | @@ -192,6 +212,22 @@ | 
| 192 | 212 | condition = condition.andCondition(new MongoCondition(c1)); | 
| 193 | 213 | } | 
| 194 | 214 | return condition.toMongoQuery(); | 
| 215 | + } | |
| 216 | + | |
| 217 | + public Date getPublishTimeStart() { | |
| 218 | + return publishTimeStart; | |
| 219 | + } | |
| 220 | + | |
| 221 | + public void setPublishTimeStart(Date publishTimeStart) { | |
| 222 | + this.publishTimeStart = publishTimeStart; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public Date getPublishTimeEnd() { | |
| 226 | + return publishTimeEnd; | |
| 227 | + } | |
| 228 | + | |
| 229 | + public void setPublishTimeEnd(Date publishTimeEnd) { | |
| 230 | + this.publishTimeEnd = publishTimeEnd; | |
| 195 | 231 | } | 
| 196 | 232 | |
| 197 | 233 | public boolean isSend() { | 
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
9537eaa
| ... | ... | @@ -1325,6 +1325,14 @@ | 
| 1325 | 1325 | c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd); | 
| 1326 | 1326 | } | 
| 1327 | 1327 | } | 
| 1328 | + else if (fmDateStart != null) | |
| 1329 | + { | |
| 1330 | + if (null != c1) { | |
| 1331 | + c1 = c1.and("fmDate").gte(fmDateStart); | |
| 1332 | + } else { | |
| 1333 | + c1 = Criteria.where("fmDate").gte(fmDateStart); | |
| 1334 | + } | |
| 1335 | + } | |
| 1328 | 1336 | |
| 1329 | 1337 | if (null != serviceType) { | 
| 1330 | 1338 | condition = condition.and("serviceType", serviceType, MongoOper.IS); | 
platform-msg-generate/src/main/java/com/lyms/platform/msg/controller/MsgGenerateController.java
View file @
9537eaa
| ... | ... | @@ -87,6 +87,22 @@ | 
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | /** | 
| 90 | + * 孕妇课程 | |
| 91 | + * @param hospitalId | |
| 92 | + * @return | |
| 93 | + */ | |
| 94 | + @RequestMapping(method = RequestMethod.GET, value = "/generateCourseMsg") | |
| 95 | + @ResponseBody | |
| 96 | + public String generateCourseMsg(@RequestParam(required = false) String hospitalId) | |
| 97 | + { | |
| 98 | + | |
| 99 | + logger.info("The request hospital id is {} ", hospitalId); | |
| 100 | + msgGenerateService.generateCourseMsg(hospitalId); | |
| 101 | + return ""; | |
| 102 | + } | |
| 103 | + | |
| 104 | + | |
| 105 | + /** | |
| 90 | 106 | * 生成所有 | 
| 91 | 107 | * @return | 
| 92 | 108 | */ | 
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
View file @
9537eaa
| ... | ... | @@ -198,8 +198,8 @@ | 
| 198 | 198 | query.setStatus(CourseStatusEnums.YFB.getId()); | 
| 199 | 199 | query.setIsSend(false); | 
| 200 | 200 | String currentDate = DateUtil.getyyyy_MM_dd(new Date()); | 
| 201 | - query.setCreatedStart(DateUtil.parseYMD(currentDate)); | |
| 202 | - query.setCreatedEnd(DateUtil.parseYMDHMS(currentDate + " 23:59:59")); | |
| 201 | + query.setPublishTimeStart(DateUtil.parseYMD(currentDate)); | |
| 202 | + query.setPublishTimeEnd(DateUtil.parseYMDHMS(currentDate + " 23:59:59")); | |
| 203 | 203 | |
| 204 | 204 | if (StringUtils.isNotEmpty(generateHospitalId)) | 
| 205 | 205 | { | 
| ... | ... | @@ -220,8 +220,7 @@ | 
| 220 | 220 | CourseMsgGenerateWorker worker = new CourseMsgGenerateWorker(courseModels.subList(i,end), | 
| 221 | 221 | baseService, | 
| 222 | 222 | yunBookbuildingService, | 
| 223 | - smsTemplateService, | |
| 224 | - babyBookbuildingService | |
| 223 | + courseService | |
| 225 | 224 | ); | 
| 226 | 225 | pool.execute(worker); | 
| 227 | 226 | } | 
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/ChanAmsMsgGenerateWorker.java
View file @
9537eaa
| ... | ... | @@ -98,9 +98,7 @@ | 
| 98 | 98 | buildType.add(2); | 
| 99 | 99 | patientsQuery.setSmsBuildTypeList(buildType); | 
| 100 | 100 | |
| 101 | -// //末次月经必须大于当前时间减去42周视为为分娩孕妇 | |
| 102 | -// Date lastMensesMax = DateUtil.addDay(new Date(), -42); | |
| 103 | -// patientsQuery.setLastMensesStart(lastMensesMax); | |
| 101 | + | |
| 104 | 102 | //健康指导短信 只能是类型为 增值服务 开通状态 才发送 | 
| 105 | 103 | patientsQuery.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | 
| 106 | 104 | patientsQuery.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | 
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/CourseMsgGenerateWorker.java
View file @
9537eaa
| ... | ... | @@ -45,21 +45,16 @@ | 
| 45 | 45 | |
| 46 | 46 | private YunBookbuildingService yunBookbuildingService; | 
| 47 | 47 | |
| 48 | + private CourseService courseService; | |
| 48 | 49 | |
| 49 | - private SmsTemplateService smsTemplateService; | |
| 50 | 50 | |
| 51 | - private BabyBookbuildingService babyBookbuildingService; | |
| 52 | - | |
| 53 | 51 | public CourseMsgGenerateWorker( List<CourseModel> courseModels, IBaseService baseService, | 
| 54 | - YunBookbuildingService yunBookbuildingService, | |
| 55 | - SmsTemplateService smsTemplateService, | |
| 56 | - BabyBookbuildingService babyBookbuildingService) | |
| 52 | + YunBookbuildingService yunBookbuildingService,CourseService courseService) | |
| 57 | 53 | { | 
| 58 | 54 | this.courseModels = courseModels; | 
| 59 | 55 | this.baseService = baseService; | 
| 60 | 56 | this.yunBookbuildingService = yunBookbuildingService; | 
| 61 | - this.smsTemplateService = smsTemplateService; | |
| 62 | - this.babyBookbuildingService = babyBookbuildingService; | |
| 57 | + this.courseService = courseService; | |
| 63 | 58 | } | 
| 64 | 59 | |
| 65 | 60 | |
| 66 | 61 | |
| 67 | 62 | |
| 68 | 63 | |
| 69 | 64 | |
| 70 | 65 | |
| 71 | 66 | |
| 72 | 67 | |
| 73 | 68 | |
| 74 | 69 | |
| 75 | 70 | |
| 76 | 71 | |
| ... | ... | @@ -121,71 +116,132 @@ | 
| 121 | 116 | |
| 122 | 117 | private void generateYun(CourseModel course,SmsConfigModel config,int service) | 
| 123 | 118 | { | 
| 124 | - //发送短信集合 | |
| 125 | - MsgListRequest list = new MsgListRequest(); | |
| 126 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 127 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 128 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 129 | - patientsQuery.setHospitalId(course.getHospitalId()); | |
| 130 | - patientsQuery.setLimit(1000); | |
| 131 | - int count = 1; | |
| 132 | - while (true) | |
| 133 | - { | |
| 134 | - List buildType = new ArrayList(); | |
| 135 | - buildType.add(0); | |
| 136 | - buildType.add(2); | |
| 137 | - patientsQuery.setSmsBuildTypeList(buildType); | |
| 138 | - //1孕妇 3 产妇 | |
| 139 | - patientsQuery.setType(1); | |
| 140 | - //分娩状态 | |
| 141 | - patientsQuery.setDueStatus(0); | |
| 119 | + try { | |
| 120 | + //发送短信集合 | |
| 121 | + MsgListRequest list = new MsgListRequest(); | |
| 122 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 123 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 124 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 125 | + patientsQuery.setHospitalId(course.getHospitalId()); | |
| 126 | + patientsQuery.setLimit(1000); | |
| 127 | + int count = 1; | |
| 128 | + while (true) | |
| 129 | + { | |
| 130 | + logger.info("generateYun course page="+count+";courseName="+course.getCourseName()+";courseId="+course.getId()); | |
| 131 | + List buildType = new ArrayList(); | |
| 132 | + buildType.add(0); | |
| 133 | + buildType.add(2); | |
| 134 | + patientsQuery.setSmsBuildTypeList(buildType); | |
| 135 | + //1孕妇 3 产妇 | |
| 136 | + patientsQuery.setType(1); | |
| 137 | + //分娩状态 | |
| 138 | + patientsQuery.setDueStatus(0); | |
| 142 | 139 | |
| 143 | - //末次月经必须大于当前时间减去42周视为未分娩孕妇 | |
| 144 | - Date lastMenses = DateUtils.getNewDate(new Date(),-42, "周", 0); | |
| 145 | - Date lastMensesMax = DateUtils.formatDate(lastMenses,DateUtils.Y_M_D); | |
| 146 | - patientsQuery.setLastMensesStart(lastMensesMax); | |
| 140 | + //末次月经必须大于当前时间减去42周视为未分娩孕妇 | |
| 141 | + Date lastMenses = DateUtils.getNewDate(new Date(),-42, "周", 0); | |
| 142 | + Date lastMensesMax = DateUtils.formatDate(lastMenses,DateUtils.Y_M_D); | |
| 143 | + patientsQuery.setLastMensesStart(lastMensesMax); | |
| 147 | 144 | |
| 148 | - patientsQuery.setNeed("true"); | |
| 149 | - patientsQuery.setPage(count); | |
| 145 | + patientsQuery.setNeed("true"); | |
| 146 | + patientsQuery.setPage(count); | |
| 150 | 147 | |
| 151 | - //查询符合条件的孕妇 | |
| 152 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 153 | - if (CollectionUtils.isNotEmpty(patients)) | |
| 154 | - { | |
| 155 | - for (Patients pat : patients) | |
| 148 | + //查询符合条件的孕妇 | |
| 149 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 150 | + if (CollectionUtils.isNotEmpty(patients)) | |
| 156 | 151 | { | 
| 157 | - //消息前缀 | |
| 158 | - String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 159 | - String courseTime = DateUtils.getDateStr(course.getCourseTime(),DateUtils.Y_M_D_H_M)+" ("+DateUtils.getWeekOfDate(course.getCourseTime())+")"; | |
| 152 | + for (Patients pat : patients) | |
| 153 | + { | |
| 154 | + //消息前缀 | |
| 155 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 156 | + String courseTime = DateUtils.getDateStr(course.getCourseTime(),DateUtils.Y_M_D_H_M)+" ("+DateUtils.getWeekOfDate(course.getCourseTime())+")"; | |
| 160 | 157 | |
| 161 | - String messageContent = "【"+messagePrefix+"】"; | |
| 162 | - MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 163 | - ServiceObjEnums.YUNOBJ.getId(), SmsServiceEnums.YFXXKCTX.getId(), | |
| 164 | - course.getHospitalId(), course.getId(), pat.getId(), course.getCourseName(), | |
| 165 | - course.getCourseSpeaker(), courseTime, | |
| 166 | - WxTempleteIdEnums.YUN_XUE_KE_CHEN_TX.getId(),service); | |
| 158 | + String messageContent = "【"+messagePrefix+"】"; | |
| 159 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 160 | + ServiceObjEnums.YUNOBJ.getId(), SmsServiceEnums.YFXXKCTX.getId(), | |
| 161 | + course.getHospitalId(), course.getId(), pat.getId(), course.getCourseName(), | |
| 162 | + course.getCourseSpeaker(), courseTime, | |
| 163 | + WxTempleteIdEnums.YUN_XUE_KE_CHEN_TX.getId(),service); | |
| 167 | 164 | |
| 168 | - messages.add(request); | |
| 165 | + messages.add(request); | |
| 166 | + } | |
| 169 | 167 | } | 
| 168 | + else | |
| 169 | + { | |
| 170 | + break; | |
| 171 | + } | |
| 172 | + count++; | |
| 170 | 173 | } | 
| 171 | - else | |
| 172 | - { | |
| 173 | - break; | |
| 174 | - } | |
| 175 | - count++; | |
| 174 | + list.setMessages(messages); | |
| 175 | + HelperUtils.sendMsg(list); | |
| 176 | + Thread.sleep(5000); | |
| 177 | + | |
| 178 | + course.setIsSend(1); | |
| 179 | + courseService.updateCourse(course); | |
| 180 | + } catch (InterruptedException e) { | |
| 181 | + logger.info("generateYun error." + course); | |
| 176 | 182 | } | 
| 177 | - list.setMessages(messages); | |
| 178 | - HelperUtils.sendMsg(list); | |
| 179 | 183 | } | 
| 180 | 184 | |
| 181 | 185 | private void generateChan(CourseModel course,SmsConfigModel config,int service) | 
| 182 | 186 | { | 
| 183 | - //发送短信集合 | |
| 184 | - MsgListRequest list = new MsgListRequest(); | |
| 185 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 187 | + try { | |
| 188 | + //发送短信集合 | |
| 189 | + MsgListRequest list = new MsgListRequest(); | |
| 190 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 191 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 192 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 193 | + patientsQuery.setHospitalId(course.getHospitalId()); | |
| 194 | + patientsQuery.setLimit(1000); | |
| 195 | + int count = 1; | |
| 196 | + while (true) | |
| 197 | + { | |
| 198 | + logger.info("generateChan course page=" + count + ";courseName=" + course.getCourseName() + ";courseId=" + course.getId()); | |
| 199 | + List buildType = new ArrayList(); | |
| 200 | + buildType.add(0); | |
| 201 | + buildType.add(2); | |
| 202 | + patientsQuery.setSmsBuildTypeList(buildType); | |
| 203 | + //1孕妇 3 产妇 | |
| 204 | + patientsQuery.setType(3); | |
| 205 | + //分娩状态 | |
| 206 | + patientsQuery.setDueStatus(0); | |
| 186 | 207 | |
| 187 | - list.setMessages(messages); | |
| 188 | - HelperUtils.sendMsg(list); | |
| 208 | + patientsQuery.setNeed("true"); | |
| 209 | + patientsQuery.setPage(count); | |
| 210 | + | |
| 211 | + //查询符合条件的孕妇 | |
| 212 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 213 | + if (CollectionUtils.isNotEmpty(patients)) | |
| 214 | + { | |
| 215 | + for (Patients pat : patients) | |
| 216 | + { | |
| 217 | + //消息前缀 | |
| 218 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
| 219 | + String courseTime = DateUtils.getDateStr(course.getCourseTime(),DateUtils.Y_M_D_H_M)+" ("+DateUtils.getWeekOfDate(course.getCourseTime())+")"; | |
| 220 | + | |
| 221 | + String messageContent = "【"+messagePrefix+"】"; | |
| 222 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 223 | + ServiceObjEnums.YUNOBJ.getId(), SmsServiceEnums.YFXXKCTX.getId(), | |
| 224 | + course.getHospitalId(), course.getId(), pat.getId(), course.getCourseName(), | |
| 225 | + course.getCourseSpeaker(), courseTime, | |
| 226 | + WxTempleteIdEnums.YUN_XUE_KE_CHEN_TX.getId(),service); | |
| 227 | + | |
| 228 | + messages.add(request); | |
| 229 | + } | |
| 230 | + } | |
| 231 | + else | |
| 232 | + { | |
| 233 | + break; | |
| 234 | + } | |
| 235 | + count++; | |
| 236 | + } | |
| 237 | + list.setMessages(messages); | |
| 238 | + HelperUtils.sendMsg(list); | |
| 239 | + Thread.sleep(5000); | |
| 240 | + course.setIsSend(1); | |
| 241 | + courseService.updateCourse(course); | |
| 242 | + } catch (InterruptedException e) { | |
| 243 | + logger.info("generateChan error."+course); | |
| 244 | + } | |
| 189 | 245 | } | 
| 190 | 246 | } | 
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
9537eaa
| ... | ... | @@ -7,6 +7,7 @@ | 
| 7 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; | 
| 8 | 8 | import com.lyms.platform.common.enums.CourseStatusEnums; | 
| 9 | 9 | import com.lyms.platform.common.enums.OptActionEnums; | 
| 10 | +import com.lyms.platform.common.enums.SmsServiceEnums; | |
| 10 | 11 | import com.lyms.platform.common.enums.YnEnums; | 
| 11 | 12 | import com.lyms.platform.common.result.BaseListResponse; | 
| 12 | 13 | import com.lyms.platform.common.result.BaseObjectResponse; | 
| ... | ... | @@ -235,6 +236,7 @@ | 
| 235 | 236 | model.setStatus(CourseStatusEnums.YFB.getId()); | 
| 236 | 237 | model.setId(id); | 
| 237 | 238 | model.setModified(new Date()); | 
| 239 | + model.setPublishTime(new Date()); | |
| 238 | 240 | courseService.updateCourse(model); | 
| 239 | 241 | } | 
| 240 | 242 | |
| ... | ... | @@ -374,7 +376,8 @@ | 
| 374 | 376 | query.setYn(YnEnums.YES.getId()); | 
| 375 | 377 | query.setHospitalId(hospitalId); | 
| 376 | 378 | |
| 377 | - int allSends = 0; //TODO | |
| 379 | + int allSends = getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
| 380 | + 1,null, null, null); | |
| 378 | 381 | |
| 379 | 382 | PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | 
| 380 | 383 | patientCourseQuery.setYn(YnEnums.YES.getId()); | 
| 381 | 384 | |
| 382 | 385 | |
| 383 | 386 | |
| ... | ... | @@ -399,19 +402,24 @@ | 
| 399 | 402 | resultData.put("allCourses",allCourses); //课程数 | 
| 400 | 403 | resultData.put("allSends",allSends); //总推送数 | 
| 401 | 404 | resultData.put("allOrders",allOrders); //总预约数 | 
| 402 | - resultData.put("allOrderRate",allCourses == 0 ? 0 : df.format((double) allOrders / allPatientCourses * 100) + "%"); //总预约率 | |
| 403 | - resultData.put("allSigns",allSigns);//总签到数 | |
| 404 | - resultData.put("allSignRate",allCourses == 0 ? 0 : df.format((double) allSigns / allPatientCourses * 100) + "%");//总签到率 | |
| 405 | + resultData.put("allOrderRate", allCourses == 0 ? 0 : df.format((double) allOrders / allPatientCourses * 100) + "%"); //总预约率 | |
| 406 | + resultData.put("allSigns", allSigns);//总签到数 | |
| 407 | + resultData.put("allSignRate", allCourses == 0 ? 0 : df.format((double) allSigns / allPatientCourses * 100) + "%");//总签到率 | |
| 405 | 408 | |
| 406 | 409 | CourseTypeQuery courseTypeQuery = new CourseTypeQuery(); | 
| 407 | 410 | courseTypeQuery.setHospitalId(hospitalId); | 
| 408 | 411 | courseTypeQuery.setYn(YnEnums.YES.getId()); | 
| 409 | 412 | |
| 413 | + String start = null; | |
| 414 | + String end = null; | |
| 415 | + | |
| 410 | 416 | if (StringUtils.isNotEmpty(time)) { | 
| 411 | 417 | String[] dates = time.split(" - "); | 
| 412 | - patientCourseQuery.setCreatedStart(DateUtil.parseYMD(dates[0])); | |
| 418 | + start = dates[0]; | |
| 419 | + patientCourseQuery.setCreatedStart(DateUtil.parseYMD(start)); | |
| 413 | 420 | if (dates.length == 2) { | 
| 414 | - patientCourseQuery.setCreatedEnd(DateUtil.parseYMDHMS(dates[1] + " 23:59:59")); | |
| 421 | + end = dates[1]; | |
| 422 | + patientCourseQuery.setCreatedEnd(DateUtil.parseYMDHMS(end + " 23:59:59")); | |
| 415 | 423 | } | 
| 416 | 424 | } | 
| 417 | 425 | |
| ... | ... | @@ -440,7 +448,8 @@ | 
| 440 | 448 | int courseSigns = patientCourseService.queryPatientCourseCount(patientCourseQuery); | 
| 441 | 449 | signs.add(courseSigns); | 
| 442 | 450 | |
| 443 | - int courseSends = 0; //TODO | |
| 451 | + int courseSends = getCourseCountData(hospitalId, String.valueOf(SmsServiceEnums.YFXXKCTX.getId()), 3, | |
| 452 | + 1,courseModel.getId(), start, end); | |
| 444 | 453 | sends.add(courseSends); | 
| 445 | 454 | |
| 446 | 455 | courseTypeQuery.setId(courseModel.getCourseTypeId()); | 
| ... | ... | @@ -452,7 +461,7 @@ | 
| 452 | 461 | tableMap.put("courseTypeName",CollectionUtils.isNotEmpty(typeModels) ? typeModels.get(0).getCourseTypeName() : ""); | 
| 453 | 462 | tableMap.put("courseName",courseModel.getCourseName()); | 
| 454 | 463 | |
| 455 | - tableMap.put("sends",0);//TODO | |
| 464 | + tableMap.put("sends",courseSends); | |
| 456 | 465 | tableMap.put("orders",courseOrders); | 
| 457 | 466 | tableMap.put("ordersRate",allCourses == 0 ? "0" : df.format((double) courseOrders / allPatientCourses * 100) + "%"); | 
| 458 | 467 | tableMap.put("signs",courseSigns); | 
| 459 | 468 | |
| ... | ... | @@ -479,8 +488,9 @@ | 
| 479 | 488 | |
| 480 | 489 | private int getCourseCountData(String hospitalId, | 
| 481 | 490 | String subTypeId, | 
| 482 | - Integer smsStatus, | |
| 491 | + Integer status, | |
| 483 | 492 | Integer sendType, | 
| 493 | + String tempId, | |
| 484 | 494 | String createTimeStart, | 
| 485 | 495 | String createTimeEnd) | 
| 486 | 496 | { | 
| ... | ... | @@ -488,7 +498,8 @@ | 
| 488 | 498 | |
| 489 | 499 | param.put("hospitalId",hospitalId); | 
| 490 | 500 | param.put("subTypeId",subTypeId); | 
| 491 | - param.put("status",smsStatus == null ? null : String.valueOf(smsStatus)); | |
| 501 | + param.put("tempId",tempId == null ? null : String.valueOf(tempId)); | |
| 502 | + param.put("status",status == null ? null : String.valueOf(status)); | |
| 492 | 503 | param.put("sendType",sendType == null ? null : String.valueOf(sendType)); | 
| 493 | 504 | param.put("createTimeStart",createTimeStart); | 
| 494 | 505 | param.put("createTimeEnd",createTimeEnd); |