Browse Source

Merge branch 'dev' of linzhuo/patient-co-management into dev

linzhuo 8 years ago
parent
commit
44b07fee29

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

@ -1556,6 +1556,7 @@ public class ConsultTeamService extends ConsultService {
        } else {
            //转发咨询问题
            Consult oldConsult = consultDao.findByCode(oldConsultCode);
            ConsultTeam consultTeam = consultTeamDao.findByConsult(oldConsultCode);
            ct.setTeam(oldConsultCode);
            if (oldConsult != null && isSend == 1) {
                JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), "居民问题:"+oldConsult.getSymptoms(), oldConsult.getImages());
@ -1585,7 +1586,7 @@ public class ConsultTeamService extends ConsultService {
                }
            }
            JSONObject qiuzuObj = new JSONObject();
            qiuzuObj.put("session_id", oldConsult.getPatient() + "_consult_" + consult.getType());
            qiuzuObj.put("session_id", oldConsult.getPatient() + consultTeam.getTeam() + consult.getType());
            qiuzuObj.put("patient", ct.getPatient());
            qiuzuObj.put("old_consult_code", oldConsultCode);
            qiuzuObj.put("doctor", ct.getDoctor());

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

@ -1854,9 +1854,9 @@ public class FamilyContractService extends BaseService {
                }
                try{
                    if(signFamily.getDoctorHealth().equals(signFamily.getDoctor())){
                        ImUtill.deleteMucUser(healthDoctor,"",patient+"_consult_2");
                        ImUtill.deleteMucUser(healthDoctor,"",patient+"_"+signFamily.getTeamCode()+"_2");
                    }else{
                        ImUtill.deleteMucUser(healthDoctor,signFamily.getDoctorHealth(),patient+"_consult_2");
                        ImUtill.deleteMucUser(healthDoctor,signFamily.getDoctorHealth(),patient+"_"+signFamily.getTeamCode()+"_2");
                    }
                }catch (Exception e){
@ -1903,7 +1903,7 @@ public class FamilyContractService extends BaseService {
                }
                wxMessages.add(data);
                try{
                    ImUtill.deleteMucUser(docHealth.getCode(),"",patient+"_consult_2");
                    ImUtill.deleteMucUser(docHealth.getCode(),"",patient+"_"+signFamily.getTeamCode()+"_2");
                }catch (Exception e){
                    result.put("status", -1);
                    result.put("msg", e.getMessage());
@ -1949,7 +1949,7 @@ public class FamilyContractService extends BaseService {
            if (StringUtils.isNotEmpty(signFamily.getDoctor())) {
                DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndQkCode(signFamily.getTeamCode(), signFamily.getDoctor());
                 try{
                    ImUtill.deleteMucUser(doctor,signFamily.getDoctor(),patient+"_consult_2");
                    ImUtill.deleteMucUser(doctor,signFamily.getDoctor(),patient+"_"+signFamily.getTeamCode()+"_2");
                }catch (Exception e){
                    result.put("status", -1);
                    result.put("msg", e.getMessage());

+ 20 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -170,17 +170,13 @@ public class ImUtill {
    }
    public static JSONObject getSessionMessage(String sessionId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
    public static JSONArray getSessionMessage(String sessionId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
        String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
                + "api/v2/sessions/"+sessionId+"/messages?session_id="+sessionId+"&user="+uid+"&start_message_id="+startMsgId+"&end_message_id="+endMsgId+"&page="+page+"&pagesize"+pagesize;
                + "api/v2/sessions/"+sessionId+"/messages?session_id="+sessionId+"&user="+uid+"&start_message_id="+startMsgId+"&end_message_id="+endMsgId+"&page="+page+"&pagesize="+pagesize;
        try{
            String ret = HttpClientUtil.get(url, "UTF-8");
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
                throw new RuntimeException(obj.getString("message"));
            }else{
                return  obj.getJSONObject("data");
            }
            JSONArray obj = new JSONArray(ret);
            return obj;
        }catch (Exception e){
            return null;
        }
@ -252,6 +248,22 @@ public class ImUtill {
        }
    }
    /**
     * 获取会话成员
     * @param sessionId
     * @return
     * @throws Exception
     */
    public static JSONArray getSessions(String sessionId){
        String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
                + "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
        try{
            String ret = HttpClientUtil.get(url,"utf-8");
            return new JSONArray(ret);
        }catch (Exception e){
            throw new RuntimeException("获取议题失败!");
        }
    }
    public  static final String SESSION_TYPE_MUC = "1";
    public  static final String SESSION_TYPE_P2P = "2";

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

@ -12,40 +12,9 @@ import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.web.BaseController;
@RestController
@RequestMapping(value = "common", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "im_new", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "IM-即时消息")
public class imController extends BaseController {
	
	private static String host = "http://172.19.103.76:3000";
	
	@RequestMapping(value="/send_bus_msg")
	public String sendBusinessMsg(String userId,String content)
	{
		try{
			String _url = host+"/api/v1/chats/sm";
			String param = "user_id="+userId+"&content="+content;
			String result = HttpUtil.sendPost(_url, param);
		
			JSONObject jb = new JSONObject(result);
			String errno = jb.get("errno").toString();
			String errorMsg = jb.get("errmsg").toString();
			if(!errno.equals("0"))
			{
				return error(-1,errorMsg);
			}
			
			return success("推送成功!");
		}
		catch(Exception ex)
		{
			error(ex);
			return invalidUserException(ex, -1, "保存失败!");
		}
	}
	
	@RequestMapping(value="/send_chat_msg")
	public String sendChatMsg(String userId,String content)
	{
		return "";
	}
}

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

@ -884,7 +884,7 @@ public class DoctorConsultController extends WeixinBaseController {
                    //取出原有咨询求助返回原咨询的患者
                    ConsultTeam consultTeam = consultTeamService.findByConsultCode(ct.getTeam());
                    Patient patient = patientService.findByCode(consultTeam.getPatient());
                    json.put("zxGroupCode",consultTeam.getPatient()+"_consult_"+consultTeam.getType());
                    json.put("zxGroupCode",consultTeam.getPatient()+"_"+consultTeam.getTeam()+"_"+consultTeam.getType());
                    json.put("from", ct.getPatient());
                    json.put("patient_name", patient.getName());
                }

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

@ -714,8 +714,20 @@ public class ConsultController extends WeixinBaseController {
    @ResponseBody
    public String logs(@RequestParam String sessionId,@RequestParam(required = false) String startMsgId,@RequestParam(required = false) String endMsgId, @RequestParam int page, @RequestParam int pagesize) {
        try {
            JSONObject messageObj = ImUtill.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
            return write(200, "查询成功", "list", messageObj);
            JSONArray messageArray = ImUtill.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
            return write(200, "查询成功", "list", messageArray);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");
        }
    }
    @RequestMapping(value = "participants")
    @ResponseBody
    public String participants(@RequestParam String sessionId) {
        try {
            JSONArray participants = ImUtill.getSessions(sessionId);
            return write(200, "查询成功", "list", participants);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");