Sfoglia il codice sorgente

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

Conflicts:
	patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendP2PUtil.java
8 anni fa
parent
commit
cac9d0845d

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

@ -35,6 +35,7 @@ import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
@ -879,6 +880,7 @@ public class DoctorInfoService extends BaseService {
        Integer error = 0;//转移失败
        for (int i = 0; i < patiensString.length; i++) {
            try {
                ImUtill.deleteMucUser(newDoctorCode,oldDoctorCode,patiensString[i]+"_consult_2");
                updateTeamHealthDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
                successs++;
            } catch (Exception e) {
@ -911,6 +913,7 @@ public class DoctorInfoService extends BaseService {
                    if (updateTeamHealthDoctorAll(newDoctorCode, patient) == -1) {
                        hasNoTeam = true;
                    }
                    ImUtill.deleteMucUser(newDoctorCode,doctor,patient+"_consult_2");
                } catch (Exception e) {
                    e.printStackTrace();
                }
@ -1083,6 +1086,7 @@ public class DoctorInfoService extends BaseService {
        for (int i = 0; i < patiensString.length; i++) {
            try {
                ImUtill.deleteMucUser(newDoctorCode,oldDoctorCode,patiensString[i]+"_consult_2");
                updateTeamDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
                successs++;
            } catch (Exception e) {

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

@ -1492,6 +1492,7 @@ public class ConsultTeamService extends ConsultService {
        // 设置患者信息
        ct.setPatient(uid);
        Doctor doctorTemp = doctorDao.findByCode(uid);
        Doctor doctor = doctorDao.findByCode(ct.getDoctor());
        // 设置医生姓名
        ct.setName(doctorTemp.getName());
        // 设置医生生日
@ -1520,28 +1521,45 @@ public class ConsultTeamService extends ConsultService {
        cd.setTo(ct.getDoctor());
        // 添加医生咨询日志
        String content = addLogs(ct);
        JSONObject messages  = ImUtill.getCreateTopicMessage(doctorTemp.getCode(),doctorTemp.getName(),consult.getTitle(),content,consult.getImages());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(ct.getPatient(),0);
        jsonObject.put(ct.getDoctor(),0);
        //设置消息ID
        JSONObject obj = ImUtill.createTopics(null,consult.getCode(),doctorTemp.getName(),jsonObject,messages,"2");
        if(obj==null||obj.getInt("status")==-1){
            throw new RuntimeException("im消息创建异常!"+obj==null?"":obj.getString("message"));
        }
        ct.setStartMsgId(obj.get("start_msg_id").toString());
        //转发咨询问题
        if(StringUtils.isNotBlank(oldConsultCode)){
        if(StringUtils.isBlank(oldConsultCode)) {
            JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), content, consult.getImages());
            JSONObject jsonObject = new JSONObject();
            jsonObject.put(ct.getPatient(), 0);
            jsonObject.put(ct.getDoctor(), 0);
            //设置消息ID
            JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, "2");
            if (obj == null || obj.getInt("status") == -1) {
                throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
            }
            ct.setStartMsgId(obj.get("start_msg_id").toString());
        }else{
            //转发咨询问题
            Consult oldConsult = consultDao.findByCode(oldConsultCode);
            ct.setTeam(oldConsultCode);
            if(oldConsult!=null&&isSend==1){
                ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),consult.getCode(),"6",oldConsult.getSymptoms());
                if(StringUtils.isNotBlank(oldConsult.getImages())){
                    String imgs[] = oldConsult.getImages().split(",");
                JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), oldConsult.getSymptoms(), oldConsult.getImages());
                JSONObject jsonObject = new JSONObject();
                jsonObject.put(ct.getPatient(), 0);
                jsonObject.put(ct.getDoctor(), 0);
                JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, "2");
                if (obj == null || obj.getInt("status") == -1) {
                    throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
                }
                ct.setStartMsgId(obj.get("start_msg_id").toString());
                ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),consult.getCode(),"6",content);
                if(StringUtils.isNotBlank(consult.getImages())){
                    String imgs[] = consult.getImages().split(",");
                    for(String url :imgs)
                        ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),consult.getCode(),"2",url);
                }
            }
            JSONObject qiuzuObj = new JSONObject();
            qiuzuObj.put("session_id",oldConsult.getPatient()+"_consult_"+consult.getType());
            qiuzuObj.put("patient",ct.getPatient());
            qiuzuObj.put("old_consult_code",oldConsultCode);
            qiuzuObj.put("doctor",ct.getDoctor());
            qiuzuObj.put("doctor_name",doctor.getName());
            ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),oldConsultCode,"5",qiuzuObj.toString());
        }
        consultTeamDao.save(ct);  // 保存医生咨询信息
        consultTeamDoctorDao.save(cd);
@ -1567,7 +1585,7 @@ public class ConsultTeamService extends ConsultService {
            throw new RuntimeException("IM消息结束异常!");
        }
        if(obj.getInt("status")==-1){
            throw new RuntimeException(obj.getString("message"));
            throw new RuntimeException(String.valueOf(obj.get("message")));
        }
        consultTeam.setType(endType);
        consultTeam.setEndMsgId(obj.getString("id"));

+ 14 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -1739,7 +1739,13 @@ public class FamilyContractService extends BaseService {
                    result.put("msg", "与当前健管师有未结束的咨询");
                    return result;
                }
                try{
                    ImUtill.deleteMucUser(healthDoctor,signFamily.getDoctorHealth(),patient+"_consult_2");
                }catch (Exception e){
                    result.put("status", -1);
                    result.put("msg", e.getMessage());
                    return result;
                }
                DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndCode(signFamily.getTeamCode(), signFamily.getDoctorHealth());
                if (teamMember != null) {
@ -1817,7 +1823,13 @@ public class FamilyContractService extends BaseService {
            String oldDoctorName = signFamily.getDoctorName();
            if (StringUtils.isNotEmpty(signFamily.getDoctor())) {
                DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndQkCode(signFamily.getTeamCode(), signFamily.getDoctor());
                 try{
                    ImUtill.deleteMucUser(doctor,signFamily.getDoctor(),patient+"_consult_2");
                }catch (Exception e){
                    result.put("status", -1);
                    result.put("msg", e.getMessage());
                    return result;
                }
                if (teamMember != null) {
                    teamMember.setDel("0");
                    teamMember.setCzrq(new Date());

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

@ -169,4 +169,33 @@ public class ImUtill {
        }
    }
    /**
     * 删除对应的成员信息在MUC模式中
     * @param userId
     * @param oldUserId
     * @param sessionId
     * @return
     */
    public static JSONObject deleteMucUser(String userId,String oldUserId,String sessionId) throws  Exception{
        String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
                + "api/v2/sessions/"+sessionId+"/participant/update";
        try{
            JSONObject params = new JSONObject();
            params.put("user_id", userId);
            params.put("old_user_id", oldUserId);
            params.put("session_id", sessionId);
            String ret = HttpClientUtil.postBody(url,params);
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
                throw new RuntimeException("人员更换失败!");
            }else{
                return obj;
            }
        }catch (Exception e){
           throw new RuntimeException("人员更换失败!");
        }
    }
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java

@ -424,7 +424,7 @@ public class WeixinBaseController extends BaseController {
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		// 重命名文件
		String newFileName = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000) + ".wav";
		String newFileName = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000) + ".mp3";
		// 保存路径
		File uploadFile = new File(tempPath + datePath + newFileName);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -188,7 +188,7 @@ public class FileUploadController extends BaseController {
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                if("3".equals(type)){
                    fileExt ="wav";
                    fileExt ="mp3";
                }
                ObjectNode objectNode = fastDFSUtil.upload(mf.getInputStream() ,fileExt,"");
                tempPaths.add(fastUrl + objectNode.get("groupName").toString().replaceAll("\"","")

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -1575,6 +1575,7 @@ public class DoctorController extends BaseController {
                return error(-2, "正在分配,请勿重复操作");
            }
            if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);

+ 3 - 12
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -660,7 +660,7 @@ public class DoctorConsultController extends WeixinBaseController {
                }
            }
            if (StringUtils.isEmpty(voice)) {
            if (StringUtils.isNotEmpty(voice)) {
                voice = fetchWxVoices();
            }
            if (StringUtils.isNotEmpty(voice)) {
@ -882,19 +882,10 @@ public class DoctorConsultController extends WeixinBaseController {
                json.put("consult", ct.getConsult());
                //是否是医生求助医生
                if(ct.getType()==10){
                    List<WlyyTalkGroup> wlyyTalkGroups = talkGroupService.findAllConsultTalkGroup(ct.getTeam());
                    if(wlyyTalkGroups!=null && wlyyTalkGroups.size()>0){
                        for (WlyyTalkGroup g : wlyyTalkGroups){
                            if(g.getType()==1){
                                json.put("zxGroupCode", g.getCode());
                                json.put("from", ct.getPatient());
                                break;
                            }
                        }
                    }
                    json.put("zxGroupCode",ct.getTeam());
                    json.put("from", ct.getPatient());
                }
            }
            return write(200, "查询成功", "data", json);
        } catch (Exception ex) {
            error(ex);