|
@ -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.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.ObjEnvelop;
|
|
@ -13,6 +14,7 @@ import com.yihu.jw.util.date.DateUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.axis.utils.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@ -36,45 +38,37 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiOperation(value = "患者咨询记录查询")
|
|
|
public ListEnvelop records(
|
|
|
@ApiParam(name = "patient", value = "居民id")
|
|
|
@RequestParam(value = "patient",required = false) String patient,
|
|
|
@RequestParam(value = "patient",required = true) String patient,
|
|
|
@ApiParam(name = "title", value = "咨询标题关键字")
|
|
|
@RequestParam(value = "title",required = false) String title,
|
|
|
@ApiParam(name = "id", value = "咨询ID")
|
|
|
@RequestParam(value = "id",required = false) Long id,
|
|
|
@RequestParam(value = "id",required = false) String id,
|
|
|
@ApiParam(name = "type", value = "咨询类型")
|
|
|
@RequestParam(value = "type",required = true) Integer type,
|
|
|
@ApiParam(name = "pagesize", value = "分页大小")
|
|
|
@RequestParam(value = "pagesize",required = false) int pagesize
|
|
|
)throws Exception{
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Object> data = imService.findConsultRecordByPatient(patient, id, pagesize, title);
|
|
|
List<ConsultVO> data = imService.findConsultRecordByPatient(patient, id,type, pagesize, title);
|
|
|
if (data != null) {
|
|
|
for (Object consult : data.getContent()) {
|
|
|
for (ConsultVO consult : data) {
|
|
|
if (consult == null) {
|
|
|
continue;
|
|
|
}
|
|
|
Object[] result = (Object[]) consult;
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", result[0]);
|
|
|
json.put("id", consult.getId());
|
|
|
// 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈
|
|
|
json.put("type", result[1]);
|
|
|
// 设置咨询标识
|
|
|
json.put("code", result[2]);
|
|
|
json.put("type", consult.getType());
|
|
|
// 设置显示标题
|
|
|
json.put("title", result[3]);
|
|
|
json.put("title", consult.getTitle());
|
|
|
// 设置主诉
|
|
|
json.put("symptoms", result[4]);
|
|
|
json.put("symptoms", consult.getSymptoms());
|
|
|
// 咨询状态
|
|
|
json.put("status", result[6]);
|
|
|
json.put("status", consult.getStatus());
|
|
|
// 设置咨询日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
|
|
|
// 咨询状态
|
|
|
json.put("doctorCode", result[7]);
|
|
|
|
|
|
json.put("teamCode", result[8]);
|
|
|
|
|
|
json.put("evaluate", result[9]);
|
|
|
|
|
|
//签约code
|
|
|
json.put("signCode", result[10]);
|
|
|
json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
|
|
|
//是否评价
|
|
|
json.put("evaluate", consult.getEvaluate());
|
|
|
|
|
|
array.add(json);
|
|
|
}
|
|
@ -86,23 +80,23 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiOperation(value = "查询居民与某个医生是否存在未结束的咨询")
|
|
|
public Envelop isExistsUnfinishedConsult(
|
|
|
@ApiParam(name = "doctor", value = "医生CODE")
|
|
|
@RequestParam(value = "doctor",required = true) String doctor)throws Exception {
|
|
|
org.json.JSONObject result = new org.json.JSONObject();
|
|
|
List<ConsultTeamDo> consults = imService.getUnfinishedConsult(getUID(), doctor);
|
|
|
@RequestParam(value = "doctor",required = true) String doctor,
|
|
|
@ApiParam(name = "patient", value = "居民CODE")
|
|
|
@RequestParam(value = "patient",required = false) String patient)throws Exception {
|
|
|
|
|
|
if (consults != null && consults.size() > 0) {
|
|
|
return success("查询成功",consults.get(0).getConsult());
|
|
|
} else {
|
|
|
return success("查询成功");
|
|
|
if(StringUtils.isEmpty(patient)){
|
|
|
patient= getUID();
|
|
|
}
|
|
|
|
|
|
Long count = imService.getUnfinishedConsult(getUID(), doctor);
|
|
|
return success(count);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = BaseHospitalRequestMapping.PatientIM.participants)
|
|
|
@ApiOperation(value = "获取会话成员")
|
|
|
public ListEnvelop participants(
|
|
|
@ApiParam(name = "sessionId", value = "会话ID")
|
|
|
@RequestParam(value = "sessionId",required = true) String sessionId){
|
|
|
@RequestParam(value = "sessionId",required = true) String sessionId)throws Exception{
|
|
|
|
|
|
JSONArray participants = imService.getSessions(sessionId);
|
|
|
return success(participants);
|
|
@ -120,7 +114,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiParam(name = "page", value = "第几页")
|
|
|
@RequestParam(value = "page",required = true) int page,
|
|
|
@ApiParam(name = "pagesize", value = "分页数")
|
|
|
@RequestParam(value = "pagesize",required = true) int pagesize){
|
|
|
@RequestParam(value = "pagesize",required = true) int pagesize)throws Exception{
|
|
|
JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
|
|
|
return success(messageArray);
|
|
|
}
|