|
@ -0,0 +1,113 @@
|
|
|
package com.yihu.jw.care.endpoint.consult;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.service.consult.ConsultService;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.im.service.ImService;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
|
* Created with IntelliJ IDEA.
|
|
|
*
|
|
|
* @Author: yeshijie
|
|
|
* @Date: 2021/5/29
|
|
|
* @Description:
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/im/doctor")
|
|
|
@Api(value = "医生端咨询IM接口", description = "医生端咨询IM接口", tags = {"医生端咨询IM接口"})
|
|
|
public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(DoctorConsultEndpoint.class);
|
|
|
|
|
|
@Autowired
|
|
|
private ConsultService consultService;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
@Autowired
|
|
|
private ImService imService;
|
|
|
|
|
|
@PostMapping(value = "finish")
|
|
|
@ApiOperation(value = "医生结束咨询", notes = "医生结束咨询")
|
|
|
public Envelop finish(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = true) String consult,
|
|
|
@ApiParam(name = "doctorCode", value = "医生COEE")
|
|
|
@RequestParam(value = "doctorCode",required = true) String doctorCode) throws Exception {
|
|
|
int resutl = consultService.finish(consult,doctorCode,2);
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorCode);
|
|
|
JSONObject msgObj = new JSONObject();
|
|
|
msgObj.put("msg",baseDoctorDO.getName()+"结束了咨询");
|
|
|
msgObj.put("consultcode",consult);
|
|
|
String jsonStr = "";
|
|
|
|
|
|
if(1 == resutl){
|
|
|
jsonStr = "{\"id\":\""+ UUID.randomUUID().toString()+"\",\"sender_id\":\""+doctorCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+System.currentTimeMillis()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
|
|
|
}
|
|
|
return success(jsonStr);
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "getConsultInfoAndPatientInfo")
|
|
|
@ApiOperation(value = "获取咨询问题,图片,居民信息", notes = "获取咨询问题,图片,居民信息")
|
|
|
public Envelop getConsultInfoAndPatientInfo(
|
|
|
@ApiParam(name = "consult", value = "咨询CODE")
|
|
|
@RequestParam(value = "consult",required = false) String consult,
|
|
|
@ApiParam(name = "patientCode", value = "居民COEE")
|
|
|
@RequestParam(value = "patientCode",required = false) String patientCode)throws Exception {
|
|
|
try {
|
|
|
return success("请求成功",imService.getConsultInfoAndPatientInfo(consult,patientCode));
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "records")
|
|
|
@ApiOperation(value = "医生咨询记录查询")
|
|
|
public Envelop records(
|
|
|
@ApiParam(name = "doctor", value = "医生id")
|
|
|
@RequestParam(value = "doctor",required = false) 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) String type,
|
|
|
@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
|
|
|
@RequestParam(value = "status",required = true) Integer status,
|
|
|
@ApiParam(name = "start_time", value = "开始时间 YYYY-MM-DD HH:MM:SS")
|
|
|
@RequestParam(value = "start_time",required = false) String start_time,
|
|
|
@ApiParam(name = "end_time", value = "结束时间 YYYY-MM-DD HH:MM:SS")
|
|
|
@RequestParam(value = "end_time",required = false) String end_time,
|
|
|
@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 = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
|
|
|
|
|
|
Long total = imService.countConsultRecordByDoctor(doctor, id,type,status,title,start_time,end_time);
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("total",total);
|
|
|
result.put("list",data);
|
|
|
return success(result);
|
|
|
}catch (Exception e){
|
|
|
return failedException(e);
|
|
|
}
|
|
|
}
|
|
|
}
|