Commit 6c24bdbef2e517fde4ed6462326513851662d7e9
1 parent
b5810d931a
Exists in
master
and in
6 other branches
血糖
Showing 3 changed files with 115 additions and 85 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/GenSequenceIdService.java
View file @
6c24bdb
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
6c24bdb
| ... | ... | @@ -3137,5 +3137,37 @@ |
| 3137 | 3137 | return "1"; |
| 3138 | 3138 | } |
| 3139 | 3139 | |
| 3140 | + @RequestMapping(method = RequestMethod.GET, value = "/cdMatDeliverHandle") | |
| 3141 | + @ResponseBody | |
| 3142 | + public void cdMatDeliverHandle(String start,String end) | |
| 3143 | + { | |
| 3144 | + MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); | |
| 3145 | + matDeliverQuery.setCreatedTimeStart(DateUtil.parseYMD(start)); | |
| 3146 | + matDeliverQuery.setCreatedTimeEnd(DateUtil.parseYMD(end)); | |
| 3147 | + matDeliverQuery.setYn(YnEnums.YES.getId()); | |
| 3148 | + List<MaternalDeliverModel> deliverModels = matDeliverService.query(matDeliverQuery); | |
| 3149 | + if (CollectionUtils.isNotEmpty(deliverModels)) | |
| 3150 | + { | |
| 3151 | + for (MaternalDeliverModel deliverModel : deliverModels) | |
| 3152 | + { | |
| 3153 | + try { | |
| 3154 | + Patients pat = patientsService.findOnePatientById(deliverModel.getParentId()); | |
| 3155 | + if (pat != null && !StringUtils.isNotEmpty(pat.getFmHospital())) | |
| 3156 | + { | |
| 3157 | + | |
| 3158 | + Organization org = organizationService.getOrganization(Integer.parseInt(pat.getHospitalId())); | |
| 3159 | + if ("9".equals(org.getCityId())) | |
| 3160 | + { | |
| 3161 | + System.out.println(pat.getUsername() + " " +pat.getCardNo()+ " " + pat.getPhone()+" "+org.getName()+"\r\n" ); | |
| 3162 | + } | |
| 3163 | + } | |
| 3164 | + }catch (Exception e) | |
| 3165 | + { | |
| 3166 | + continue; | |
| 3167 | + } | |
| 3168 | + } | |
| 3169 | + } | |
| 3170 | + } | |
| 3171 | + | |
| 3140 | 3172 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
6c24bdb
| ... | ... | @@ -369,89 +369,88 @@ |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | |
| 372 | -// // 周平均 | |
| 373 | -// Date date = new Date(); | |
| 374 | -// List<Map<String, Object>> weekAvgMap = new ArrayList<>(); | |
| 375 | -// Map<Integer, Map<String, Object>> weekAvgMapTemp = new LinkedHashMap<>(); | |
| 376 | -// Date weekStart = DateUtil.getYmdDate(DateUtil.addDay(DateUtil.addWeek(date, -1), 1)); | |
| 377 | -// List<BloodSugar> bloodSugarsWeek = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("created").gte(weekStart)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); | |
| 378 | -// for (BloodSugar bloodSugar : bloodSugarsWeek) { | |
| 379 | -// if(weekAvgMapTemp.containsKey(bloodSugar.getBloodSugarType())) { | |
| 380 | -// Map<String, Object> temp = weekAvgMapTemp.get(bloodSugar.getBloodSugarType()); | |
| 381 | -// temp.put("dayCount", Integer.parseInt(temp.get("dayCount") + "") + 1); // 总共有记录的天数 | |
| 382 | -// temp.put("sugarCount", Double.parseDouble(temp.get("sugarCount") + "") + Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 383 | -// weekAvgMapTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 384 | -// } else { | |
| 385 | -// Map<String, Object> temp = new HashMap<>(); | |
| 386 | -// temp.put("dayCount", 1); // 总共有记录的天数 | |
| 387 | -// temp.put("sugarCount", Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 388 | -// weekAvgMapTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 389 | -// } | |
| 390 | -// } | |
| 391 | -// for (BloodSugarEnums bloodSugarEnums : BloodSugarEnums.values()) { | |
| 392 | -// Map<String, Object> weekMap = new HashMap<>(); | |
| 393 | -// weekMap.put("name", bloodSugarEnums.getName()); | |
| 394 | -// boolean flag = true; | |
| 395 | -// for (Map.Entry<Integer, Map<String, Object>> entry : weekAvgMapTemp.entrySet()) { | |
| 396 | -// if(entry.getKey() == bloodSugarEnums.getId()) { | |
| 397 | -// Map<String, Object> map = entry.getValue(); | |
| 398 | -// Integer dayCount = (Integer) map.get("dayCount"); | |
| 399 | -// Double sugarCount = (Double) map.get("sugarCount"); | |
| 400 | -// weekMap.put("value", MathUtil.doubleFormat2(sugarCount / dayCount)); | |
| 401 | -// flag = false; | |
| 402 | -// } | |
| 403 | -// } | |
| 404 | -// if(flag) { | |
| 405 | -// weekMap.put("value", ""); | |
| 406 | -// } | |
| 407 | -// weekAvgMap.add(weekMap); | |
| 408 | -// } | |
| 372 | + // 周平均 | |
| 373 | + Date date = new Date(); | |
| 374 | + List<Map<String, Object>> weekAvgMap = new ArrayList<>(); | |
| 375 | + Map<Integer, Map<String, Object>> weekAvgMapTemp = new LinkedHashMap<>(); | |
| 376 | + Date weekStart = DateUtil.getYmdDate(DateUtil.addDay(DateUtil.addWeek(date, -1), 1)); | |
| 377 | + List<BloodSugar> bloodSugarsWeek = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("created").gte(weekStart)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); | |
| 378 | + for (BloodSugar bloodSugar : bloodSugarsWeek) { | |
| 379 | + if(weekAvgMapTemp.containsKey(bloodSugar.getBloodSugarType())) { | |
| 380 | + Map<String, Object> temp = weekAvgMapTemp.get(bloodSugar.getBloodSugarType()); | |
| 381 | + temp.put("dayCount", Integer.parseInt(temp.get("dayCount") + "") + 1); // 总共有记录的天数 | |
| 382 | + temp.put("sugarCount", Double.parseDouble(temp.get("sugarCount") + "") + Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 383 | + weekAvgMapTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 384 | + } else { | |
| 385 | + Map<String, Object> temp = new HashMap<>(); | |
| 386 | + temp.put("dayCount", 1); // 总共有记录的天数 | |
| 387 | + temp.put("sugarCount", Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 388 | + weekAvgMapTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 389 | + } | |
| 390 | + } | |
| 391 | + for (BloodSugarEnums bloodSugarEnums : BloodSugarEnums.values()) { | |
| 392 | + Map<String, Object> weekMap = new HashMap<>(); | |
| 393 | + weekMap.put("name", bloodSugarEnums.getName()); | |
| 394 | + boolean flag = true; | |
| 395 | + for (Map.Entry<Integer, Map<String, Object>> entry : weekAvgMapTemp.entrySet()) { | |
| 396 | + if(entry.getKey() == bloodSugarEnums.getId()) { | |
| 397 | + Map<String, Object> map = entry.getValue(); | |
| 398 | + Integer dayCount = (Integer) map.get("dayCount"); | |
| 399 | + Double sugarCount = (Double) map.get("sugarCount"); | |
| 400 | + weekMap.put("value", MathUtil.doubleFormat2(sugarCount / dayCount)); | |
| 401 | + flag = false; | |
| 402 | + } | |
| 403 | + } | |
| 404 | + if(flag) { | |
| 405 | + weekMap.put("value", ""); | |
| 406 | + } | |
| 407 | + weekAvgMap.add(weekMap); | |
| 408 | + } | |
| 409 | 409 | |
| 410 | -// // 月平均 | |
| 411 | -// List<Map<String, Object>> monthAvgMap = new ArrayList<>(); | |
| 412 | -// Map<Integer, Map<String, Object>> monthAvgTemp = new LinkedHashMap<>(); | |
| 413 | -//// Date monthStart = DateUtil.addMonth(date, -1); | |
| 414 | -// Date monthStart = DateUtil.getYmdDate(DateUtil.addDay(DateUtil.addMonth(date, -1), 1)); | |
| 415 | -// List<BloodSugar> bloodSugarsMonth = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("created").gte(monthStart)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); | |
| 416 | -// for (BloodSugar bloodSugar : bloodSugarsMonth) { | |
| 417 | -// if(monthAvgTemp.containsKey(bloodSugar.getBloodSugarType())) { | |
| 418 | -// Map<String, Object> temp = monthAvgTemp.get(bloodSugar.getBloodSugarType()); | |
| 419 | -// temp.put("dayCount", Integer.parseInt(temp.get("dayCount") + "") + 1); // 总共有记录的天数 | |
| 420 | -// temp.put("sugarCount", Double.parseDouble(temp.get("sugarCount") + "") + Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 421 | -// monthAvgTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 422 | -// } else { | |
| 423 | -// Map<String, Object> temp = new HashMap<>(); | |
| 424 | -// temp.put("dayCount", 1); // 总共有记录的天数 | |
| 425 | -// temp.put("sugarCount", Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 426 | -// monthAvgTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 427 | -// } | |
| 428 | -// } | |
| 429 | -// for (BloodSugarEnums bloodSugarEnums : BloodSugarEnums.values()) { | |
| 430 | -// Map<String, Object> monthMap = new HashMap<>(); | |
| 431 | -// monthMap.put("name", bloodSugarEnums.getName()); | |
| 432 | -// boolean flag = true; | |
| 433 | -// for (Map.Entry<Integer, Map<String, Object>> entry : monthAvgTemp.entrySet()) { | |
| 434 | -// monthMap.put("name", bloodSugarEnums.getName()); | |
| 435 | -// if(entry.getKey() == bloodSugarEnums.getId()) { | |
| 436 | -// Map<String, Object> map = entry.getValue(); | |
| 437 | -// Integer dayCount = (Integer) map.get("dayCount"); | |
| 438 | -// Double sugarCount = (Double) map.get("sugarCount"); | |
| 439 | -// monthMap.put("value", MathUtil.doubleFormat2(sugarCount / dayCount)); | |
| 440 | -// flag = false; | |
| 441 | -// } | |
| 442 | -// } | |
| 443 | -// if(flag) { | |
| 444 | -// monthMap.put("value", ""); | |
| 445 | -// } | |
| 446 | -// monthAvgMap.add(monthMap); | |
| 447 | -// } | |
| 410 | + // 月平均 | |
| 411 | + List<Map<String, Object>> monthAvgMap = new ArrayList<>(); | |
| 412 | + Map<Integer, Map<String, Object>> monthAvgTemp = new LinkedHashMap<>(); | |
| 413 | +// Date monthStart = DateUtil.addMonth(date, -1); | |
| 414 | + Date monthStart = DateUtil.getYmdDate(DateUtil.addDay(DateUtil.addMonth(date, -1), 1)); | |
| 415 | + List<BloodSugar> bloodSugarsMonth = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("created").gte(monthStart)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); | |
| 416 | + for (BloodSugar bloodSugar : bloodSugarsMonth) { | |
| 417 | + if(monthAvgTemp.containsKey(bloodSugar.getBloodSugarType())) { | |
| 418 | + Map<String, Object> temp = monthAvgTemp.get(bloodSugar.getBloodSugarType()); | |
| 419 | + temp.put("dayCount", Integer.parseInt(temp.get("dayCount") + "") + 1); // 总共有记录的天数 | |
| 420 | + temp.put("sugarCount", Double.parseDouble(temp.get("sugarCount") + "") + Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 421 | + monthAvgTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 422 | + } else { | |
| 423 | + Map<String, Object> temp = new HashMap<>(); | |
| 424 | + temp.put("dayCount", 1); // 总共有记录的天数 | |
| 425 | + temp.put("sugarCount", Double.parseDouble(bloodSugar.getBloodSugar())); // 总共所有记录的和 | |
| 426 | + monthAvgTemp.put(bloodSugar.getBloodSugarType(), temp); | |
| 427 | + } | |
| 428 | + } | |
| 429 | + for (BloodSugarEnums bloodSugarEnums : BloodSugarEnums.values()) { | |
| 430 | + Map<String, Object> monthMap = new HashMap<>(); | |
| 431 | + monthMap.put("name", bloodSugarEnums.getName()); | |
| 432 | + boolean flag = true; | |
| 433 | + for (Map.Entry<Integer, Map<String, Object>> entry : monthAvgTemp.entrySet()) { | |
| 434 | + monthMap.put("name", bloodSugarEnums.getName()); | |
| 435 | + if(entry.getKey() == bloodSugarEnums.getId()) { | |
| 436 | + Map<String, Object> map = entry.getValue(); | |
| 437 | + Integer dayCount = (Integer) map.get("dayCount"); | |
| 438 | + Double sugarCount = (Double) map.get("sugarCount"); | |
| 439 | + monthMap.put("value", MathUtil.doubleFormat2(sugarCount / dayCount)); | |
| 440 | + flag = false; | |
| 441 | + } | |
| 442 | + } | |
| 443 | + if(flag) { | |
| 444 | + monthMap.put("value", ""); | |
| 445 | + } | |
| 446 | + monthAvgMap.add(monthMap); | |
| 447 | + } | |
| 448 | 448 | |
| 449 | 449 | |
| 450 | - List<Map<String, Object>> monthAvgMap = new ArrayList<>(); | |
| 451 | - List<Map<String, Object>> weekAvgMap = new ArrayList<>(); | |
| 452 | - Date monthStart = new Date(); | |
| 453 | - DateUtil.formatYmd(monthStart); | |
| 454 | - List<BloodSugar> bss = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("created").gte(monthStart)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); | |
| 450 | + List<Map<String, Object>> todayMap = new ArrayList<>(); | |
| 451 | + Date todayStart = new Date(); | |
| 452 | + DateUtil.formatYmd(todayStart); | |
| 453 | + List<BloodSugar> bss = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("created").gte(todayStart)).with(new Sort(Sort.Direction.DESC, "created")), BloodSugar.class); | |
| 455 | 454 | if (CollectionUtils.isNotEmpty(bss)) |
| 456 | 455 | { |
| 457 | 456 | for (BloodSugarEnums bloodSugarEnums : BloodSugarEnums.values()) { |
| ... | ... | @@ -470,8 +469,7 @@ |
| 470 | 469 | if(flag) { |
| 471 | 470 | monthMap.put("value", ""); |
| 472 | 471 | } |
| 473 | - monthAvgMap.add(monthMap); | |
| 474 | - weekAvgMap.add(monthMap); | |
| 472 | + todayMap.add(monthMap); | |
| 475 | 473 | } |
| 476 | 474 | |
| 477 | 475 | |
| ... | ... | @@ -512,7 +510,7 @@ |
| 512 | 510 | return RespBuilder.buildSuccess("restList", restList, "count", bloodSugars.size(), |
| 513 | 511 | "dayCount", dayCountSet.size(), "month", |
| 514 | 512 | monthCountSet3, "monthAvgMap", monthAvgMap, |
| 515 | - "weekAvgMap", weekAvgMap,"newBloodVal",newBloodMap,"weightInfo",weightInfo,"isReport",isReport,"id",id,"exceptionCount",exceptionCount); | |
| 513 | + "weekAvgMap", weekAvgMap,"newBloodVal",newBloodMap,"weightInfo",weightInfo,"isReport",isReport,"id",id,"exceptionCount",exceptionCount,"todayMap",todayMap); | |
| 516 | 514 | } |
| 517 | 515 | |
| 518 | 516 | private Map<String, List<BloodSugar>> sortMapByKey(Map<String, List<BloodSugar>> datas) { |