java 建maplist放case center合并

    public void import12(){
        List<Map<String, Object>> mapList=new ArrayList<Map<String, Object>>();
        Map<String,Object> mapInfo=new HashMap<>();
        ImgCaseFilter imgCaseFilter=new ImgCaseFilter();
        List<ImgCase> imgCases=imgCaseService.selectAll(imgCaseFilter);        
        
        for(ImgCase imgCase:imgCases){
            ImgCenterFilter imgCenterFilter=new ImgCenterFilter();
            imgCenterFilter.setEq_caseId(imgCase.getId());
            JSONObject obj = new JSONObject();    
            
            String patientId = imgCase.getPatientId();
            String name = imgCase.getName();
            String age = imgCase.getAge();
            String sex = imgCase.getSex();
            
            obj.put("patientid", patientId);
            obj.put("name", name);
            obj.put("age", age);
            obj.put("sex", sex);
            obj.put("imgInfo", null);
            obj.put("imgInfo", null);
            
            List<ImgCenter> imgCenters=imgCenterService.selectAll(imgCenterFilter);    
            List<String> urllist=new ArrayList<String>();//当前caseid下imgcenter里的图片url            
            for(ImgCenter imgCenter:imgCenters){
                String url=imgCenter.getImgUrl();
                urllist.add(url);                
            }
            mapInfo.put("imgCase", obj);
            mapInfo.put("imgCenter", urllist);
            mapList.add(mapInfo);
        }
    }
    

 

posted @ 2019-02-12 12:10  yangly  阅读(255)  评论(0编辑  收藏  举报