|
@ -4,8 +4,11 @@ import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
|
|
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
|
|
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
|
|
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
|
|
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
|
|
@ -18,6 +21,7 @@ import com.yihu.wlyy.util.*;
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@ -57,20 +61,18 @@ public class ConsultController extends WeixinBaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
@Autowired
|
|
@Autowired
|
|
private PatientDao patientDao;
|
|
|
|
|
|
private PatientDao patientDao;
|
|
@Autowired
|
|
@Autowired
|
|
private CommonUtil CommonUtil;
|
|
private CommonUtil CommonUtil;
|
|
@Autowired
|
|
@Autowired
|
|
private ImUtill ImUtill;
|
|
private ImUtill ImUtill;
|
|
@Autowired
|
|
@Autowired
|
|
private HttpUtil httpUtil; @Autowired
|
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
|
@Autowired
|
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
private HttpUtil httpUtil;
|
|
@Autowired
|
|
@Autowired
|
|
private SignFamilyDao signFamilyDao;
|
|
private SignFamilyDao signFamilyDao;
|
|
@Autowired
|
|
@Autowired
|
|
private DoctorDao doctorDao;
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 患者咨询记录查询
|
|
* 患者咨询记录查询
|
|
*
|
|
*
|
|
@ -263,14 +265,15 @@ public class ConsultController extends WeixinBaseController {
|
|
return error(-1, "查询失败");
|
|
return error(-1, "查询失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "isPrescriptionConsult", method = RequestMethod.GET)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ApiOperation("是否可以续方咨询")
|
|
@ApiOperation("是否可以续方咨询")
|
|
public String isPrescriptConsult(String patient){
|
|
|
|
try{
|
|
|
|
|
|
public String isPrescriptConsult(String patient) {
|
|
|
|
try {
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
if(signFamily==null){
|
|
|
|
return error(-1,"您还未签约,不能发起续方咨询!");
|
|
|
|
|
|
if (signFamily == null) {
|
|
|
|
return error(-1, "您还未签约,不能发起续方咨询!");
|
|
}
|
|
}
|
|
|
|
|
|
//点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
|
|
//点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
|
|
@ -278,21 +281,21 @@ public class ConsultController extends WeixinBaseController {
|
|
|
|
|
|
Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
|
|
Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
json.put("doctor",doctor.getCode());
|
|
|
|
json.put("doctorName",doctor.getName());
|
|
|
|
json.put("adminTeamId",signFamily.getAdminTeamId());
|
|
|
|
json.put("hospital",doctor.getHospital());
|
|
|
|
json.put("hospitalName",doctor.getHospitalName());
|
|
|
|
|
|
json.put("doctor", doctor.getCode());
|
|
|
|
json.put("doctorName", doctor.getName());
|
|
|
|
json.put("adminTeamId", signFamily.getAdminTeamId());
|
|
|
|
json.put("hospital", doctor.getHospital());
|
|
|
|
json.put("hospitalName", doctor.getHospitalName());
|
|
|
|
|
|
return write(200, "查询成功!", "data", json);
|
|
return write(200, "查询成功!", "data", json);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
return error(-1,"查询失败");
|
|
|
|
|
|
return error(-1, "查询失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
|
|
|
|
|
|
@RequestMapping(value = "addPrescriptionConsult", method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ApiOperation("添加续方咨询")
|
|
@ApiOperation("添加续方咨询")
|
|
public String addPrescriptionConsult(@ApiParam(name = "patient", value = "居民code", defaultValue = "1")
|
|
public String addPrescriptionConsult(@ApiParam(name = "patient", value = "居民code", defaultValue = "1")
|
|
@ -304,14 +307,14 @@ public class ConsultController extends WeixinBaseController {
|
|
@ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
|
|
@ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
|
|
@RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
|
|
@RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
|
|
@ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
|
|
@ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
|
|
@RequestParam(value = "reason", required = false) String reason){
|
|
|
|
try{
|
|
|
|
|
|
@RequestParam(value = "reason", required = false) String reason) {
|
|
|
|
try {
|
|
ConsultTeam consult = new ConsultTeam();
|
|
ConsultTeam consult = new ConsultTeam();
|
|
consult.setType(8);//续方咨询
|
|
consult.setType(8);//续方咨询
|
|
consult.setAdminTeamId(adminTeamId);
|
|
consult.setAdminTeamId(adminTeamId);
|
|
// 保存到数据库
|
|
// 保存到数据库
|
|
int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
|
|
|
|
// int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
|
|
|
|
|
|
// int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f", "a663d0cf7f8c4d38a8327cedc921e65f", doctor, consult, reason);
|
|
|
|
int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(), getUID(), doctor, consult, reason);
|
|
if (res == -1) {
|
|
if (res == -1) {
|
|
return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
|
|
return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
|
|
}
|
|
}
|
|
@ -327,9 +330,9 @@ public class ConsultController extends WeixinBaseController {
|
|
BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
|
|
BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
|
|
return write(200, "提交成功", "data", consult);
|
|
return write(200, "提交成功", "data", consult);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
return error(-1,"添加失败");
|
|
|
|
|
|
return error(-1, "添加失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -352,8 +355,8 @@ public class ConsultController extends WeixinBaseController {
|
|
@RequestParam(required = false) String voice,
|
|
@RequestParam(required = false) String voice,
|
|
@RequestParam(required = false) Long guidance) {
|
|
@RequestParam(required = false) Long guidance) {
|
|
try {
|
|
try {
|
|
System.out.println("guidance1="+guidance);
|
|
|
|
System.out.println("symptoms="+symptoms);
|
|
|
|
|
|
System.out.println("guidance1=" + guidance);
|
|
|
|
System.out.println("symptoms=" + symptoms);
|
|
if (type == null) {
|
|
if (type == null) {
|
|
type = 1;
|
|
type = 1;
|
|
}
|
|
}
|
|
@ -397,9 +400,9 @@ public class ConsultController extends WeixinBaseController {
|
|
consult.setGuidance(guidance);
|
|
consult.setGuidance(guidance);
|
|
}
|
|
}
|
|
|
|
|
|
System.out.println("guidance2="+guidance);
|
|
|
|
|
|
System.out.println("guidance2=" + guidance);
|
|
// 保存到数据库
|
|
// 保存到数据库
|
|
int res = consultTeamService.addTeamConsult(consult, getRepUID(),getUID());
|
|
|
|
|
|
int res = consultTeamService.addTeamConsult(consult, getRepUID(), getUID());
|
|
if (res == -1) {
|
|
if (res == -1) {
|
|
return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
|
|
return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
|
|
} else if (res == -2) {
|
|
} else if (res == -2) {
|
|
@ -428,23 +431,23 @@ public class ConsultController extends WeixinBaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "intoTopic",method = RequestMethod.POST)
|
|
|
|
|
|
@RequestMapping(value = "intoTopic", method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@ApiOperation("进入咨询")
|
|
@ApiOperation("进入咨询")
|
|
public String intoTopic(@RequestParam(required = true) String consult){
|
|
|
|
try{
|
|
|
|
int result = consultTeamService.intoTopic(consult,getRepUID(),getUID());
|
|
|
|
if(result==-1){
|
|
|
|
return error(-1,"该咨询不是进行中");
|
|
|
|
|
|
public String intoTopic(@RequestParam(required = true) String consult) {
|
|
|
|
try {
|
|
|
|
int result = consultTeamService.intoTopic(consult, getRepUID(), getUID());
|
|
|
|
if (result == -1) {
|
|
|
|
return error(-1, "该咨询不是进行中");
|
|
}
|
|
}
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
json.put("consult",consult);
|
|
|
|
json.put("content","进入咨询");
|
|
|
|
|
|
json.put("consult", consult);
|
|
|
|
json.put("content", "进入咨询");
|
|
BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getRepUID(), json);
|
|
BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getRepUID(), json);
|
|
return success("进入成功");
|
|
return success("进入成功");
|
|
}catch (Exception e){
|
|
|
|
|
|
} catch (Exception e) {
|
|
error(e);
|
|
error(e);
|
|
return error(-1,"请求失败");
|
|
|
|
|
|
return error(-1, "请求失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@ -507,9 +510,9 @@ public class ConsultController extends WeixinBaseController {
|
|
consult.setVoice(voice);
|
|
consult.setVoice(voice);
|
|
consult.setDoctor(doctorCode);//设置专科医生
|
|
consult.setDoctor(doctorCode);//设置专科医生
|
|
// 保存到数据库
|
|
// 保存到数据库
|
|
JSONObject object = consultTeamService.famousConsult(consult, getRepUID(), "1",getUID());
|
|
|
|
JSONObject resultConsult = new JSONObject(consult);
|
|
|
|
resultConsult.put("session_id",object.getString("session_id"));
|
|
|
|
|
|
JSONObject object = consultTeamService.famousConsult(consult, getRepUID(), "1", getUID());
|
|
|
|
JSONObject resultConsult = new JSONObject(consult);
|
|
|
|
resultConsult.put("session_id", object.getString("session_id"));
|
|
//名医咨询次数减一
|
|
//名医咨询次数减一
|
|
doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
|
|
doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
|
|
// 推送消息给医生
|
|
// 推送消息给医生
|
|
@ -775,10 +778,10 @@ public class ConsultController extends WeixinBaseController {
|
|
int i = 0;
|
|
int i = 0;
|
|
List<String> failed = new ArrayList<>();
|
|
List<String> failed = new ArrayList<>();
|
|
|
|
|
|
String agent = getUID()==getRepUID()?null:getUID();
|
|
|
|
|
|
String agent = getUID() == getRepUID() ? null : getUID();
|
|
for (ConsultTeamLog log : logs) {
|
|
for (ConsultTeamLog log : logs) {
|
|
// String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
|
|
// String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
|
|
String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),agent);
|
|
|
|
|
|
String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(), agent);
|
|
if (StringUtils.isNotEmpty(response)) {
|
|
if (StringUtils.isNotEmpty(response)) {
|
|
JSONObject resObj = new JSONObject(response);
|
|
JSONObject resObj = new JSONObject(response);
|
|
if (resObj.getInt("status") == -1) {
|
|
if (resObj.getInt("status") == -1) {
|
|
@ -813,7 +816,7 @@ public class ConsultController extends WeixinBaseController {
|
|
JSONObject messageObj = ImUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getRepUID());
|
|
JSONObject messageObj = ImUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getRepUID());
|
|
|
|
|
|
//过滤续签
|
|
//过滤续签
|
|
consultTeamService.removeRenewPerson(messageObj,getRepUID());
|
|
|
|
|
|
consultTeamService.removeRenewPerson(messageObj, getRepUID());
|
|
|
|
|
|
return write(200, "查询成功", "list", messageObj);
|
|
return write(200, "查询成功", "list", messageObj);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@ -830,7 +833,7 @@ public class ConsultController extends WeixinBaseController {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "logs")
|
|
@RequestMapping(value = "logs")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String logs(@RequestParam String sessionId,@RequestParam(required = false) String startMsgId,@RequestParam(required = false) String endMsgId, @RequestParam int page, @RequestParam int pagesize) {
|
|
|
|
|
|
public String logs(@RequestParam String sessionId, @RequestParam(required = false) String startMsgId, @RequestParam(required = false) String endMsgId, @RequestParam int page, @RequestParam int pagesize) {
|
|
try {
|
|
try {
|
|
JSONArray messageArray = ImUtill.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getRepUID());
|
|
JSONArray messageArray = ImUtill.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getRepUID());
|
|
return write(200, "查询成功", "list", messageArray);
|
|
return write(200, "查询成功", "list", messageArray);
|
|
@ -847,7 +850,7 @@ public class ConsultController extends WeixinBaseController {
|
|
JSONArray participants = ImUtill.getSessions(sessionId);
|
|
JSONArray participants = ImUtill.getSessions(sessionId);
|
|
|
|
|
|
//过滤续签
|
|
//过滤续签
|
|
consultTeamService.removeRenewPerson(participants,getRepUID());
|
|
|
|
|
|
consultTeamService.removeRenewPerson(participants, getRepUID());
|
|
|
|
|
|
return write(200, "查询成功", "list", participants);
|
|
return write(200, "查询成功", "list", participants);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@ -874,7 +877,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
+ "api/v1/chats/message";
|
|
+ "api/v1/chats/message";
|
|
String reG = HttpUtil.sendGet(url, "id=" + logId + "&type=" + msgType);
|
|
|
|
|
|
String reG = httpUtil.sendGet(url, "id=" + logId + "&type=" + msgType);
|
|
JSONObject obj = null;
|
|
JSONObject obj = null;
|
|
if (!org.springframework.util.StringUtils.isEmpty(reG)) {
|
|
if (!org.springframework.util.StringUtils.isEmpty(reG)) {
|
|
obj = new JSONObject(new String(reG.getBytes(), "utf-8"));
|
|
obj = new JSONObject(new String(reG.getBytes(), "utf-8"));
|
|
@ -958,21 +961,22 @@ public class ConsultController extends WeixinBaseController {
|
|
|
|
|
|
@RequestMapping(value = "getTopic")
|
|
@RequestMapping(value = "getTopic")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String getTopic(String consult){
|
|
|
|
try{
|
|
|
|
|
|
public String getTopic(String consult) {
|
|
|
|
try {
|
|
return success(ImUtill.getTopic(consult).get("data").toString());
|
|
return success(ImUtill.getTopic(consult).get("data").toString());
|
|
}catch (Exception e){
|
|
|
|
return error(-1,e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
return error(-1, e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "getConsult")
|
|
@RequestMapping(value = "getConsult")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
public String getConsult(String consult){
|
|
|
|
try{
|
|
|
|
|
|
public String getConsult(String consult) {
|
|
|
|
try {
|
|
ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
|
|
ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
|
|
return write(200, "查询成功", "data", consultTeam);
|
|
return write(200, "查询成功", "data", consultTeam);
|
|
}catch (Exception e){
|
|
|
|
return error(-1,e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
return error(-1, e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|