yeshijie 7 سال پیش
والد
کامیت
4ebf3113c0

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -788,6 +788,10 @@ public class ConsultTeamService extends ConsultService {
    public int addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
        synchronized (patient.intern()){//新增同步块,防止居民网络不好时多次点击,或者im服务器响应慢导致同时发起多个咨询
            if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
                return -3;
            }
            JSONObject users = new JSONObject();
            if(patient.equals(agent)){

+ 63 - 33
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.service.third.fzzb;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.doctor.DoctorDao;
@ -81,9 +82,9 @@ public class HealthEducationArticleService extends BaseService{
     * @param userId 是    当前用户ID
     * @return
     */
    public String getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId){
        String response = "";
    public JSONArray getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
@ -92,13 +93,18 @@ public class HealthEducationArticleService extends BaseService{
            param.put("pageIndex",pageIndex);
            param.put("pageSize",pageSize);
            param.put("userId",userId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalList,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONArray("Result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
    /**
@ -106,18 +112,24 @@ public class HealthEducationArticleService extends BaseService{
     * @param articleId 文章id
     * @return
     */
    public String getArticalById(String articleId){
        String response = "";
    public JSONObject getArticalById(String articleId) throws Exception{
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleId",articleId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getArticalById,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getArticalById,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
    /**
@ -131,8 +143,10 @@ public class HealthEducationArticleService extends BaseService{
     * @param userType 是    1 医生 2 居民
     * @return
     */
    public String getCollectionArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId,Integer userType){
        String response = "";
    public JSONArray getCollectionArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId,
                                              Integer pageIndex, Integer pageSize,String userId,Integer userType) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
@ -143,12 +157,18 @@ public class HealthEducationArticleService extends BaseService{
            param.put("userId",userId);
            param.put("userType",userType);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCollectionArticalList,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCollectionArticalList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result").getJSONArray("result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
@ -157,22 +177,25 @@ public class HealthEducationArticleService extends BaseService{
     * @param categoryLevel 是    获取类别:1、一级类别 2、二级类别
     * @return
     */
    public String getCategoryList(String categoryLevel) throws Exception{
        String response = "";
    public JSONArray getCategoryList(String categoryLevel) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("categoryLevel",categoryLevel);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCategoryList,param.toString(),"1"));
            JSONObject json = JSON.parseObject(response);
            if("10000".equals(json.getString(""))){
            }
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getCategoryList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result").getJSONArray("result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
    /**
@ -242,9 +265,10 @@ public class HealthEducationArticleService extends BaseService{
     * @param userId 是    当前用户ID
     * @return
     */
    public String getDoctorArticalByUserId(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId){
        String response = "";
    public JSONArray getDoctorArticalByUserId(String articleTitle, Integer articleState, String firstLevelCategoryId,
                                              Integer pageIndex, Integer pageSize,String userId) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
@ -254,12 +278,18 @@ public class HealthEducationArticleService extends BaseService{
            param.put("pageSize",pageSize);
            param.put("userId",userId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalByUserId,param.toString(),"1"));
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getDoctorArticalByUserId,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            logger.error(e.getMessage());
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONObject("Result").getJSONArray("result");
        }else {
            throw new Exception(json.getString("Message"));
        }
        return response;
    }
}

+ 0 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -193,27 +193,6 @@ public class ImUtill {
        return response;
    }
    /**
     * 发送消息给IM(发送给医生的,医生会多发送医生助手微信模板消息)
     *
     * @param from        来自
     * @param contentType 1文字 2图片消息
     * @param content     内容
     */
    public String sendDoctorImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType,String sendJson) {
        String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
        JSONObject params = new JSONObject();
        params.put("sender_id", from);
        params.put("sender_name", fromName);
        params.put("content_type", contentType);
        params.put("content", content);
        params.put("session_id", sessionId);
        params.put("business_type", businessType);
        params.put("sendJson", sendJson);
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
    /**
     * 更新会话状态
     *

+ 0 - 44
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -337,50 +337,6 @@ public class imController extends BaseController {
        }
    }
    @RequestMapping(value = "/testwx", method = RequestMethod.POST)
    @ResponseBody
    public String testwx(@ApiParam(name="doctor",value="医生code",defaultValue = "xy201703150222")
                         @RequestParam(value="doctor",required = true) String doctor){
        try {
            Doctor d = doctorDao.findByCode(doctor);
            String sessionId = "ec7572875d27446cb4f067b13a85d72a_0ee64daec62746279517ca70d307a52f_8";
            JSONObject json = new JSONObject();
            json.put("openid", "o7NFZwyjo7Wvhv2Wh0eOUoUtlUT4");
            json.put("template_id", "-dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18");
            json.put("url", "wap.baidu.com");
            JSONObject data = new JSONObject();
            JSONObject first = new JSONObject();
            first.put("value","first");
            first.put("color","#000000");
            JSONObject remark = new JSONObject();
            remark.put("value","");
            remark.put("color","#000000");
            JSONObject keyword1 = new JSONObject();
            keyword1.put("value","description");
            keyword1.put("color","#000000");
            JSONObject keyword2 = new JSONObject();
            keyword2.put("value","replyContent");
            keyword2.put("color","#000000");
            JSONObject keyword3 = new JSONObject();
            keyword3.put("value","senderName");
            keyword3.put("color","#000000");
            data.put("first",first);
            data.put("remark",remark);
            data.put("keyword1",keyword1);
            data.put("keyword2",keyword2);
            data.put("keyword3",keyword3);
            json.put("data",data);
            ImUtill.sendDoctorImMsg(doctor, d.getName(), sessionId, "1", "test", "REMAIN",json.toString());
            return success("发送成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送失败!");
        }
    }
    public List getMemberByDoctor(String doctor) {
        String sql = "SELECT d.photo,d.`name`,d.sex,d.`code`,d.level " +
                " from wlyy_admin_team t,wlyy_admin_team_member m,wlyy_doctor d " +

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -616,8 +616,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            String response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
//            String response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -630,7 +630,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    public String getCategoryList(@ApiParam(name = "categoryLevel", value = "获取类别:1、一级类别 2、二级类别",defaultValue = "1")
                                       @RequestParam(value = "categoryLevel", required = true) String categoryLevel){
        try {
            String response = healthEducationArticleService.getCategoryList(categoryLevel);
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCategoryList(categoryLevel);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -651,8 +651,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            String response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID(),1);
//            String response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56",1);
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID(),1);
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56",1);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -665,7 +665,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                  @RequestParam(value = "articleId", required = true) String articleId){
        try {
            String response = healthEducationArticleService.getArticalById(articleId);
            com.alibaba.fastjson.JSONObject response = healthEducationArticleService.getArticalById(articleId);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -721,8 +721,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
//            String response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            String response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();

+ 3 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -320,14 +320,7 @@ public class ConsultController extends WeixinBaseController {
            if (type != 1 && type != 2) {
                return error(-1, "无效请求!");
            }
            try {
                if (consultTeamService.exist(getRepUID(), type)) {
                    return error(-1, "还有咨询未结束,不允许再次提交咨询!");
                }
            } catch (Exception e) {
                error(e);
                return error(-1, e.getMessage());
            }
            if (StringUtils.isEmpty(images)) {
                images = fetchWxImages();
            }
@ -364,6 +357,8 @@ public class ConsultController extends WeixinBaseController {
                return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
            } else if (res == -2) {
                return error(-1, "家庭签约信息不存在或已过期,无法进行三师医生咨询!");
            }else if (res == -3) {
                return error(-1, "还有咨询未结束,不允许再次提交咨询!");
            }
            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());