| 
					
				 | 
			
			
				@ -2,6 +2,7 @@ package com.yihu.jw.care.endpoint.consult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.dao.course.DoctorPatientTmpDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.consult.ConsultService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorRoleDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -10,6 +11,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.im.ConsultTeamDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.wx.WxWechatDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.course.DoctorPatientTmpDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.message.SystemMessageDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.file_upload.FileUploadService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -111,12 +113,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "sessionId", value = "会话id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "sessionId",required = false) String sessionId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "patient", value = "居民CODE") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patient",required = true) String patient)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patient",required = true) String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								return Envelop.getError("参数错误请求失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return success("请求成功",consultService.findLastOnlineConsult(patient, orgCode,sessionId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return success("请求成功",consultService.findLastOnlineConsult(patient, orgCode,sessionId,type)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return failedException(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -128,9 +132,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "doctor", value = "医生CODE") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "doctor",required = false) String doctor, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "patient", value = "居民CODE") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patient",required = true) String patient)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patient",required = true) String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String consultCode = consultService.getUnfinishedConsult(patient, doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String consultCode = consultService.getUnfinishedConsult(patient, doctor, type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return success("请求成功",consultCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return failedException(e); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -150,7 +156,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "images",required = false) String images, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "voice", value = "语音") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "voice",required = false) String voice, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "type", value = "咨询类型:23在线咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = false) Integer type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "source", value = "咨询类型来源") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "source",required = false) String source)throws Exception{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -161,7 +167,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							type = 23; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ConsultTeamDo consult = new ConsultTeamDo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置咨询类型:23 在线咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置咨询类型:23 在线咨询 24老人在线咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						consult.setType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置主要症状 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						consult.setSymptoms(symptoms); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -179,6 +185,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							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")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -192,6 +201,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							data.put("question",symptoms); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							data.put("type",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							systemMessageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							consultService.saveMessage(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -205,12 +215,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patient",required = true) String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "orgCode", value = "机构code") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "orgCode",required = true) String orgCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = false,defaultValue = "23") Integer type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "page", value = "第几页") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "page",required = false) int page, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "pagesize", value = "分页大小") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient, page,pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return success(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return failedException(e); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -228,7 +240,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "symptoms",required = false) String symptoms, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "id", value = "咨询ID") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "id",required = false) String id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "type", value = "咨询类型") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = true) String type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "status",required = false) Integer status, 
			 |