瀏覽代碼

咨询接口提交

huangwenjie 5 年之前
父節點
當前提交
38421a2331

+ 36 - 27
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -216,7 +216,7 @@ public class ImService {
	 * 根据咨询CODE进入会话
	 * @param consult 咨询CODE
	 * @param currentUid 当前居民ID
	 * @param uid 代理人ID
	 * @param uid 代理人ID(目前版本废弃)
	 * @return
	 */
	public int intoTopic(String consult, String currentUid, String uid) {
@ -226,18 +226,18 @@ public class ImService {
		}
		
		String content = "进入了咨询";
		BasePatientDO p = basePatientDao.findById(uid);
		BasePatientDO p = basePatientDao.findById(currentUid);
		String intoUserName = p.getName();
		if (currentUid.equals(uid)) {
			content = intoUserName + content;
		} else {
//		if (currentUid.equals(uid)) {
//			content = intoUserName + content;
//		} else {
			BasePatientDO member = basePatientDao.findById(currentUid);
			content = intoUserName + content;
			//目前没有家人关系,所以家人名称的名字获取暂时注释
//			content = member.getName() + "(" + relations.get(familyMember.getFamilyRelation()) + ")" + content;
		}
//		}
		
		imUtil.sendIntoTopicIM(ct.getPatient(), ct.getPatient(), ct.getConsult(), content, uid, intoUserName);
		imUtil.sendIntoTopicIM(ct.getPatient(), ct.getPatient(), ct.getConsult(), content, currentUid, intoUserName);
		return 0;
		
	}
@ -266,15 +266,15 @@ public class ImService {
		
		String[] arr = null;
		if (type == 3) {
			String path = fetchWxVoices(wechat_appid);
			JSONObject obj = new JSONObject();
			// 将临时语音拷贝到正式存储路径下
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
				content = fileUtil.copyTempVoice(path,fastdfs_file_url);
				obj.put("path", content);
				obj.put("times", times);
				content = obj.toString();
			}
//			String path = fetchWxVoices(wechat_appid);
//			JSONObject obj = new JSONObject();
//			// 将临时语音拷贝到正式存储路径下
//			if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
//				content = fileUtil.copyTempVoice(path,fastdfs_file_url);
//				obj.put("path", path);
//				obj.put("times", times);
//				content = obj.toString();
//			}
			ConsultTeamLogDo log = new ConsultTeamLogDo();
			log.setConsult(consult);
			log.setContent(content);
@ -283,16 +283,16 @@ public class ImService {
			log.setType(type);
			logs.add(log);
		} else if (type == 2) {
			// 图片消息
			content = fetchWxImages(wechat_appid);
			// 将临时图片拷贝到正式存储路径下
			if (org.apache.commons.lang3.StringUtils.isNotEmpty(content)) {
				content = fileUtil.copyTempImage(content,upload_temp_path);
			}
			if (org.apache.commons.lang3.StringUtils.isEmpty(content)) {
				throw new Exception("图片上传失败!");
//				return error(-1, "图片上传失败!");
			}
//			// 图片消息
//			content = fetchWxImages(wechat_appid);
//			// 将临时图片拷贝到正式存储路径下
//			if (org.apache.commons.lang3.StringUtils.isNotEmpty(content)) {
//				content = fileUtil.copyTempImage(content,upload_temp_path);
//			}
//			if (org.apache.commons.lang3.StringUtils.isEmpty(content)) {
//				throw new Exception("图片上传失败!");
////				return error(-1, "图片上传失败!");
//			}
			String[] images = content.split(",");
			for (String image : images) {
				ConsultTeamLogDo log = new ConsultTeamLogDo();
@ -993,5 +993,14 @@ public class ImService {
		consultTeamDao.save(consultTeam);
		return 1;
	}
	
	/**
	 * 根据咨询CODE获取session_id
	 * @param consult
	 * @return
	 */
	public JSONObject getTopic(String consult) throws Exception {
		
		return imUtil.getTopic(consult);
	}
}

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

@ -264,8 +264,11 @@ public class BaseHospitalRequestMapping {
        //居民详情
        public static final String patientInfo = "/patientInfo";
        
        //结束咨询
        //结束咨询id
        public static final String finish = "/finish";
    
        //根据咨询CODE获取session_id
        public static final String getTopic = "/getTopic";
        
    }
    
@ -292,6 +295,9 @@ public class BaseHospitalRequestMapping {
    
        //查询单个诊室状态
        public static final String findClinicRoomStatus = "findClinicRoomStatus";
    
        //结束咨询id
        public static final String finish = "/finish";
        
    }

+ 12 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -154,4 +154,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
//			BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new org.json.JSONObject(consult));
			return success(consult);
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.finish)
	@ApiOperation(value = "医生结束咨询", notes = "医生结束咨询")
	public Envelop finish(
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = false) String consult,
			@ApiParam(name = "doctorCode", value = "医生COEE")
			@RequestParam(value = "doctorCode",required = false) String doctorCode
	) throws Exception {
		int resutl = imService.finish(consult,doctorCode,2);
		return success(resutl);
	}
}

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

@ -136,8 +136,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "根据咨询CODE进入会话")
	public Envelop intoTopic(
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = true) String consult){
		int result = imService.intoTopic(consult,"",getUID());
			@RequestParam(value = "consult",required = true) String consult,
			@ApiParam(name = "patientCode", value = "居民CODE")
			@RequestParam(value = "patientCode",required = true) String patientCode
			){
		int result = imService.intoTopic(consult,patientCode,"");
		if(result==-1){
			return failed("该咨询不是进行中");
		}
@ -160,9 +163,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "times", value = "")
			@RequestParam(value = "times",required = false) Integer times,
			@ApiParam(name = "wechat_appid", value = "")
			@RequestParam(value = "wechat_appid",required = true) String wechat_appid) throws Exception {
			@RequestParam(value = "wechat_appid",required = false) String wechat_appid,
			@ApiParam(name = "patientCode", value = "居民CODE")
			@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
		List<String> failed = new ArrayList<>();
		failed = imService.append(consult,content,type,times,getUID(),wechat_appid);
		failed = imService.append(consult,content,type,times,patientCode,wechat_appid);
		return success(failed);
	}
	
@ -250,11 +255,17 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = false) String consult,
			@ApiParam(name = "patientCode", value = "居民COEE")
			@RequestParam(value = "patientCode",required = false) String patientCode,
			@ApiParam(name = "endType", value = "1居民 2医生")
			@RequestParam(value = "endType",required = false) int endType
			@RequestParam(value = "patientCode",required = false) String patientCode
			) throws Exception {
		int resutl = imService.finish(consult,patientCode,endType);
		int resutl = imService.finish(consult,patientCode,1);
		return success(resutl);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getTopic)
	@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
	public Envelop getTopic(
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = false) String consult)throws Exception {
		return success("请求成功",imService.getTopic(consult));
	}
}