Преглед изворни кода

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

liubing пре 2 година
родитељ
комит
e65de1fb45

+ 5 - 0
common/common-entity/sql记录

@ -2209,3 +2209,8 @@ INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedback3', NULL, 'opinionFeedbackType', '3', '功能建议', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedback4', NULL, 'opinionFeedbackType', '4', '其他', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedbackUser1', NULL, 'opinionFeedbackUser', '0', '家属', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedbackUser2', NULL, 'opinionFeedbackUser', '1', '社工', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedbackUser3', NULL, 'opinionFeedbackUser', '2', '助老员', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedbackstatus1', NULL, 'opinionFeedbackstatus', '0', '处理中', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `base`.`wlyy_hospital_sys_dict`(`id`, `saas_id`, `dict_name`, `dict_code`, `dict_value`, `py_code`, `sort`, `hospital`, `create_time`, `create_user`, `create_user_name`, `update_time`, `update_user`, `update_user_name`, `img_url`, `model_name`) VALUES ('opinionFeedbackstatus2', NULL, 'opinionFeedbackstatus', '1', '已回复', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/opinionFeedback/OpinionFeedbackController.java

@ -28,14 +28,14 @@ public class OpinionFeedbackController extends EnvelopRestEndpoint {
    @GetMapping("findOpinionFeedbackList")
    @ApiOperation("查找列表")
    public ObjEnvelop findOpinionFeedbackList(@RequestParam(value = "suggestUserName", required = false) String suggestUserName,
                                              @RequestParam(value = "feedbcakType", required = false) Integer feedbcakType,
                                              @RequestParam(value = "feedbackType", required = false) Integer feedbackType,
                                              @RequestParam(value = "userType", required = false) Integer userType,
                                              @RequestParam(value = "suggestStatus", required = false) Integer suggestStatus,
                                              @RequestParam(value = "page", required = false) Integer page,
                                              @RequestParam(value = "pageSize", required = false) Integer pageSize,
                                              @RequestParam(value = "id", required = false) String id) {
        try {
            JSONObject opinionFeedbackList = opinionFeedbackService.findOpinionFeedbackList(suggestUserName, feedbcakType, userType, suggestStatus, page, pageSize, id);
            JSONObject opinionFeedbackList = opinionFeedbackService.findOpinionFeedbackList(suggestUserName, feedbackType, userType, suggestStatus, page, pageSize, id);
            return success(opinionFeedbackList);
        } catch (Exception e) {
            e.printStackTrace();

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

@ -73,7 +73,7 @@ public class CustomerService {
        if (1 == status) {
            String sqlTotal = "select count(id) from wlyy_user_role where 1=1 and role = 'chjd_kf' and del=1";
            Integer total = jdbcTemplate.queryForObject(sqlTotal, Integer.class);
            if (total > 1) return -1;
            if (total >= 1) return -1;
        }
        String sql = "update wlyy_user_role set del = '" + status + "' where user = '" + id + "' and role ='chjd_kf' ";

+ 6 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/opinionFeedback/OpinionFeedbackService.java

@ -23,7 +23,7 @@ public class OpinionFeedbackService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public JSONObject findOpinionFeedbackList(String suggestUserName, Integer feedbcakType, Integer userType, Integer suggestStatus, Integer page, Integer pageSize,String id) {
    public JSONObject findOpinionFeedbackList(String suggestUserName, Integer feedbackType, Integer userType, Integer suggestStatus, Integer page, Integer pageSize,String id) {
        JSONObject jsonObject = new JSONObject();
@ -39,9 +39,9 @@ public class OpinionFeedbackService {
            sql += " and suggest_user_name like '%" + suggestUserName + "%'";
            sqlTotal += " and suggest_user_name like '%" + suggestUserName + "%'";
        }
        if (null != feedbcakType) {
            sql +=" and feedback_type = "+feedbcakType+"";
            sqlTotal +=" and feedback_type = "+feedbcakType+"";
        if (null != feedbackType) {
            sql +=" and feedback_type = "+feedbackType+"";
            sqlTotal +=" and feedback_type = "+feedbackType+"";
        }
        if (null != userType) {
            sql +=" and  user_type = "+userType+"";
@ -63,6 +63,8 @@ public class OpinionFeedbackService {
        if (StringUtils.isBlank(id)) {
            if (page == null) {
                page = 0;
            }else {
                page = (page - 1) * pageSize;
            }
            if (pageSize == null) {
                pageSize = 10;

+ 78 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/cutomerService/CustomerServiceController.java

@ -0,0 +1,78 @@
package com.yihu.jw.care.endpoint.cutomerService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.customerService.CustomerService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * Created by wsl on 2022/9/13
 */
@RestController
@RequestMapping(value = "/customerService/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医养客服")
public class CustomerServiceController extends EnvelopRestEndpoint {
    @Autowired
    private CustomerService customerService;
    @ApiOperation("获取生效客服信息")
    @GetMapping(value= "findCustomerServiceInfo")
    public ListEnvelop customerServiceInfo(){
        try {
            List<Map<String, Object>> result = customerService.customerServiceInfo();
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("服务端异常!");
        }
    }
    @ApiOperation("获取客服咨询信息")
    @GetMapping(value= "consultList")
    public ListEnvelop consultList(@RequestParam(value = "user_id", required = true) String user_id,
                                   @RequestParam(value = "business_type", required = true) String business_type,
                                   @RequestParam(value = "status", required = true) String status,
                                   @RequestParam(value = "name", required = false) String name,
                                   @RequestParam(value = "search_type", required = true) String search_type,
                                   @RequestParam(value = "page", required = true) Integer page,
                                   @RequestParam(value = "size", required = true) Integer size){
        try {
            JSONArray jsonArray = customerService.consultList(user_id, business_type, status, name, search_type, page, size);
            return success(jsonArray);
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("服务端异常!");
        }
    }
    @ApiOperation("获取客服咨询未回复数量")
    @GetMapping(value= "consultNoReply")
    public ObjEnvelop consultNoReply(@RequestParam(value = "doctor", required = true) String doctor){
        try {
            JSONObject jsonObject = customerService.consultNoReply(doctor);
            return success(jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("服务端异常!");
        }
    }
}

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

@ -0,0 +1,127 @@
package com.yihu.jw.care.service.customerService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.util.HttpClientUtilCare;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.util.ImUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by wsl on 2022/9/13
 */
@Service
public class CustomerService {
    @Value("${im.im_list_get}")
    private String im_host;
    //@Autowired
    //private HttpClientUtilCare httpClientUtilCare;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    RedisTemplate redisTemplate;
    @Autowired
    ImService imService;
    @Autowired
    private ImUtil imUtil;
    // user_id=13&business_type=2&status=0&name=&search_type=1&page=1&size=20
    //获取客服信息
    public List<Map<String, Object>> customerServiceInfo() {
        String sql = "SELECT d.id,d.`name`,d.photo,d.mobile FROM base_doctor d INNER JOIN wlyy_user_role r ON d.id = r.`user` WHERE r.del = 1 AND r.role = 'chjd_kf'  ";
        String listStr = imUtil.getOnlineListByType("helper");
        JSONObject onLineObj = JSONObject.parseObject(listStr);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (200 == onLineObj.getInteger("status")) {
            JSONObject oneLineInfo = onLineObj.getJSONObject("helper");
            for (Map<String, Object> map : list) {
                String doctorCode = map.get("id").toString();
                if (oneLineInfo.containsKey(doctorCode)) {
                    if (oneLineInfo.getInteger(doctorCode) > 0) {
                        map.put("onLineFlag", 1);
                    } else {
                        map.put("onLineFlag", 0);
                    }
                } else {
                    map.put("onLineFlag", 0);
                }
            }
        }
        return list;
    }
    public JSONArray consultList(String user_id, String business_type, String status, String name, String search_type, Integer page, Integer size) {
        if (StringUtils.isBlank(name)) {
            name = "";
        }
        String imAddr = im_host + "api/v2/sessions?user_id=" + user_id + "&business_type=" + business_type + "&status=" + status + "&" +
                "name=" + name + "&search_type=" + search_type + "&page=" + page + "&size=" + size + "";
        HttpClientUtilCare httpClientUtilCare = new HttpClientUtilCare();
        String sing = httpClientUtilCare.get(imAddr, "utf-8");
        JSONArray jsonArray = JSONArray.parseArray(sing);
        JSONArray result = new JSONArray();
        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())) {
                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);
                if (list.size() > 0) {
                    jsonObject.put("userType", list.get(0).get("type").toString());
                }else {
                    jsonObject.put("userType", "未知");
                }
               /* 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+"'";
                            Integer total = jdbcTemplate.queryForObject(fpatientSql, Integer.class);
                            if (total>0){
                                jsonObject.put("userType","家属");
                            }
                            break;
                        default:
                            break;
                    }
                }*/
            }
            result.add(jsonObject);
        }
        return result;
    }
    public JSONObject consultNoReply(String doctor) {
        JSONObject result = new JSONObject();
        Integer integer = imService.SessionsUnreadMessageCount(doctor,"2");
        result.put("total", integer);
        return result;
    }
}