yeshijie vor 7 Jahren
Ursprung
Commit
21017ae38a

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

@ -2236,11 +2236,34 @@ public class ConsultTeamService extends ConsultService {
        String endName = "";
        String endId = "";
        //推送给IM文字消息
        //结束咨询才发送推送给IM文字消息
        if (endType == 1) {
            Patient p = patientDao.findByCode(endOperator);
            endName = p.getName();
            endId = p.getCode();
        } else {
            if (endOperator.equals("admin")) {
                endId = "system";
                endName = "咨询超时未回复,系统自动";
            } else {
                Doctor d = doctorDao.findByCode(endOperator);
                endId = d.getCode();
                endName = d.getName();
            }
        }
        JSONObject obj = ImUtill.endTopics(consultTeam.getPatient(), endId, endName, consultTeam.getConsult());
        if (obj == null) {
            throw new RuntimeException("IM消息结束异常!");
        }
        if (obj.getInt("status") == -1) {
            throw new RuntimeException(String.valueOf(obj.get("message")));
        }
        //结束咨询才发送推送给IM文字消息
        if (endType == 1) {
            Patient p = patientDao.findByCode(endOperator);
            endName = p.getName();
            if (consultTeam.getType() == 2||consultTeam.getType()==8) {
                String openId = p.getOpenid();
                JSONObject json = new JSONObject();
@ -2277,14 +2300,6 @@ public class ConsultTeamService extends ConsultService {
                }
            }
        } else {
            if (endOperator.equals("admin")) {
                endId = "system";
                endName = "咨询超时未回复,系统自动";
            } else {
                Doctor d = doctorDao.findByCode(endOperator);
                endId = d.getCode();
                endName = d.getName();
            }
            if (consultTeam.getType() == 2||consultTeam.getType()==8) {
                Patient p = patientDao.findByCode(consultTeam.getPatient());
                String name = p.getName();
@ -2328,13 +2343,7 @@ public class ConsultTeamService extends ConsultService {
            }
        }
        JSONObject obj = ImUtill.endTopics(consultTeam.getPatient(), endId, endName, consultTeam.getConsult());
        if (obj == null) {
            throw new RuntimeException("IM消息结束异常!");
        }
        if (obj.getInt("status") == -1) {
            throw new RuntimeException(String.valueOf(obj.get("message")));
        }
        consultTeam.setEndMsgId(obj.getString("id"));
        cons.setEndTime(new Date());
        consultTeam.setEndTime(new Date());