|
@ -22,7 +22,6 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@ -58,14 +57,16 @@ public class ConsultController extends WeixinBaseController {
|
|
|
@Autowired
|
|
|
private DoctorWorkTimeService doctorWorkTimeService;
|
|
|
@Autowired
|
|
|
PatientDao patientDao;
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private CommonUtil CommonUtil;
|
|
|
@Autowired
|
|
|
private ImUtill ImUtill;
|
|
|
@Autowired
|
|
|
private HttpUtil httpUtil;
|
|
|
|
|
|
private HttpUtil httpUtil; @Autowired
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
@Autowired
|
|
|
private DoctorDao doctorDao;
|
|
|
|
|
|
/**
|
|
|
* 患者咨询记录查询
|
|
@ -259,7 +260,75 @@ public class ConsultController extends WeixinBaseController {
|
|
|
return error(-1, "查询失败");
|
|
|
}
|
|
|
}
|
|
|
@RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("是否可以续方咨询")
|
|
|
public String isPrescriptConsult(String patient){
|
|
|
try{
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient);
|
|
|
if(signFamily==null){
|
|
|
return error(-1,"您还未签约,不能发起续方咨询!");
|
|
|
}
|
|
|
|
|
|
//点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
|
|
|
|
|
|
|
|
|
Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
|
|
|
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());
|
|
|
|
|
|
return write(200, "查询成功!", "data", json);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,"查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("添加续方咨询")
|
|
|
public String addPrescriptionConsult(@ApiParam(name = "patient", value = "居民code", defaultValue = "1")
|
|
|
@RequestParam(value = "patient", required = true) String patient,
|
|
|
@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
|
|
|
@RequestParam(value = "jwCode", required = true) String jwCode,
|
|
|
@ApiParam(name = "doctor", value = "咨询医生(开方医生、审核医生)", defaultValue = "86225d1365e711e69f7c005056850d66")
|
|
|
@RequestParam(value = "doctor", required = true) String doctor,
|
|
|
@ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
|
|
|
@RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
|
|
|
@ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
|
|
|
@RequestParam(value = "reason", required = false) String reason){
|
|
|
try{
|
|
|
ConsultTeam consult = new ConsultTeam();
|
|
|
consult.setType(8);//续方咨询
|
|
|
consult.setAdminTeamId(adminTeamId);
|
|
|
// 保存到数据库
|
|
|
int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
|
|
|
// int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
|
|
|
if (res == -1) {
|
|
|
return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
|
|
|
}
|
|
|
|
|
|
// Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());
|
|
|
// // 添加到统计队列
|
|
|
// if (consult.getType() == 2) {
|
|
|
// DoctorStatisticsTask.getInstance(doctorStatisticsService).put(consult.getDoctor(), 1, 1, 0);
|
|
|
// }
|
|
|
|
|
|
// 推送消息给医生
|
|
|
PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.续方咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM_PRESCRIPTION.您有新的续方咨询.name(), consult.getConsult());
|
|
|
BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
|
|
|
return write(200, "提交成功", "data", consult);
|
|
|
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1,"添加失败");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 三师咨询添加接口
|
|
|
*
|
|
@ -782,8 +851,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
return invalidUserException(e, -1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
@Value("${im.im_list_get}")
|
|
|
private String im_list_get;
|
|
|
|
|
|
/**
|
|
|
* 查找单个咨询记录
|
|
|
*
|
|
@ -800,9 +868,9 @@ public class ConsultController extends WeixinBaseController {
|
|
|
return error(-1, "咨询记录不存在!");
|
|
|
}
|
|
|
|
|
|
String url =im_list_get
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
|
|
|
+ "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;
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(reG)) {
|
|
|
obj = new JSONObject(new String(reG.getBytes(), "utf-8"));
|