Explorar o código

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

# Conflicts:
#	svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java
wangzhinan %!s(int64=4) %!d(string=hai) anos
pai
achega
6c468f80f6

+ 28 - 3
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -45,7 +45,6 @@ import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.slf4j.LoggerFactory;
@ -1453,6 +1452,26 @@ public class ImService {
		// 添加医生咨询日志
		addLogs(ct);
		JSONObject result = imUtil.getSingleSessionInfo(sessionId,doctorCode);
		//发送外层SOCKET消息 在线复诊
		if("1".equals(wlyyOutpatientDO.getOutpatientType())){
			System.out.println("发送外层SOCKET消息:在线复诊");
			JSONObject object = new JSONObject();
			object.put("socket_sms_type",5);
			object.put("relation_code",wlyyOutpatientDO.getId());
			imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getPatient(),"1",object.toString());
			//医生接诊发送导诊护士外层消息
			this.sendOutpatientGuaidanceMessage(wlyyOutpatientDO);
		}else if("2".equals(wlyyOutpatientDO.getOutpatientType())){
			//协同门诊
			System.out.println("发送外层SOCKET消息:协同门诊");
			JSONObject object = new JSONObject();
			object.put("socket_sms_type",5);
			object.put("relation_code",wlyyOutpatientDO.getId());
			imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getGeneralDoctor(),"1",object.toString());
			//医生接诊发送导诊护士外层消息
			this.sendOutpatientGuaidanceMessage(wlyyOutpatientDO);
		}
		return result;
	}
@ -2304,7 +2323,7 @@ public class ImService {
	 * @param session_id
	 * @return
	 */
	public String getPatientGuaidenceConsult(String patientCode, String session_id) throws Exception{
	public String getPatientGuaidenceConsult(String patientCode, String session_id,String type) throws Exception{
		
		Boolean re = false;
		re = imUtil.sessionIsExist(session_id);
@ -2320,7 +2339,13 @@ public class ImService {
			}else{
				patientSex= "女";
			}
			JSONObject sessionJson  = imUtil.createSession(participants,imUtil.SESSION_TYPE_GUIDANCE_HOSPITAL,"居民 "+basePatientDO.getName()+" "+patientSex,session_id);
			String sessionType = null;
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)){
				sessionType = type;
			}else {
				sessionType=imUtil.SESSION_TYPE_GUIDANCE_HOSPITAL;
			}
			JSONObject sessionJson  = imUtil.createSession(participants,sessionType,"居民 "+basePatientDO.getName()+" "+patientSex,session_id);
			if(sessionJson.getInteger("status") ==-1){
				throw  new RuntimeException(sessionJson.getString("message"));
			}else{

+ 2 - 2
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -3,14 +3,13 @@ package com.yihu.jw.im.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.yihu.jw.util.http.HttpClientUtil;
import java.util.ArrayList;
import java.util.List;
@ -682,6 +681,7 @@ public class ImUtil {
	public static final String SESSION_TYPE_GENERAL_EXPERT = "15";//全科医生发起求助专科医生的专家咨询
	public static final String SESSION_TYPE_EXAMINATION_VIDEO = "16";//在线复诊-视频
	public static final String SESSION_TYPE_MUC_VIDEO = "17";//专家-视频
	public static final String SESSION_TYPE_GUIDANCE_ASSISTANT = "18";//导诊助手
	public static final String SESSION_STATUS_PROCEEDINGS = "0";
	public static final String SESSION_STATUS_END = "1";
	

+ 2 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -888,6 +888,8 @@ public class BaseHospitalRequestMapping {
        //居民端:查询正医生当前咨询人数
        public static final String getDoctorConsultCount="getDoctorConsultCount";
        public static final String sessionIsExist = "sessionIsExist";
    }
    
    /**

+ 27 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -17,6 +17,7 @@ import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
@ -101,6 +102,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private YkyyService ykyyService;
	@Autowired
	public ImUtil imUtil;
	@Value("${fastDFS.fastdfs_file_url}")
	private String fastdfs_file_url;
@ -716,11 +720,27 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "导诊的咨询对话", notes = "导诊的咨询对话")
	public Envelop getPatientGuaidenceConsult(@ApiParam(name = "patientCode", value = "居民CODE")
	                       @RequestParam(value = "patientCode", required = true)String patientCode) throws Exception {
		String session_id = patientCode+"_guidance_14";
		session_id = imService.getPatientGuaidenceConsult(patientCode,session_id);
		String session_id = session_id = patientCode+"_guidance_14";
		session_id = imService.getPatientGuaidenceConsult(patientCode,session_id,null);
		return success(session_id);
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.sessionIsExist)
	@ApiOperation(value = "判断导诊sessionId是否存在", notes = "判断导诊sessionId是否存在")
	public Envelop sessionIsExist(@ApiParam(name = "patientCode", value = "居民CODE")
											  @RequestParam(value = "patientCode", required = true)String patientCode,
											  @ApiParam(name = "type", value = "type")
											  @RequestParam(value = "type", required = false)String type) throws Exception {
		String session_id = null;
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)){
			session_id = patientCode+"_guidance_"+type;
		}
		Boolean re = imUtil.sessionIsExist(session_id);
		return success(re);
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.updateConsultParticipant)
	@ApiOperation(value = "更新会话成员(新增或删除)", notes = "更新会话成员(新增或删除)")
@ -742,12 +762,15 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "sender_name", value = "发送者姓名", defaultValue = "")
			@RequestParam(value = "sender_name", required = true) String sender_name,
			@ApiParam(name = "session_id", value = "session_id", defaultValue = "")
			@RequestParam(value = "session_id", required = true) String session_id,
			@RequestParam(value = "session_id", required = false) String session_id,
			@ApiParam(name = "content_type", value = "内容类型", defaultValue = "")
			@RequestParam(value = "content_type", required = true) String content_type,
			@ApiParam(name = "content", value = "消息内容", defaultValue = "")
			@RequestParam(value = "content", required = true) String content
	)throws Exception{
		if (!org.apache.commons.lang3.StringUtils.isNoneBlank(session_id)){
			session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,content_type);
		}
		String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1");
		return success(result);
	}