Commit 359c96b8eb7137b4fb71fcd4f2ffc34a6740a2e4
1 parent
6f1b239a32
Exists in
master
and in
6 other branches
update
Showing 2 changed files with 101 additions and 33 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
359c96b
| ... | ... | @@ -789,7 +789,7 @@ |
| 789 | 789 | pq.setLimit(riskPatientsQueryRequest.getLimit()); |
| 790 | 790 | List <Patients> ps = patientsService.queryPatientBySort(pq, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder()); |
| 791 | 791 | if (CollectionUtils.isNotEmpty(ps)) { |
| 792 | - data = convertToQuanWeight(ps); | |
| 792 | + data = convertToQuanWeight(ps,null); | |
| 793 | 793 | } |
| 794 | 794 | } |
| 795 | 795 | } |
| ... | ... | @@ -841,7 +841,7 @@ |
| 841 | 841 | List<MaternalDeliverModel> deliverModels = mongoTemplate.find(querymd, MaternalDeliverModel.class); |
| 842 | 842 | if(CollectionUtils.isNotEmpty(deliverModels)){ |
| 843 | 843 | MaternalDeliverModel maternalDeliverModel = deliverModels.get(0); |
| 844 | - idsMd.add(patients.getId()); | |
| 844 | + idsMd.add(maternalDeliverModel.getParentId()); | |
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | } |
| ... | ... | @@ -869,7 +869,7 @@ |
| 869 | 869 | pq.setLimit(riskPatientsQueryRequest.getLimit()); |
| 870 | 870 | List <Patients> ps = patientsService.queryPatientBySort(pq, riskPatientsQueryRequest.getSort(), riskPatientsQueryRequest.getOrder()); |
| 871 | 871 | if(CollectionUtils.isNotEmpty(ps)){ |
| 872 | - data = convertToQuanWeight(ps); | |
| 872 | + data = convertToQuanWeight(ps,"judaer");//judaer巨大儿管理 | |
| 873 | 873 | } |
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | |
| ... | ... | @@ -939,11 +939,13 @@ |
| 939 | 939 | if (CollectionUtils.isNotEmpty(list)) { |
| 940 | 940 | for (Map map : list) { |
| 941 | 941 | Map m = new HashMap <>(); |
| 942 | + m.put("fmDate", map.get("fmDate")); | |
| 942 | 943 | m.put("username", map.get("username")); |
| 943 | 944 | m.put("age", map.get("age")); |
| 944 | 945 | m.put("phone", map.get("phone")); |
| 945 | - m.put("currentWeek", map.get("currentWeek")); | |
| 946 | + m.put("fmWeek", map.get("fmWeek")); | |
| 946 | 947 | m.put("riskFactor", map.get("riskFactor")); |
| 948 | + m.put("babyWeight", map.get("babyWeight")); | |
| 947 | 949 | m.put("bmi", map.get("bmi")); |
| 948 | 950 | m.put("beforeHeight", map.get("beforeHeight")); |
| 949 | 951 | m.put("beforeWeight", map.get("beforeWeight")); |
| ... | ... | @@ -968,7 +970,7 @@ |
| 968 | 970 | } |
| 969 | 971 | OutputStream out = response.getOutputStream(); |
| 970 | 972 | Map<String, String> cnames = new LinkedHashMap<>(); |
| 971 | - cnamesMap(cnames); | |
| 973 | + cnamesMapWeight(cnames); | |
| 972 | 974 | response.setContentType("application/octet-stream"); |
| 973 | 975 | response.setCharacterEncoding("UTF-8"); |
| 974 | 976 | response.setHeader("Content-Disposition", "attachment;fileName=" + "巨大儿管理.xls"); |
| ... | ... | @@ -993,6 +995,21 @@ |
| 993 | 995 | cnames.put("dayWeight"+i,"测量日期/体重"+i); |
| 994 | 996 | } |
| 995 | 997 | } |
| 998 | + private void cnamesMapWeight(Map<String, String> cnames) { | |
| 999 | + cnames.put("fmDate", "分娩日期"); | |
| 1000 | + cnames.put("username", "姓名"); | |
| 1001 | + cnames.put("age", "年龄"); | |
| 1002 | + cnames.put("phone", "手机号"); | |
| 1003 | + cnames.put("fmWeek", "分娩孕周"); | |
| 1004 | + cnames.put("riskFactor", "高危因素"); | |
| 1005 | + cnames.put("babyWeight", "新生儿体重"); | |
| 1006 | + cnames.put("bmi", "BMI指数"); | |
| 1007 | + cnames.put("beforeHeight", "身高"); | |
| 1008 | + cnames.put("beforeWeight", "孕前体重"); | |
| 1009 | + for (int i = 0; i <= 20 ; i++) { | |
| 1010 | + cnames.put("dayWeight"+i,"测量日期/体重"+i); | |
| 1011 | + } | |
| 1012 | + } | |
| 996 | 1013 | |
| 997 | 1014 | /** |
| 998 | 1015 | * list排序(按照日期升序) |
| ... | ... | @@ -1466,7 +1483,7 @@ |
| 1466 | 1483 | } |
| 1467 | 1484 | return data; |
| 1468 | 1485 | } |
| 1469 | - private List<Map> convertToQuanWeight(List<Patients> patientses) { | |
| 1486 | + private List<Map> convertToQuanWeight(List<Patients> patientses,String type) { | |
| 1470 | 1487 | List<Map> data = new ArrayList<>(); |
| 1471 | 1488 | int batchSize = 4; |
| 1472 | 1489 | int end = 0; |
| ... | ... | @@ -1476,7 +1493,7 @@ |
| 1476 | 1493 | if (end > patientses.size()) { |
| 1477 | 1494 | end = patientses.size(); |
| 1478 | 1495 | } |
| 1479 | - listFuture.add(commonThreadPool.submit(new QuanWeightWorker(patientses.subList(i, end),mongoTemplate,commonService,basicConfigService))); | |
| 1496 | + listFuture.add(commonThreadPool.submit(new QuanWeightWorker(patientses.subList(i, end),mongoTemplate,commonService,basicConfigService,type))); | |
| 1480 | 1497 | } |
| 1481 | 1498 | for (Future f : listFuture) { |
| 1482 | 1499 | try { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/QuanWeightWorker.java
View file @
359c96b
| ... | ... | @@ -4,7 +4,9 @@ |
| 4 | 4 | import com.lyms.platform.biz.service.CommonService; |
| 5 | 5 | import com.lyms.platform.common.enums.YnEnums; |
| 6 | 6 | import com.lyms.platform.common.utils.DateUtil; |
| 7 | +import com.lyms.platform.common.utils.StringUtils; | |
| 7 | 8 | import com.lyms.platform.operate.web.facade.PatientFacade; |
| 9 | +import com.lyms.platform.pojo.MaternalDeliverModel; | |
| 8 | 10 | import com.lyms.platform.pojo.PatientWeight; |
| 9 | 11 | import com.lyms.platform.pojo.Patients; |
| 10 | 12 | import com.lyms.platform.query.AntExChuQuery; |
| 11 | 13 | |
| 12 | 14 | |
| 13 | 15 | |
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | |
| 17 | 19 | |
| 18 | 20 | |
| 19 | 21 | |
| 20 | 22 | |
| ... | ... | @@ -30,57 +32,106 @@ |
| 30 | 32 | private List<Patients> patientses; |
| 31 | 33 | private MongoTemplate mongoTemplate; |
| 32 | 34 | private CommonService commonService; |
| 35 | + private String type; | |
| 33 | 36 | private BasicConfigService basicConfigService; |
| 34 | 37 | public QuanWeightWorker(List<Patients> patientses, |
| 35 | 38 | MongoTemplate mongoTemplate, |
| 36 | 39 | CommonService commonService, |
| 37 | - BasicConfigService basicConfigService | |
| 40 | + BasicConfigService basicConfigService, | |
| 41 | + String type | |
| 38 | 42 | ) { |
| 39 | 43 | this.patientses = patientses; |
| 40 | 44 | this.mongoTemplate = mongoTemplate; |
| 41 | 45 | this.commonService = commonService; |
| 42 | 46 | this.basicConfigService = basicConfigService; |
| 47 | + this.type = type; | |
| 43 | 48 | } |
| 44 | 49 | |
| 45 | 50 | @Override |
| 46 | 51 | public List<Map> call() throws Exception { |
| 47 | 52 | List<Map> data = new ArrayList<>(); |
| 48 | - for (Patients patients : patientses) { | |
| 49 | - if(com.lyms.platform.common.utils.StringUtils.isNotEmpty(patients.getId())){ | |
| 53 | + for (Patients patients : patientses) | |
| 54 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(patients.getId())) { | |
| 50 | 55 | List<PatientWeight> patientWeightList = mongoTemplate.find(Query.query(Criteria.where("patientId").is(patients.getId()).and("yn").ne("0")), PatientWeight.class); |
| 51 | - if(CollectionUtils.isNotEmpty(patientWeightList)){ | |
| 56 | + if (CollectionUtils.isNotEmpty(patientWeightList)) { | |
| 52 | 57 | PatientWeight patientWeight = patientWeightList.get(0); |
| 53 | - if(patientWeight!=null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patientWeight.getBmi())){ | |
| 58 | + if (patientWeight != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(patientWeight.getBmi())) { | |
| 54 | 59 | Map map = new HashMap(); |
| 55 | - map.put("username", patients.getUsername()); | |
| 56 | - map.put("age", patients.getAge()); | |
| 57 | - map.put("phone", patients.getPhone()); | |
| 58 | - map.put("currentWeek", patients.getType() == 3 ? "已分娩" : DateUtil.getWeekDesc(patients.getLastMenses(), new Date())); | |
| 59 | - String risk =getRiskFactor(patients.getRiskFactorId()); | |
| 60 | - if(org.apache.commons.lang.StringUtils.isEmpty(risk)){ | |
| 61 | - risk=(org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor())?"":patients.getoRiskFactor()); | |
| 62 | - }else{ | |
| 63 | - risk=risk+(org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor())?"":","+patients.getoRiskFactor()); | |
| 64 | - } | |
| 65 | -// String rFactor = commonService.resloveFactor(JsonUtil.toList(patients.getRiskLevelId(), String.class)); | |
| 66 | - map.put("riskFactor",risk); | |
| 67 | - map.put("bmi", patientWeight.getBmi()); | |
| 68 | - map.put("beforeHeight", patientWeight.getBeforeHeight()); | |
| 69 | - map.put("beforeWeight", patientWeight.getBeforeWeight()); | |
| 70 | - map.put("dayWeights",patientWeight.getDayWeights()); | |
| 60 | + if(StringUtils.isEmpty(type)){ | |
| 61 | + //-------------------------孕期体重异常管理---字段---------------------- | |
| 62 | + puliMap(patients, patientWeight, map); | |
| 63 | + data.add(map); | |
| 71 | 64 | |
| 65 | + }else if("judaer".equals(type)) { | |
| 66 | + //-------------------------巨大儿管理---字段---------------------- | |
| 67 | + map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate())); | |
| 68 | + if (patients.getFmWeek() != null) { | |
| 69 | + String dueWeek = ""; | |
| 70 | + String week = (patients.getFmWeek() / 7) + ""; | |
| 71 | + int day = (patients.getFmWeek() % 7); | |
| 72 | + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); | |
| 73 | + map.put("fmWeek", dueWeek); | |
| 74 | + } else { | |
| 75 | + map.put("fmWeek", ""); | |
| 76 | + } | |
| 77 | + Query querymd = Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").ne("0") | |
| 78 | + .and("baby").elemMatch(Criteria.where("babyWeight").gte("4000"))); | |
| 79 | + List<MaternalDeliverModel> deliverModels = mongoTemplate.find(querymd, MaternalDeliverModel.class); | |
| 80 | + if(CollectionUtils.isNotEmpty(deliverModels)){ | |
| 81 | + MaternalDeliverModel maternalDeliverModel = deliverModels.get(0); | |
| 82 | + List<MaternalDeliverModel.Baby> baby = maternalDeliverModel.getBaby(); | |
| 83 | + for (int i = 0; i < baby.size() ; i++) { | |
| 84 | + MaternalDeliverModel.Baby baby1 = baby.get(i); | |
| 85 | + map.put("babyWeight", baby1.getBabyWeight()); | |
| 86 | + puliMap(patients, patientWeight, map); | |
| 87 | + data.add(map); | |
| 88 | + } | |
| 89 | + } | |
| 72 | 90 | |
| 73 | - map.put("patientId", patients.getId()); | |
| 74 | - map.put("pid", patients.getPid()); | |
| 75 | - map.put("cardNo", patients.getCardNo()); | |
| 76 | - data.add(map); | |
| 91 | + } | |
| 92 | + | |
| 77 | 93 | } |
| 78 | 94 | |
| 79 | 95 | } |
| 80 | 96 | } |
| 81 | - } | |
| 82 | 97 | return data; |
| 83 | 98 | } |
| 99 | + | |
| 100 | + private void puliMap(Patients patients, PatientWeight patientWeight, Map map) { | |
| 101 | + map.put("username", patients.getUsername()); | |
| 102 | + map.put("age", patients.getAge()); | |
| 103 | + map.put("phone", patients.getPhone()); | |
| 104 | + map.put("currentWeek", patients.getType() == 3 ? "已分娩" : DateUtil.getWeekDesc(patients.getLastMenses(), new Date())); | |
| 105 | + String risk = getRiskFactor(patients.getRiskFactorId()); | |
| 106 | + if (org.apache.commons.lang.StringUtils.isEmpty(risk)) { | |
| 107 | + risk = (org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor()) ? "" : patients.getoRiskFactor()); | |
| 108 | + } else { | |
| 109 | + risk = risk + (org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor()) ? "" : "," + patients.getoRiskFactor()); | |
| 110 | + } | |
| 111 | +// String rFactor = commonService.resloveFactor(JsonUtil.toList(patients.getRiskLevelId(), String.class)); | |
| 112 | + map.put("riskFactor", risk); | |
| 113 | + map.put("bmi", patientWeight.getBmi()); | |
| 114 | + map.put("beforeHeight", patientWeight.getBeforeHeight()); | |
| 115 | + map.put("beforeWeight", patientWeight.getBeforeWeight()); | |
| 116 | + map.put("dayWeights", patientWeight.getDayWeights()); | |
| 117 | + if (patientWeight.getDayWeights() != null) { | |
| 118 | + int i = 1; | |
| 119 | + for(Map.Entry<String, String> entry : patientWeight.getDayWeights().entrySet()){ | |
| 120 | + String mapKey = entry.getKey(); | |
| 121 | + String mapValue = entry.getValue(); | |
| 122 | + System.out.println(mapKey + "/" + mapValue); | |
| 123 | + map.put("dayWeights"+i++, mapKey + "/" + mapValue); | |
| 124 | + } | |
| 125 | + | |
| 126 | + } | |
| 127 | + | |
| 128 | + map.put("patientId", patients.getId()); | |
| 129 | + map.put("pid", patients.getPid()); | |
| 130 | + map.put("cardNo", patients.getCardNo()); | |
| 131 | + | |
| 132 | + | |
| 133 | + } | |
| 134 | + | |
| 84 | 135 | public static List filter(List<java.util.Map> level){ |
| 85 | 136 | List list = new ArrayList(); |
| 86 | 137 | List addEdList = new ArrayList(); |