|
@ -54,16 +54,20 @@ public class ConsultController extends WeixinBaseController {
|
|
|
|
|
|
/**
|
|
|
* 患者咨询记录查询
|
|
|
* @param title 咨询标题
|
|
|
* @param id
|
|
|
* @param pagesize 分页大小
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "records")
|
|
|
@ResponseBody
|
|
|
public String consultRecords(long id, int pagesize) {
|
|
|
public String consultRecords(
|
|
|
@RequestParam(required = false) String title,
|
|
|
long id,
|
|
|
int pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Object> data = consultTeamService.findConsultRecordByPatient(getUID(), id, pagesize);
|
|
|
Page<Object> data = consultTeamService.findConsultRecordByPatient(getUID(), id, pagesize,title);
|
|
|
if (data != null) {
|
|
|
for (Object consult : data.getContent()) {
|
|
|
if (consult == null) {
|
|
@ -228,7 +232,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
voice = CommonUtil.copyTempVoice(voice);
|
|
|
}
|
|
|
ConsultTeam consult = new ConsultTeam();
|
|
|
// 设置咨询类型:1三师咨询,2家庭医生咨询
|
|
|
// 设置咨询类型:1三师咨询,2家庭医生咨询 6.名医咨询
|
|
|
consult.setType(type);
|
|
|
// 设置发病时间
|
|
|
consult.setWhen(when);
|
|
@ -256,7 +260,12 @@ public class ConsultController extends WeixinBaseController {
|
|
|
DoctorStatisticsTask.getInstance(doctorStatisticsService).put(consult.getDoctor(), 1, 1, 0);
|
|
|
}
|
|
|
// 推送消息给医生
|
|
|
PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
|
|
|
if(type==6){
|
|
|
// 推送消息给医生
|
|
|
PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.您有新的名医咨询.name(), consult.getConsult());
|
|
|
}else{
|
|
|
PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
|
|
|
}
|
|
|
return success("提交成功");
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
@ -282,6 +291,16 @@ public class ConsultController extends WeixinBaseController {
|
|
|
@RequestParam(required = false) String images,
|
|
|
@RequestParam(required = false) String voice) {
|
|
|
try {
|
|
|
//判断医生是否是在工作时间
|
|
|
JSONObject jo=doctorWorkTimeService.isDoctorWorking(doctorCode);
|
|
|
if(!jo.get("status").equals("1")){
|
|
|
return error(-1, jo.get("msg").toString());
|
|
|
}
|
|
|
//判断医生是否剩下咨询次数
|
|
|
int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctorCode);
|
|
|
if(result==0){
|
|
|
return error(-1, "没有次数");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(images)) {
|
|
|
images = fetchWxImages();
|
|
|
}
|
|
@ -300,8 +319,8 @@ public class ConsultController extends WeixinBaseController {
|
|
|
return error(-1, "已经存在名医咨询!");
|
|
|
}
|
|
|
ConsultTeam consult = new ConsultTeam();
|
|
|
// 设置咨询类型:1三师咨询,2家庭医生咨询 3.名医咨询
|
|
|
consult.setType(3);
|
|
|
// 设置咨询类型:1三师咨询,2家庭医生咨询 6.名医咨询
|
|
|
consult.setType(6);
|
|
|
// 设置发病时间
|
|
|
consult.setWhen(when);
|
|
|
// 设置主要症状
|
|
@ -313,7 +332,8 @@ public class ConsultController extends WeixinBaseController {
|
|
|
consult.setDoctor(doctorCode);//设置专科医生
|
|
|
// 保存到数据库
|
|
|
consultTeamService.addFamousTeamConsult(consult, getUID());
|
|
|
|
|
|
//名医咨询次数减一
|
|
|
doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
|
|
|
// 推送消息给医生
|
|
|
PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.您有新的名医咨询.name(), consult.getConsult());
|
|
|
return success("提交成功");
|
|
@ -323,7 +343,104 @@ public class ConsultController extends WeixinBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 名医列表
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "famousDoctorList")
|
|
|
@ResponseBody
|
|
|
public String famousDoctorList(
|
|
|
@RequestParam(required = false) String name,
|
|
|
long id,
|
|
|
int pagesize) {
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Doctor>list = doctorService.famousDoctorList(name, id, pagesize);
|
|
|
if (list != null) {
|
|
|
for (Doctor doctor : list) {
|
|
|
if (doctor == null) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", doctor.getId());
|
|
|
// 医生标识
|
|
|
json.put("code", doctor.getCode());
|
|
|
// 医生姓名
|
|
|
json.put("name", doctor.getName());
|
|
|
// 所在医院名称
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
// 所在医院名称
|
|
|
json.put("hospital_name", doctor.getHosptialName());
|
|
|
// 科室名称
|
|
|
json.put("dept_name", (doctor.getDeptName() == null ||
|
|
|
StringUtils.isEmpty(doctor.getDeptName().toString())) ? " " : doctor.getDeptName());
|
|
|
// 职称名称
|
|
|
json.put("job_name", (doctor.getJobName() == null ||
|
|
|
StringUtils.isEmpty(doctor.getJobName().toString())) ? " " : doctor.getJobName());
|
|
|
// 头像
|
|
|
json.put("photo", doctor.getPhoto());
|
|
|
// 简介
|
|
|
json.put("introduce", doctor.getIntroduce());
|
|
|
// 专长
|
|
|
json.put("expertise", doctor.getExpertise());
|
|
|
// 剩余咨询次数
|
|
|
json.put("num", doctorWorkTimeService.getDoctorConsultTimesRemain(doctor.getCode()));
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "获取医院医生列表成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "获取医院医生列表失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 名医主页
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "famousDoctorPage")
|
|
|
@ResponseBody
|
|
|
public String famousDoctorPage(
|
|
|
String doctorCode) {
|
|
|
try {
|
|
|
Doctor temp = doctorService.findDoctorByCode(doctorCode);
|
|
|
if (temp != null) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
// 设置医生手机号码
|
|
|
json.put("mobile", temp.getMobile());
|
|
|
// 设置医生标识
|
|
|
json.put("code", temp.getCode());
|
|
|
// 设置医生姓名
|
|
|
json.put("name", temp.getName());
|
|
|
// 设置医生头像
|
|
|
json.put("photo", CommonUtil.getPhoneUrl(temp.getPhoto()));
|
|
|
// 设置医生性别
|
|
|
json.put("sex", temp.getSex());
|
|
|
// 设置省名称
|
|
|
json.put("provinceName", temp.getProvinceName());
|
|
|
// 设置城市名称
|
|
|
json.put("cityName", temp.getCityName());
|
|
|
// 设置医院名称
|
|
|
json.put("hospitalName", temp.getHosptialName());
|
|
|
// 设置部门名称
|
|
|
json.put("deptName", StringUtils.isNotEmpty(temp.getDeptName()) ? temp.getDeptName() : "");
|
|
|
// 设置职称
|
|
|
json.put("jobName", StringUtils.isNotEmpty(temp.getJobName()) ? temp.getJobName() : "");
|
|
|
// 设置医生专长
|
|
|
json.put("expertise", StringUtils.isNotEmpty(temp.getExpertise()) ? temp.getExpertise() : "");
|
|
|
// 设置医生简介
|
|
|
json.put("introduce", StringUtils.isNotEmpty(temp.getIntroduce()) ? temp.getIntroduce() : "");
|
|
|
//doctorWorkTimeService.findDoctorWeekWorkTime()
|
|
|
return write(200, "医生信息查询成功!", "data", json);
|
|
|
} else {
|
|
|
return error(-1, "医生信息查询失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "医生信息查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "status")
|
|
|
@ResponseBody
|