|  | @ -117,7 +117,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "patient", value = "居民CODE")
 |  | 			@ApiParam(name = "patient", value = "居民CODE")
 | 
												
													
														
															|  | 			@RequestParam(value = "patient",required = true) String patient,
 |  | 			@RequestParam(value = "patient",required = true) String patient,
 | 
												
													
														
															|  | 			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
 |  | 			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
 | 
												
													
														
															|  | 			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
 | 
												
													
														
															|  | 		try {
 |  | 		try {
 | 
												
													
														
															|  | 			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
 |  | 			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
 | 
												
													
														
															|  | 				return Envelop.getError("参数错误请求失败");
 |  | 				return Envelop.getError("参数错误请求失败");
 | 
												
											
												
													
														
															|  | @ -136,7 +136,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "patient", value = "居民CODE")
 |  | 			@ApiParam(name = "patient", value = "居民CODE")
 | 
												
													
														
															|  | 			@RequestParam(value = "patient",required = true) String patient,
 |  | 			@RequestParam(value = "patient",required = true) String patient,
 | 
												
													
														
															|  | 			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
 |  | 			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
 | 
												
													
														
															|  | 			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
 | 
												
													
														
															|  | 		try {
 |  | 		try {
 | 
												
													
														
															|  | 			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
 |  | 			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
 | 
												
													
														
															|  | 			return success("请求成功",consultCode);
 |  | 			return success("请求成功",consultCode);
 | 
												
											
												
													
														
															|  | @ -161,55 +161,58 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
 |  | 			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
 | 
												
													
														
															|  | 			@RequestParam(value = "type",required = false) Integer type,
 |  | 			@RequestParam(value = "type",required = false) Integer type,
 | 
												
													
														
															|  | 			@ApiParam(name = "source", value = "咨询类型来源")
 |  | 			@ApiParam(name = "source", value = "咨询类型来源")
 | 
												
													
														
															|  | 			@RequestParam(value = "source",required = false) String source)throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "source",required = false) String source){
 | 
												
													
														
															|  | 
 |  | 		try{
 | 
												
													
														
															|  | 
 |  | 			System.out.println("symptoms="+symptoms);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		System.out.println("symptoms="+symptoms);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		if (type == null) {
 |  | 
 | 
												
													
														
															|  | 			type = 23;
 |  | 
 | 
												
													
														
															|  | 		}
 |  | 
 | 
												
													
														
															|  | 		ConsultTeamDo consult = new ConsultTeamDo();
 |  | 
 | 
												
													
														
															|  | 		// 设置咨询类型:23 在线咨询 24老人在线咨询
 |  | 
 | 
												
													
														
															|  | 		consult.setType(type);
 |  | 
 | 
												
													
														
															|  | 		// 设置主要症状
 |  | 
 | 
												
													
														
															|  | 		consult.setSymptoms(symptoms);
 |  | 
 | 
												
													
														
															|  | 		// 设置咨询图片URL
 |  | 
 | 
												
													
														
															|  | 		consult.setImages(images);
 |  | 
 | 
												
													
														
															|  | 		// 设置咨询语音URL
 |  | 
 | 
												
													
														
															|  | 		consult.setVoice(voice);
 |  | 
 | 
												
													
														
															|  | 		consult.setDoctor(doctor);
 |  | 
 | 
												
													
														
															|  | 		consult.setPatient(patient);
 |  | 
 | 
												
													
														
															|  | 		// 保存到数据库
 |  | 
 | 
												
													
														
															|  | 		synchronized (patient.intern()){//新增同步方法
 |  | 
 | 
												
													
														
															|  | 			JSONObject re = null;
 |  | 
 | 
												
													
														
															|  | 			re = consultService.addTeamConsult(consult, patient,doctor,source);
 |  | 
 | 
												
													
														
															|  | 			//发送系统消息
 |  | 
 | 
												
													
														
															|  | 			SystemMessageDO systemMessageDO = new SystemMessageDO();
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setTitle("新增在线咨询");
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setType("850");
 |  | 
 | 
												
													
														
															|  | 			if (type==24){
 |  | 
 | 
												
													
														
															|  | 				systemMessageDO.setType("851");
 |  | 
 | 
												
													
														
															|  | 
 |  | 			if (type == null) {
 | 
												
													
														
															|  | 
 |  | 				type = 23;
 | 
												
													
														
															|  | 
 |  | 			}
 | 
												
													
														
															|  | 
 |  | 			ConsultTeamDo consult = new ConsultTeamDo();
 | 
												
													
														
															|  | 
 |  | 			// 设置咨询类型:23 在线咨询 24老人在线咨询
 | 
												
													
														
															|  | 
 |  | 			consult.setType(type);
 | 
												
													
														
															|  | 
 |  | 			// 设置主要症状
 | 
												
													
														
															|  | 
 |  | 			consult.setSymptoms(symptoms);
 | 
												
													
														
															|  | 
 |  | 			// 设置咨询图片URL
 | 
												
													
														
															|  | 
 |  | 			consult.setImages(images);
 | 
												
													
														
															|  | 
 |  | 			// 设置咨询语音URL
 | 
												
													
														
															|  | 
 |  | 			consult.setVoice(voice);
 | 
												
													
														
															|  | 
 |  | 			consult.setDoctor(doctor);
 | 
												
													
														
															|  | 
 |  | 			consult.setPatient(patient);
 | 
												
													
														
															|  | 
 |  | 			// 保存到数据库
 | 
												
													
														
															|  | 
 |  | 			synchronized (patient.intern()){//新增同步方法
 | 
												
													
														
															|  | 
 |  | 				JSONObject re = null;
 | 
												
													
														
															|  | 
 |  | 				re = consultService.addTeamConsult(consult, patient,doctor,source);
 | 
												
													
														
															|  | 
 |  | 				//发送系统消息
 | 
												
													
														
															|  | 
 |  | 				SystemMessageDO systemMessageDO = new SystemMessageDO();
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setTitle("新增在线咨询");
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setType("850");
 | 
												
													
														
															|  | 
 |  | 				if (type==24){
 | 
												
													
														
															|  | 
 |  | 					systemMessageDO.setType("851");
 | 
												
													
														
															|  | 
 |  | 				}
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setReceiver(re.getString("doctor"));
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setReceiverName(re.getString("doctorName"));
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setRelationCode(re.getString("sessiond_id"));
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setSender(re.getString("patient"));
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setSenderName(re.getString("patientName"));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 				net.sf.json.JSONObject data = new net.sf.json.JSONObject();
 | 
												
													
														
															|  | 
 |  | 				data.put("name",re.getString("patientName"));
 | 
												
													
														
															|  | 
 |  | 				data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
 | 
												
													
														
															|  | 
 |  | 				data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
 | 
												
													
														
															|  | 
 |  | 				data.put("question",symptoms);
 | 
												
													
														
															|  | 
 |  | 				data.put("type",1);
 | 
												
													
														
															|  | 
 |  | 				systemMessageDO.setData(data.toString());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 				consultService.saveMessage(systemMessageDO);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 				serviceNewsService.addServiceNews(re.getString("patientName"),patient,"2",null);
 | 
												
													
														
															|  | 			}
 |  | 			}
 | 
												
													
														
															|  | 			systemMessageDO.setReceiver(re.getString("doctor"));
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setReceiverName(re.getString("doctorName"));
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setRelationCode(re.getString("sessiond_id"));
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setSender(re.getString("patient"));
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setSenderName(re.getString("patientName"));
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 			net.sf.json.JSONObject data = new net.sf.json.JSONObject();
 |  | 
 | 
												
													
														
															|  | 			data.put("name",re.getString("patientName"));
 |  | 
 | 
												
													
														
															|  | 			data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
 |  | 
 | 
												
													
														
															|  | 			data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
 |  | 
 | 
												
													
														
															|  | 			data.put("question",symptoms);
 |  | 
 | 
												
													
														
															|  | 			data.put("type",1);
 |  | 
 | 
												
													
														
															|  | 			systemMessageDO.setData(data.toString());
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 			consultService.saveMessage(systemMessageDO);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 			serviceNewsService.addServiceNews(re.getString("patientName"),patient,"2",null);
 |  | 
 | 
												
													
														
															|  | 		}
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		return success("操作成功", consult);
 |  | 
 | 
												
													
														
															|  | 
 |  | 			return success("操作成功", consult);
 | 
												
													
														
															|  | 
 |  | 		}catch(Exception e){
 | 
												
													
														
															|  | 
 |  | 			return failedException(e);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 	@GetMapping(value = "findConsultDoctor")
 |  | 	@GetMapping(value = "findConsultDoctor")
 | 
												
											
												
													
														
															|  | @ -224,7 +227,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "page", value = "第几页")
 |  | 			@ApiParam(name = "page", value = "第几页")
 | 
												
													
														
															|  | 			@RequestParam(value = "page",required = false) int page,
 |  | 			@RequestParam(value = "page",required = false) int page,
 | 
												
													
														
															|  | 			@ApiParam(name = "pagesize", value = "分页大小")
 |  | 			@ApiParam(name = "pagesize", value = "分页大小")
 | 
												
													
														
															|  | 			@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "pagesize",required = false) int pagesize){
 | 
												
													
														
															|  | 		try {
 |  | 		try {
 | 
												
													
														
															|  | 			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize);
 |  | 			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize);
 | 
												
													
														
															|  | 			return success(data);
 |  | 			return success(data);
 | 
												
											
												
													
														
															|  | @ -253,7 +256,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "pagesize", value = "分页大小")
 |  | 			@ApiParam(name = "pagesize", value = "分页大小")
 | 
												
													
														
															|  | 			@RequestParam(value = "pagesize",required = false) int pagesize,
 |  | 			@RequestParam(value = "pagesize",required = false) int pagesize,
 | 
												
													
														
															|  | 			@ApiParam(name = "doctorName", value = "医生名字")
 |  | 			@ApiParam(name = "doctorName", value = "医生名字")
 | 
												
													
														
															|  | 			@RequestParam(value = "doctorName",required = false) String doctorName)throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "doctorName",required = false) String doctorName){
 | 
												
													
														
															|  | 		try {
 |  | 		try {
 | 
												
													
														
															|  | 			List<Map<String,Object>>  data = consultService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,symptoms,status,doctorName);
 |  | 			List<Map<String,Object>>  data = consultService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,symptoms,status,doctorName);
 | 
												
													
														
															|  | 			Long total = consultService.countConsultRecordByPatient(patient, id,type,title,symptoms,doctorName,status);
 |  | 			Long total = consultService.countConsultRecordByPatient(patient, id,type,title,symptoms,doctorName,status);
 | 
												
											
												
													
														
															|  | @ -273,25 +276,29 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "consult", value = "咨询CODE")
 |  | 			@ApiParam(name = "consult", value = "咨询CODE")
 | 
												
													
														
															|  | 			@RequestParam(value = "consult",required = false) String consult,
 |  | 			@RequestParam(value = "consult",required = false) String consult,
 | 
												
													
														
															|  | 			@ApiParam(name = "patientCode", value = "居民COEE")
 |  | 			@ApiParam(name = "patientCode", value = "居民COEE")
 | 
												
													
														
															|  | 			@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
 |  | 
 | 
												
													
														
															|  | 		int resutl = consultService.finish(consult,patientCode,1);
 |  | 
 | 
												
													
														
															|  | 		BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
 |  | 
 | 
												
													
														
															|  | 		JSONObject msgObj = new JSONObject();
 |  | 
 | 
												
													
														
															|  | 		msgObj.put("msg",basePatientDO.getName()+"结束了咨询");
 |  | 
 | 
												
													
														
															|  | 		msgObj.put("consultcode",consult);
 |  | 
 | 
												
													
														
															|  | 		String jsonStr = "";
 |  | 
 | 
												
													
														
															|  | 		if(1 == resutl){
 |  | 
 | 
												
													
														
															|  | 			jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+System.currentTimeMillis()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
 |  | 
 | 
												
													
														
															|  | 		}
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "patientCode",required = false) String patientCode) {
 | 
												
													
														
															|  | 
 |  | 		try {
 | 
												
													
														
															|  | 
 |  | 			int resutl = consultService.finish(consult,patientCode,1);
 | 
												
													
														
															|  | 
 |  | 			BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
 | 
												
													
														
															|  | 
 |  | 			JSONObject msgObj = new JSONObject();
 | 
												
													
														
															|  | 
 |  | 			msgObj.put("msg",basePatientDO.getName()+"结束了咨询");
 | 
												
													
														
															|  | 
 |  | 			msgObj.put("consultcode",consult);
 | 
												
													
														
															|  | 
 |  | 			String jsonStr = "";
 | 
												
													
														
															|  | 
 |  | 			if(1 == resutl){
 | 
												
													
														
															|  | 
 |  | 				jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+System.currentTimeMillis()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
 | 
												
													
														
															|  | 
 |  | 			}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		return success(jsonStr);
 |  | 
 | 
												
													
														
															|  | 
 |  | 			return success(jsonStr);
 | 
												
													
														
															|  | 
 |  | 		}catch (Exception e){
 | 
												
													
														
															|  | 
 |  | 			return failedException(e);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 	@GetMapping(value = "getTopic")
 |  | 	@GetMapping(value = "getTopic")
 | 
												
													
														
															|  | 	@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
 |  | 	@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
 | 
												
													
														
															|  | 	public Envelop getTopic(
 |  | 	public Envelop getTopic(
 | 
												
													
														
															|  | 			@ApiParam(name = "consult", value = "咨询CODE")
 |  | 			@ApiParam(name = "consult", value = "咨询CODE")
 | 
												
													
														
															|  | 			@RequestParam(value = "consult",required = false) String consult)throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "consult",required = false) String consult) {
 | 
												
													
														
															|  | 		try {
 |  | 		try {
 | 
												
													
														
															|  | 			return success("请求成功",imService.getTopic(consult));
 |  | 			return success("请求成功",imService.getTopic(consult));
 | 
												
													
														
															|  | 		}catch (Exception e){
 |  | 		}catch (Exception e){
 | 
												
											
												
													
														
															|  | @ -311,8 +318,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "times", value = "")
 |  | 			@ApiParam(name = "times", value = "")
 | 
												
													
														
															|  | 			@RequestParam(value = "times",required = false) Integer times,
 |  | 			@RequestParam(value = "times",required = false) Integer times,
 | 
												
													
														
															|  | 			@ApiParam(name = "patientCode", value = "居民CODE")
 |  | 			@ApiParam(name = "patientCode", value = "居民CODE")
 | 
												
													
														
															|  | 			@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "patientCode",required = false) String patientCode){
 | 
												
													
														
															|  | 		try {
 |  | 		try {
 | 
												
													
														
															|  | 			List<String> failed = new ArrayList<>();
 |  | 			List<String> failed = new ArrayList<>();
 | 
												
													
														
															|  | 			//处理语音文件
 |  | 			//处理语音文件
 | 
												
											
												
													
														
															|  | @ -348,10 +354,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 	@ApiOperation(value = "获取会话成员")
 |  | 	@ApiOperation(value = "获取会话成员")
 | 
												
													
														
															|  | 	public ListEnvelop participants(
 |  | 	public ListEnvelop participants(
 | 
												
													
														
															|  | 			@ApiParam(name = "sessionId", value = "会话ID")
 |  | 			@ApiParam(name = "sessionId", value = "会话ID")
 | 
												
													
														
															|  | 			@RequestParam(value = "sessionId",required = true) String sessionId)throws Exception{
 |  | 
 | 
												
													
														
															|  | 		
 |  | 
 | 
												
													
														
															|  | 		JSONArray participants = imService.getSessions(sessionId);
 |  | 
 | 
												
													
														
															|  | 		return success(participants);
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "sessionId",required = true) String sessionId){
 | 
												
													
														
															|  | 
 |  | 		try{
 | 
												
													
														
															|  | 
 |  | 			JSONArray participants = imService.getSessions(sessionId);
 | 
												
													
														
															|  | 
 |  | 			return success(participants);
 | 
												
													
														
															|  | 
 |  | 		}catch (Exception e){
 | 
												
													
														
															|  | 
 |  | 			return failedListEnvelopException(e);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
 |  | 	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
 | 
												
											
												
													
														
															|  | @ -366,9 +375,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@ApiParam(name = "page", value = "第几页")
 |  | 			@ApiParam(name = "page", value = "第几页")
 | 
												
													
														
															|  | 			@RequestParam(value = "page",required = true) int page,
 |  | 			@RequestParam(value = "page",required = true) int page,
 | 
												
													
														
															|  | 			@ApiParam(name = "pagesize", value = "分页数")
 |  | 			@ApiParam(name = "pagesize", value = "分页数")
 | 
												
													
														
															|  | 			@RequestParam(value = "pagesize",required = true) int pagesize)throws Exception{
 |  | 
 | 
												
													
														
															|  | 		JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
 |  | 
 | 
												
													
														
															|  | 		return success(messageArray);
 |  | 
 | 
												
													
														
															|  | 
 |  | 			@RequestParam(value = "pagesize",required = true) int pagesize){
 | 
												
													
														
															|  | 
 |  | 		try{
 | 
												
													
														
															|  | 
 |  | 			JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
 | 
												
													
														
															|  | 
 |  | 			return success(messageArray);
 | 
												
													
														
															|  | 
 |  | 		}catch (Exception e){
 | 
												
													
														
															|  | 
 |  | 			return failedListEnvelopException(e);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
											
												
													
														
															|  | @ -377,28 +390,32 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 	public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
 |  | 	public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
 | 
												
													
														
															|  | 	                       @RequestParam(value = "pageUrl", required = true)String pageUrl,
 |  | 	                       @RequestParam(value = "pageUrl", required = true)String pageUrl,
 | 
												
													
														
															|  | 	                       @ApiParam(name = "wxId", value = "微信id")
 |  | 	                       @ApiParam(name = "wxId", value = "微信id")
 | 
												
													
														
															|  | 	                       @RequestParam(value = "wxId", required = true)String wxId) throws Exception {
 |  | 
 | 
												
													
														
															|  | 		logger.info("pageUrl="+pageUrl);
 |  | 
 | 
												
													
														
															|  | 		logger.info("wxId="+wxId);
 |  | 
 | 
												
													
														
															|  | 		String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
 |  | 
 | 
												
													
														
															|  | 		WxWechatDO wxWechatDO = wechatDao.findById(wxId);
 |  | 
 | 
												
													
														
															|  | 		Map<Object, Object> map = new HashMap<Object, Object>();
 |  | 
 | 
												
													
														
															|  | 		if (ticket != null) {
 |  | 
 | 
												
													
														
															|  | 			String noncestr = UUID.randomUUID().toString();
 |  | 
 | 
												
													
														
															|  | 			long timestamp = System.currentTimeMillis() / 1000;
 |  | 
 | 
												
													
														
															|  | 			String url = pageUrl;
 |  | 
 | 
												
													
														
															|  | 			logger.info("getSign.url="+url);
 |  | 
 | 
												
													
														
															|  | 			String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url;
 |  | 
 | 
												
													
														
															|  | 			logger.info("getSign.str="+str);
 |  | 
 | 
												
													
														
															|  | 			// sha1加密
 |  | 
 | 
												
													
														
															|  | 			String signature = SHA1(str);
 |  | 
 | 
												
													
														
															|  | 			map.put("noncestr", noncestr);
 |  | 
 | 
												
													
														
															|  | 			map.put("timestamp", timestamp);
 |  | 
 | 
												
													
														
															|  | 			map.put("signature", signature);
 |  | 
 | 
												
													
														
															|  | 			map.put("appid", wxWechatDO.getAppId());
 |  | 
 | 
												
													
														
															|  | 			return success(PatientRequestMapping.Wechat.api_success,map);
 |  | 
 | 
												
													
														
															|  | 
 |  | 	                       @RequestParam(value = "wxId", required = true)String wxId){
 | 
												
													
														
															|  | 
 |  | 		try{
 | 
												
													
														
															|  | 
 |  | 			logger.info("pageUrl="+pageUrl);
 | 
												
													
														
															|  | 
 |  | 			logger.info("wxId="+wxId);
 | 
												
													
														
															|  | 
 |  | 			String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
 | 
												
													
														
															|  | 
 |  | 			WxWechatDO wxWechatDO = wechatDao.findById(wxId);
 | 
												
													
														
															|  | 
 |  | 			Map<Object, Object> map = new HashMap<Object, Object>();
 | 
												
													
														
															|  | 
 |  | 			if (ticket != null) {
 | 
												
													
														
															|  | 
 |  | 				String noncestr = UUID.randomUUID().toString();
 | 
												
													
														
															|  | 
 |  | 				long timestamp = System.currentTimeMillis() / 1000;
 | 
												
													
														
															|  | 
 |  | 				String url = pageUrl;
 | 
												
													
														
															|  | 
 |  | 				logger.info("getSign.url="+url);
 | 
												
													
														
															|  | 
 |  | 				String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "×tamp=" + timestamp + "&url=" + url;
 | 
												
													
														
															|  | 
 |  | 				logger.info("getSign.str="+str);
 | 
												
													
														
															|  | 
 |  | 				// sha1加密
 | 
												
													
														
															|  | 
 |  | 				String signature = SHA1(str);
 | 
												
													
														
															|  | 
 |  | 				map.put("noncestr", noncestr);
 | 
												
													
														
															|  | 
 |  | 				map.put("timestamp", timestamp);
 | 
												
													
														
															|  | 
 |  | 				map.put("signature", signature);
 | 
												
													
														
															|  | 
 |  | 				map.put("appid", wxWechatDO.getAppId());
 | 
												
													
														
															|  | 
 |  | 				return success(PatientRequestMapping.Wechat.api_success,map);
 | 
												
													
														
															|  | 
 |  | 			}
 | 
												
													
														
															|  | 
 |  | 			return failed(PatientRequestMapping.Wechat.api_error);
 | 
												
													
														
															|  | 
 |  | 		}catch (Exception e){
 | 
												
													
														
															|  | 
 |  | 			return failedException(e);
 | 
												
													
														
															|  | 		}
 |  | 		}
 | 
												
													
														
															|  | 		return failed(PatientRequestMapping.Wechat.api_error);
 |  | 
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 	/**
 |  | 	/**
 | 
												
											
												
													
														
															|  | @ -434,9 +451,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 	                                       @ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
 |  | 	                                       @ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
 | 
												
													
														
															|  | 	                                       @RequestParam(value = "userid", required = true) String userid,
 |  | 	                                       @RequestParam(value = "userid", required = true) String userid,
 | 
												
													
														
															|  | 	                                       @ApiParam(name = "olduserid", value = "删除的成员id")
 |  | 	                                       @ApiParam(name = "olduserid", value = "删除的成员id")
 | 
												
													
														
															|  | 	                                       @RequestParam(value = "olduserid", required = false) String olduserid)throws Exception{
 |  | 
 | 
												
													
														
															|  | 		imService.updateParticipant(sessionid,userid,olduserid);
 |  | 
 | 
												
													
														
															|  | 		return success("操作成功");
 |  | 
 | 
												
													
														
															|  | 
 |  | 	                                       @RequestParam(value = "olduserid", required = false) String olduserid){
 | 
												
													
														
															|  | 
 |  | 		try {
 | 
												
													
														
															|  | 
 |  | 			imService.updateParticipant(sessionid,userid,olduserid);
 | 
												
													
														
															|  | 
 |  | 			return success("操作成功");
 | 
												
													
														
															|  | 
 |  | 		} catch (Exception e) {
 | 
												
													
														
															|  | 
 |  | 			return failedException(e);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 	@PostMapping(value = "messageAppend")
 |  | 	@PostMapping(value = "messageAppend")
 | 
												
											
												
													
														
															|  | @ -458,47 +479,51 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  | 			@RequestParam(value = "type", required = false) String type,
 |  | 			@RequestParam(value = "type", required = false) String type,
 | 
												
													
														
															|  | 			@ApiParam(name = "times", value = "times", defaultValue = "")
 |  | 			@ApiParam(name = "times", value = "times", defaultValue = "")
 | 
												
													
														
															|  | 			@RequestParam(value = "times", required = false) Integer times
 |  | 			@RequestParam(value = "times", required = false) Integer times
 | 
												
													
														
															|  | 	)throws Exception{
 |  | 
 | 
												
													
														
															|  | 		List<String> failed = new ArrayList<>();
 |  | 
 | 
												
													
														
															|  | 		//处理语音文件
 |  | 
 | 
												
													
														
															|  | 		if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
 |  | 
 | 
												
													
														
															|  | 			if("3".equalsIgnoreCase(content_type)){//语音文件
 |  | 
 | 
												
													
														
															|  | 				String voicepath = imService.fetchWxVoices(wechat_appid);
 |  | 
 | 
												
													
														
															|  | 				logger.info("voice_path:"+voicepath);
 |  | 
 | 
												
													
														
															|  | 				JSONObject obj = new JSONObject();
 |  | 
 | 
												
													
														
															|  | 				String voiceurl = "";
 |  | 
 | 
												
													
														
															|  | 				// 将临时语音拷贝到正式存储路径下
 |  | 
 | 
												
													
														
															|  | 				if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
 |  | 
 | 
												
													
														
															|  | 					voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
 |  | 
 | 
												
													
														
															|  | 					obj.put("path", voiceurl);
 |  | 
 | 
												
													
														
															|  | 					obj.put("times", times);
 |  | 
 | 
												
													
														
															|  | 					content = obj.toString();
 |  | 
 | 
												
													
														
															|  | 				}
 |  | 
 | 
												
													
														
															|  | 			}else if("2".equalsIgnoreCase(content_type)){//图片文件
 |  | 
 | 
												
													
														
															|  | 				String imagepath = imService.fetchWxImages(wechat_appid);
 |  | 
 | 
												
													
														
															|  | 				logger.info("image_path:"+imagepath);
 |  | 
 | 
												
													
														
															|  | 				String imgeUrl = "";
 |  | 
 | 
												
													
														
															|  | 				// 将临时语音拷贝到正式存储路径下
 |  | 
 | 
												
													
														
															|  | 				if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
 |  | 
 | 
												
													
														
															|  | 					imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
 |  | 
 | 
												
													
														
															|  | 					content = imgeUrl;
 |  | 
 | 
												
													
														
															|  | 				}
 |  | 
 | 
												
													
														
															|  | 			}else{
 |  | 
 | 
												
													
														
															|  | 
 |  | 	){
 | 
												
													
														
															|  | 
 |  | 		try {
 | 
												
													
														
															|  | 
 |  | 			List<String> failed = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | 			//处理语音文件
 | 
												
													
														
															|  | 
 |  | 			if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
 | 
												
													
														
															|  | 
 |  | 				if("3".equalsIgnoreCase(content_type)){//语音文件
 | 
												
													
														
															|  | 
 |  | 					String voicepath = imService.fetchWxVoices(wechat_appid);
 | 
												
													
														
															|  | 
 |  | 					logger.info("voice_path:"+voicepath);
 | 
												
													
														
															|  | 
 |  | 					JSONObject obj = new JSONObject();
 | 
												
													
														
															|  | 
 |  | 					String voiceurl = "";
 | 
												
													
														
															|  | 
 |  | 					// 将临时语音拷贝到正式存储路径下
 | 
												
													
														
															|  | 
 |  | 					if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
 | 
												
													
														
															|  | 
 |  | 						voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
 | 
												
													
														
															|  | 
 |  | 						obj.put("path", voiceurl);
 | 
												
													
														
															|  | 
 |  | 						obj.put("times", times);
 | 
												
													
														
															|  | 
 |  | 						content = obj.toString();
 | 
												
													
														
															|  | 
 |  | 					}
 | 
												
													
														
															|  | 
 |  | 				}else if("2".equalsIgnoreCase(content_type)){//图片文件
 | 
												
													
														
															|  | 
 |  | 					String imagepath = imService.fetchWxImages(wechat_appid);
 | 
												
													
														
															|  | 
 |  | 					logger.info("image_path:"+imagepath);
 | 
												
													
														
															|  | 
 |  | 					String imgeUrl = "";
 | 
												
													
														
															|  | 
 |  | 					// 将临时语音拷贝到正式存储路径下
 | 
												
													
														
															|  | 
 |  | 					if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
 | 
												
													
														
															|  | 
 |  | 						imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
 | 
												
													
														
															|  | 
 |  | 						content = imgeUrl;
 | 
												
													
														
															|  | 
 |  | 					}
 | 
												
													
														
															|  | 
 |  | 				}else{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 				}
 | 
												
													
														
															|  | 
 |  | 			}
 | 
												
													
														
															|  | 
 |  | 			session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
 | 
												
													
														
															|  | 
 |  | 			String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
 | 
												
													
														
															|  | 
 |  | 			List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
 | 
												
													
														
															|  | 
 |  | 			for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
 | 
												
													
														
															|  | 
 |  | 				System.out.println("发送外层SOCKET消息:通知医生导诊");
 | 
												
													
														
															|  | 
 |  | 				JSONObject object = new JSONObject();
 | 
												
													
														
															|  | 
 |  | 				object.put("socket_sms_type",13);
 | 
												
													
														
															|  | 
 |  | 				object.put("relation_code",session_id);
 | 
												
													
														
															|  | 
 |  | 				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
 | 
												
													
														
															|  | 			}
 |  | 			}
 | 
												
													
														
															|  | 		}
 |  | 
 | 
												
													
														
															|  | 		session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
 |  | 
 | 
												
													
														
															|  | 		String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
 |  | 
 | 
												
													
														
															|  | 		List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
 |  | 
 | 
												
													
														
															|  | 		for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
 |  | 
 | 
												
													
														
															|  | 			System.out.println("发送外层SOCKET消息:通知医生导诊");
 |  | 
 | 
												
													
														
															|  | 			JSONObject object = new JSONObject();
 |  | 
 | 
												
													
														
															|  | 			object.put("socket_sms_type",13);
 |  | 
 | 
												
													
														
															|  | 			object.put("relation_code",session_id);
 |  | 
 | 
												
													
														
															|  | 			imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
 |  | 
 | 
												
													
														
															|  | 		}
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 		return success(result);
 |  | 
 | 
												
													
														
															|  | 
 |  | 			return success(result);
 | 
												
													
														
															|  | 
 |  | 		} catch (Exception e) {
 | 
												
													
														
															|  | 
 |  | 			return failedException(e);
 | 
												
													
														
															|  | 
 |  | 		}
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |