@Test public void testConvertMapForIndividualDoctor() throws Exception { }
private List<HashMap> convertMapForIndividualDoctor(List<HashMap> statistics){ Map<Integer, HashMap> map = new HashMap<>(); List<HashMap> result = new ArrayList<>(); for(HashMap s: statistics){ Integer roleId = Integer.valueOf(s.get("id").toString()); String type = s.get("type").toString(); BigDecimal totalMoney = (BigDecimal) s.get("total_money"); String departmentName = s.get("department_name").toString(); String titleName = s.get("title_name").toString(); if (!map.containsKey(roleId)) { map.put(roleId, new HashMap()); map.get(roleId).put("roleId", roleId); map.get(roleId).put("departmentName", departmentName); map.get(roleId).put("titleName", titleName); map.get(roleId).put(type, totalMoney); } else{ map.get(roleId).put("roleId", roleId); map.get(roleId).put(type, totalMoney); } } Iterator ite = map.entrySet().iterator(); int i = 0; while(ite.hasNext()){ Map.Entry string = (Map.Entry)ite.next(); result.add(i, (HashMap) string.getValue()); i++; } return result; }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private List<HashMap> convertMapForIndividualDoctor(List<HashMap> statistics){ Map<Integer, HashMap> map = new HashMap<>(); List<HashMap> result = new ArrayList<>(); for(HashMap s: statistics){ Integer roleId = Integer.valueOf(s.get("id").toString()); String type = s.get("type").toString(); BigDecimal totalMoney = (BigDecimal) s.get("total_money"); String departmentName = s.get("department_name").toString(); String titleName = s.get("title_name").toString(); if (!map.containsKey(roleId)) { map.put(roleId, new HashMap()); map.get(roleId).put("roleId", roleId); map.get(roleId).put("departmentName", departmentName); map.get(roleId).put("titleName", titleName); map.get(roleId).put(type, totalMoney); } else{ map.get(roleId).put("roleId", roleId); map.get(roleId).put(type, totalMoney); } } Iterator ite = map.entrySet().iterator(); int i = 0; while(ite.hasNext()){ Map.Entry string = (Map.Entry)ite.next(); result.add(i, (HashMap) string.getValue()); i++; } return result; } }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private List<HashMap> convertMapForIndividualDoctor(List<HashMap> statistics){ Map<Integer, HashMap> map = new HashMap<>(); List<HashMap> result = new ArrayList<>(); for(HashMap s: statistics){ Integer roleId = Integer.valueOf(s.get("id").toString()); String type = s.get("type").toString(); BigDecimal totalMoney = (BigDecimal) s.get("total_money"); String departmentName = s.get("department_name").toString(); String titleName = s.get("title_name").toString(); if (!map.containsKey(roleId)) { map.put(roleId, new HashMap()); map.get(roleId).put("roleId", roleId); map.get(roleId).put("departmentName", departmentName); map.get(roleId).put("titleName", titleName); map.get(roleId).put(type, totalMoney); } else{ map.get(roleId).put("roleId", roleId); map.get(roleId).put(type, totalMoney); } } Iterator ite = map.entrySet().iterator(); int i = 0; while(ite.hasNext()){ Map.Entry string = (Map.Entry)ite.next(); result.add(i, (HashMap) string.getValue()); i++; } return result; }  }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private List<HashMap> convertMapForIndividualDoctor(List<HashMap> statistics){ Map<Integer, HashMap> map = new HashMap<>(); List<HashMap> result = new ArrayList<>(); for(HashMap s: statistics){ Integer roleId = Integer.valueOf(s.get("id").toString()); String type = s.get("type").toString(); BigDecimal totalMoney = (BigDecimal) s.get("total_money"); String departmentName = s.get("department_name").toString(); String titleName = s.get("title_name").toString(); if (!map.containsKey(roleId)) { map.put(roleId, new HashMap()); map.get(roleId).put("roleId", roleId); map.get(roleId).put("departmentName", departmentName); map.get(roleId).put("titleName", titleName); map.get(roleId).put(type, totalMoney); } else{ map.get(roleId).put("roleId", roleId); map.get(roleId).put(type, totalMoney); } } Iterator ite = map.entrySet().iterator(); int i = 0; while(ite.hasNext()){ Map.Entry string = (Map.Entry)ite.next(); result.add(i, (HashMap) string.getValue()); i++; } return result; }  @Override CommonResult doctorStatistics(String beginDateStr, String endDateStr); @Override CommonResult doctorStatisticsByUserIdAndDate(String dateStr, Integer userId); }
DoctorStatisticsServiceImpl implements DoctorStatisticsService { private List<HashMap> convertMapForIndividualDoctor(List<HashMap> statistics){ Map<Integer, HashMap> map = new HashMap<>(); List<HashMap> result = new ArrayList<>(); for(HashMap s: statistics){ Integer roleId = Integer.valueOf(s.get("id").toString()); String type = s.get("type").toString(); BigDecimal totalMoney = (BigDecimal) s.get("total_money"); String departmentName = s.get("department_name").toString(); String titleName = s.get("title_name").toString(); if (!map.containsKey(roleId)) { map.put(roleId, new HashMap()); map.get(roleId).put("roleId", roleId); map.get(roleId).put("departmentName", departmentName); map.get(roleId).put("titleName", titleName); map.get(roleId).put(type, totalMoney); } else{ map.get(roleId).put("roleId", roleId); map.get(roleId).put(type, totalMoney); } } Iterator ite = map.entrySet().iterator(); int i = 0; while(ite.hasNext()){ Map.Entry string = (Map.Entry)ite.next(); result.add(i, (HashMap) string.getValue()); i++; } return result; }  @Override CommonResult doctorStatistics(String beginDateStr, String endDateStr); @Override CommonResult doctorStatisticsByUserIdAndDate(String dateStr, Integer userId);  }