|
@ -1,6 +1,8 @@
|
|
|
package com.yihu.wlyy.web.common.im;
|
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.util.ImUtill;
|
|
|
import io.swagger.annotations.Api;
|
|
@ -26,25 +28,26 @@ public class imController extends BaseController {
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
@Autowired
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
/**
|
|
|
* 获取列表
|
|
|
* status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
|
|
|
* 第一次列表为当前医生(很可能团队长)待回复列表 传参:doctor有后台获取 status=0,reply=0未回复
|
|
|
* 后 取团队内单各医生的咨询情况 doctor、status、reply均有前端传入
|
|
|
* 后 取团队内单个医生的咨询情况 doctor、status、reply均有前端传入
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/consult/getList", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public String getTeamData(
|
|
|
public String getConsultByStatus(
|
|
|
@RequestParam(required = false) String doctor,
|
|
|
@RequestParam Integer status,
|
|
|
@RequestParam(required = false) Integer reply,
|
|
|
@RequestParam int page,
|
|
|
@RequestParam int pagesize) {
|
|
|
try {
|
|
|
// 后端校验
|
|
|
if (StringUtils.isEmpty(doctor)) {
|
|
|
doctor = getUID();
|
|
|
}
|
|
@ -55,10 +58,25 @@ public class imController extends BaseController {
|
|
|
while (it.hasNext()) {
|
|
|
Map map = new HashMap();
|
|
|
JSONObject ob = (JSONObject) it.next();
|
|
|
String id = ob.get("id").toString();
|
|
|
String avatar = ob.get("avatar").toString();
|
|
|
String session_id = ob.get("session_id").toString();
|
|
|
String name = ob.get("name").toString();
|
|
|
map.put("name", name);
|
|
|
String name = ob.get("patient_name").toString();
|
|
|
String createTime = ob.get("create_time").toString();
|
|
|
String description = ob.get("description").toString();
|
|
|
String sex = ob.get("sex").toString();
|
|
|
String startId = ob.get("start_message_id").toString();
|
|
|
String endId = ob.get("end_message_id").toString();
|
|
|
map.put("id", id);
|
|
|
map.put("session_id", session_id);
|
|
|
map.put("photo", avatar);
|
|
|
map.put("patientName", name);
|
|
|
map.put("sex", sex);
|
|
|
map.put("create_time", createTime);
|
|
|
map.put("description", description);
|
|
|
map.put("start_message_id", startId);
|
|
|
map.put("end_message_id", endId);
|
|
|
|
|
|
list.add(map);
|
|
|
}
|
|
|
return write(200, "查询成功", "data", list);
|
|
@ -90,11 +108,11 @@ public class imController extends BaseController {
|
|
|
for (Map<String, Object> doc : doctors) {
|
|
|
Map map = new HashMap();
|
|
|
String doctor = doc.get("code").toString();
|
|
|
map.put("photo", doc.get("photo").toString());
|
|
|
map.put("photo", doc.get("photo")==null?"":doc.get("photo").toString());
|
|
|
map.put("name", doc.get("name").toString());
|
|
|
map.put("sex", doc.get("sex").toString());
|
|
|
map.put("doctor", doctor);
|
|
|
// map.put("code", "ec6714314d6d48a6bfcf1e9119187e02");
|
|
|
map.put("type",doc.get("level")==null?"":doc.get("level").toString());
|
|
|
String totalUnReply = ImUtill.getConsultData(doctor, 0, 0);
|
|
|
int unReply = Integer.parseInt(totalUnReply);
|
|
|
map.put("totalUnReply", unReply);
|
|
@ -114,36 +132,12 @@ public class imController extends BaseController {
|
|
|
json.put("totalReply", countReply);
|
|
|
json.put("totalConsult", countConsult);
|
|
|
json.put("doctors", list);
|
|
|
return write(200, "查询成功");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取团队内医生的健康咨询状况
|
|
|
*
|
|
|
* @param code
|
|
|
* @param type 0待回复 1进行中 2已完成
|
|
|
* @return
|
|
|
*//*
|
|
|
@RequestMapping(value = "/getTeamDoctor", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public String getTeamDoctor(@RequestParam String code,
|
|
|
@RequestParam int type,
|
|
|
@RequestParam int pageNo,
|
|
|
@RequestParam int pageSize) {
|
|
|
try {
|
|
|
// List list = consultTeamService.getTeamDoctor(code, type);
|
|
|
// return write(200, "查询成功", "data", list);
|
|
|
return write(200, "查询成功");
|
|
|
return write(200, "查询成功", "data", json);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
/**/
|
|
|
|
|
|
/**
|
|
|
* 获取团队医生下居民的咨询
|
|
@ -158,11 +152,9 @@ public class imController extends BaseController {
|
|
|
// 1.调im接口
|
|
|
// 2.判断团队长和当前咨询居民是否存在签约关系
|
|
|
String doctor = getUID();
|
|
|
// Boolean flag = consultTeamService.getConsultByPatient(patient,doctor);
|
|
|
int count = signFamilyDao.findByPatientAndDoctor(patient,doctor);
|
|
|
boolean flag = (count ==0)? false : true;
|
|
|
return write(200, "查询成功", "data", flag);
|
|
|
// return write(200, "查询成功");
|
|
|
int count = signFamilyDao.findByPatientAndDoctor(patient, doctor);
|
|
|
boolean flag = (count == 0) ? false : true;
|
|
|
return write(200, "查询成功", "data", flag);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "查询失败!");
|
|
@ -170,8 +162,7 @@ public class imController extends BaseController {
|
|
|
}
|
|
|
|
|
|
public List getMemberByDoctor(String doctor) {
|
|
|
// List<Doctor> doctors = doctorDao.findMemberByLeader(doctor);
|
|
|
String sql = "SELECT d.photo,d.`name`,d.sex,d.`code` " +
|
|
|
String sql = "SELECT d.photo,d.`name`,d.sex,d.`code`,d.level " +
|
|
|
" from wlyy_admin_team t,wlyy_admin_team_member m,wlyy_doctor d " +
|
|
|
" where t.id = m.team_id and m.doctor_code = d.`code` and t.available = 1 and m.available=1 " +
|
|
|
" and t.leader_code = ? ";
|