Commit 463db6e6d9354519e6fa9fadc8164da27826366c

Authored by dongqin

Merge remote-tracking branch 'origin/master'

Showing 8 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 463db6e
... ... @@ -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 @ 463db6e
... ... @@ -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 @ 463db6e
... ... @@ -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 @ 463db6e
... ... @@ -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 @ 463db6e
... ... @@ -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 @ 463db6e
... ... @@ -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/BabyEvaluationCriterionServiceImpl.java View file @ 463db6e
... ... @@ -23,6 +23,7 @@
23 23 import org.springframework.data.mongodb.core.query.Update;
24 24 import org.springframework.stereotype.Service;
25 25  
  26 +import java.math.BigDecimal;
26 27 import java.util.*;
27 28  
28 29 /**
... ... @@ -47,7 +48,7 @@
47 48  
48 49  
49 50 /**
50   - * 获取儿童神经心理发育检查项 最近五个月的检查项
  51 + * 获取儿童神经心理发育检查项 最近三/四/五个月的检查项
51 52 *
52 53 * @param babyId
53 54 * @return
54 55  
55 56  
56 57  
57 58  
58 59  
59 60  
60 61  
61 62  
62 63  
... ... @@ -66,43 +67,45 @@
66 67 }
67 68 int month3 = getCurrentMonth(month, 3);
68 69 if (month3 >= 3 && month3 <= 72) {
  70 +
  71 + // 大于等于3月龄 小于等于72月龄
69 72 int month2 = getCurrentMonth(month3, 2);
70 73 int month1 = getCurrentMonth(month2, 2);
71 74 int month4 = getCurrentMonth(month3, 4);
72 75 int month5 = getCurrentMonth(month4, 4);
73 76 months = new int[]{month1, month2, month3, month4, month5};
74   - //mapList = getListMap(months, babyId, checkMonth);
75   - }
76 77  
77   - if (month3 < 3) {
  78 + }else if (month3 < 3) {
78 79 if (month3 == 1) {
  80 +
  81 + // 等于1月龄
79 82 int month4 = getCurrentMonth(month3, 4);
80 83 int month5 = getCurrentMonth(month4, 4);
81 84 months = new int[] {month3, month4, month5};
82   - //mapList = getListMap(months);
83   - }
84   - if (month3 == 2) {
  85 +
  86 + }else if (month3 == 2) {
  87 +
  88 + // 等于2月龄
85 89 int month2 = getCurrentMonth(month3, 2);
86 90 int month4 = getCurrentMonth(month3, 4);
87 91 int month5 = getCurrentMonth(month4, 4);
88 92 months = new int[] {month2, month3, month4, month5};
89   - //mapList = getListMap(months);
90 93 }
91   - }
92   -
93   - if (month3 > 72 && month3 <= 84) {
  94 + } else if (month3 > 72 && month3 <= 84) {
94 95 if (month3 == 78) {
  96 +
  97 + // 等于78月龄
95 98 int month2 = getCurrentMonth(month3, 2);
96 99 int month1 = getCurrentMonth(month2, 2);
97 100 int month4 = getCurrentMonth(month3, 4);
98 101 months = new int[]{month1, month2, month3, month4};
99   - //mapList = getListMap(months);
100   - }
101   - if (month3 == 84) {
  102 +
  103 + }else if (month3 == 84) {
  104 +
  105 + // 等于84月龄
102 106 int month2 = getCurrentMonth(month3, 2);
103 107 int month1 = getCurrentMonth(month2, 2);
104 108 months = new int[]{month1, month2, month3};
105   - //mapList = getListMap(months);
106 109 }
107 110 }
108 111 stringObjectMap = getListMap(months, babyId, checkMonth);
109 112  
... ... @@ -153,9 +156,12 @@
153 156 private Map<String, Object> getListMap(int [] months, String babyId, Integer checkMonth) {
154 157 Map<String, Object> resultMap = new HashMap<>(16);
155 158 String neuroPsychologicalId = null;
156   - Double totalProjectVal = 0D;
  159 + // 智龄
  160 + Integer mentalAge = 0;
157 161 List<Map<String, Object>> mapList = new LinkedList<>();
158   - for (int i = 0; i < months.length ; i++) {
  162 + for (int i = 0, size = months.length; i < size ; i++) {
  163 + // 当前本月的被勾选的总分数
  164 + Double currentProjectVal = 0D;
159 165 int currentMonth = months[i];
160 166 // 月龄对应的数据
161 167 Map<String, Object> objectMap = new HashMap<>();
... ... @@ -181,7 +187,7 @@
181 187 and("babyId").is(babyId).and("yn").is(YnEnums.YES.getId()).and("checkMonth").is(checkMonth)), BabyNeuroPsychologicalModel.class);
182 188 if (one != null) {
183 189 isSelected = true;
184   - totalProjectVal += projectVal;
  190 + currentProjectVal += projectVal;
185 191 if (neuroPsychologicalId == null) {
186 192 neuroPsychologicalId = one.getId();
187 193 }
188 194  
189 195  
... ... @@ -197,8 +203,39 @@
197 203 map.put("projectType", entry.getKey());
198 204 map.put("detailList", list);
199 205 }
  206 +
  207 + int developmentQuotient = 0;
  208 + if (currentProjectVal > 0) {
  209 + mentalAge = new BigDecimal(currentProjectVal).divide(new BigDecimal(5), 0, BigDecimal.ROUND_HALF_UP).intValue();
  210 + developmentQuotient = new BigDecimal(mentalAge).divide(new BigDecimal(checkMonth), 0, BigDecimal.ROUND_HALF_UP).intValue();
  211 + developmentQuotient *= 100;
  212 + }
  213 + // 当前测试时月龄
  214 + objectMap.put("checkMonth", checkMonth);
  215 + // 配置对应的月龄
200 216 objectMap.put("month", currentMonth);
  217 + // 领域组
201 218 objectMap.put("listGroup", listGroup);
  219 + BabyEvaluationCriterionModel criterionModel = mongoTemplate.findOne(Query.query(Criteria.where("type").is(2).
  220 + and("minBorder").lte(developmentQuotient).and("maxBorder").gte(developmentQuotient)), BabyEvaluationCriterionModel.class);
  221 + String aptitudeName = null,levelName = null;
  222 + if (criterionModel != null) {
  223 + aptitudeName = criterionModel.getAptitudeName();
  224 + levelName = criterionModel.getLevelName();
  225 + }
  226 + // 发育商、智能、等级评价
  227 + objectMap.put("developmentQuotient", developmentQuotient);
  228 + objectMap.put("aptitudeName", aptitudeName);
  229 + objectMap.put("levelName", levelName);
  230 +
  231 + // 当前检查时间
  232 + BabyNeuroPsychologicalModel one = mongoTemplate.findOne(Query.query(
  233 + Criteria.where("babyId").is(babyId).and("yn").is(YnEnums.YES.getId()).and("checkMonth").is(checkMonth)), BabyNeuroPsychologicalModel.class);
  234 + String currentCheckTime = one == null
  235 + ? ""
  236 + : (one.getUpdateTime() == null ? DateUtil.getYmd(one.getCreateTime()) : DateUtil.getYmd(one.getUpdateTime()));
  237 + objectMap.put("currentCheckTime", currentCheckTime);
  238 +
202 239 mapList.add(objectMap);
203 240 }
204 241 resultMap.put("configs", mapList);
205 242  
... ... @@ -246,10 +283,12 @@
246 283 with(new Sort(new Sort.Order(Sort.Direction.ASC, "createTime"))), BabyNeuroPsychologicalModel.class);
247 284 List<Object> objectList = new ArrayList<>();
248 285 if (CollectionUtils.isNotEmpty(models)) {
  286 +
249 287 // 若该儿童做过该项检查,一次查出
250 288 for (BabyNeuroPsychologicalModel model : models) {
251 289 BaseResponse itemListByBabyId = getItemListByBabyId(model.getBabyId(), model.getCheckMonth());
252 290 if (itemListByBabyId.getErrorcode() != 0) {
  291 + // 出错直接return
253 292 return itemListByBabyId;
254 293 }
255 294 List<Map<String, Object>> mapList = (List<Map<String, Object>>) itemListByBabyId.getObject();
... ... @@ -260,6 +299,7 @@
260 299 return baseResponse;
261 300 } else {
262 301  
  302 + // 根据当前儿童显示项目领域的配置信息,以供save
263 303 return getItemListByBabyId(babyId,null);
264 304 }
265 305 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 463db6e
... ... @@ -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,144 @@
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 + //糖尿病
  2370 + if (this.initReport("0").contains(reis)) {
  2371 + List<QhdWeightConfigModel> diabetes = mongoTemplate.find(Query.query(Criteria.where("kcal").is(diabetesKcal).and("isHighRisk").is("1").and("highRiskIlness").is("0")), QhdWeightConfigModel.class);
  2372 + datas.put("1", this.getQhdInfo(weights, data3, diabetes, patientWeight, patients, bmiD, week));
  2373 + } else if (this.initReport("1").contains(reis)) {
  2374 + //高血压
  2375 + List<QhdWeightConfigModel> feritin = mongoTemplate.find(Query.query(Criteria.where("kcal").is(gxyKcal).and("isHighRisk").is("1").and("highRiskIlness").is("1")), QhdWeightConfigModel.class);
  2376 + datas.put("2", this.getQhdInfo(weights, data2, feritin, patientWeight, patients, bmiD, week));
  2377 + } else if (this.initReport("2").contains(reis)) {
  2378 + //贫血
  2379 + List<QhdWeightConfigModel> anemia = mongoTemplate.find(Query.query(Criteria.where("kcal").is(gxyKcal).and("isHighRisk").is("1").and("highRiskIlness").is("2")), QhdWeightConfigModel.class);
  2380 + datas.put("3", this.getQhdInfo(weights, data0, anemia, patientWeight, patients, bmiD, week));
  2381 + }
  2382 + }
  2383 + }
  2384 + if (datas.size() == 0) {
  2385 + BaseResponse baseResponse = this.report(pid, userId, rid, "1");
  2386 + return baseResponse;
  2387 + }
  2388 + /*//同时出现高血压和肝硬化或肝功能不全则按照肝硬化或肝功能不全
  2389 + if (datas.containsKey("3") && datas.containsKey("8")) {
  2390 + datas.put("2", datas.get("8"));
  2391 + }*/
  2392 +
  2393 + List<Map<String, Object>> dayWeights2 = patientWeight.getDayWeights2();
  2394 + String doctorId = "";
  2395 + if (CollectionUtils.isNotEmpty(dayWeights2)) {
  2396 + for (Map map : dayWeights2) {
  2397 + Object data = map.get("data");
  2398 + if (data != null) {
  2399 + String dbData = data.toString();
  2400 + String currentDate = DateUtil.getyyyy_MM_dd(new Date());
  2401 + if (dbData.equals(currentDate)) {
  2402 + Object doctorIdObj = map.get("doctorId");
  2403 + if (doctorId != null) {
  2404 + doctorId = (String) doctorIdObj;
  2405 + }
  2406 + }
  2407 + }
  2408 + }
  2409 + }
  2410 + healthChargeFacade.addHealthCharge(patientWeight.getHospitalId(), 1, patientWeight.getPatientId(), 2, 1, userId, doctorId, false);
  2411 +
  2412 + PatientWeight patientWeight1 = new PatientWeight();
  2413 + patientWeight1.setPrintingTime(new Date());
  2414 + patientWeightService2.update(Query.query(Criteria.where("_id").is(pid)), patientWeight1);
  2415 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(this.getFirstOrNull(datas));
  2416 + }
  2417 +
  2418 +
2279 2419 //获取第一个map中数据值
2280 2420 private static Object getFirstOrNull(Map<String, Map<String, Object>> map) {
2281 2421 Object obj = null;
... ... @@ -2410,6 +2550,101 @@
2410 2550 return data;
2411 2551 }
2412 2552  
  2553 +
  2554 + /**
  2555 + * 秦皇岛定制
  2556 + **/
  2557 + public Map getQhdInfo(Map<Integer, String> weights, Map<String, Object> data, List<QhdWeightConfigModel> weightReportModel, PatientWeight patientWeight, Patients patients, double bmi, int week) {
  2558 + setReport(data, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(), patientWeight.getBregmatic());
  2559 + Map userMap = new HashMap();
  2560 + userMap.put("userName", patients.getUsername());
  2561 + userMap.put("age", patients.getAge() + "岁");
  2562 + userMap.put("height", patientWeight.getBeforeHeight() + "cm");
  2563 + userMap.put("bmi", bmi);
  2564 + userMap.put("week", "孕" + week + "周");
  2565 + userMap.put("vcCardNo", patients.getVcCardNo());
  2566 + userMap.put("phone", patients.getPhone());
  2567 + userMap.put("dueDate", DateUtil.getyyyy_MM_dd(patients.getDueDate()));
  2568 + userMap.put("NowWeight", patientWeight.getNowWeight() + "kg");
  2569 + userMap.put("BeforeWeight", patientWeight.getBeforeWeight() + "kg");
  2570 + userMap.put("state", this.getState(patientWeight.getNowWeight(), patientWeight.getBeforeWeight(), patientWeight.getBregmatic(), week, bmi));
  2571 +
  2572 + //userMap.put("riskFactor", set);
  2573 + data.put("userInfo", userMap);
  2574 + /* Map map2 = new HashMap();
  2575 + map2.put("guideTitle", weightReportModel.getGuideTitle());
  2576 + map2.put("guideInfo", weightReportModel.getGuideInfo());
  2577 + data.put("nutritionGuide", map2);*/
  2578 + Map map1 = new HashMap();
  2579 + Map map3 = new HashMap();
  2580 + Map map4 = new HashMap();
  2581 + for (QhdWeightConfigModel qhd : weightReportModel) {
  2582 + if (null != qhd.getDietRules()) {
  2583 + // map3.put("dietTitle", weightReportModel.getDietTitle());
  2584 + map3.put("dietInfo", qhd.getDietRules());
  2585 + }
  2586 + if (null != qhd.getPregnancy()) {
  2587 +
  2588 + if (week < 12 && qhd.getPregnancy() == 0) {
  2589 + map1.put("kacl", qhd.getKcal());
  2590 + map1.put("breakfast", qhd.getBreakfast());
  2591 + map1.put("breakfastAdd", qhd.getBreakfastAdd());
  2592 + map1.put("lunch", qhd.getLunch());
  2593 + map1.put("lunchAdd", qhd.getLunchAdd());
  2594 + map1.put("dinner", qhd.getDinner());
  2595 + map1.put("dinnerAdd", qhd.getDinnerAdd());
  2596 + //孕中期
  2597 + } else if (week <= 28 && week >= 12 && qhd.getPregnancy() == 1) {
  2598 + map1.put("kacl", qhd.getKcal());
  2599 + map1.put("breakfast", qhd.getBreakfast());
  2600 + map1.put("breakfastAdd", qhd.getBreakfastAdd());
  2601 + map1.put("lunch", qhd.getLunch());
  2602 + map1.put("lunchAdd", qhd.getLunchAdd());
  2603 + map1.put("dinner", qhd.getDinner());
  2604 + map1.put("dinnerAdd", qhd.getDinnerAdd());
  2605 + //孕晚期
  2606 + } else if (week <= 40 && week >= 29 && qhd.getPregnancy() == 2) {
  2607 + map1.put("kacl", qhd.getKcal());
  2608 + map1.put("breakfast", qhd.getBreakfast());
  2609 + map1.put("breakfastAdd", qhd.getBreakfastAdd());
  2610 + map1.put("lunch", qhd.getLunch());
  2611 + map1.put("lunchAdd", qhd.getLunchAdd());
  2612 + map1.put("dinner", qhd.getDinner());
  2613 + map1.put("dinnerAdd", qhd.getDinnerAdd());
  2614 + }
  2615 +
  2616 + }
  2617 + if (week >= 0 && week <= 12 && CollectionUtils.isNotEmpty(qhd.getEarlySuggests())) {
  2618 + map1.put("proposalInfo", qhd.getEarlySuggests());
  2619 + } else if (week >= 13 && week <= 28 && CollectionUtils.isNotEmpty(qhd.getMiddleSuggests())) {
  2620 + map1.put("proposalInfo", qhd.getMiddleSuggests());
  2621 + } else if (week >= 29 && week <= 40 && CollectionUtils.isNotEmpty(qhd.getLaterSuggests())) {
  2622 + map1.put("proposalInfo", qhd.getLaterSuggests());
  2623 + }
  2624 + }
  2625 +
  2626 + data.put("recipes", map1);
  2627 + data.put("dietaryRules", map3);
  2628 +
  2629 + /* if (null != weightReportModel.getWeeks() && weightReportModel.getWeeks() == week) {
  2630 + Map map = new HashMap();
  2631 + map.put("weeks", weightReportModel.getWeeks());
  2632 + map.put("becareful", weightReportModel.getBecareful());
  2633 + data.put("attentionWeek", map);
  2634 + }*/
  2635 + List<String> healthy = new ArrayList();
  2636 + healthy.add("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");//健康id//
  2637 + healthy.add("a427da89-594a-46c2-b9f7-1b0d355ce54c");//28>BMI>25
  2638 + healthy.add("5a40c6c5422b03d4ad2bf7bd");//BMI<18.5
  2639 + if (patients.getRiskFactorId().size() - this.getSame(healthy, patients.getRiskFactorId()).size() >= 2) {
  2640 + Map map = new HashMap();
  2641 + map.put("tipsInfo", "您当前情况存在两种及以上高危风险因素,需请您的主管医生结合临床实际情况对报告进行解读,并根据医生解读建议,指导日常营养膳食");
  2642 + data.put("tips", map);
  2643 + }
  2644 + return data;
  2645 + }
  2646 +
  2647 +
2413 2648 //获取俩个list相同数据
2414 2649 public List getSame(List list1, List list2) {
2415 2650 List sameList = new ArrayList();
... ... @@ -3085,6 +3320,42 @@
3085 3320  
3086 3321 }
3087 3322 return status;
  3323 + }
  3324 +
  3325 + /**
  3326 + * 0.糖尿病
  3327 + * 1.高血压
  3328 + * 2.贫血
  3329 + **/
  3330 + private List<String> initReport(String type) {
  3331 + //糖尿病
  3332 + List<String> diabetesList = new ArrayList<>();
  3333 + diabetesList.add("5aab6d3d422b03d4ad2bf83e");//妊娠期糖尿病(无需药物治疗)
  3334 + diabetesList.add("5aab6d3e422b03d4ad2bf83f");//糖尿病合并妊娠(无需药物治疗)
  3335 + diabetesList.add("de7468e6-1bb5-4fab-ae84-78857868409a");//需药物治疗的糖尿病
  3336 +
  3337 + //贫血
  3338 + List<String> anemiaList = new ArrayList<>();
  3339 + anemiaList.add("5a41f715422b03d4ad2bf7f7");//妊娠合并贫血(Hb 60-110g/L)
  3340 + anemiaList.add("5aab6d3e422b03d4ad2bf847");//轻度缺铁性贫血(100-109g/L)
  3341 + anemiaList.add("5aab6d3e422b03d4ad2bf848");//中度缺铁性贫血(70-99g/L)
  3342 + anemiaList.add("5a41fa0c422b03d4ad2bf814");//重度贫血(Hb≤40g/L)
  3343 + anemiaList.add("82e4441b-7072-443e-a30f-39b0b4504d75");//重度贫血(Hb40-60g/L)
  3344 + anemiaList.add("80c41987-fd8a-4595-a773-088b60a6a33d");//再生障碍性贫血
  3345 +
  3346 + //高血压
  3347 + List<String> hypertensionList = new ArrayList<>();
  3348 + hypertensionList.add("5aab6d3f422b03d4ad2bf854");//妊娠期高血压
  3349 + hypertensionList.add("5aab6d3f422b03d4ad2bf856");//慢性高血压合并妊娠
  3350 + if ("0".equals(type)) {
  3351 + return diabetesList;
  3352 + } else if ("1".equals(type)) {
  3353 + return hypertensionList;
  3354 + } else if ("2".equals(type)) {
  3355 + return anemiaList;
  3356 + } else {
  3357 + return null;
  3358 + }
3088 3359 }
3089 3360  
3090 3361 }