|
@ -10,6 +10,7 @@ import com.yihu.wlyy.service.app.consult.ConsultService;
|
|
|
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
|
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
|
import com.yihu.wlyy.service.app.talk.TalkGroupService;
|
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.util.MessageType;
|
|
@ -65,7 +66,6 @@ public class DoctorConsultController extends WeixinBaseController {
|
|
|
private ConsultService consultService;
|
|
|
@Autowired
|
|
|
private TalkGroupService talkGroupService;
|
|
|
|
|
|
/**
|
|
|
* 三师咨询列表查询
|
|
|
*
|
|
@ -757,4 +757,121 @@ public class DoctorConsultController extends WeixinBaseController {
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 医生求助添加接口
|
|
|
*
|
|
|
* @param when 发病时间
|
|
|
* @param symptoms 主要症状
|
|
|
* @param groupCode 从哪个讨论组发起的求助
|
|
|
* @param images 图片URL地址,多图以逗号分隔
|
|
|
* @param voice 语音URL地址
|
|
|
* @param doctorCode 名医的code
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "forHelpAdd")
|
|
|
@ResponseBody
|
|
|
public String forHelpAdd(
|
|
|
@RequestParam(required = false) String when,
|
|
|
String symptoms,
|
|
|
@RequestParam(required = false) String oldConsultCode,
|
|
|
@RequestParam(required = false) String groupCode,
|
|
|
@RequestParam(required = false) String doctorCode,
|
|
|
@RequestParam(required = false) String images,
|
|
|
@RequestParam(required = false) String voice) {
|
|
|
try {
|
|
|
//判断医生是否是在工作时间
|
|
|
/*JSONObject jo = doctorWorkTimeService.isFamousDoctorWorking(doctorCode);
|
|
|
if (!jo.get("status").equals("1")) {
|
|
|
return error(-1, jo.get("msg").toString());
|
|
|
}*/
|
|
|
if (StringUtils.isEmpty(images)) {
|
|
|
images = fetchWxImages();
|
|
|
// 将临时图片拷贝到正式存储路径下
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
images = CommonUtil.copyTempImage(images);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isEmpty(voice)) {
|
|
|
voice = fetchWxVoices();
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(voice)) {
|
|
|
voice = CommonUtil.copyTempVoice(voice);
|
|
|
}
|
|
|
//判断是否已经存在还没有关闭的名医咨询
|
|
|
// if(consultTeamService.isExistFamousConsult(getUID())){
|
|
|
// return error(-1, "已经存在名医咨询!");
|
|
|
// }
|
|
|
ConsultTeam consult = new ConsultTeam();
|
|
|
// 设置咨询类型:1三师咨询,2家庭医生咨询 6.患者发起名医咨询 7医生发起的名医咨询 10医生发起的求助
|
|
|
consult.setType(10);
|
|
|
// 设置来源(从哪个讨论组发起的求助)
|
|
|
consult.setTeam(groupCode);
|
|
|
// 设置发病时间
|
|
|
consult.setWhen(when);
|
|
|
// 设置主要症状
|
|
|
consult.setSymptoms(symptoms);
|
|
|
// 设置咨询图片URL
|
|
|
consult.setImages(images);
|
|
|
// 设置咨询语音URL
|
|
|
consult.setVoice(voice);
|
|
|
consult.setDoctor(doctorCode);//设置专科医生
|
|
|
// 保存到数据库
|
|
|
if(consultTeamService.isCommonTeam( doctorCode, getUID() ))
|
|
|
consultTeamService.sendForHelpMsg( consult, getUID(), oldConsultCode );
|
|
|
else
|
|
|
consultTeamService.addForHelpTeamConsult( consult, getUID(), oldConsultCode );
|
|
|
|
|
|
// 推送消息给医生
|
|
|
/*PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_DOCTOR.D_CT_04.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_DOCTOR.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_DOCTOR.您有新的名医咨询.name(), consult.getConsult());
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
String[] arr = images.split(",");
|
|
|
for (String img : arr) {
|
|
|
PushMsgTask.getInstance().put(consult.getDoctor(), "2", MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_DOCTOR.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_DOCTOR.您有新的名医咨询.name(), img);
|
|
|
}
|
|
|
}*/
|
|
|
return success("提交成功");
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return invalidUserException(ex, -1, "提交失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "hasUnfinished")
|
|
|
@ResponseBody
|
|
|
public String hasUnfinished(String doctorCode) {
|
|
|
try {
|
|
|
String curDoc = getUID();
|
|
|
JSONObject json = new JSONObject();
|
|
|
if(consultTeamService.isCommonTeam(doctorCode, curDoc)){
|
|
|
json.put("isCommonTeam", 1);
|
|
|
return write(200, "查询成功", "data", json);
|
|
|
}
|
|
|
|
|
|
List<ConsultTeam> ls = consultTeamService.hasUnfinished(doctorCode, curDoc);
|
|
|
if(ls!=null && ls.size() > 0){
|
|
|
ConsultTeam ct = ls.get(0);
|
|
|
json.put("consult", ct.getConsult());
|
|
|
//是否是医生求助医生
|
|
|
if(ct.getType()==10){
|
|
|
List<WlyyTalkGroup> wlyyTalkGroups = talkGroupService.findAllConsultTalkGroup(ct.getTeam());
|
|
|
if(wlyyTalkGroups!=null && wlyyTalkGroups.size()>0){
|
|
|
for (WlyyTalkGroup g : wlyyTalkGroups){
|
|
|
if(g.getType()==1){
|
|
|
json.put("zxGroupCode", g.getCode());
|
|
|
json.put("from", ct.getPatient());
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return write(200, "查询成功", "data", json);
|
|
|
} catch (Exception ex) {
|
|
|
error(ex);
|
|
|
return invalidUserException(ex, -1, "提交失败!");
|
|
|
}
|
|
|
}
|
|
|
}
|