From e28e65a6f621e573f9db3277fcc4f55cf3212fb0 Mon Sep 17 00:00:00 2001 From: hujiaqi Date: Wed, 11 Jan 2017 17:40:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/facade/BabyStatisticsManagerFacade.java | 116 +++++++++++++++++++-- .../operate/web/facade/MatDeliverFacade.java | 72 +++++++++---- 2 files changed, 154 insertions(+), 34 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java index 9aa08ec..166bc61 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyStatisticsManagerFacade.java @@ -20,9 +20,7 @@ import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; +import java.util.*; /** * @auther HuJiaqi @@ -73,6 +71,30 @@ public class BabyStatisticsManagerFacade { } } + // 排序,这里数据量并不大,所以可以在这里排序,排序规则为按照count倒序 + Collections.sort(babyStatisticsManagerBuildDoctorGroupQueryModelList, new Comparator() { + @Override + public int compare(BabyStatisticsManagerBuildDoctorGroupQueryModel o1, BabyStatisticsManagerBuildDoctorGroupQueryModel o2) { + int i1; + int i2; + try { + i1 = Integer.valueOf(o1.getCount()); + } catch (Exception e) { + i1 = 0; + } + try { + i2 = Integer.valueOf(o2.getCount()); + } catch (Exception e) { + i2 = 0; + } + if (i1 > i2) { + return -1; + } else { + return 1; + } + } + }); + babyStatisticsManagerBuildDoctorGroupResult.setData(babyStatisticsManagerBuildDoctorGroupQueryModelList); babyStatisticsManagerBuildDoctorGroupResult.setErrorcode(ErrorCodeConstants.SUCCESS); babyStatisticsManagerBuildDoctorGroupResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); @@ -161,20 +183,44 @@ public class BabyStatisticsManagerFacade { if (CollectionUtils.isNotEmpty(temp)) { for (HashMap hashMap : temp) { - BabyStatisticsManagerCheckDoctorGroupQueryModel babyStatisticsManagerBuildDoctorGroupQueryModel = new BabyStatisticsManagerCheckDoctorGroupQueryModel(); + BabyStatisticsManagerCheckDoctorGroupQueryModel babyStatisticsManagerCheckDoctorGroupQueryModel = new BabyStatisticsManagerCheckDoctorGroupQueryModel(); String checkDoctorName; try { checkDoctorName = usersService.getUsers(Integer.valueOf(hashMap.get("_id").toString())).getName(); } catch (Exception e) { checkDoctorName = "-"; } - babyStatisticsManagerBuildDoctorGroupQueryModel.setCheckDoctorName(checkDoctorName); - babyStatisticsManagerBuildDoctorGroupQueryModel.setCheckDoctorId(hashMap.get("_id") == null ? null : hashMap.get("_id").toString()); - babyStatisticsManagerBuildDoctorGroupQueryModel.setCount(hashMap.get("count").toString()); - babyStatisticsManagerCheckDoctorGroupQueryModelList.add(babyStatisticsManagerBuildDoctorGroupQueryModel); + babyStatisticsManagerCheckDoctorGroupQueryModel.setCheckDoctorName(checkDoctorName); + babyStatisticsManagerCheckDoctorGroupQueryModel.setCheckDoctorId(hashMap.get("_id") == null ? null : hashMap.get("_id").toString()); + babyStatisticsManagerCheckDoctorGroupQueryModel.setCount(hashMap.get("count").toString()); + babyStatisticsManagerCheckDoctorGroupQueryModelList.add(babyStatisticsManagerCheckDoctorGroupQueryModel); } } + // 排序,这里数据量并不大,所以可以在这里排序,排序规则为按照count倒序 + Collections.sort(babyStatisticsManagerCheckDoctorGroupQueryModelList, new Comparator() { + @Override + public int compare(BabyStatisticsManagerCheckDoctorGroupQueryModel o1, BabyStatisticsManagerCheckDoctorGroupQueryModel o2) { + int i1; + int i2; + try { + i1 = Integer.valueOf(o1.getCount()); + } catch (Exception e) { + i1 = 0; + } + try { + i2 = Integer.valueOf(o2.getCount()); + } catch (Exception e) { + i2 = 0; + } + if (i1 > i2) { + return -1; + } else { + return 1; + } + } + }); + babyStatisticsManagerBuildDoctorGroupResult.setData(babyStatisticsManagerCheckDoctorGroupQueryModelList); babyStatisticsManagerBuildDoctorGroupResult.setErrorcode(ErrorCodeConstants.SUCCESS); babyStatisticsManagerBuildDoctorGroupResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); @@ -274,18 +320,66 @@ public class BabyStatisticsManagerFacade { } List temp = babyCheckService.babyStatisticsManagerWeekAgeGroup(babyCheckModelQuery); - List babyStatisticsManagerCheckDoctorGroupQueryModelList = new ArrayList<>(); + List babyStatisticsManagerWeekAgeGroupQueryModelList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(temp)) { for (HashMap hashMap : temp) { BabyStatisticsManagerWeekAgeGroupQueryModel babyStatisticsManagerWeekAgeGroupQueryModel = new BabyStatisticsManagerWeekAgeGroupQueryModel(); babyStatisticsManagerWeekAgeGroupQueryModel.setWeekAge(hashMap.get("_id") == null ? null : hashMap.get("_id").toString()); babyStatisticsManagerWeekAgeGroupQueryModel.setCount(hashMap.get("count").toString()); - babyStatisticsManagerCheckDoctorGroupQueryModelList.add(babyStatisticsManagerWeekAgeGroupQueryModel); + babyStatisticsManagerWeekAgeGroupQueryModelList.add(babyStatisticsManagerWeekAgeGroupQueryModel); + } + } + + // 排序,这里数据量并不大,所以可以在这里排序,排序规则为按照weekAge正序 + Collections.sort(babyStatisticsManagerWeekAgeGroupQueryModelList, new Comparator() { + @Override + public int compare(BabyStatisticsManagerWeekAgeGroupQueryModel o1, BabyStatisticsManagerWeekAgeGroupQueryModel o2) { + int i1; + int i2; + try { + i1 = Integer.valueOf(o1.getWeekAge()); + } catch (Exception e) { + i1 = 0; + } + try { + i2 = Integer.valueOf(o2.getWeekAge()); + } catch (Exception e) { + i2 = 0; + } + if (i1 > i2) { + return 1; + } else { + return -1; + } + } + }); + for (BabyStatisticsManagerWeekAgeGroupQueryModel babyStatisticsManagerWeekAgeGroupQueryModel : babyStatisticsManagerWeekAgeGroupQueryModelList) { + System.out.println(babyStatisticsManagerWeekAgeGroupQueryModel.getWeekAge()); + } + List babyStatisticsManagerWeekAgeGroupQueryModelListResult = new ArrayList<>(); + // 从0开始,没有也填充 + int index = 0; + for(Integer i = 0;i<37;i++) { + try { + while (!i.toString().equals(babyStatisticsManagerWeekAgeGroupQueryModelList.get(index).getWeekAge()) && i < Integer.valueOf(babyStatisticsManagerWeekAgeGroupQueryModelList.get(index).getWeekAge())) { + index++; + } + } catch (Exception e) { + index++; + } + if (babyStatisticsManagerWeekAgeGroupQueryModelList.get(index) == null) { + BabyStatisticsManagerWeekAgeGroupQueryModel babyStatisticsManagerWeekAgeGroupQueryModel = new BabyStatisticsManagerWeekAgeGroupQueryModel(); + babyStatisticsManagerWeekAgeGroupQueryModel.setCount("0"); + babyStatisticsManagerWeekAgeGroupQueryModel.setWeekAge(i.toString()); + babyStatisticsManagerWeekAgeGroupQueryModelListResult.add(babyStatisticsManagerWeekAgeGroupQueryModel); + } else { + babyStatisticsManagerWeekAgeGroupQueryModelListResult.add(babyStatisticsManagerWeekAgeGroupQueryModelList.get(index)); + index++; } } - babyStatisticsManagerWeekAgeGroupResult.setData(babyStatisticsManagerCheckDoctorGroupQueryModelList); + babyStatisticsManagerWeekAgeGroupResult.setData(babyStatisticsManagerWeekAgeGroupQueryModelListResult); babyStatisticsManagerWeekAgeGroupResult.setErrorcode(ErrorCodeConstants.SUCCESS); babyStatisticsManagerWeekAgeGroupResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); return babyStatisticsManagerWeekAgeGroupResult; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java index 17d56e7..494a6a6 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java @@ -991,6 +991,7 @@ public class MatDeliverFacade { } } + patientsQuery.setYn(YnEnums.YES.getId()); patientsQuery.setIsAutoFm(YnEnums.NO.getId()); patientsQuery.setType(3); @@ -1177,6 +1178,9 @@ public class MatDeliverFacade { pregnancyOut += renShenJieJuEnums.getName() + ","; break; } + if(StringUtils.isEmpty(pregnancyOut)){ + pregnancyOut+="-,"; + } } } if (childbirthManagerRequest.getInitQuery().contains("sex")) { @@ -1185,18 +1189,27 @@ public class MatDeliverFacade { sex += sexEnum.getText() + ","; break; } + if(StringUtils.isEmpty(sex)){ + sex+="-,"; + } } } - babyWeight += babyModel.getBabyWeight() == null ? "" : babyModel.getBabyWeight() + ","; - babyHeight += babyModel.getBabyHeight() == null ? "" : babyModel.getBabyHeight() + ","; - asphyxiaM += babyModel.getAsphyxiaM() == null ? "" : babyModel.getAsphyxiaM() + ","; - babyHealthy += babyModel.getBabyHealthy() == null ? "" : babyModel.getBabyHealthy() + ","; - malformation += babyModel.getMalformation() == null ? "" : babyModel.getMalformation() + ","; + babyWeight += babyModel.getBabyWeight() == null ? "-," : babyModel.getBabyWeight() + ","; + babyHeight += babyModel.getBabyHeight() == null ? "-," : babyModel.getBabyHeight() + ","; + asphyxiaM += babyModel.getAsphyxiaM() == null ? "-," : babyModel.getAsphyxiaM() + ","; + babyHealthy += babyModel.getBabyHealthy() == null ? "-," : babyModel.getBabyHealthy() + ","; + if(Integer.valueOf(0).equals(babyModel.getMalformation())){ + malformation+="非畸形"+","; + }else if(Integer.valueOf(1).equals(babyModel.getMalformation())){ + malformation+="畸形"+","; + }else{ + malformation+="-,"; + } Map map = JsonUtil.getMap(babyModel.getApgarScore()); if (MapUtils.isNotEmpty(map)) { - apgarScorePf1 += map.get("pf1") == null ? "" : map.get("pf1") + ","; - apgarScorePf5 += map.get("pf5") == null ? "" : map.get("pf5") + ","; - apgarScorePf10 += map.get("pf10") == null ? "" : map.get("pf10") + ","; + apgarScorePf1 += map.get("pf1") == null ? "-," : map.get("pf1") + ","; + apgarScorePf5 += map.get("pf5") == null ? "-," : map.get("pf5") + ","; + apgarScorePf10 += map.get("pf10") == null ? "-," : map.get("pf10") + ","; } } } catch (Exception e) { @@ -1329,7 +1342,12 @@ public class MatDeliverFacade { } } heartRate += placenta.get("heartRate") == null ? "" : placenta.get("heartRate") + ","; - fetalPresentation += placenta.get("fetalPresentation") == null ? "" : placenta.get("fetalPresentation") + ","; + for (FetalEnums fetalEnums : FetalEnums.values()) { + if (fetalEnums.getId().equals(placenta.get("fetalPresentation"))) { + fetalPresentation += fetalEnums.getName() + ","; + break; + } + } } } } @@ -1367,9 +1385,18 @@ public class MatDeliverFacade { Map totalprocessMap = JsonUtil.getMap(maternalDeliverModel.getTotalprocess()); if (MapUtils.isNotEmpty(totalprocessMap)) { childbirthManagerQueryModel.setTotalprocess(totalprocessMap.get("h") + "时" + totalprocessMap.get("m") + "分"); - }else{ + } else { childbirthManagerQueryModel.setTotalprocess(""); } + // 死亡原因 + if (childbirthManagerRequest.getInitQuery().contains("deathCause")) { + for (DeathCauseEnums deathCauseEnums : DeathCauseEnums.values()) { + if (deathCauseEnums.getId().equals(maternalDeliverModel.getDeathCause())) { + childbirthManagerQueryModel.setDeathCause(deathCauseEnums.getName()); + break; + } + } + } // 收缩压,舒张压 Map chBpMap = JsonUtil.getMap(maternalDeliverModel.getChBp()); @@ -1634,27 +1661,26 @@ public class MatDeliverFacade { if ("com.lyms.platform.operate.web.request.MatDeliverAddRequest$Placenta".equals(obj.getClass().getName())) { //转换类型 MatDeliverAddRequest.Placenta placenta = (MatDeliverAddRequest.Placenta) obj; - if (placenta!=null){ - //胎方位 - if (StringUtils.isNotEmpty(placenta.getFetalPosition())){ - for (FetalPositionEnums fetalPositionEnums : FetalPositionEnums.values()) { - if (fetalPositionEnums.getId().equals(placenta.getFetalPosition())) { - fetalPosition += fetalPositionEnums.getName(); - break; - } + //胎方位 + if (StringUtils.isNotEmpty(placenta.getFetalPosition())) { + for (FetalPositionEnums fetalPositionEnums : FetalPositionEnums.values()) { + if (fetalPositionEnums.getId().equals(placenta.getFetalPosition())) { + fetalPosition += fetalPositionEnums.getName(); + break; } } - //胎先露 - fetalPresentation += placenta.getFetalPresentation() == null ? "" : placenta.getFetalPresentation(); - //胎心率 - heartRate += placenta.getHeartRate() == null ? "" : placenta.getHeartRate().toString(); } + //胎先露 + fetalPresentation += placenta.getFetalPresentation() == null ? "" : placenta.getFetalPresentation(); + //胎心率 + heartRate += placenta.getHeartRate() == null ? "" : placenta.getHeartRate().toString(); + } if ("java.util.LinkedHashMap".equals(obj.getClass().getName())) { Map placenta = JsonUtil.getMap(obj.toString()); if (MapUtils.isNotEmpty(placenta)) { - if (placenta.get("fetalPosition")!=null){ + if (placenta.get("fetalPosition") != null) { for (FetalPositionEnums fetalPositionEnums : FetalPositionEnums.values()) { if (fetalPositionEnums.getId().equals(placenta.get("fetalPosition"))) { fetalPosition += fetalPositionEnums.getName(); -- 1.8.3.1