Commit ee34ecb9ef4a2012e2f63a59cf3bfa0378e8ffba

Authored by [wangbo]
1 parent 296e1adeaa
Exists in master and in 1 other branch dev

秦皇岛高危版报告

Showing 7 changed files with 674 additions and 7 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ ee34ecb
... ... @@ -4221,7 +4221,7 @@
4221 4221 for (int i = 1; i < rows; i++) {
4222 4222 System.out.println("rows=" + i);
4223 4223 QhdWeightConfigModel qhd = new QhdWeightConfigModel();
4224   -
  4224 + qhd.setIsHighRisk("0");
4225 4225 Cell[] cells = s.getRow(i);
4226 4226 if (cells.length > 0) {
4227 4227 //遍历每行中的每列
... ... @@ -4263,7 +4263,7 @@
4263 4263 for (int i = 1; i < rows1; i++) {
4264 4264 System.out.println("rows=" + i);
4265 4265 QhdWeightConfigModel qhd = new QhdWeightConfigModel();
4266   -
  4266 + qhd.setIsHighRisk("0");
4267 4267 Cell[] cells = s1.getRow(i);
4268 4268 if (cells.length > 0) {
4269 4269 //遍历每行中的每列
4270 4270  
... ... @@ -4321,7 +4321,352 @@
4321 4321  
4322 4322 }
4323 4323  
  4324 + /**
  4325 + * 秦皇岛孕妇高危版体重报告
  4326 + */
  4327 + public static void saveQhdGaoWeiWeight(String fileName) {
  4328 + ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
  4329 + MongoTemplate mongoTemplate
  4330 + = (MongoTemplate) applicationContext.getBean("mongoTemplate");
  4331 + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
  4332 + File file = new File(fileName);
  4333 + Workbook wb = null;
  4334 + try {
  4335 + wb = Workbook.getWorkbook(file);
4324 4336  
  4337 + Sheet s = wb.getSheet(0);
  4338 + System.out.println(s.getName() + " : ");
  4339 + int rows = s.getRows();
  4340 + if (rows > 0) {
  4341 + //遍历每行
  4342 + for (int i = 1; i < rows; i++) {
  4343 + System.out.println("rows=" + i);
  4344 + QhdWeightConfigModel qhd = new QhdWeightConfigModel();
  4345 + qhd.setIsHighRisk("1");//高危
  4346 + qhd.setHighRiskIlness("0");//高血压
  4347 + Cell[] cells = s.getRow(i);
  4348 + if (cells.length > 0) {
  4349 + //遍历每行中的每列
  4350 + for (int j = 0; j < cells.length; j++) {
  4351 + String str = cells[j].getContents().trim();
  4352 + if (StringUtils.isEmpty(str)) {
  4353 + continue;
  4354 + }
  4355 + switch (j) {
  4356 + case 0:
  4357 + qhd.setKcal(Integer.parseInt(str));
  4358 + continue;
  4359 + case 1:
  4360 + List<String> list1 = Arrays.asList(str.split("\n"));
  4361 + qhd.setEarlySuggests(list1);
  4362 + continue;
  4363 + case 2:
  4364 + List<String> list2 = Arrays.asList(str.split("\n"));
  4365 + qhd.setMiddleSuggests(list2);
  4366 + continue;
  4367 +
  4368 + case 3:
  4369 + List<String> list3 = Arrays.asList(str.split("\n"));
  4370 + qhd.setLaterSuggests(list3);
  4371 + continue;
  4372 +
  4373 + case 4:
  4374 + List<String> list4 = Arrays.asList(str.split("\n"));
  4375 + qhd.setDietRules(list4);
  4376 + continue;
  4377 + }
  4378 + }
  4379 +
  4380 + }
  4381 + mongoTemplate.save(qhd);
  4382 + }
  4383 + }
  4384 +
  4385 +
  4386 + Sheet s2 = wb.getSheet(2);
  4387 + System.out.println(s2.getName() + " : ");
  4388 + int rows2 = s2.getRows();
  4389 + if (rows2 > 0) {
  4390 + //遍历每行
  4391 + for (int i = 1; i < rows2; i++) {
  4392 + System.out.println("rows=" + i);
  4393 + QhdWeightConfigModel qhd = new QhdWeightConfigModel();
  4394 + qhd.setIsHighRisk("1");//高危
  4395 + qhd.setHighRiskIlness("0");//高血压
  4396 + Cell[] cells = s2.getRow(i);
  4397 + if (cells.length > 0) {
  4398 + //遍历每行中的每列
  4399 + for (int j = 0; j < cells.length; j++) {
  4400 + String str = cells[j].getContents().trim();
  4401 + if (StringUtils.isEmpty(str)) {
  4402 + continue;
  4403 + }
  4404 + switch (j) {
  4405 + case 0:
  4406 + qhd.setKcal(Integer.parseInt(str));
  4407 + continue;
  4408 + case 1:
  4409 + List<String> list1 = Arrays.asList(str.split("\n"));
  4410 + qhd.setBreakfast(list1);
  4411 + continue;
  4412 + case 2:
  4413 + List<String> list2 = Arrays.asList(str.split("\n"));
  4414 + qhd.setBreakfastAdd(list2);
  4415 + continue;
  4416 + case 3:
  4417 + List<String> list3 = Arrays.asList(str.split("\n"));
  4418 + qhd.setLunch(list3);
  4419 + continue;
  4420 + case 4:
  4421 + List<String> list4 = Arrays.asList(str.split("\n"));
  4422 + qhd.setLunchAdd(list4);
  4423 + continue;
  4424 + case 5:
  4425 + List<String> list5 = Arrays.asList(str.split("\n"));
  4426 + qhd.setDinner(list5);
  4427 + continue;
  4428 + case 6:
  4429 + List<String> list6 = Arrays.asList(str.split("\n"));
  4430 + qhd.setDinnerAdd(list6);
  4431 + continue;
  4432 + case 7:
  4433 + qhd.setPregnancy(Integer.parseInt(str));
  4434 + continue;
  4435 + }
  4436 +
  4437 + }
  4438 +
  4439 + }
  4440 + mongoTemplate.save(qhd);
  4441 + }
  4442 + }
  4443 +
  4444 +
  4445 + Sheet s3 = wb.getSheet(3);
  4446 + System.out.println(s3.getName() + " : ");
  4447 + int rows3 = s3.getRows();
  4448 + if (rows3 > 0) {
  4449 + //遍历每行
  4450 + for (int i = 1; i < rows3; i++) {
  4451 + System.out.println("rows3=" + i);
  4452 + QhdWeightConfigModel qhd = new QhdWeightConfigModel();
  4453 + qhd.setIsHighRisk("1");//高危
  4454 + qhd.setHighRiskIlness("1");//
  4455 + Cell[] cells = s3.getRow(i);
  4456 + if (cells.length > 0) {
  4457 + //遍历每行中的每列
  4458 + for (int j = 0; j < cells.length; j++) {
  4459 + String str = cells[j].getContents().trim();
  4460 + if (StringUtils.isEmpty(str)) {
  4461 + continue;
  4462 + }
  4463 + switch (j) {
  4464 + case 0:
  4465 + qhd.setKcal(Integer.parseInt(str));
  4466 + continue;
  4467 + case 1:
  4468 + List<String> list1 = Arrays.asList(str.split("\n"));
  4469 + qhd.setEarlySuggests(list1);
  4470 + continue;
  4471 + case 2:
  4472 + List<String> list2 = Arrays.asList(str.split("\n"));
  4473 + qhd.setMiddleSuggests(list2);
  4474 + continue;
  4475 +
  4476 + case 3:
  4477 + List<String> list3 = Arrays.asList(str.split("\n"));
  4478 + qhd.setLaterSuggests(list3);
  4479 + continue;
  4480 +
  4481 + case 4:
  4482 + List<String> list4 = Arrays.asList(str.split("\n"));
  4483 + qhd.setDietRules(list4);
  4484 + continue;
  4485 + }
  4486 + }
  4487 +
  4488 + }
  4489 + mongoTemplate.save(qhd);
  4490 + }
  4491 + }
  4492 +
  4493 +
  4494 + Sheet s5 = wb.getSheet(5);
  4495 + System.out.println(s5.getName() + " : ");
  4496 + int rows5 = s5.getRows();
  4497 + if (rows5 > 0) {
  4498 + //遍历每行
  4499 + for (int i = 1; i < rows5; i++) {
  4500 + System.out.println("rows=" + i);
  4501 + QhdWeightConfigModel qhd = new QhdWeightConfigModel();
  4502 + qhd.setIsHighRisk("1");//高危
  4503 + qhd.setHighRiskIlness("1");//高血压
  4504 + Cell[] cells = s5.getRow(i);
  4505 + if (cells.length > 0) {
  4506 + //遍历每行中的每列
  4507 + for (int j = 0; j < cells.length; j++) {
  4508 + String str = cells[j].getContents().trim();
  4509 + if (StringUtils.isEmpty(str)) {
  4510 + continue;
  4511 + }
  4512 + switch (j) {
  4513 + case 0:
  4514 + qhd.setKcal(Integer.parseInt(str));
  4515 + continue;
  4516 + case 1:
  4517 + List<String> list1 = Arrays.asList(str.split("\n"));
  4518 + qhd.setBreakfast(list1);
  4519 + continue;
  4520 + case 2:
  4521 + List<String> list2 = Arrays.asList(str.split("\n"));
  4522 + qhd.setBreakfastAdd(list2);
  4523 + continue;
  4524 + case 3:
  4525 + List<String> list3 = Arrays.asList(str.split("\n"));
  4526 + qhd.setLunch(list3);
  4527 + continue;
  4528 + case 4:
  4529 + List<String> list4 = Arrays.asList(str.split("\n"));
  4530 + qhd.setLunchAdd(list4);
  4531 + continue;
  4532 + case 5:
  4533 + List<String> list5 = Arrays.asList(str.split("\n"));
  4534 + qhd.setDinner(list5);
  4535 + continue;
  4536 + case 6:
  4537 + List<String> list6 = Arrays.asList(str.split("\n"));
  4538 + qhd.setDinnerAdd(list6);
  4539 + continue;
  4540 + case 7:
  4541 + qhd.setPregnancy(Integer.parseInt(str));
  4542 + continue;
  4543 + }
  4544 +
  4545 + }
  4546 +
  4547 + }
  4548 + mongoTemplate.save(qhd);
  4549 + }
  4550 + }
  4551 +
  4552 +
  4553 + Sheet s6 = wb.getSheet(6);
  4554 + System.out.println(s6.getName() + " : ");
  4555 + int rows6 = s6.getRows();
  4556 + if (rows6 > 0) {
  4557 + //遍历每行
  4558 + for (int i = 1; i < rows6; i++) {
  4559 + System.out.println("rows=" + i);
  4560 + QhdWeightConfigModel qhd = new QhdWeightConfigModel();
  4561 + qhd.setIsHighRisk("1");//贫血
  4562 + qhd.setHighRiskIlness("2");//高血压
  4563 + Cell[] cells = s6.getRow(i);
  4564 + if (cells.length > 0) {
  4565 + //遍历每行中的每列
  4566 + for (int j = 0; j < cells.length; j++) {
  4567 + String str = cells[j].getContents().trim();
  4568 + if (StringUtils.isEmpty(str)) {
  4569 + continue;
  4570 + }
  4571 + switch (j) {
  4572 + case 0:
  4573 + qhd.setKcal(Integer.parseInt(str));
  4574 + continue;
  4575 + case 1:
  4576 + List<String> list1 = Arrays.asList(str.split("\n"));
  4577 + qhd.setEarlySuggests(list1);
  4578 + continue;
  4579 + case 2:
  4580 + List<String> list2 = Arrays.asList(str.split("\n"));
  4581 + qhd.setMiddleSuggests(list2);
  4582 + continue;
  4583 +
  4584 + case 3:
  4585 + List<String> list3 = Arrays.asList(str.split("\n"));
  4586 + qhd.setLaterSuggests(list3);
  4587 + continue;
  4588 +
  4589 + case 4:
  4590 + List<String> list4 = Arrays.asList(str.split("\n"));
  4591 + qhd.setDietRules(list4);
  4592 + continue;
  4593 +
  4594 + }
  4595 + }
  4596 +
  4597 + }
  4598 + mongoTemplate.save(qhd);
  4599 + }
  4600 + }
  4601 +
  4602 +
  4603 + Sheet s8 = wb.getSheet(8);
  4604 + System.out.println(s8.getName() + " : ");
  4605 + int rows8 = s8.getRows();
  4606 + if (rows8 > 0) {
  4607 + //遍历每行
  4608 + for (int i = 1; i < rows8; i++) {
  4609 + System.out.println("rows=" + i);
  4610 + QhdWeightConfigModel qhd = new QhdWeightConfigModel();
  4611 + qhd.setIsHighRisk("1");//高危
  4612 + qhd.setHighRiskIlness("2");//糖尿病
  4613 + Cell[] cells = s8.getRow(i);
  4614 + if (cells.length > 0) {
  4615 + //遍历每行中的每列
  4616 + for (int j = 0; j < cells.length; j++) {
  4617 + String str = cells[j].getContents().trim();
  4618 + if (StringUtils.isEmpty(str)) {
  4619 + continue;
  4620 + }
  4621 + switch (j) {
  4622 + case 0:
  4623 + qhd.setKcal(Integer.parseInt(str));
  4624 + continue;
  4625 + case 1:
  4626 + List<String> list1 = Arrays.asList(str.split("\n"));
  4627 + qhd.setBreakfast(list1);
  4628 + continue;
  4629 + case 2:
  4630 + List<String> list2 = Arrays.asList(str.split("\n"));
  4631 + qhd.setBreakfastAdd(list2);
  4632 + continue;
  4633 + case 3:
  4634 + List<String> list3 = Arrays.asList(str.split("\n"));
  4635 + qhd.setLunch(list3);
  4636 + continue;
  4637 + case 4:
  4638 + List<String> list4 = Arrays.asList(str.split("\n"));
  4639 + qhd.setLunchAdd(list4);
  4640 + continue;
  4641 + case 5:
  4642 + List<String> list5 = Arrays.asList(str.split("\n"));
  4643 + qhd.setDinner(list5);
  4644 + continue;
  4645 + case 6:
  4646 + List<String> list6 = Arrays.asList(str.split("\n"));
  4647 + qhd.setDinnerAdd(list6);
  4648 + continue;
  4649 + case 7:
  4650 + qhd.setPregnancy(Integer.parseInt(str));
  4651 + continue;
  4652 + }
  4653 +
  4654 + }
  4655 +
  4656 + }
  4657 + mongoTemplate.save(qhd);
  4658 + }
  4659 + }
  4660 +
  4661 +
  4662 + } catch (IOException e) {
  4663 + e.printStackTrace();
  4664 + } catch (BiffException e) {
  4665 + e.printStackTrace();
  4666 + }
  4667 +
  4668 + }
  4669 +
4325 4670 public static void Test(String fileName) {
4326 4671 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
4327 4672 MongoTemplate mongoTemplate
4328 4673  
... ... @@ -4874,14 +5219,16 @@
4874 5219 //babyReport("G:\\儿童膳食报告.xls");
4875 5220 // saveQhdbabyDiaginose("F:\\承德工位\\秦皇岛儿童诊断 - 副本.xls");
4876 5221  
4877   - saveQhdWeight("F:\text.xls");
  5222 + //saveQhdWeight("F:\text.xls");
4878 5223 //
4879 5224 //saveQhdbabyDiaginose("F:\\承德工位\\秦皇岛儿童诊断 - 副本.xls");
4880 5225  
4881 5226  
4882 5227 //saveEvaluationCriterionModel("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童量表码表.xls");
4883 5228 //saveEvaluationCriterionModel2("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童智能等级.xls");
4884   - saveEvaluationCriterionModel3("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童神经心理发育情况.xls");
  5229 + // saveEvaluationCriterionModel3("D:\\user\\workspace\\产品中心\\区域平台\\需求资料\\儿童神经心理发育情况.xls");
  5230 + //saveQhdWeight("F:\\text.xls");
  5231 + saveQhdGaoWeiWeight("F:\\秦皇岛高危版体重报告.xls");
4885 5232 }
4886 5233  
4887 5234 }
platform-dal/src/main/java/com/lyms/platform/pojo/QhdWeightConfigModel.java View file @ ee34ecb
... ... @@ -18,6 +18,12 @@
18 18 private List<String> middleSuggests;//中期建议
19 19 private List<String> laterSuggests;//晚期建议
20 20  
  21 + private List<String> dietRules;//高危饮食规则
  22 + //是否高危 0正常版 1高危版
  23 + private String isHighRisk;
  24 +
  25 + //0.高血压 1 贫血 2 糖尿病
  26 + private String highRiskIlness;
21 27 /***
22 28 * 0 早期
23 29 * 1 中期
... ... @@ -27,6 +33,30 @@
27 33  
28 34 private Integer kcal; //整值卡路里
29 35  
  36 +
  37 + public String getHighRiskIlness() {
  38 + return highRiskIlness;
  39 + }
  40 +
  41 + public void setHighRiskIlness(String highRiskIlness) {
  42 + this.highRiskIlness = highRiskIlness;
  43 + }
  44 +
  45 + public List<String> getDietRules() {
  46 + return dietRules;
  47 + }
  48 +
  49 + public void setDietRules(List<String> dietRules) {
  50 + this.dietRules = dietRules;
  51 + }
  52 +
  53 + public String getIsHighRisk() {
  54 + return isHighRisk;
  55 + }
  56 +
  57 + public void setIsHighRisk(String isHighRisk) {
  58 + this.isHighRisk = isHighRisk;
  59 + }
30 60  
31 61 public List<String> getBreakfast() {
32 62 return breakfast;
platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java View file @ ee34ecb
... ... @@ -364,7 +364,6 @@
364 364 if (StringUtils.isNotEmpty(parentId)) {
365 365 condition = condition.and("parentId", parentId, MongoOper.IS);
366 366 }
367   -
368 367 if (null != parentIds) {
369 368 condition = condition.and("parentId", parentIds, MongoOper.IN);
370 369 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java View file @ ee34ecb
... ... @@ -270,5 +270,24 @@
270 270 return patientWeightService.getWeightsReport(pid, getUserId(request), rid, version);
271 271 }
272 272  
  273 +
  274 + /**
  275 + * 体重营养管理报表
  276 + *
  277 + * @param pid
  278 + * @return
  279 + */
  280 + @ResponseBody
  281 + @RequestMapping(value = "/qhdReport/{pid}", method = RequestMethod.GET)
  282 + @TokenRequired
  283 + public BaseResponse qhdReport(@PathVariable String pid,
  284 + HttpServletRequest request,
  285 + @RequestParam(value = "rid", required = false) String rid, String version) {
  286 + if (pid.isEmpty() || "null".equals(pid)) {
  287 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.USER_PASSWORD_ERROR).setErrormsg("pid值不能为空!");
  288 + }
  289 + return patientWeightService.qhdHighRiskReport(pid, getUserId(request), rid, version);
  290 + }
  291 +
273 292 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java View file @ ee34ecb
... ... @@ -847,7 +847,7 @@
847 847 // 婚检追访时间
848 848 temp.put("trackDownTime", CollectionUtils.isEmpty(trackDown) ? "--" : DateUtil.getyyyy_MM_dd(trackDown.get(0).getTrackDownDate()));
849 849 // 预约时间
850   - temp.put("yyTime", CollectionUtils.isEmpty(trackDown) ? "--" : DateUtil.getyyyy_MM_dd(downRecord.getAppointmentDate()));
  850 + temp.put("yyTime", downRecord.getAppointmentDate() == null ? "--" : DateUtil.getyyyy_MM_dd(downRecord.getAppointmentDate()));
851 851  
852 852  
853 853 //Long checkNum = mongoTemplate.count(Query.query(Criteria.where("certificateNum").is(archiveModel.getCertificateNum()).and("hospitalId").is(archiveModel.getHospitalId()).and("yn").is(1)), PremaritalCheckup.class);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java View file @ ee34ecb
... ... @@ -60,6 +60,8 @@
60 60  
61 61 BaseResponse getWeightsReport(String pid, Integer userId, String rid, String version);
62 62  
  63 + BaseResponse qhdHighRiskReport(String pid, Integer userId, String rid, String version);
  64 +
63 65 public void setReport(Map<String, Object> restMap, Map<Integer, String> weights, String beforeWeight,
64 66 String bmi, Map<String, String> dayWeights, String bregmatic);
65 67  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ ee34ecb
... ... @@ -106,6 +106,7 @@
106 106 return RespBuilder.buildSuccess("bregmaticEnums2", bregmaticEnums2, "type", type);
107 107 }
108 108  
  109 +
109 110 @Override
110 111 public BaseResponse addOrUpdate(Integer userId, PatientWeight patientWeight, String doctorId) {
111 112 String hospitalId = autoMatchFacade.getHospitalId(userId);
... ... @@ -688,7 +689,7 @@
688 689 } else {
689 690 pregnancys = 2;
690 691 }
691   - QhdWeightConfigModel qhdWeightConfig = mongoTemplate.findOne(Query.query(Criteria.where("kcal").is(k1).and("pregnancy").is(pregnancys)), QhdWeightConfigModel.class);
  692 + QhdWeightConfigModel qhdWeightConfig = mongoTemplate.findOne(Query.query(Criteria.where("kcal").is(k1).and("pregnancy").is(pregnancys).and("isHighRisk").is("0")), QhdWeightConfigModel.class);
692 693  
693 694 if (qhdWeightConfig != null) {
694 695 setRecipe(map, qhdWeightConfig, week, kmap);//秦皇岛设置食谱
... ... @@ -1133,6 +1134,7 @@
1133 1134 map.put("cookbooks", cookbooks);
1134 1135 map.put("cookbookTitle", "推荐菜谱");
1135 1136 }
  1137 +
1136 1138 private void setCookbookQhd(Map<String, Object> map, WeightConfigModel configModel) {
1137 1139 List<WeightConfigModel.Cookbook> cookbooks = configModel.getCookbooks();
1138 1140 map.put("cookbooks", cookbooks);
... ... @@ -2276,6 +2278,143 @@
2276 2278 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(this.getFirstOrNull(datas));
2277 2279 }
2278 2280  
  2281 + /**
  2282 + * 秦皇岛高危报告
  2283 + */
  2284 + @Override
  2285 + public BaseResponse qhdHighRiskReport(String pid, Integer userId, String rid, String version) {
  2286 + Map<String, Map<Integer, Double>> series = new HashMap<>();
  2287 + Map<String, Map<String, Object>> datas = new TreeMap<>();
  2288 + PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(pid)), PatientWeight.class);
  2289 + //1.获取该孕妇是否有推荐的高危项
  2290 + Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(patientWeight.getPatientId())), Patients.class);
  2291 + //1.1获取到这孕妇所有的高危因素id
  2292 + //1.2获取身高
  2293 + /* String height = patientWeight.getBeforeHeight();
  2294 + //获取体重
  2295 + String weight = patientWeight.getBeforeWeight();*/
  2296 + Double heights = Double.valueOf(patientWeight.getBeforeHeight()).doubleValue() / 100;
  2297 + int week = DateUtil.getWeek2(patients.getLastMenses(), new Date());
  2298 + //获取胎数
  2299 + String bregmatic = patientWeight.getBregmatic();
  2300 + //获取bmi值
  2301 + Double bmiD = Double.valueOf(this.getBmi(patientWeight.getBeforeWeight(), patientWeight.getBeforeHeight())).doubleValue();
  2302 + String bmiStr = "";
  2303 + //空和1表示单胎
  2304 + if (!org.apache.commons.lang.StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) {
  2305 + if (bmiD < 18.5) {
  2306 + bmiStr = "BMI<18.5";
  2307 + } else if (bmiD >= 18.5 && bmiD <= 24.99) {
  2308 + bmiStr = "BMI=18.5-24.9";
  2309 + } else if (bmiD > 24.9 && bmiD < 30) {
  2310 + bmiStr = "BMI=25-29.9";
  2311 + } else if (bmiD >= 30) {
  2312 + bmiStr = "BMI≥30";
  2313 + }
  2314 + } else {
  2315 + if (bmiD <= 24.9) {
  2316 + bmiStr = "BMI≤24.9";
  2317 + } else if (bmiD >= 25 && bmiD <= 29.99) {
  2318 + bmiStr = "BMI=25-29.9";
  2319 + } else if (bmiD >= 30) {
  2320 + bmiStr = "BMI≥30";
  2321 + }
  2322 + }
  2323 + //计算出区间范围
  2324 + double low = 0.0;
  2325 + double high = 0.0;
  2326 + this.getSerie(series, bmiStr, bregmatic);
  2327 + Map<Integer, Double> lowMap = series.get("lowData");
  2328 + for (Map.Entry<Integer, Double> entry : lowMap.entrySet()) {
  2329 + if (entry.getKey() == week) {
  2330 + }
  2331 + }
  2332 + Map<Integer, Double> highMap = series.get("highData");
  2333 + for (Map.Entry<Integer, Double> entry : highMap.entrySet()) {
  2334 + if (entry.getKey() == week) {
  2335 + high = entry.getValue();
  2336 + }
  2337 + }
  2338 +
  2339 + //20190602 上线前新加bug
  2340 + //计算出属于那种类型 偏重 还事负重 还是正常 当前体重-孕前体重
  2341 + Double residualWeight = Double.valueOf(patientWeight.getNowWeight()).doubleValue() - Double.valueOf(patientWeight.getBeforeWeight()).doubleValue();
  2342 + //贫血/高血压计算规则
  2343 + Integer gxyKcal = this.getRounding((int) this.getKcal(bregmatic, residualWeight, low, high, week, bmiD, patients, patientWeight, heights, 1.12));
  2344 + //糖尿病计算规则
  2345 + Integer diabetesKcal = getDiabetesRounding((int) this.getDiabetes(heights, week));
  2346 +
  2347 + System.out.println("diabetesKcal " + diabetesKcal);
  2348 +
  2349 + //获取改孕妇的高危项
  2350 + String risk = patients.getRiskLevelId();
  2351 + if (risk.contains("eb146c03-b19f-4e28-b85f-fda574b2283b")) {
  2352 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("警告").setData("该风险已超过管控范围,请到医生处进行咨询");
  2353 + } else {
  2354 + //获取视图
  2355 + Map<String, String> dayWeights = patientWeight.getDayWeights();
  2356 + Map<Integer, String> weights = new LinkedHashMap<>();
  2357 + if (MapUtils.isNotEmpty(dayWeights)) {
  2358 + Set<Map.Entry<String, String>> entries = dayWeights.entrySet();
  2359 + for (Map.Entry<String, String> entry : entries) {
  2360 + weights.put(DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(entry.getKey())), entry.getValue());
  2361 + }
  2362 + }
  2363 + Map<String, Object> data0 = new HashMap<>();
  2364 + Map<String, Object> data2 = new HashMap<>();
  2365 + Map<String, Object> data3 = new HashMap<>();
  2366 + List<String> reiskFactor = patients.getRiskFactorId();
  2367 + for (String reis : reiskFactor) {
  2368 + //糖尿病
  2369 + if (this.initReport("0").contains(reis)) {
  2370 + List<QhdWeightConfigModel> diabetes = mongoTemplate.find(Query.query(Criteria.where("kcal").is(diabetesKcal).and("isHighRisk").is("1").and("highRiskIlness").is("0")), QhdWeightConfigModel.class);
  2371 + datas.put("1", this.getQhdInfo(weights, data3, diabetes, patientWeight, patients, bmiD, week));
  2372 + } else if (this.initReport("1").contains(reis)) {
  2373 + //高血压
  2374 + List<QhdWeightConfigModel> feritin = mongoTemplate.find(Query.query(Criteria.where("kcal").is(gxyKcal).and("isHighRisk").is("1").and("highRiskIlness").is("1")), QhdWeightConfigModel.class);
  2375 + datas.put("2", this.getQhdInfo(weights, data2, feritin, patientWeight, patients, bmiD, week));
  2376 + } else if (this.initReport("2").contains(reis)) {
  2377 + //贫血
  2378 + List<QhdWeightConfigModel> anemia = mongoTemplate.find(Query.query(Criteria.where("kcal").is(gxyKcal).and("isHighRisk").is("1").and("highRiskIlness").is("2")), QhdWeightConfigModel.class);
  2379 + datas.put("3", this.getQhdInfo(weights, data0, anemia, patientWeight, patients, bmiD, week));
  2380 + }
  2381 + }
  2382 + }
  2383 + if (datas.size() == 0) {
  2384 + BaseResponse baseResponse = this.report(pid, userId, rid, "1");
  2385 + return baseResponse;
  2386 + }
  2387 + /*//同时出现高血压和肝硬化或肝功能不全则按照肝硬化或肝功能不全
  2388 + if (datas.containsKey("3") && datas.containsKey("8")) {
  2389 + datas.put("2", datas.get("8"));
  2390 + }*/
  2391 +
  2392 + List<Map<String, Object>> dayWeights2 = patientWeight.getDayWeights2();
  2393 + String doctorId = "";
  2394 + if (CollectionUtils.isNotEmpty(dayWeights2)) {
  2395 + for (Map map : dayWeights2) {
  2396 + Object data = map.get("data");
  2397 + if (data != null) {
  2398 + String dbData = data.toString();
  2399 + String currentDate = DateUtil.getyyyy_MM_dd(new Date());
  2400 + if (dbData.equals(currentDate)) {
  2401 + Object doctorIdObj = map.get("doctorId");
  2402 + if (doctorId != null) {
  2403 + doctorId = (String) doctorIdObj;
  2404 + }
  2405 + }
  2406 + }
  2407 + }
  2408 + }
  2409 + healthChargeFacade.addHealthCharge(patientWeight.getHospitalId(), 1, patientWeight.getPatientId(), 2, 1, userId, doctorId, false);
  2410 +
  2411 + PatientWeight patientWeight1 = new PatientWeight();
  2412 + patientWeight1.setPrintingTime(new Date());
  2413 + patientWeightService2.update(Query.query(Criteria.where("_id").is(pid)), patientWeight1);
  2414 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(this.getFirstOrNull(datas));
  2415 + }
  2416 +
  2417 +
2279 2418 //获取第一个map中数据值
2280 2419 private static Object getFirstOrNull(Map<String, Map<String, Object>> map) {
2281 2420 Object obj = null;
... ... @@ -2410,6 +2549,101 @@
2410 2549 return data;
2411 2550 }
2412 2551  
  2552 +
  2553 + /**
  2554 + * 秦皇岛定制
  2555 + **/
  2556 + public Map getQhdInfo(Map<Integer, String> weights, Map<String, Object> data, List<QhdWeightConfigModel> weightReportModel, PatientWeight patientWeight, Patients patients, double bmi, int week) {
  2557 + setReport(data, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(), patientWeight.getBregmatic());
  2558 + Map userMap = new HashMap();
  2559 + userMap.put("userName", patients.getUsername());
  2560 + userMap.put("age", patients.getAge() + "岁");
  2561 + userMap.put("height", patientWeight.getBeforeHeight() + "cm");
  2562 + userMap.put("bmi", bmi);
  2563 + userMap.put("week", "孕" + week + "周");
  2564 + userMap.put("vcCardNo", patients.getVcCardNo());
  2565 + userMap.put("phone", patients.getPhone());
  2566 + userMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate()));
  2567 + userMap.put("NowWeight", patientWeight.getNowWeight() + "kg");
  2568 + userMap.put("BeforeWeight", patientWeight.getBeforeWeight() + "kg");
  2569 + userMap.put("state", this.getState(patientWeight.getNowWeight(), patientWeight.getBeforeWeight(), patientWeight.getBregmatic(), week, bmi));
  2570 +
  2571 + //userMap.put("riskFactor", set);
  2572 + data.put("userInfo", userMap);
  2573 + /* Map map2 = new HashMap();
  2574 + map2.put("guideTitle", weightReportModel.getGuideTitle());
  2575 + map2.put("guideInfo", weightReportModel.getGuideInfo());
  2576 + data.put("nutritionGuide", map2);*/
  2577 + Map map1 = new HashMap();
  2578 + Map map3 = new HashMap();
  2579 + Map map4 = new HashMap();
  2580 + for (QhdWeightConfigModel qhd : weightReportModel) {
  2581 + if (null != qhd.getDietRules()) {
  2582 + // map3.put("dietTitle", weightReportModel.getDietTitle());
  2583 + map3.put("dietInfo", qhd.getDietRules());
  2584 + }
  2585 + if (null != qhd.getPregnancy()) {
  2586 +
  2587 + if (week < 12 && qhd.getPregnancy() == 0) {
  2588 + map1.put("kacl", qhd.getKcal());
  2589 + map1.put("breakfast", qhd.getBreakfast());
  2590 + map1.put("breakfastAdd", qhd.getBreakfastAdd());
  2591 + map1.put("lunch", qhd.getLunch());
  2592 + map1.put("lunchAdd", qhd.getLunchAdd());
  2593 + map1.put("dinner", qhd.getDinner());
  2594 + map1.put("dinnerAdd", qhd.getDinnerAdd());
  2595 + //孕中期
  2596 + } else if (week <= 28 && week >= 12 && qhd.getPregnancy() == 1) {
  2597 + map1.put("kacl", qhd.getKcal());
  2598 + map1.put("breakfast", qhd.getBreakfast());
  2599 + map1.put("breakfastAdd", qhd.getBreakfastAdd());
  2600 + map1.put("lunch", qhd.getLunch());
  2601 + map1.put("lunchAdd", qhd.getLunchAdd());
  2602 + map1.put("dinner", qhd.getDinner());
  2603 + map1.put("dinnerAdd", qhd.getDinnerAdd());
  2604 + //孕晚期
  2605 + } else if (week <= 40 && week >= 29 && qhd.getPregnancy() == 2) {
  2606 + map1.put("kacl", qhd.getKcal());
  2607 + map1.put("breakfast", qhd.getBreakfast());
  2608 + map1.put("breakfastAdd", qhd.getBreakfastAdd());
  2609 + map1.put("lunch", qhd.getLunch());
  2610 + map1.put("lunchAdd", qhd.getLunchAdd());
  2611 + map1.put("dinner", qhd.getDinner());
  2612 + map1.put("dinnerAdd", qhd.getDinnerAdd());
  2613 + }
  2614 +
  2615 + }
  2616 + if (week >= 0 && week <= 12 && CollectionUtils.isNotEmpty(qhd.getEarlySuggests())) {
  2617 + map1.put("proposalInfo", qhd.getEarlySuggests());
  2618 + } else if (week >= 13 && week <= 28 && CollectionUtils.isNotEmpty(qhd.getMiddleSuggests())) {
  2619 + map1.put("proposalInfo", qhd.getMiddleSuggests());
  2620 + } else if (week >= 29 && week <= 40 && CollectionUtils.isNotEmpty(qhd.getLaterSuggests())) {
  2621 + map1.put("proposalInfo", qhd.getLaterSuggests());
  2622 + }
  2623 + }
  2624 +
  2625 + data.put("recipes", map1);
  2626 + data.put("dietaryRules", map3);
  2627 +
  2628 + /* if (null != weightReportModel.getWeeks() && weightReportModel.getWeeks() == week) {
  2629 + Map map = new HashMap();
  2630 + map.put("weeks", weightReportModel.getWeeks());
  2631 + map.put("becareful", weightReportModel.getBecareful());
  2632 + data.put("attentionWeek", map);
  2633 + }*/
  2634 + List<String> healthy = new ArrayList();
  2635 + healthy.add("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");//健康id//
  2636 + healthy.add("a427da89-594a-46c2-b9f7-1b0d355ce54c");//28>BMI>25
  2637 + healthy.add("5a40c6c5422b03d4ad2bf7bd");//BMI<18.5
  2638 + if (patients.getRiskFactorId().size() - this.getSame(healthy, patients.getRiskFactorId()).size() >= 2) {
  2639 + Map map = new HashMap();
  2640 + map.put("tipsInfo", "您当前情况存在两种及以上高危风险因素,需请您的主管医生结合临床实际情况对报告进行解读,并根据医生解读建议,指导日常营养膳食");
  2641 + data.put("tips", map);
  2642 + }
  2643 + return data;
  2644 + }
  2645 +
  2646 +
2413 2647 //获取俩个list相同数据
2414 2648 public List getSame(List list1, List list2) {
2415 2649 List sameList = new ArrayList();
... ... @@ -3085,6 +3319,42 @@
3085 3319  
3086 3320 }
3087 3321 return status;
  3322 + }
  3323 +
  3324 + /**
  3325 + * 0.糖尿病
  3326 + * 1.高血压
  3327 + * 2.贫血
  3328 + **/
  3329 + private List<String> initReport(String type) {
  3330 + //糖尿病
  3331 + List<String> diabetesList = new ArrayList<>();
  3332 + diabetesList.add("5aab6d3d422b03d4ad2bf83e");//妊娠期糖尿病(无需药物治疗)
  3333 + diabetesList.add("5aab6d3e422b03d4ad2bf83f");//糖尿病合并妊娠(无需药物治疗)
  3334 + diabetesList.add("de7468e6-1bb5-4fab-ae84-78857868409a");//需药物治疗的糖尿病
  3335 +
  3336 + //贫血
  3337 + List<String> anemiaList = new ArrayList<>();
  3338 + anemiaList.add("5a41f715422b03d4ad2bf7f7");//妊娠合并贫血(Hb 60-110g/L)
  3339 + anemiaList.add("5aab6d3e422b03d4ad2bf847");//轻度缺铁性贫血(100-109g/L)
  3340 + anemiaList.add("5aab6d3e422b03d4ad2bf848");//中度缺铁性贫血(70-99g/L)
  3341 + anemiaList.add("5a41fa0c422b03d4ad2bf814");//重度贫血(Hb≤40g/L)
  3342 + anemiaList.add("82e4441b-7072-443e-a30f-39b0b4504d75");//重度贫血(Hb40-60g/L)
  3343 + anemiaList.add("80c41987-fd8a-4595-a773-088b60a6a33d");//再生障碍性贫血
  3344 +
  3345 + //高血压
  3346 + List<String> hypertensionList = new ArrayList<>();
  3347 + hypertensionList.add("5aab6d3f422b03d4ad2bf854");//妊娠期高血压
  3348 + hypertensionList.add("5aab6d3f422b03d4ad2bf856");//慢性高血压合并妊娠
  3349 + if ("0".equals(type)) {
  3350 + return diabetesList;
  3351 + } else if ("1".equals(type)) {
  3352 + return hypertensionList;
  3353 + } else if ("2".equals(type)) {
  3354 + return anemiaList;
  3355 + } else {
  3356 + return null;
  3357 + }
3088 3358 }
3089 3359  
3090 3360 }