Commit 9a4809b63928dc0fde5365955bf44a8172265d8f
1 parent
1cddf1fb71
Exists in
master
and in
8 other branches
code update
Showing 7 changed files with 114 additions and 29 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PostReviewDaoImpl.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
View file @
9a4809b
| ... | ... | @@ -69,9 +69,9 @@ |
| 69 | 69 | return result.getMappedResults(); |
| 70 | 70 | } |
| 71 | 71 | @Override |
| 72 | - public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String pid) { | |
| 72 | + public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String parentId) { | |
| 73 | 73 | |
| 74 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte(startDate).and("parentId").is("pid").and("hospitalId").is(hospitalId)); | |
| 74 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte(startDate).and("parentId").is(parentId).and("hospitalId").is(hospitalId)); | |
| 75 | 75 | AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); |
| 76 | 76 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
| 77 | 77 | AggregationResults<AntenatalExaminationModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_antex", AntenatalExaminationModel.class); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PostReviewDaoImpl.java
View file @
9a4809b
| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | |
| 79 | 79 | @Override |
| 80 | 80 | public List<PostReviewModel> queryPostOrder(Date orderDate, String hospitalId) { |
| 81 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).lte(orderDate).and("hospitalId").is(hospitalId)); | |
| 81 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte(orderDate).lte(orderDate).and("hospitalId").is(hospitalId)); | |
| 82 | 82 | AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); |
| 83 | 83 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
| 84 | 84 | AggregationResults<PostReviewModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_postreview", PostReviewModel.class); |
| ... | ... | @@ -86,7 +86,7 @@ |
| 86 | 86 | } |
| 87 | 87 | @Override |
| 88 | 88 | public List<PostReviewModel> queryPostOrder(Date orderDate, String hospitalId,String parentId) { |
| 89 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).and("hospitalId").is(hospitalId).and("parentId").is(parentId)); | |
| 89 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte(orderDate).and("hospitalId").is(hospitalId).and("parentId").is(parentId)); | |
| 90 | 90 | AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); |
| 91 | 91 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
| 92 | 92 | AggregationResults<PostReviewModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_postreview", PostReviewModel.class); |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
9a4809b
| ... | ... | @@ -742,18 +742,25 @@ |
| 742 | 742 | // System.out.println(s); |
| 743 | 743 | // Date s = addDay(parseYMD("2016-02-26"), 168); |
| 744 | 744 | |
| 745 | - int start = 37; | |
| 746 | - int end = 37; | |
| 745 | +// int start = 37; | |
| 746 | +// int end = 37; | |
| 747 | +// | |
| 748 | +// | |
| 749 | +// Date startDate = DateUtil.getNewDate(-end-1,"周",1+1); | |
| 750 | +// Date endDate = DateUtil.getNewDate(-start,"周",0+1); | |
| 747 | 751 | |
| 748 | 752 | |
| 749 | - Date startDate = DateUtil.getNewDate(-end-1,"周",1+1); | |
| 750 | - Date endDate = DateUtil.getNewDate(-start,"周",0+1); | |
| 751 | - | |
| 752 | - | |
| 753 | 753 | // Date startDate = DateUtil.getNewDate(-end,"天",1); |
| 754 | 754 | // Date endDate = DateUtil.getNewDate(-start,"天",1); |
| 755 | 755 | |
| 756 | - System.out.println(startDate + "==="+ endDate); | |
| 756 | +// System.out.println(startDate + "==="+ endDate); | |
| 757 | + | |
| 758 | + | |
| 759 | +// Date startDate = getRangeDate(parseYMD("2016-09-07"),2,"周",-1); | |
| 760 | +// System.out.println(getyyyy_MM_dd(startDate)); | |
| 761 | + | |
| 762 | + int a = daysBetween(parseYMD("2016-08-30"),new Date()); | |
| 763 | + System.out.println(a); | |
| 757 | 764 | } catch (Exception e) |
| 758 | 765 | { |
| 759 | 766 |
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
View file @
9a4809b
| ... | ... | @@ -104,7 +104,7 @@ |
| 104 | 104 | condition= condition.and("id",id, MongoOper.IS); |
| 105 | 105 | } |
| 106 | 106 | if(null!=nextCheckTime){ |
| 107 | - condition= condition.and("nextCheckTime",nextCheckTime, MongoOper.IS); | |
| 107 | + condition= condition.and("nextCheckTime",nextCheckTime, MongoOper.GTE); | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if(null!=hospitalId){ |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
9a4809b
| ... | ... | @@ -86,6 +86,9 @@ |
| 86 | 86 | query.setYn(YnEnums.YES.getId()); |
| 87 | 87 | String week = DateUtil.getWeekOfDate(new Date()); |
| 88 | 88 | query.setGuideTime(week); |
| 89 | + | |
| 90 | + query.setHospitalId(221+""); | |
| 91 | + | |
| 89 | 92 | //查询出对应周几要发送的的医院配置 |
| 90 | 93 | List<SmsConfigModel> configs = smsConfigService.querySmsConfig(query); |
| 91 | 94 | |
| ... | ... | @@ -295,7 +298,7 @@ |
| 295 | 298 | if (!isRisk) |
| 296 | 299 | { |
| 297 | 300 | //计算出孕周 孕周计算方式 当前时间减去末次月经 除以7 的到孕周 |
| 298 | - int weeks = DateUtil.daysBetween(new Date(), pat.getLastMenses()) / 7; | |
| 301 | + int weeks = DateUtil.daysBetween(pat.getLastMenses(),new Date()) / 7; | |
| 299 | 302 | String yunWeek = String.valueOf(weeks); |
| 300 | 303 | //得到符合当前孕周的短信条数 |
| 301 | 304 | List<MessageContent> messageContents = amsSmses.get(yunWeek); |
| ... | ... | @@ -426,7 +429,7 @@ |
| 426 | 429 | } |
| 427 | 430 | |
| 428 | 431 | |
| 429 | - int weeks = DateUtil.daysBetween(new Date(), baby.getBirth()) / 7; | |
| 432 | + int weeks = DateUtil.daysBetween(baby.getBirth(),new Date()) / 7; | |
| 430 | 433 | String weekAge = String.valueOf(weeks); |
| 431 | 434 | //得到符合当前孕周的短信条数 |
| 432 | 435 | List<MessageContent> messageContents = amsSmses.get(weekAge); |
| ... | ... | @@ -435,12 +438,12 @@ |
| 435 | 438 | { |
| 436 | 439 | for(MessageContent message : messageContents) |
| 437 | 440 | { |
| 438 | - //判断当前短信是否已经发送 通过短信ID和孕妇ID | |
| 439 | - boolean isExist = SaveMessageService.isExistSms(baby.getId(), message.getId()); | |
| 440 | - if (isExist) | |
| 441 | - { | |
| 442 | - continue; | |
| 443 | - } | |
| 441 | +// //判断当前短信是否已经发送 通过短信ID和孕妇ID | |
| 442 | +// boolean isExist = SaveMessageService.isExistSms(baby.getId(), message.getId()); | |
| 443 | +// if (isExist) | |
| 444 | +// { | |
| 445 | +// continue; | |
| 446 | +// } | |
| 444 | 447 | String messageContent = "【"+messagePrefix+"】" + message.getContent(); |
| 445 | 448 | MessageRequest request = getMessageRequest( messageContent,baby.getMphone(),ServiceObjEnums.BABYOBJ.getId(), SmsServiceEnums.YBZD.getId(), |
| 446 | 449 | baby.getHospitalId(),message.getId(),baby.getId()); |
| ... | ... | @@ -552,7 +555,7 @@ |
| 552 | 555 | String messagePrefix = getSmsPrefix(config, pat.getBookbuildingDoctor()); |
| 553 | 556 | |
| 554 | 557 | //计算产后多少周 按分娩日期计算 |
| 555 | - int weeks = DateUtil.daysBetween(new Date(),pat.getFmDate()) / 7; | |
| 558 | + int weeks = DateUtil.daysBetween(pat.getFmDate(),new Date()) / 7; | |
| 556 | 559 | String yunWeek = String.valueOf(weeks); |
| 557 | 560 | //得到符合当前孕周的短信条数 |
| 558 | 561 | List<MessageContent> messageContents = amsSmses.get(yunWeek); |
| ... | ... | @@ -629,7 +632,7 @@ |
| 629 | 632 | SmsConfigQuery configQuery = new SmsConfigQuery(); |
| 630 | 633 | configQuery.setYn(YnEnums.YES.getId()); |
| 631 | 634 | configQuery.setPrefixTypes(new Integer[]{0, 1}); |
| 632 | -// configQuery.setHospitalId(221 + ""); | |
| 635 | + configQuery.setHospitalId(221 + ""); | |
| 633 | 636 | |
| 634 | 637 | //查询出对应医院配置 |
| 635 | 638 | List<SmsConfigModel> configs = smsConfigService.querySmsConfig(configQuery); |
| ... | ... | @@ -670,7 +673,7 @@ |
| 670 | 673 | for (SmsTemplateModel template : templates) |
| 671 | 674 | { |
| 672 | 675 | |
| 673 | -// if (!("57d65fa80cf2798825ca2d87".equals(template.getId())) ) | |
| 676 | +// if (!("57d605380cf2e638ab9a7036".equals(template.getId())) ) | |
| 674 | 677 | // { |
| 675 | 678 | // continue; |
| 676 | 679 | // } |
| 677 | 680 | |
| ... | ... | @@ -2183,12 +2186,23 @@ |
| 2183 | 2186 | |
| 2184 | 2187 | AntExChuQuery antExChuQuery = new AntExChuQuery(); |
| 2185 | 2188 | antExChuQuery.setYn(YnEnums.YES.getId()); |
| 2186 | - antExChuQuery.setNextCheckTimeStart(startDate); | |
| 2189 | + antExChuQuery.setNextCheckTime(startDate); | |
| 2187 | 2190 | antExChuQuery.setParentId(pid); |
| 2188 | 2191 | List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery); |
| 2189 | 2192 | for (AntExChuModel chu : chus) |
| 2190 | 2193 | { |
| 2191 | 2194 | idset.add(chu.getParentId()); |
| 2195 | + | |
| 2196 | + AntExQuery antExQuery = new AntExQuery(); | |
| 2197 | + antExQuery.setParentId(chu.getParentId()); | |
| 2198 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 2199 | + //复诊不存在 才添加 | |
| 2200 | + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
| 2201 | + if (!CollectionUtils.isNotEmpty(list)) | |
| 2202 | + { | |
| 2203 | + idset.add(chu.getParentId()); | |
| 2204 | + } | |
| 2205 | + | |
| 2192 | 2206 | } |
| 2193 | 2207 | List<AntenatalExaminationModel> fuzs = antenatalExaminationService.queryYuyueAntenatalExamination(startDate,tempHid,pid); |
| 2194 | 2208 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java
View file @
9a4809b
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | import org.springframework.web.bind.annotation.*; |
| 17 | 17 | |
| 18 | 18 | import javax.servlet.http.HttpServletRequest; |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 19 | 20 | import javax.validation.Valid; |
| 20 | 21 | import java.util.ArrayList; |
| 21 | 22 | import java.util.HashMap; |
| ... | ... | @@ -95,7 +96,7 @@ |
| 95 | 96 | @TokenRequired |
| 96 | 97 | public BaseResponse getCheckItem(@RequestParam("parentId")String id,HttpServletRequest request) { |
| 97 | 98 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 98 | - return sieveFacade.getCheckItem(id,loginState.getId()); | |
| 99 | + return sieveFacade.getCheckItem(id, loginState.getId()); | |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | 102 | @ResponseBody |
| ... | ... | @@ -177,6 +178,20 @@ |
| 177 | 178 | public BaseResponse queryChanQianSieve(@Valid CqSieveQueryRequest cqSieveQueryRequest,HttpServletRequest request){ |
| 178 | 179 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 179 | 180 | return sieveFacade.queryList(cqSieveQueryRequest,loginState.getId()); |
| 181 | + } | |
| 182 | + | |
| 183 | + | |
| 184 | + /** | |
| 185 | + * 导出产筛列表 | |
| 186 | + * @param cqSieveQueryRequest | |
| 187 | + * @param request | |
| 188 | + * @return | |
| 189 | + */ | |
| 190 | + @RequestMapping(value = "/exportCqsieves",method = RequestMethod.GET) | |
| 191 | + @TokenRequired | |
| 192 | + public void exportCqsieves(@Valid CqSieveQueryRequest cqSieveQueryRequest,HttpServletRequest request,HttpServletResponse response){ | |
| 193 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 194 | + sieveFacade.exportCqsieves(cqSieveQueryRequest, loginState.getId(),response); | |
| 180 | 195 | } |
| 181 | 196 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveFacade.java
View file @
9a4809b
| ... | ... | @@ -5,11 +5,14 @@ |
| 5 | 5 | import com.lyms.platform.biz.service.PatientsService; |
| 6 | 6 | import com.lyms.platform.biz.service.SieveService; |
| 7 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 8 | +import com.lyms.platform.common.enums.ServiceStatusEnums; | |
| 9 | +import com.lyms.platform.common.enums.SexEnum; | |
| 8 | 10 | import com.lyms.platform.common.enums.YnEnums; |
| 9 | 11 | import com.lyms.platform.common.result.BaseListResponse; |
| 10 | 12 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 11 | 13 | import com.lyms.platform.common.result.BaseResponse; |
| 12 | 14 | import com.lyms.platform.common.utils.DateUtil; |
| 15 | +import com.lyms.platform.common.utils.ExcelUtil; | |
| 13 | 16 | import com.lyms.platform.common.utils.JsonUtil; |
| 14 | 17 | import com.lyms.platform.operate.web.request.ChanQianDiaAddRequest; |
| 15 | 18 | import com.lyms.platform.operate.web.request.CqSieveQueryRequest; |
| ... | ... | @@ -28,10 +31,9 @@ |
| 28 | 31 | import org.springframework.data.domain.Sort; |
| 29 | 32 | import org.springframework.stereotype.Component; |
| 30 | 33 | |
| 31 | -import java.util.ArrayList; | |
| 32 | -import java.util.Date; | |
| 33 | -import java.util.HashMap; | |
| 34 | -import java.util.List; | |
| 34 | +import javax.servlet.http.HttpServletResponse; | |
| 35 | +import java.io.OutputStream; | |
| 36 | +import java.util.*; | |
| 35 | 37 | |
| 36 | 38 | /** |
| 37 | 39 | * 产筛门面 |
| ... | ... | @@ -231,6 +233,53 @@ |
| 231 | 233 | } |
| 232 | 234 | } |
| 233 | 235 | return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(sieveQuery.getPageInfo()); |
| 236 | + } | |
| 237 | + | |
| 238 | + public void exportCqsieves(CqSieveQueryRequest cqSieveQueryRequest, Integer id, HttpServletResponse response) { | |
| 239 | + try { | |
| 240 | + | |
| 241 | + BaseListResponse listResponse = (BaseListResponse)queryList(cqSieveQueryRequest, id); | |
| 242 | + | |
| 243 | + List<SieveListResult> list = listResponse.getData(); | |
| 244 | + List<Map<String,Object>> datas = new ArrayList<>(); | |
| 245 | + | |
| 246 | + if (CollectionUtils.isNotEmpty(list)) | |
| 247 | + { | |
| 248 | + for (SieveListResult sive : list) | |
| 249 | + { | |
| 250 | + Map<String,Object> data = new HashMap<>(); | |
| 251 | + data.put("name", sive.getName()); | |
| 252 | + data.put("cDueWeek", sive.getcDueWeek()); | |
| 253 | + data.put("tireNumber", sive.getTireNumber()); | |
| 254 | + data.put("dueWeek", sive.getDueWeek()); | |
| 255 | + data.put("ztfxText", sive.getZtfxText()); | |
| 256 | + data.put("phone", sive.getPhone()); | |
| 257 | + data.put("cqStatus", sive.getCqStatus()); | |
| 258 | + data.put("cqResult", sive.getCqResult()); | |
| 259 | + data.put("renShenResult", sive.getRenShenResult()); | |
| 260 | + datas.add(data); | |
| 261 | + } | |
| 262 | + } | |
| 263 | + OutputStream out = response.getOutputStream(); | |
| 264 | + Map<String,String> cnames = new HashMap<>(); | |
| 265 | + cnames.put("name", "姓名"); | |
| 266 | + cnames.put("sex","当前孕周"); | |
| 267 | + cnames.put("tireNumber","胎数"); | |
| 268 | + cnames.put("dueWeek", "申请孕周"); | |
| 269 | + cnames.put("ztfxText", "整体风险"); | |
| 270 | + cnames.put("phone", "联系方式"); | |
| 271 | + cnames.put("cqStatus", "产前诊断"); | |
| 272 | + cnames.put("cqResult","产前诊断结果"); | |
| 273 | + cnames.put("renShenResult","妊娠结局"); | |
| 274 | + response.setContentType("application/octet-stream"); | |
| 275 | + response.setCharacterEncoding("UTF-8"); | |
| 276 | + response.setHeader("Content-Disposition", "attachment;fileName="+"childDatas.xls"); | |
| 277 | + ExcelUtil.toExcel(out, datas, cnames); | |
| 278 | + } | |
| 279 | + catch (Exception e) | |
| 280 | + { | |
| 281 | + | |
| 282 | + } | |
| 234 | 283 | } |
| 235 | 284 | } |