diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java index 7e23e5c..8f61a72 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java @@ -545,7 +545,7 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService if(p == null) { return RespBuilder.buildSuccess(); } - AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").is(1).and("checkTime").gte(p.getLastMenses())).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class); + List antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").is(1).and("checkTime").gte(p.getLastMenses())).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class); List antexModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(p.getPid()).and("yn").is(1).and("checkDate").gte(p.getLastMenses())).with(new Sort(Sort.Direction.DESC, "checkDate")), AntenatalExaminationModel.class); Map xyMap = new HashMap<>(); @@ -569,7 +569,7 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService Map tzMap = new HashMap<>(); Map weights = new LinkedHashMap<>(); - boolean tzFlag = antExChuModel == null || StringUtils.isEmpty(antExChuModel.getYqWeight()) || StringUtils.isEmpty(antExChuModel.getHeight()) ? false : true; + boolean tzFlag = CollectionUtils.isEmpty(antExChuModels) || StringUtils.isEmpty(antExChuModels.get(antExChuModels.size() - 1).getYqWeight()) || StringUtils.isEmpty(antExChuModels.get(antExChuModels.size() - 1).getHeight()) ? false : true; for (AntenatalExaminationModel antexModel : antexModels) { @@ -583,9 +583,6 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService temp.put("abdominalCircumference", antexModel.getAbdominalCircumference());// 腹围 List tireData = antexModel.getTireData(); - String fetalPosition = ""; // 胎位 - String heartRate = ""; // 胎心 - String fetalPresentation = ""; // 先露 StringBuffer fetalPosition2 = new StringBuffer(); // 胎位 StringBuffer heartRate2 = new StringBuffer(); // 胎心 StringBuffer fetalPresentation2 = new StringBuffer(); // 先露 @@ -619,57 +616,56 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService restList.add(temp); } - // 添加初诊list\ - if(antExChuModel != null) { - Map temp = new HashMap<>(); - temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); - Integer week = DateUtil.getWeek2(p.getLastMenses(), antExChuModel.getCheckTime()); - temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), antExChuModel.getCheckTime())); - temp.put("weight", antExChuModel.getWeight()); - temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--")); - temp.put("gonggao", antExChuModel.getGonggao()); - temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围 - - List tireData = antExChuModel.getPlacentas(); - String fetalPosition = ""; - String heartRate = ""; - String fetalPresentation = ""; - StringBuffer fetalPosition2 = new StringBuffer(); // 胎位 - StringBuffer heartRate2 = new StringBuffer(); // 胎心 - StringBuffer fetalPresentation2 = new StringBuffer(); // 先露 - try { // 有些数据前端传的有问题 存的class - if(CollectionUtils.isNotEmpty(tireData)) { - for (Map tireDatum : tireData) { - if(fetalPosition2.length() > 0) fetalPosition2.append("/"); - if(heartRate2.length() > 0) heartRate2.append("/"); - if(fetalPresentation2.length() > 0) fetalPresentation2.append("/"); - fetalPosition2.append(tireDatum.containsKey("fetalPosition") ? FetalPositionEnums.getTitle2((String) tireDatum.get("fetalPosition")) : "--"); - heartRate2.append(tireDatum.containsKey("heartRate") ? tireDatum.get("heartRate").toString().replaceAll("\\.0", "") : "--"); - fetalPresentation2.append(tireDatum.containsKey("fetalPresentation") ? FetalEnums.getTitle2((String) tireDatum.get("fetalPresentation")) : "--"); - } - } else { + // 添加初诊list + + for (AntExChuModel antExChuModel : antExChuModels) { + Map temp = new HashMap<>(); + temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); + Integer week = DateUtil.getWeek2(p.getLastMenses(), antExChuModel.getCheckTime()); + temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), antExChuModel.getCheckTime())); + temp.put("weight", antExChuModel.getWeight()); + temp.put("bp", parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), "--") + "/" + parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), "--")); + temp.put("gonggao", antExChuModel.getGonggao()); + temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围 + + List tireData = antExChuModel.getPlacentas(); + StringBuffer fetalPosition2 = new StringBuffer(); // 胎位 + StringBuffer heartRate2 = new StringBuffer(); // 胎心 + StringBuffer fetalPresentation2 = new StringBuffer(); // 先露 + try { // 有些数据前端传的有问题 存的class + if(CollectionUtils.isNotEmpty(tireData)) { + for (Map tireDatum : tireData) { + if(fetalPosition2.length() > 0) fetalPosition2.append("/"); + if(heartRate2.length() > 0) heartRate2.append("/"); + if(fetalPresentation2.length() > 0) fetalPresentation2.append("/"); + fetalPosition2.append(tireDatum.containsKey("fetalPosition") ? FetalPositionEnums.getTitle2((String) tireDatum.get("fetalPosition")) : "--"); + heartRate2.append(tireDatum.containsKey("heartRate") ? tireDatum.get("heartRate").toString().replaceAll("\\.0", "") : "--"); + fetalPresentation2.append(tireDatum.containsKey("fetalPresentation") ? FetalEnums.getTitle2((String) tireDatum.get("fetalPresentation")) : "--"); + } + } else { + fetalPosition2.append("--"); + heartRate2.append("--"); + fetalPresentation2.append("--"); + } + } catch (Exception e) { fetalPosition2.append("--"); heartRate2.append("--"); fetalPresentation2.append("--"); } - } catch (Exception e) { - fetalPosition2.append("--"); - heartRate2.append("--"); - fetalPresentation2.append("--"); - } - temp.put("fetalPosition", fetalPosition2.toString()); // 胎位 - temp.put("heartRate", heartRate2.toString()); // 胎心 - temp.put("fetalPresentation", fetalPresentation2.toString()); // 先露 - temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿 - temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白 - temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素 + temp.put("fetalPosition", fetalPosition2.toString()); // 胎位 + temp.put("heartRate", heartRate2.toString()); // 胎心 + temp.put("fetalPresentation", fetalPresentation2.toString()); // 先露 + temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿 + temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白 + temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素 - ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0)); - szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0)); + ssy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("ssy"), 0)); + szy.set(week, parseNull(JSONObject.parseObject(antExChuModel.getBp()).getString("szy"), 0)); - restList.add(temp); - } + restList.add(temp); + + } @@ -681,7 +677,7 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService } }*/ if(tzFlag) { - setReport(tzMap, weights, antExChuModel.getYqWeight(), PatientWeightServiceImpl.getBmi(antExChuModel.getYqWeight(), antExChuModel.getHeight())); + setReport(tzMap, weights, antExChuModels.get(antExChuModels.size() - 1).getYqWeight(), PatientWeightServiceImpl.getBmi(antExChuModels.get(antExChuModels.size() - 1).getYqWeight(), antExChuModels.get(antExChuModels.size() - 1).getHeight())); } return RespBuilder.buildSuccess("tabList", restList, "xyMap", xyMap, "tzMap", tzMap);