소스 검색

代码修改

LAPTOP-KB9HII50\70708 1 년 전
부모
커밋
e9a3e004c7

+ 33 - 7
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -347,6 +347,24 @@ public class ImService {
        return consultCode;
    }
    public String getUnfinishedConsult(String patient, String doctor,int type) {
        String totalSql = "SELECT a.consult as \"consultCode\" " +
                "FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
                "WHERE a.consult=b.consult " +
                "AND a.patient= '" + patient + "' " +
                "AND b.to_doctor='" + doctor + "' " +
                "AND a.del='1' " +
                "AND a.type=" +type+
                "AND a.status=0";
        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
        String consultCode = null;
        if (rstotal != null && rstotal.size() > 0) {
            consultCode = rstotal.get(0).get("consultCode").toString();
        }
        logger.info("未结束判断语句" + totalSql + "======consultCode" + consultCode);
        return consultCode;
    }
    /**
     * 查询居民与某个医生未结束的专家咨询
     *
@ -977,12 +995,20 @@ public class ImService {
            }
        }
        if (!flag) {
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor))) {//判断是否有未结束的咨询移到同步方法中
//			re.put("status", -3);
//			return re;
                throw new RuntimeException("居民还有未结束的专家咨询!");
            if(ct.getType()==28){
                if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
                    throw new RuntimeException("居民还有未结束的康复咨询!");
                }
            }else {
                if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor))) {//判断是否有未结束的咨询移到同步方法中
                    throw new RuntimeException("居民还有未结束的专家咨询!");
                }
            }
        }
        String title = "专家咨询";
        if(ct.getType()==28){
            title = "康复咨询";
        }
        JSONObject users = new JSONObject();
@ -1010,7 +1036,7 @@ public class ImService {
        // 医生未读数量为1
        ct.setDoctorRead(1);
        // 添加咨询记录
        ConsultDo consult = addConsult(ct.getPatient(), "专家咨询", ct.getSymptoms(), ct.getImages(), ct.getType(), source);
        ConsultDo consult = addConsult(ct.getPatient(), title, ct.getSymptoms(), ct.getImages(), ct.getType(), source);
//		// 设置关联指导
//		consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
@ -1021,7 +1047,7 @@ public class ImService {
        ct.setDoctorName(baseDoctorDO.getName());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("title", tempPatient.getName() + "申请专家咨询");
        jsonObject.put("title", tempPatient.getName() + "申请"+title);
        jsonObject.put("content", ct.getSymptoms());
        jsonObject.put("age", DateUtil.getAgeForIdcard(tempPatient.getIdcard()));
        jsonObject.put("sex", tempPatient.getSex());
@ -1029,7 +1055,7 @@ public class ImService {
        //推送给IM去创建议题,取得成员消息
        JSONObject messages = imUtil.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), jsonObject.toJSONString(), consult.getImages(), doctor);
        users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
        users.put(patient, 0);
        String session_type = imUtil.SESSION_TYPE_MUC;
        if (17 == ct.getType()) {
            session_type = imUtil.SESSION_TYPE_MUC_VIDEO;//专家咨询-视频

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -23,7 +23,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	private Integer type;           //  1、15三师咨询,2、家庭医生咨询,
	// 6、患者名医咨询 7医生名医咨询 8续方咨询 9、16在线复诊咨询(居民直接咨询专家)
	// 10医生发起的求助 11思明区上门服务在线咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 13、互联网医院专家咨询 28、康复咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 23 新生儿在线咨询
	// 24 老人在线咨询
	// 25

+ 1 - 1028
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/consult/controller/ConsultController.java

@ -4,17 +4,11 @@ package com.yihu.jw.hospital.module.consult.controller;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamLogDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.message.MessageNoticeSetting;
import com.yihu.jw.entity.util.SystemConfEntity;
import com.yihu.jw.hospital.module.consult.service.ConsultTeamService;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.task.PushMsgTask;
import com.yihu.jw.hospital.utils.HttpUtil;
import com.yihu.jw.hospital.utils.WeiXinAccessTokenUtils;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultTeamDao;
@ -24,19 +18,15 @@ import com.yihu.jw.message.service.MessageService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.common.CommonUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
@ -139,315 +129,6 @@ public class ConsultController extends EnvelopRestEndpoint {
//    private WlyyDynamicMessagesDao dynamicMessagesDao;
//    @ApiOperation("testRedis")
//    @RequestMapping(value = "testRedis",method = RequestMethod.POST)
//    public String testRedis(){
//        try{
//            String redis_key = "REDIS_KEY_REPLACER";
//            String Topics ="sessions:REDIS_KEY_REPLACER:topics";
//            String Topic= "topics:REDIS_KEY_REPLACER";
//            String Messages= "sessions:REDIS_KEY_REPLACER:messages";
//            String MessagesByTimestamp= "sessions:REDIS_KEY_REPLACER:messages_by_timestamp";
//            String sessionId = "0fab4dd67e074e16ac86db6b6c15233e_7e3da9605d064b4fa0aacca95cf683b3_2";
//
//            String setKey = Messages.replace(redis_key,sessionId);
//            System.out.println(setKey);
//            long l1= redisTemplate.boundZSetOps(setKey).zCard();
//            Set<String> range = redisTemplate.boundZSetOps(setKey).range(0, -1);
//            System.out.println(l1);
//            System.out.println(range.size());
//            return success("testRedis");
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return error(-1,"挂断失败");
//    }
//    @RequestMapping(value = "sendVideoCommunication")
//    @ApiOperation("居民发起视频通讯")
//    public String sendVideoCommunication(@ApiParam(name = "patient", value = "居民code")
//                                         @RequestParam(value = "patient", required = true) String patient,
//                                         @ApiParam(name = "consult", value = "咨询code")
//                                         @RequestParam(value = "consult", required = true) String consult,
//                                         @ApiParam(name = "doctor", value = "医生code")
//                                         @RequestParam(value = "doctor", required = true) String doctor,
//                                         @ApiParam(name = "sessionId", value = "会话id")
//                                         @RequestParam(value = "sessionId", required = true) String sessionId) {
//        try {
//            ConsultTeamDo consultTeam = consultTeamDao.findByConsult(consult);
//            if (consultTeam.getStatus() != 0) {
//                return error(-1, "该咨询已结束,无法发起视频通讯!");
//            }
//
///*            BaseDoctorDO d = doctorDao.findByCode(doctor);
//            if(d.getVideoStauts()!=null&&d.getVideoStauts()==1){
//                return error(-1, "医生在视频通讯中,无法发起视频通讯!");
//            }*/
//
//            BasePatientDO p = patientDao.findByCode(patient);
//
//            JSONObject message = new JSONObject();
//            JSONObject content = new JSONObject();
//            content.put("patient", patient);
//            content.put("patientName", p.getName());
//            content.put("consult", consult);
//            content.put("sessionId", sessionId);
//            content.put("patientName", p.getName());
//            content.put("photo", p.getPhoto());
//            message.put("id", getUID());
//            message.put("sender_id", p.getCode());
//            message.put("session_id", "system");
//            message.put("sender_name", p.getName());
//            message.put("content_type", 40);
//            message.put("timestamp", DateUtil.getStringDate());
//            message.put("content", content);
//
//            String response = imUtill.sendVideoCommunication(doctor, message.toString());
//            JSONObject jsonObject = new JSONObject(response);
//            if (1 == jsonObject.getInt("status")) {
//                return error(-1, "医生不在线无法发起视频通讯!");
//            }
////            d.setVideoStauts(1);
////            doctorDao.save(d);
//            return success("发起成功");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return error(-1, "发起失败!");
//    }
//    @ApiOperation("居民取消视频")
//    @RequestMapping(value = "cancelVideo", method = RequestMethod.POST)
//    public String cancelVideo(@ApiParam(name = "consult", value = "咨询code")
//                              @RequestParam(value = "consult", required = true) String consult,
//                              @ApiParam(name = "doctor", value = "医生code")
//                              @RequestParam(value = "doctor", required = true) String doctor,
//                              @ApiParam(name = "sessionId", value = "会话id")
//                              @RequestParam(value = "sessionId", required = true) String sessionId) {
//        try {
//            BaseDoctorDO d = doctorDao.findByCode(doctor);
//            d.setVideoStauts(0);
//            doctorDao.save(d);
//            BasePatientDO p = patientDao.findByCode(getUID());
//
//            JSONObject message = new JSONObject();
//            JSONObject content = new JSONObject();
//            content.put("patient", p.getCode());
//            content.put("patientName", p.getName());
//            content.put("consult", consult);
//            content.put("sessionId", sessionId);
//            content.put("patientName", p.getName());
//            content.put("photo", p.getPhoto());
//            message.put("id", getUID());
//            message.put("sender_id", p.getCode());
//            message.put("session_id", "system");
//            message.put("sender_name", p.getName());
//            message.put("content_type", 45);
//            message.put("timestamp", DateUtil.getStringDate());
//            message.put("content", content);
//
//            String response = imUtill.sendVideoCommunication(doctor, message.toString());
//
//            imUtill.sendTopicIM(p.getCode(), p.getName(), consult, "45", "居民取消视频通讯", null);
//            return success("取消成功");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return error(-1, "取消失败");
//    }
//    @ApiOperation("居民挂断视频")
//    @RequestMapping(value = "handUpVideo", method = RequestMethod.POST)
//    public String handUpVideo(@ApiParam(name = "consult", value = "咨询code")
//                              @RequestParam(value = "consult", required = true) String consult,
//                              @ApiParam(name = "doctor", value = "医生code")
//                              @RequestParam(value = "doctor", required = true) String doctor,
//                              @ApiParam(name = "time", value = "视频接通时长")
//                              @RequestParam(value = "time", required = true) String time) {
//        try {
//            BaseDoctorDO d = doctorDao.findById(doctor).orElse(null);
//            d.setVideoStauts(0);
//            doctorDao.save(d);
//            BasePatientDO p = patientDao.findById(getUID()).orElse(null);
//            imUtill.sendTopicIM(p.getId(), p.getName(), consult, "44", time, null);
//            return success("挂断成功");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return error(-1, "挂断失败");
//    }
    /**
     * 患者咨询记录查询
     *
     * @param title    咨询标题
     * @param id
     * @param pagesize 分页大小
     * @return
     */
//    @RequestMapping(value = "records")
//    @ApiOperation("患者咨询记录查询")
//    public String consultRecords(
//            @RequestParam(required = false) String title,
//            long id,
//            int pagesize) {
//        try {
//            JSONArray array = new JSONArray();
//            Page<Object> data = consultTeamService.findConsultRecordByPatient(getRepUID(), id, pagesize, title);
//            if (data != null) {
//                for (Object consult : data.getContent()) {
//                    if (consult == null) {
//                        continue;
//                    }
//                    Object[] result = (Object[]) consult;
//                    JSONObject json = new JSONObject();
//                    json.put("id", result[0]);
//                    // 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈
//                    json.put("type", result[1]);
//                    // 设置咨询标识
//                    json.put("code", result[2]);
//                    // 设置显示标题
//                    json.put("title", result[3]);
//                    // 设置主诉
//                    json.put("symptoms", result[4]);
//                    // 咨询状态
//                    json.put("status", result[6]);
//                    // 设置咨询日期
//                    json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
//                    // 咨询状态
//                    json.put("doctorCode", result[7]);
//
//                    json.put("teamCode", result[8]);
//
//                    json.put("evaluate", result[9]);
//
//                    //签约code
//                    json.put("signCode", result[10]);
//
//                    array.put(json);
//                }
//            }
//            return write(200, "查询成功!", "list", array);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败!");
//        }
//    }
    /**
     * 获取医生的排班时间
     *
     * @param doctor
     * @param week
     * @return
     */
//    @RequestMapping(value = "/doctor_worktime/week")
//    @ApiOperation("获取医生的排班时间")
//    public String getDoctorWeekWorkTime(String doctor, String week) {
//        try {
//            JSONObject result = doctorWorkTimeService.findDoctorWeekWorkTime(doctor, week);
//
//            return write(200, "查询成功!", "data", result);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败!");
//        }
//    }
    /**
     * 获取医生某天的排班时间
     *
     * @param doctor
     * @return
     */
//    @RequestMapping(value = "/doctor_worktime")
//    @ApiOperation("获取医生某天的排班时间")
//    public String getDoctorWorkTime(String doctor) {
//        try {
//            JSONObject result = doctorWorkTimeService.findDoctorWorkTime(doctor);
//
//            return write(200, "查询成功!", "data", result);
//        } catch (ServiceException se) {
//            return write(-1, se.getMessage());
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败!");
//        }
//    }
    /**
     * 医生是否在工作
     *
     * @param doctor
     * @return
     */
//    @RequestMapping(value = "is_doctor_working")
//    @ApiOperation("医生是否在工作")
//    public String isDoctorAtWorking(String doctor) {
//        try {
//            JSONObject result = doctorWorkTimeService.isDoctorWorking(doctor);
//            return write(200, result.getString("msg"), "data", result.getString("status"));
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败");
//        }
//    }
    /**
     * 患者端在发起家庭医生咨询时检查全科医生和健管师是否在工作
     *
     * @param doctor
     * @param healthDoctor
     * @return
     */
//    @RequestMapping(value = "isDoctorWorkWhenconsult", method = RequestMethod.POST)
//    @ApiOperation("全科医生和健管师是否在工作")
//    public String isDoctorWorkWhenconsult(String doctor, String healthDoctor) {
//        try {
//            JSONObject result = doctorWorkTimeService.isDoctorWorkingWhenConsult(doctor, healthDoctor);
//            return write(200, result.getString("msg"), "data", result.getString("status"));
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败");
//        }
//    }
    /**
     * 名医是否在工作
     *
     * @param doctor
     * @return
     */
//    @RequestMapping(value = "is_famous_doctor_working")
//    @ApiOperation("名医是否在工作")
//    public String isFamousDoctorAtWorking(String doctor) {
//        try {
//            JSONObject result = doctorWorkTimeService.isFamousDoctorWorking(doctor);
//            return write(200, result.getString("msg"), "data", result.getString("status"));
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败");
//        }
//    }
    /**
     * 名医咨询剩余次数查询
     *
     * @param doctor
     * @return
     */
//    @ApiOperation("名医咨询剩余次数查询")
//    @RequestMapping(value = "/consult_times_remain")
//    public String famousDoctorTimesRemain(String doctor) {
//        try {
//            int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctor);
//            return write(200, "查询成功", "data", result);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败");
//        }
//    }
    /**
     * 获取未完成咨询
     *
@ -655,294 +336,6 @@ public class ConsultController extends EnvelopRestEndpoint {
//        }
//    }
//    @RequestMapping(value = "intoTopic", method = RequestMethod.POST)
//    @ApiOperation("进入咨询")
//    public String intoTopic(@RequestParam(required = true) String consult) {
//        try {
//            int result = consultTeamService.intoTopic(consult, getRepUID(), getUID());
//            if (result == -1) {
//                return error(-1, "该咨询不是进行中");
//            }
//            JSONObject json = new JSONObject();
//            json.put("consult", consult);
//            json.put("content", "进入咨询");
//            BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getRepUID(), json);
//            return success("进入成功");
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "请求失败");
//        }
//    }
    /**
     * 名医咨询添加接口
     *
     * @param when       发病时间
     * @param symptoms   主要症状
     * @param images     图片URL地址,多图以逗号分隔
     * @param voice      语音URL地址
     * @param doctorCode 名医的code
     * @return
     */
//    @RequestMapping(value = "famousAdd")
//    @ApiOperation("名医咨询添加接口")
//    public String famousAdd(
//            @RequestParam(required = false) String when,
//            String symptoms,
//            @RequestParam(required = false) String doctorCode,
//            @RequestParam(required = false) String images,
//            @RequestParam(required = false) String voice) {
//        try {
//            //判断医生是否是在工作时间
//            JSONObject jo = doctorWorkTimeService.isFamousDoctorWorking(doctorCode);
//            if (!jo.get("status").equals("1")) {
//                return error(-1, jo.get("msg").toString());
//            }
//            //判断医生是否剩下咨询次数
//            int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctorCode);
//            if (result == 0) {
//                return error(-1, "没有次数");
//            }
//            if (StringUtils.isEmpty(images)) {
//                images = fetchWxImages();
//            }
//            // 将临时图片拷贝到正式存储路径下
//            if (StringUtils.isNotEmpty(images)) {
//                images = CommonUtil.copyTempImage(images);
//            }
//            if (StringUtils.isEmpty(voice)) {
//                voice = fetchWxVoices();
//            }
//            if (StringUtils.isNotEmpty(voice)) {
//                voice = CommonUtil.copyTempVoice(voice);
//            }
//            //判断是否已经存在还没有关闭的咨询
//            if (consultTeamService.isExistConsult(getRepUID(), doctorCode)) {
//                return error(-1, "还有咨询未结束,不允许再次提交咨询!");
//            }
//            ConsultTeam consult = new ConsultTeam();
//            // 设置咨询类型:1三师咨询,2家庭医生咨询 6.名医咨询
//            consult.setType(6);
//            // 设置发病时间
//            consult.setWhen(when);
//            // 设置主要症状
//            consult.setSymptoms(symptoms);
//            // 设置咨询图片URL
//            consult.setImages(images);
//            // 设置咨询语音URL
//            consult.setVoice(voice);
//            consult.setDoctor(doctorCode);//设置专科医生
//            // 保存到数据库
//            JSONObject object = consultTeamService.famousConsult(consult, getRepUID(), "1", getUID());
//            JSONObject resultConsult = new JSONObject(consult);
//            resultConsult.put("session_id", object.getString("session_id"));
//            //名医咨询次数减一
//            doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
//            // 推送消息给医生
//            pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.D_CT_03.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.您有新的名医咨询.name(), consult.getConsult());
//            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
//            return write(200, "提交成功", "data", resultConsult);
//        } catch (ServiceException se) {
//            return write(-1, se.getMessage());
//        } catch (Exception ex) {
//            error(ex);
//            return invalidUserException(ex, -1, "提交失败!");
//        }
//    }
    /**
     * 名医列表
     *
     * @return
     */
//    @RequestMapping(value = "famousDoctorList")
//    @ApiOperation("名医列表")
//    public String famousDoctorList(
//            @RequestParam(required = false) String name) {
//        try {
//            JSONArray array = new JSONArray();
//            List<Doctor> list = doctorService.famousDoctorList(name);
//            if (list != null) {
//                for (BaseDoctorDO doctor : list) {
//                    if (doctor == null) {
//                        continue;
//                    }
//
//                    // 判断名医是否在工作
//                    JSONObject isWorking = doctorWorkTimeService.isDoctorWorking(doctor.getCode());
//
//                    if (isWorking == null || !isWorking.getString("status").equals("1")) {
//                        continue;
//                    }
//
//                    int num = doctorWorkTimeService.getDoctorConsultTimesRemain(doctor.getCode());
//
//                    if (num < 1) {
//                        continue;
//                    }
//
//                    JSONObject json = new JSONObject();
//                    json.put("id", doctor.getId());
//                    // 医生标识
//                    json.put("code", doctor.getCode());
//                    // 医生性别
//                    json.put("sex", doctor.getSex());
//                    // 医生姓名
//                    json.put("name", doctor.getName());
//                    // 所在医院名称
//                    json.put("hospital", doctor.getHospital());
//                    // 所在医院名称
//                    json.put("hospital_name", doctor.getHospitalName());
//                    // 科室名称
//                    json.put("dept_name", (doctor.getDeptName() == null ||
//                            StringUtils.isEmpty(doctor.getDeptName().toString())) ? " " : doctor.getDeptName());
//                    // 职称名称
//                    json.put("job_name", (doctor.getJobName() == null ||
//                            StringUtils.isEmpty(doctor.getJobName().toString())) ? " " : doctor.getJobName());
//                    // 头像
//                    json.put("photo", doctor.getPhoto());
//                    // 简介
//                    json.put("introduce", doctor.getIntroduce());
//                    // 专长
//                    json.put("expertise", doctor.getExpertise());
//                    // 剩余咨询次数
//                    json.put("num", num);
//                    array.put(json);
//                }
//            }
//            return write(200, "获取医院医生列表成功!", "list", array);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "获取医院医生列表失败!");
//        }
//    }
//    @RequestMapping(value = "status")
//    public String status(String consult) {
//        try {
//            ConsultTeam ct = consultTeamService.findByCode(consult);
//            if (ct == null) {
//                return error(-1, "获取状态失败!");
//            } else {
//                return write(200, "获取状态成功!", "data", ct.getStatus());
//            }
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "获取状态失败!");
//        }
//    }
//    @RequestMapping(value = "evaluateStatus")
////    public String statuss(String consult) {
////        try {
////            ConsultTeam ct = consultTeamService.findByCode(consult);
////            if (ct == null) {
////                return error(-1, "获取状态失败!");
////            } else {
////                return write(200, "获取状态成功!", "data", ct.getEvaluate());
////            }
////        } catch (Exception e) {
////            error(e);
////            return invalidUserException(e, -1, "获取状态失败!");
////        }
////    }
    /**
     * 查询患者三师咨询咨询列表
     *
     * @param status   咨询状态(0未结束,1已结束,-1 已取消)
     * @param pagesize 页数
     * @return 查询结果
     */
//    @RequestMapping(value = "list")
//    @ApiOperation("查询患者三师咨询咨询列表")
//    public String list(int status, long id, int pagesize) {
//        try {
//            Page<ConsultTeam> consults = consultTeamService.findByPatient(getRepUID(), status, id, pagesize);
//            JSONArray jsonArray = new JSONArray();
//            if (consults != null) {
//                for (ConsultTeam consult : consults) {
//                    if (consult == null) {
//                        continue;
//                    }
//                    JSONObject json = new JSONObject();
//                    json.put("id", consult.getId());
//                    // 设置咨询标志
//                    json.put("code", consult.getConsult());
//                    // 设置咨询类型:0公共咨询,1指定医生,2三师咨询
//                    json.put("type", consult.getType());
//                    // 设置标题
//                    json.put("title", consult.getSymptoms());
//                    // 设置发病时间
//                    json.put("when", consult.getWhen());
//                    // 设置患者未读数量
//                    json.put("patientRead", consult.getPatientRead());
//                    // 设置状态
//                    json.put("status", consult.getStatus());
//                    // 设置患者评价标识
//                    json.put("comment", consult.getComment());
//                    // 设置关联指导
//                    json.put("guidance", consult.getGuidance());
//                    // 设置咨询或回复时间
//                    json.put("time", DateUtil.dateToStr(consult.getCzrq(), DateUtil.YYYY_MM_DD_HH_MM_SS));
//                    jsonArray.put(json);
//                }
//            }
//            return write(200, "查询成功", "list", jsonArray);
//        } catch (Exception ex) {
//            error(ex);
//            return invalidUserException(ex, -1, "查询失败!");
//        }
//    }
    /**
     * 患者取消三师咨询
     *
     * @param consult
     * @return
     */
//    @RequestMapping(value = "cancel")
//    @ApiOperation("患者取消三师咨询")
//    public String cancel(String consult) {
//        try {
//            int row = consultTeamService.cancel(consult);
//            if (row > 0) {
//                return success("咨询已取消!");
//            } else {
//                return error(-1, "咨询不能取消!");
//            }
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "操作失败!");
//        }
//    }
    /**
     * 修改状态为1的咨询记录为结束
     *
     * @param code 咨询标识
     * @return
     */
//    @RequestMapping(value = "finish")
//    @ApiOperation("修改状态为1的咨询记录为结束")
//    public String finish(@RequestParam(required = true) String code) {
//        try {
//            int row = consultTeamService.finishConsult(code, getRepUID(), 1);
//            if (row > 0) {
//                return success("操作成功!");
//            } else if (row == -2) {
//                return error(-1, "续方未审核,不能结束续方咨询!");
//            } else {
//                return error(-1, "操作失败!");
//            }
//        } catch (ServiceException se) {
//            return write(-1, se.getMessage());
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "操作失败!");
//        }
//    }
//    @RequestMapping(value = "imAppend")
//    @ApiOperation("im会话回复通用接口")
@ -1104,42 +497,6 @@ public class ConsultController extends EnvelopRestEndpoint {
                            if (doctorCode.equals(patient.getId())) {
                                continue;
                            }
                            //健管
                            Boolean flag = messageService.getMessageNoticeSettingByMessageType(doctorCode, "1", MessageNoticeSetting.MessageTypeEnum.imSwitch.getValue());
                            //全科
//                            Boolean flag2 = !messageService.getMessageNoticeSettingByMessageType(doctorCode, "1", MessageNoticeSetting.MessageTypeEnum.familyTopicSwitch.getValue());
//                            if (flag) {
//                                //            新增发送医生助手模板消息 v1.4.0 by wujunjie
//                                BaseDoctorDO doctor = doctorDao.findById(doctorCode).orElse(null);
//                                String doctorOpenID = doctor.getOpenid();
//                                if (StringUtils.isNotEmpty(doctorOpenID)) {
//                                    String title = "";
//                                    ConsultDo consultSingle = consultDao.findById(log.getConsult()).orElse(null);
//                                    if (consultSingle != null) {
//                                        Integer singleType = consultSingle.getType();
//                                        if (singleType != null && singleType == 8) {
//                                            title = consultSingle.getTitle();
//                                        } else if (singleType != null && singleType != 8) {
//                                            title = consultSingle.getSymptoms();
//                                        }
//                                        String repContent = parseContentType(type + "", content);
//                                        String first = "居民" + patient.getName() + "的咨询有新的回复。";
//                                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
//                                        List<NameValuePair> params = new ArrayList<>();
//                                        params.add(new BasicNameValuePair("type", "8"));
//                                        params.add(new BasicNameValuePair("openId", doctorOpenID));
//                                        params.add(new BasicNameValuePair("url", targetUrl));
//                                        params.add(new BasicNameValuePair("first", first));
//                                        params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
//                                        String keywords = title + "," + repContent + "," + doctor.getName();
//                                        params.add(new BasicNameValuePair("keywords", keywords));
//
//                                        httpClientUtil.post(url, params, "UTF-8");
//                                        System.out.println("发送对象:" + doctorCode);
//                                        System.out.println("发送对象名字:" + doctor.getName());
//                                    }
//                                }
//                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
@ -1154,36 +511,6 @@ public class ConsultController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 获取医生评价列表
     *
     * @param consult  咨询标识
     * @param pagesize 每页显示数,默认为10
     * @return
     */
//    @GetMapping(value = "loglist2")
//    @ApiOperation("获取医生评价列表")
//    public String loglist2(@RequestParam String consult, @RequestParam int page, @RequestParam int pagesize) {
//        try {
//            ConsultTeamDo consultModel = consultTeamService.findByCode(consult);
//            if (consultModel == null) {
//                return error(-1, "咨询记录不存在!");
//            }
//            JSONObject messageObj = imUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getRepUID());
//
//            //过滤续签
//            consultTeamService.removeRenewPerson(messageObj, getRepUID());
//            //过滤非本次咨询专科医生
//            consultTeamService.removeSpecialist(messageObj, getRepUID(), consult);
//
//            return write(200, "查询成功", "list", messageObj);
//        } catch (ServiceException se) {
//            return write(-1, se.getMessage());
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "查询失败!");
//        }
//    }
    /**
     * 网络咨询咨询日志查询
@ -1218,143 +545,7 @@ public class ConsultController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 网络咨询咨询日志查询
     *
     * @param pagesize 每页显示数,默认为10
     * @return
     */
//    @RequestMapping(value = "logs")
//    @ApiOperation("网络咨询咨询日志查询")
//    public String logs(@RequestParam String sessionId, @RequestParam(required = false) String startMsgId, @RequestParam(required = false) String endMsgId, @RequestParam int page, @RequestParam int pagesize) {
//        try {
//            JSONArray messageArray = imUtill.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getRepUID());
//            return write(200, "查询成功", "list", messageArray);
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "查询失败!");
//        }
//    }
//    @RequestMapping(value = "participants")
//    public String participants(@RequestParam String sessionId) {
//        try {
//            JSONArray participants = imUtill.getSessionsParticipants(sessionId);
//
//            //过滤续签
//            consultTeamService.removeRenewPerson(participants, getRepUID());
//
//            return write(200, "查询成功", "list", participants);
//        } catch (ServiceException se) {
//            return write(-1, se.getMessage());
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "查询失败!");
//        }
//    }
    /**
     * 查找单个咨询记录
     *
     * @param consult 咨询标识
     * @param logId   记录标识
     * @return
     */
//    @RequestMapping(value = "oneLog")
//    @ApiOperation("查找单个咨询记录")
//    public String oneLog(@RequestParam String consult, @RequestParam Long logId, @RequestParam int msgType) {
//        try {
//            ConsultTeamDo consultModel = consultTeamService.findByCode(consult);
//            if (consultModel == null) {
//                return error(-1, "咨询记录不存在!");
//            }
//
//            String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
//                    + "api/v1/chats/message";
//            String reG = httpUtil.sendGet(url, "id=" + logId + "&type=" + msgType);
//            JSONObject obj = null;
//            if (!org.springframework.util.StringUtils.isEmpty(reG)) {
//                obj = new JSONObject(new String(reG.getBytes(), "utf-8"));
//            } else {
//                return error(-1, "查询失败");
//            }
//
//            if (obj == null) {
//                return error(-1, "查询失败");
//            }
//
//            JSONObject json = new JSONObject();
//
//            json.put("id", obj.getInt("id"));
//            if (!obj.getString("from").equals(getRepUID())) {
//                BaseDoctorDO doc = doctorService.findDoctorByCode(obj.getString("from"));
//                // 设置回复医生姓名
//                json.put("doctorName", doc.getName());
//                json.put("photo", doc.getPhoto());
//            } else {
//                BasePatientDO p = patientDao.findByCode(obj.getString("from"));
//                // 设置回复医生姓名
//                json.put("doctorName", p.getName());
//                json.put("photo", p.getPhoto());
//            }
//
//            // 设置回复内容
//            json.put("content", obj.getString("content"));
//            // 设置咨询或回复时间
//            json.put("time", DateUtil.dateToStr(new Date(obj.getLong("timestamp")), DateUtil.YYYY_MM_DD_HH_MM_SS));
//            // 设置记录类型:1文字,2图片,3语音
//            json.put("msgType", obj.getInt("contentType"));
//            // 设置类型:0患者问,1医生回复,2患者追问,3患者评价
//            if (!obj.getString("from").equals(getRepUID())) {
//                json.put("type", 1);
//            } else {
//                json.put("type", obj.getInt("contentType") == 6 ? 0 : 2);
//            }
//
//            // 返回结果
//            return write(200, "查询成功", "consult", json);
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "查询失败!");
//        }
//    }
    /**
     * 三师咨询评论
     * consult 咨询标识
     * content 评价内容
     * star    星级
     * 操作结果
     */
//    @RequestMapping(value = "comment")
//    @ApiOperation("三师咨询评论")
//    public String comment(String consult, String content, int star) {
//        try {
//            // 保存评价
//            JSONArray array = doctorCommentService.consultComment(getRepUID(), consult, content, star, 2);
//            // 添加到统计队列
//            if (array != null) {
//                //新增判断 续方咨询暂不统计
//                ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
//                if (consultTeam.getType() != 8) {
//                    DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
//                }
//            }
//            // 添加评价记录
//            ConsultTeamLogDo log = new ConsultTeamLogDo();
//            log.setConsult(consult);
//            log.setContent(content);
//            log.setChatType(1);
//            log.setDel("1");
//            log.setType(3);
//            log = consultTeamService.reply(log, getRepUID(), null, log.getType());
//            return success("感谢您的评价!");
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "评价失败!");
//        }
//
//    }
    @RequestMapping(value = "getTopic")
    public Envelop getTopic(String consult) {
        try {
@ -1378,209 +569,6 @@ public class ConsultController extends EnvelopRestEndpoint {
    /*===========================================续方咨询==============================================================*/
//    @RequestMapping(value = "isPrescriptionConsult", method = RequestMethod.GET)
//    @ApiOperation("是否可以续方咨询")
//    public String isPrescriptConsult(@ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true) String patient) {
//        try {
//            JSONObject json = consultTeamService.isPrescriptConsult(patient);
//            if (json.has("msg")) {
//                return error(-1, json.getString("msg"));
//            }
//            return write(200, "查询成功!", "data", json);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败");
//        }
//    }
//    @RequestMapping(value = "addPrescriptionConsult", method = RequestMethod.POST)
//    @ApiOperation("添加续方咨询")
//    public String addPrescriptionConsult(@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
//                                         @RequestParam(value = "jwCode", required = true) String jwCode,
//                                         @ApiParam(name = "doctor", value = "咨询医生(开方医生、审核医生)", defaultValue = "86225d1365e711e69f7c005056850d66")
//                                         @RequestParam(value = "doctor", required = true) String doctor,
//                                         @ApiParam(name = "type", value = "咨询类型(1、高血压-续方咨询;2、糖尿病-续方咨询,3、高糖-续方咨询 4、其他疾病咨询)", defaultValue = "1")
//                                         @RequestParam(value = "type", required = true) Integer type,
//                                         @ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
//                                         @RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
//                                         @ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
//                                         @RequestParam(value = "reason", required = false) String reason,
//                                         @ApiParam(name = "signTag", value = "0为家签续方,1未非家签约", defaultValue = "0")
//                                         @RequestParam(value = "signTag", required = false) Integer signTag,
//                                         @ApiParam(name = "hospital", value = "机构CODE")
//                                         @RequestParam(value = "hospital", required = false) String hospital,
//                                         @ApiParam(name = "systolic", value = "收缩压")
//                                         @RequestParam(value = "systolic", required = false) String systolic,
//                                         @ApiParam(name = "diastolic", value = "舒张压")
//                                         @RequestParam(value = "diastolic", required = false) String diastolic,
//                                         @ApiParam(name = "bloodSugar", value = "血糖")
//                                         @RequestParam(value = "bloodSugar", required = false) String bloodSugar,
//                                         @ApiParam(name = "bloodSugarType", value = "血糖类型")
//                                         @RequestParam(value = "bloodSugarType", required = false) String bloodSugarType,
//                                         @ApiParam(name = "hospitalName", value = "机构名称")
//                                         @RequestParam(value = "hospitalName", required = false) String hospitalName,
//                                         @ApiParam(name = "ratType", value = "费别类型 zy_common_dict表IV_RATE_TYPE_DICT")
//                                         @RequestParam(value = "ratType", required = false) String ratType,
//                                         @RequestParam(required = true) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送 4网格员派送", name = "dispensaryType") int dispensaryType,
//                                         @RequestParam(required = true) @ApiParam(value = "配送地址json", name = "addressJson", defaultValue = "{\"townName\":\"海沧区\",\"code\":\"3502050100\",\"address\":" +
//                                                 "\"冰岛\",\"cityName\":\"厦门市\",\"townCode\":\"350205\",\"provinceCode\":\"350000\",\"cityCode\":\"350200\",\"name\":\"海沧区嵩屿街道社区卫生服务中心\"," +
//                                                 "\"provinceName\":\"福建省\",\"streeCode\":\"35020501\",\"streeName\":\"皇后大道东\",\"phone\":\"13253541190\"}") String addressJson) {
//        try {
//            ConsultTeam consult = new ConsultTeam();
//            consult.setType(8);//续方咨询
//            consult.setAdminTeamId(adminTeamId);
//
//            //增加体征数据上传发送IM消息标识:1血压 2血糖 3血压+血糖---huangwenjie 2017.11.06
//            consult.setHealthindexType(type);
//            // 保存到数据库
//            int res = 0;
//            synchronized (jwCode.intern()) {
//                res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(), getUID(), doctor, consult, reason, type,
//                        addressJson, dispensaryType, signTag, hospital, hospitalName, adminTeamId, systolic, diastolic, bloodSugar, bloodSugarType, ratType);
//            }
//            if (res == -1) {
//                return error(-1, "该处方存在未审核的续方,无法进行续方咨询!");
//            }
//            if (res == -2) {
//                return error(-1, "您还未签约,不能发起续方咨询!");
//            }
//            if (res == -3) {
//                return error(-1, "您当天有未完成的续方,不能发起续方咨询!");
//            }
//
//            if (messageService.getMessageNoticeSettingByMessageType(doctor, "1", MessageNoticeSetting.MessageTypeEnum.prescriptionSwitch.getValue())) {
//                // 推送消息给医生
//                pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.D_CT_05.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.续方咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.您有新的续方咨询.name(), consult.getConsult());
//                try {
//                    //续方消息应该发给居民签约的团队长,modify by hmf
//                    SignFamily signFamily = signFamilyDao.findByPatient(getRepUID());
//                    BaseDoctorDO doctor1 = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
//                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
//                    BasePatientDO patient = patientDao.findByCode(getRepUID());
//                    String doctorOpenID = doctor1.getOpenid();
//                    if (StringUtils.isNotEmpty(doctorOpenID)) {
//                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
//                        List<NameValuePair> params = new ArrayList<>();
//                        params.add(new BasicNameValuePair("type", "9"));
//                        params.add(new BasicNameValuePair("openId", doctorOpenID));
//                        params.add(new BasicNameValuePair("url", targetUrl));
//                        params.add(new BasicNameValuePair("first", doctor1.getName() + "医生您好。您的签约居民" + patient.getName() + "申请线上续方,请尽快审核。"));
//                        params.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
//                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
//                        String keywords = "续方审核" + "," + doctor1.getHospitalName() + "," + doctor1.getName();
//                        params.add(new BasicNameValuePair("keywords", keywords));
//
//                        httpClientUtil.post(url, params, "UTF-8");
//                    }
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
//            return write(200, "提交成功", "data", consult);
//
//        } catch (ServiceException se) {
//            return write(-1, se.getMessage());
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "添加失败");
//        }
//    }
//    @RequestMapping(value = "getPreConsultList", method = RequestMethod.GET)
//    @ApiOperation("获取续方咨询列表")
//    public String getPreConsultList(@ApiParam(name = "title", value = "咨询标题") @RequestParam(required = false) String title,
//                                    @ApiParam(name = "id", value = "第几页") @RequestParam(required = true) long id,
//                                    @ApiParam(name = "pagesize", value = "页面大小") @RequestParam(required = true) int pagesize) {
//        try {
//            JSONArray array = new JSONArray();
//            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize, 8, title);//8表示续方咨询
//            if (data != null) {
//                for (Object consult : data.getContent()) {
//                    if (consult == null) {
//                        continue;
//                    }
//                    Object[] result = (Object[]) consult;
//                    JSONObject json = new JSONObject();
//                    json.put("id", result[0]);
//                    // 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈,8 续方咨询
//                    json.put("type", result[1]);
//                    // 设置咨询标识
//                    json.put("code", result[2]);
//                    // 设置显示标题
//                    json.put("title", result[3]);
//                    // 设置主诉
//                    json.put("symptoms", result[4]);
//                    // 咨询状态
//                    json.put("status", result[6]);
//                    // 设置咨询日期
//                    json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
//                    // 咨询状态
//                    json.put("doctorCode", result[7]);
//                    json.put("evaluate", result[8]);
//                    String relationCode = result[9] == null ? "" : result[9].toString();
//                    json.put("prescriptionCode", relationCode);//续方code
//                    json.put("prescriptionDt", prescriptionDiagnosisService.getPrescriptionDiagnosis(relationCode));//续方疾病类型
//                    json.put("prescriptionInfo", prescriptionDiagnosisService.getPrescriptionInfo(relationCode));//续方药品信息
//
//                    array.put(json);
//                }
//            }
//            return write(200, "查询成功!", "list", array);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败!");
//        }
//    }
//    @RequestMapping(value = "prescriptionDetail", method = RequestMethod.GET)
//    @ApiOperation("获取续方信息")
//    public String prescriptionDetail(@ApiParam(name = "consult", value = "咨询code") @RequestParam(required = true) String consult) {
//        try {
//            JSONObject json = new JSONObject();
//
//            Consult consult1 = consultDao.findByCode(consult);
//
//            String prescriptionCode = consult1.getRelationCode();
//            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
//            json.put("status", prescription.getStatus());//状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
//            json.put("prescriptionInfo", prescriptionDiagnosisService.getPrescriptionInfo(prescriptionCode));//续方药品信息
//            json.put("symptoms", consult1.getSymptoms());//咨询类型--- 1高血压,2糖尿病
//            json.put("jwCode", prescription.getJwCode());//基位处方code
//            json.put("code", prescription.getCode());//续方code
//            json.put("viewJiancha", prescription.getViewJiancha());//检查
//            json.put("viewTizhen", prescription.getViewTizhen());//体征
//            json.put("viewChufang", prescription.getViewChufang());//处方
//            json.put("viewXufang", prescription.getViewXufang());//续方
//            json.put("viewWenjuan", prescription.getViewWenjuan());//问卷
//            json.put("viewSuifang", prescription.getViewSuifang());//随访
//
//            return write(200, "查询成功!", "data", json);
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败!");
//        }
//    }
//    @RequestMapping(value = "remainConsultTimes", method = RequestMethod.GET)
//    @ApiOperation("获取剩余家庭咨询次数")
//    public String countRemainConsult() {
//        try {
//            String patient = getRepUID();
//            JSONObject result = consultTeamService.countRemainConsult(patient);
//            if (result.has("count") && result.has("amount")) {
//                return write(200, "查询成功!", "data", result);
//            } else if (result.has("count") && !result.has("amount")) {
//                return error(-1, "您的签约已到期,请重新申请");
//            } else {
//                return error(-1, "查询失败!");
//            }
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败!");
//        }
//    }
    /**
     * 解析contentType
     * PlainText: 1,   // 信息
@ -1839,22 +827,7 @@ public class ConsultController extends EnvelopRestEndpoint {
//        }
//    }
    /**
     * 获取患者发起咨询时可选择的专科医生团队列表,
     *
     * @param patientCode 患者code
     * @return
     */
//    @RequestMapping(value = "getConsultDoctorForConsulting", method = RequestMethod.GET)
//    @ApiOperation("获取咨询医生团队列表列表")
//    public String getConsultDoctorForConsulting(@RequestParam("patientCode") String patientCode) {
//        try {
//            return write(200, "查询成功", "data", consultTeamService.getConsultDoctorForConsulting(patientCode));
//        } catch (Exception e) {
//            error(e);
//            return error(-1, "查询失败");
//        }
//    }
    /**
     *