|  | @ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | 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.hospital.prescription.service.PrescriptionService;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.service.ImService;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.service.BasePatientService;
 | 
	
	
		
			
				|  | @ -14,6 +15,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.patient.PatientRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.dao.WechatDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.wechat.service.WechatInfoService;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
	
		
			
				|  | @ -46,9 +48,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private WechatInfoService wechatInfoService;
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@Autowired
 | 
	
		
			
				|  |  | 	private WechatDao wechatDao;
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
 | 
	
		
			
				|  |  | 	@ApiOperation(value = "患者咨询记录查询")
 | 
	
		
			
				|  |  | 	public ListEnvelop records(
 | 
	
		
			
				|  |  | 	public Envelop records(
 | 
	
		
			
				|  |  | 								@ApiParam(name = "patient", value = "居民id")
 | 
	
		
			
				|  |  | 								@RequestParam(value = "patient",required = true) String patient,
 | 
	
		
			
				|  |  | 								@ApiParam(name = "title", value = "咨询标题关键字")
 | 
	
	
		
			
				|  | @ -57,11 +62,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 								@RequestParam(value = "id",required = false) String id,
 | 
	
		
			
				|  |  | 								@ApiParam(name = "type", value = "咨询类型")
 | 
	
		
			
				|  |  | 								@RequestParam(value = "type",required = true) 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{
 | 
	
		
			
				|  |  | 		JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  | 		List<ConsultVO>  data = imService.findConsultRecordByPatient(patient, id,type, pagesize, title);
 | 
	
		
			
				|  |  | 		List<ConsultVO>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		if (data != null) {
 | 
	
		
			
				|  |  | 			for (ConsultVO consult : data) {
 | 
	
		
			
				|  |  | 				if (consult == null) {
 | 
	
	
		
			
				|  | @ -91,7 +99,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 				array.add(json);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return success(array);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  | 		result.put("total",total);
 | 
	
		
			
				|  |  | 		result.put("list",array);
 | 
	
		
			
				|  |  | 		return success(result);
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedConsult)
 | 
	
	
		
			
				|  | @ -314,7 +328,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getEvaluationByConsultCode)
 | 
	
		
			
				|  |  | 	@ApiOperation(value = "评价咨询", notes = "评价咨询")
 | 
	
		
			
				|  |  | 	@ApiOperation(value = "根据咨询CODE获取评价", notes = "根据咨询CODE获取评价")
 | 
	
		
			
				|  |  | 	public ListEnvelop getEvaluationByConsultCode(
 | 
	
		
			
				|  |  | 			@ApiParam(name = "consult", value = "咨询CODE")
 | 
	
		
			
				|  |  | 			@RequestParam(value = "consult",required = true) String consult)throws Exception{
 | 
	
	
		
			
				|  | @ -333,6 +347,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 	                       @RequestParam(value = "wxId", required = true)String wxId) throws Exception {
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		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();
 | 
	
	
		
			
				|  | @ -344,6 +359,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 			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);
 |