Explorar el Código

咨询推送修改

yeshijie hace 7 años
padre
commit
2a08184831

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

@ -785,9 +785,11 @@ public class ConsultTeamService extends ConsultService {
     * @return
     * @throws Exception
     */
    public int addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
    public JSONObject addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
        JSONObject re = new JSONObject();
        if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
            return -3;
            re.put("status",-3);
            return re;
        }
        JSONObject users = new JSONObject();
@ -802,7 +804,8 @@ public class ConsultTeamService extends ConsultService {
            SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
            if (sc == null) {
                // 不存在三师签约
                return -2;
                re.put("status",-2);
                return re;
            }
            ct.setTeam(sc.getTeamCode());
            // 设置健康管理师,三师咨询默认给健康管理师处理
@ -832,7 +835,8 @@ public class ConsultTeamService extends ConsultService {
            if (sf == null) {
                // 不存在家庭签约
                return -1;
                re.put("status",-1);
                return re;
            }
            ct.setTeam(sf.getTeamCode());
            // 设置健康管理师,家庭医生咨询默认给健康管理师处理
@ -913,10 +917,13 @@ public class ConsultTeamService extends ConsultService {
        ct.setStartMsgId(obj.get("start_msg_id").toString());
        consultTeamDao.save(ct);
        consultDao.save(consult);
        JSONArray doctor = new JSONArray();
        for (String key : users.keySet()) {
            if (patient.equals(key)) {
                continue;
            }
            doctor.put(key);
            //记录咨询的医生详情误删
            ConsultTeamDoctor cd = new ConsultTeamDoctor();
            cd.setConsult(consult.getCode());
@ -930,8 +937,10 @@ public class ConsultTeamService extends ConsultService {
        // 添加咨询转发记录
        // 添加医生咨询日志
        String content = addLogs(ct);
        re.put("doctor",doctor);
        re.put("status",1);
        return re;
        return 1;
    }
    /**

+ 13 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -353,8 +353,11 @@ public class ConsultController extends WeixinBaseController {
            System.out.println("guidance2="+guidance);
            // 保存到数据库
            int res = 0;
            JSONArray dts = null;
            synchronized (getRepUID().intern()){//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
                res = consultTeamService.addTeamConsult(consult, getRepUID(),getUID());
                JSONObject re = consultTeamService.addTeamConsult(consult, getRepUID(),getUID());
                res = re.getInt("status");
                dts = re.getJSONArray("doctor");
            }
            if (res == -1) {
                return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
@ -377,7 +380,15 @@ public class ConsultController extends WeixinBaseController {
            }
            // 推送消息给医生
            pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            if(dts==null||dts.length()==0){
                pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            }else {
                for (int i=0;i<dts.length();i++){
                    String doctorCode = dts.getString(i);
                    pushMsgTask.put(doctorCode, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
                }
            }
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {