|  | @ -6,11 +6,15 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | import com.yihu.jw.base.dao.a2dao.MediicineDeviceDao;
 |  | import com.yihu.jw.base.dao.a2dao.MediicineDeviceDao;
 | 
												
													
														
															|  | import com.yihu.jw.base.dao.a2dao.MediicineDeviceUserDao;
 |  | import com.yihu.jw.base.dao.a2dao.MediicineDeviceUserDao;
 | 
												
													
														
															|  | import com.yihu.jw.base.dao.a2dao.MediicineUserDao;
 |  | import com.yihu.jw.base.dao.a2dao.MediicineUserDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.base.dao.role.RoleDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.base.dao.user.UserDao;
 | 
												
													
														
															|  | import com.yihu.jw.base.util.ConstantUtils;
 |  | import com.yihu.jw.base.util.ConstantUtils;
 | 
												
													
														
															|  | import com.yihu.jw.base.util.JavaBeanUtils;
 |  | import com.yihu.jw.base.util.JavaBeanUtils;
 | 
												
													
														
															|  | import com.yihu.jw.entity.a1entity.MediicineDeviceUser;
 |  | import com.yihu.jw.entity.a1entity.MediicineDeviceUser;
 | 
												
													
														
															|  | import com.yihu.jw.entity.a1entity.Mediicinedevice;
 |  | import com.yihu.jw.entity.a1entity.Mediicinedevice;
 | 
												
													
														
															|  | import com.yihu.jw.entity.a1entity.Mediicineuser;
 |  | import com.yihu.jw.entity.a1entity.Mediicineuser;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.role.RoleDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.user.UserDO;
 | 
												
													
														
															|  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 |  | import com.yihu.jw.utils.hibernate.HibenateUtils;
 | 
												
													
														
															|  | import com.yihu.mysql.query.BaseJpaService;
 |  | import com.yihu.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
											
												
													
														
															|  | @ -30,17 +34,21 @@ import java.util.logging.Logger;
 | 
												
													
														
															|  | @Service
 |  | @Service
 | 
												
													
														
															|  | public class MedicineUserService extends BaseJpaService<Mediicineuser, MediicineUserDao> {
 |  | public class MedicineUserService extends BaseJpaService<Mediicineuser, MediicineUserDao> {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  | 
 | 
												
													
														
															|  |     private MediicineUserDao userDao;
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private MediicineDeviceUserDao deviceUserDao;
 |  |     private MediicineDeviceUserDao deviceUserDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private MediicineDeviceDao deviceDao;
 |  |     private MediicineDeviceDao deviceDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private ObjectMapper objectMapper;
 |  | 
 | 
												
													
														
															|  | 
 |  |     private UserDao userDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private RoleDao roleDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private ObjectMapper objectMapper;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private HibenateUtils hibenateUtils;
 |  |     private HibenateUtils hibenateUtils;
 | 
												
											
												
													
														
															|  | @ -55,9 +63,63 @@ public class MedicineUserService extends BaseJpaService<Mediicineuser, Mediicine
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      * @throws Exception
 |  |      * @throws Exception
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONObject queryUserListFullInfo(String content,int page, int size,String wechatId) throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject queryUserListFullInfo(String content,String userId,int page, int size,String wechatId) throws Exception {
 | 
												
													
														
															|  |         JSONObject result = new JSONObject();
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  |         String sql = "SELECT\n" +
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         UserDO user = userDao.findOne(userId);
 | 
												
													
														
															|  | 
 |  |         RoleDO role = roleDao.findOne(user.getRoleId());
 | 
												
													
														
															|  | 
 |  |         String sql = "";
 | 
												
													
														
															|  | 
 |  |         String conditionSql = "";
 | 
												
													
														
															|  | 
 |  |         //登录者所管理的社区code串
 | 
												
													
														
															|  | 
 |  |         String belongCommunitys = "";
 | 
												
													
														
															|  | 
 |  |         {
 | 
												
													
														
															|  | 
 |  |             //市管理员
 | 
												
													
														
															|  | 
 |  |             if ("saasAdmin".equals(role.getCode())) {
 | 
												
													
														
															|  | 
 |  |                 sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                         "\t`code`\tas community\n" +
 | 
												
													
														
															|  | 
 |  |                         "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "\tdm_hospital\n" +
 | 
												
													
														
															|  | 
 |  |                         "WHERE\n" +
 | 
												
													
														
															|  | 
 |  |                         "\tdel = 1";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             //区域管理员
 | 
												
													
														
															|  | 
 |  |             if ("regionAdmin".equals(role.getCode())) {
 | 
												
													
														
															|  | 
 |  |                 sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                         "\tdh.`code` AS community\n" +
 | 
												
													
														
															|  | 
 |  |                         "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "\twlyy_user_area t\n" +
 | 
												
													
														
															|  | 
 |  |                         "LEFT JOIN dm_hospital dh ON t.town = dh.town\n" +
 | 
												
													
														
															|  | 
 |  |                         "WHERE\n" +
 | 
												
													
														
															|  | 
 |  |                         "\tt.user_id = '" + userId + "'\n" +
 | 
												
													
														
															|  | 
 |  |                         "AND t.del = 1\n" +
 | 
												
													
														
															|  | 
 |  |                         "AND dh.del = 1";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             //社区管理员
 | 
												
													
														
															|  | 
 |  |             if ("communityAdmin".equals(role.getCode())) {
 | 
												
													
														
															|  | 
 |  |                 sql = "SELECT\n" +
 | 
												
													
														
															|  | 
 |  |                         "t.hospital AS community\n" +
 | 
												
													
														
															|  | 
 |  |                         "FROM\n" +
 | 
												
													
														
															|  | 
 |  |                         "wlyy_user_area AS t\n" +
 | 
												
													
														
															|  | 
 |  |                         "WHERE\n" +
 | 
												
													
														
															|  | 
 |  |                         "t.user_id = '" + userId + "'\n" +
 | 
												
													
														
															|  | 
 |  |                         "AND t.del = 1";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
 | 
												
													
														
															|  | 
 |  |             for (Map<String, Object> stringObjectMap : list) {
 | 
												
													
														
															|  | 
 |  |                 if (stringObjectMap.get("community") != null && !StringUtils.isEmpty(stringObjectMap.get("community").toString())) {
 | 
												
													
														
															|  | 
 |  |                     if (StringUtils.isEmpty(belongCommunitys)) {
 | 
												
													
														
															|  | 
 |  |                         belongCommunitys += stringObjectMap.get("community").toString();
 | 
												
													
														
															|  | 
 |  |                     } else {
 | 
												
													
														
															|  | 
 |  |                         belongCommunitys += "," +  stringObjectMap.get("community").toString();
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (!StringUtils.isEmpty(belongCommunitys)) {
 | 
												
													
														
															|  | 
 |  |             conditionSql += "\tAND ',"+ belongCommunitys +",' LIKE CONCAT('%,',wua.hospital,',%')\n";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         sql = "SELECT\n" +
 | 
												
													
														
															|  |                 "\tb.id AS id,\n" +
 |  |                 "\tb.id AS id,\n" +
 | 
												
													
														
															|  |                 "\tb.create_time AS createTime,\n" +
 |  |                 "\tb.create_time AS createTime,\n" +
 | 
												
													
														
															|  |                 "\tb.create_user AS createUser,\n" +
 |  |                 "\tb.create_user AS createUser,\n" +
 | 
												
											
												
													
														
															|  | @ -83,7 +145,7 @@ public class MedicineUserService extends BaseJpaService<Mediicineuser, Mediicine
 | 
												
													
														
															|  |                 "\tb.last_login_failure_time AS lastLoginFailureTime,\n" +
 |  |                 "\tb.last_login_failure_time AS lastLoginFailureTime,\n" +
 | 
												
													
														
															|  |                 "\tb.role_id AS roleId\n" +
 |  |                 "\tb.role_id AS roleId\n" +
 | 
												
													
														
															|  |                 "FROM\n" +
 |  |                 "FROM\n" +
 | 
												
													
														
															|  |                 "\tbase_user b\n" +
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "\tbase_user b LEFT JOIN wlyy_user_area wua on b.id = wua.user_id\n" +
 | 
												
													
														
															|  |                 "WHERE\n" +
 |  |                 "WHERE\n" +
 | 
												
													
														
															|  |                 "\tb.role_id IN (\n" +
 |  |                 "\tb.role_id IN (\n" +
 | 
												
													
														
															|  |                 "\t\tSELECT\n" +
 |  |                 "\t\tSELECT\n" +
 | 
												
											
												
													
														
															|  | @ -96,36 +158,9 @@ public class MedicineUserService extends BaseJpaService<Mediicineuser, Mediicine
 | 
												
													
														
															|  |                 "\t)\n" +
 |  |                 "\t)\n" +
 | 
												
													
														
															|  |                 "\tAND b.enabled = 1\n" +
 |  |                 "\tAND b.enabled = 1\n" +
 | 
												
													
														
															|  |                 "\tAND b.locked = 0\n";
 |  |                 "\tAND b.locked = 0\n";
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | //        String sql = "SELECT\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.id AS id,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.account AS account,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.belong_community AS belongCommunity,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.bir_date AS birDate,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.confirm_password AS confirmPassword,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.contact_info AS contactInfo,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.`name` AS `name`,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.`password` AS `password`,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.res_med_cabinet AS resMedCabinet,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.res_pon_area AS resPonArea,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.role AS role,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.sex AS sex,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.create_time AS createTime,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.create_user AS createUser,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.create_user_name AS createUserName,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.update_time AS updateTime,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.update_user AS updateUser,\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t.update_user_name AS updateUserName\n" +
 |  | 
 | 
												
													
														
															|  | //                "FROM\n" +
 |  | 
 | 
												
													
														
															|  | //                "    t_mediicine_user AS t\n" +
 |  | 
 | 
												
													
														
															|  | //                "WHERE\n" +
 |  | 
 | 
												
													
														
															|  | //                "    1=1\n";
 |  | 
 | 
												
													
														
															|  |         String conditionSql = "";
 |  | 
 | 
												
													
														
															|  |         if (!StringUtils.isEmpty(content)){
 |  |         if (!StringUtils.isEmpty(content)){
 | 
												
													
														
															|  | //            conditionSql += " AND CONCAT(t.account, t.`name`) like '%"+ content +"%'";
 |  | 
 | 
												
													
														
															|  |             conditionSql += "\tAND CONCAT(IFNULL(b.`mobile`,''),IFNULL(b.`name`,'')) like '%"+ content +"%'";
 |  |             conditionSql += "\tAND CONCAT(IFNULL(b.`mobile`,''),IFNULL(b.`name`,'')) like '%"+ content +"%'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         sql = sql + conditionSql;
 |  |         sql = sql + conditionSql;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<Map<String,Object>> list=null;
 |  |         List<Map<String,Object>> list=null;
 |