|  | @ -1,13 +1,16 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.hospital.endpoint.consult;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.im.ConsultTeamDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.prescription.service.PrescriptionService;
 | 
	
		
			
				|  |  | import com.yihu.jw.im.service.ImService;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.im.ConsultVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.ListEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | import io.swagger.annotations.ApiParam;
 | 
	
	
		
			
				|  | @ -16,6 +19,8 @@ import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * @author huangwenjie
 | 
	
	
		
			
				|  | @ -270,6 +275,63 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 		return success("请求成功",result);
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.records)
 | 
	
		
			
				|  |  | 	@ApiOperation(value = "医生咨询记录查询")
 | 
	
		
			
				|  |  | 	public Envelop records(
 | 
	
		
			
				|  |  | 			@ApiParam(name = "doctor", value = "医生id")
 | 
	
		
			
				|  |  | 			@RequestParam(value = "doctor",required = true) String doctor,
 | 
	
		
			
				|  |  | 			@ApiParam(name = "title", value = "咨询标题关键字")
 | 
	
		
			
				|  |  | 			@RequestParam(value = "title",required = false) String title,
 | 
	
		
			
				|  |  | 			@ApiParam(name = "id", value = "咨询ID")
 | 
	
		
			
				|  |  | 			@RequestParam(value = "id",required = false) String id,
 | 
	
		
			
				|  |  | 			@ApiParam(name = "type", value = "咨询类型")
 | 
	
		
			
				|  |  | 			@RequestParam(value = "type",required = true) Integer type,
 | 
	
		
			
				|  |  | 			@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
 | 
	
		
			
				|  |  | 			@RequestParam(value = "status",required = true) Integer status,
 | 
	
		
			
				|  |  | 			@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.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		if (data != null) {
 | 
	
		
			
				|  |  | 			for (ConsultVO consult : data) {
 | 
	
		
			
				|  |  | 				if (consult == null) {
 | 
	
		
			
				|  |  | 					continue;
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 				JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  | 				json.put("id", consult.getId());
 | 
	
		
			
				|  |  | 				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
 | 
	
		
			
				|  |  | 				json.put("type", consult.getType());
 | 
	
		
			
				|  |  | 				// 设置显示标题
 | 
	
		
			
				|  |  | 				json.put("title", consult.getTitle());
 | 
	
		
			
				|  |  | 				// 设置主诉
 | 
	
		
			
				|  |  | 				json.put("symptoms", consult.getSymptoms());
 | 
	
		
			
				|  |  | 				// 咨询状态
 | 
	
		
			
				|  |  | 				json.put("status", consult.getStatus());
 | 
	
		
			
				|  |  | 				// 设置咨询日期
 | 
	
		
			
				|  |  | 				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
 | 
	
		
			
				|  |  | 				//是否评价
 | 
	
		
			
				|  |  | 				json.put("evaluate", consult.getEvaluate());
 | 
	
		
			
				|  |  | 				//患者头像
 | 
	
		
			
				|  |  | 				json.put("patientPhoto", consult.getPatientphoto());
 | 
	
		
			
				|  |  | 				//患者名称
 | 
	
		
			
				|  |  | 				json.put("patientName", consult.getPatientName());
 | 
	
		
			
				|  |  | 				
 | 
	
		
			
				|  |  | 				array.add(json);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		Long total = imService.countConsultRecordByDoctor(doctor, id,type,status,title);
 | 
	
		
			
				|  |  | 		
 | 
	
		
			
				|  |  | 		JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  | 		result.put("total",total);
 | 
	
		
			
				|  |  | 		result.put("list",array);
 | 
	
		
			
				|  |  | 		return success(result);
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	
 | 
	
		
			
				|  |  | 	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.testSendPrescriptionIM)
 | 
	
		
			
				|  |  | 	@ApiOperation(value = "测试发送处方消息", notes = "测试发送处方消息")
 |