/*
* 需要从数据库里获取 from tag_img tg LEFT JOIN img_center imc ON
* tg.img_md5=imc.img_md5 left join img_case c on imc.case_id=c.id
*
* where c.source_id='3f8b081edd0c4060805bf6a077f30679' and img_info LIKE
* '%脊柱侧弯%'
*/
public void import8(){
List<Map<String, Object>> list = jdbcTemplate
.queryForList("SELECT img_md5,tag_json FROM tag_img WHERE type_id='ff4dfd4ba7d949958b3d630a90fcca75' and tag_flag=1 limit 22,5");
System.out.println(list.size());
int i=0;
for(Map<String,Object> tagimg:list){
i++;
System.out.println(i);
String imgMd5 = tagimg.get("img_md5").toString();
JSONArray array=JSONArray.parseArray(tagimg.get("tag_json").toString());//得到原来的json
System.out.println(array);
TagImgFilter filter = new TagImgFilter();//更改的集合
filter.setEq_orgId("c1fa7ba875fa4c9a899e2787eb79e802");
filter.setEq_setId("d5e8f01a2e6649cf877eacda8ceb6ff1");
filter.setEq_typeId("52336e7e43204fa68c006692b355137a");
filter.setEq_imgMd5(imgMd5);
TagImg imgnew = tagImgService.selectAll(filter).get(0);
JSONArray arraynew=JSONArray.parseArray(imgnew.getTagJson());
System.out.println("11111111111");
System.out.println(arraynew);
for(int countjson=0;countjson<array.size();countjson++){
JSONObject jsonObj = array.getJSONObject(countjson);
for(int countjsonnew=0;countjsonnew<arraynew.size();countjsonnew++){
JSONObject jsonDBle = arraynew.getJSONObject(countjsonnew);
if (jsonObj.get("x").equals(jsonDBle.get("x")) && jsonObj.get("y").equals(jsonDBle.get("y")) && jsonObj.get("width").equals(jsonDBle.get("width")) && jsonObj.get("height").equals(jsonDBle.get("height"))){
System.out.println(jsonDBle);
arraynew.remove(jsonDBle);
}
System.out.println(arraynew);
System.out.println(arraynew.size());
}
}
imgnew.setTagJson(arraynew.toString());
tagImgService.save(imgnew);
}
}