Browse Source

医养 1.8.7

wsl 2 years ago
parent
commit
a0e55ee22b

+ 3 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/customerService/CustomerServiceController.java

@ -66,7 +66,9 @@ public class CustomerServiceController extends EnvelopRestEndpoint {
                return Envelop.getError("添加失败!当前已存在一个生效客服!",500);
            }else if (result == -1){
                return Envelop.getError("添加失败!当前客服已存在未生效状态!",500);
            }else {
            }else if (result == -2){
               return Envelop.getError("添加失败!添加用户非管理员!",500);
           }else {
               return success("添加成功");
           }

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/customerService/CustomerService.java

@ -59,10 +59,13 @@ public class CustomerService {
    public Integer addCustomerServiceUser(String id) {
        String sql = "select count(id) from wlyy_user_role where del = 1";
        String sqldel = "select count(id) from wlyy_user_role where user ='" + id + "' and del = 0";
        String sqladmin = "select count(id) from wlyy_user_role where user ='" + id + "' and role = '330100'";
        Integer total = jdbcTemplate.queryForObject(sql, Integer.class);
        Integer delTotal = jdbcTemplate.queryForObject(sqldel, Integer.class);
        Integer adminTital = jdbcTemplate.queryForObject(sqladmin, Integer.class);
        if (total > 0) return 0;
        if (delTotal > 0) return -1;
        if (!(adminTital > 0)) return -2;
        String instSql = "INSERT INTO `base`.`wlyy_user_role`(`user`, `role`, `czy`, `czrq`,`del`) VALUES ('" + id + "', 'chjd_kf', NULL, NULL,1);";
        jdbcTemplate.update(instSql);
        return 1;

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/role/DoctorRoleDao.java

@ -14,6 +14,6 @@ import java.util.List;
public interface DoctorRoleDao extends JpaRepository<DoctorRole, Long> {
    @Query(value = "select b.* from wlyy_user_role a,wlyy_role b where a.role = b.code and a.user = ?1",nativeQuery = true)
    @Query(value = "select b.* from wlyy_user_role a,wlyy_role b where a.role = b.code and a.user = ?1 and ((a.del = 1 OR a.del IS NULL) )  ",nativeQuery = true)
    List<DoctorRole> findUserRole(String user);
}

+ 38 - 17
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/customerService/CustomerService.java

@ -73,28 +73,32 @@ public class CustomerService {
        JSONArray jsonArray = JSONArray.parseArray(sing);
        JSONArray result = new JSONArray();
        for (int i = 0; i < jsonArray.size(); i++) {
        System.out.println("-----imAddr:"+imAddr);
        String sql = "SELECT CASE WHEN archive_type = 1 THEN '老人' WHEN archive_type = 2 THEN '幼儿' WHEN archive_type = 3 THEN '家属' END AS type FROM base_patient  WHERE  id = '<id>' AND del = 1 " +
                "UNION  " +
                "SELECT CASE " +
                " WHEN doctor_level = 2 THEN " +
                " '社工' " +
                "WHEN doctor_level = 4 THEN " +
                "'助老员' " +
                "WHEN doctor_level = 3 THEN " +
                "'教师' " +
                "END AS type FROM base_doctor WHERE id = '<id>'  ";
       for (int i = 0; i < jsonArray.size(); i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            System.out.println(jsonObject.get("sender_id") + ":" + jsonObject.get("sender_name"));
            if (jsonObject.get("sender_id") != null && StringUtils.isNotBlank(jsonObject.get("sender_id").toString())) {
           /*  if (jsonObject.get("sender_id") != null && StringUtils.isNotBlank(jsonObject.get("sender_id").toString())&&!jsonObject.get("sender_id").toString().equals(user_id)) {
                String id = jsonObject.get("sender_id").toString();
                String sql = "SELECT CASE WHEN archive_type = 1 THEN '老人' WHEN archive_type = 2 THEN '幼儿' WHEN archive_type = 3 THEN '家属' END AS type FROM base_patient  WHERE  id = '" + id + "' AND del = 1 " +
                        "UNION  " +
                        "SELECT CASE " +
                        " WHEN doctor_level = 2 THEN " +
                        " '社工' " +
                        "WHEN doctor_level = 4 THEN " +
                        "'助老员' " +
                        "WHEN doctor_level = 3 THEN " +
                        "'教师' " +
                        "END AS type FROM base_doctor WHERE id = '" + id + "'  ";
                List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
                String labelSql = sql.replace("<id>",id);
                List<Map<String, Object>> list = jdbcTemplate.queryForList(labelSql);
                if (list.size() > 0) {
                    jsonObject.put("userType", list.get(0).get("type").toString());
                }else {
                    jsonObject.put("userType", "未知");
                }
               /* for (Map<String, Object> map : list) {
               *//* for (Map<String, Object> map : list) {
                    switch (map.get("type").toString()){
                        case "老人":
                            String fpatientSql = "SELECT count(id) FROM base_patient_family_member  WHERE  family_member = '"+id+"'";
@ -107,10 +111,27 @@ public class CustomerService {
                            break;
                    }
                }*/
            }
                }*//*
            }else {*/
                JSONArray participantsArray = JSONArray.parseArray(jsonObject.get("participantsTimeArray").toString());
                for (Object participantObj : participantsArray) {
                    JSONObject participant = JSONObject.parseObject(participantObj.toString());
                    if (!user_id.equals(participant.getString("id"))) {
                        String id = participant.getString("id");
                        String labelSql = sql.replace("<id>",id);
                        List<Map<String, Object>> list = jdbcTemplate.queryForList(labelSql);
                        if (list.size() > 0) {
                            jsonObject.put("userType", list.get(0).get("type").toString());
                        }else {
                            jsonObject.put("userType", "未知");
                        }
                    }
                }
           /* }*/
            result.add(jsonObject);
        }
       }
        return result;
    }