|
@ -1,11 +1,13 @@
|
|
|
package com.yihu.wlyy.web.patient.consult;
|
|
|
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeam;
|
|
|
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
@ -75,6 +77,8 @@ public class ConsultController extends WeixinBaseController {
|
|
|
private ImUtill ImUtill;
|
|
|
@Autowired
|
|
|
private HttpUtil httpUtil;
|
|
|
@Autowired
|
|
|
private ConsultTeamDao consultTeamDao;
|
|
|
|
|
|
/**
|
|
|
* 患者咨询记录查询
|
|
@ -132,52 +136,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
@RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("获取续方咨询列表")
|
|
|
public String getPreConsultList(@RequestParam(required = false) String title,
|
|
|
@RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
// Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
|
|
|
Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
|
|
|
if (data != null) {
|
|
|
for (Object consult : data.getContent()) {
|
|
|
if (consult == null) {
|
|
|
continue;
|
|
|
}
|
|
|
Object[] result = (Object[]) consult;
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", result[0]);
|
|
|
// 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈,8 续方咨询
|
|
|
json.put("type", result[1]);
|
|
|
// 设置咨询标识
|
|
|
json.put("code", result[2]);
|
|
|
// 设置显示标题
|
|
|
json.put("title", result[3]);
|
|
|
// 设置主诉
|
|
|
json.put("symptoms", result[4]);
|
|
|
// 咨询状态
|
|
|
json.put("status", result[6]);
|
|
|
// 设置咨询日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
|
|
|
// 咨询状态
|
|
|
json.put("doctorCode", result[7]);
|
|
|
json.put("evaluate", result[8]);
|
|
|
String relationCode = result[9]==null?"":result[9].toString();
|
|
|
json.put("prescriptionCode",relationCode);//续方code
|
|
|
json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(relationCode));//续方疾病类型
|
|
|
json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(relationCode));//续方药品信息
|
|
|
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 获取医生的排班时间
|
|
|
*
|
|
@ -314,73 +273,6 @@ public class ConsultController extends WeixinBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@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 = "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,"添加失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 三师咨询添加接口
|
|
@ -710,6 +602,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "cancel")
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String cancel(String consult) {
|
|
|
try {
|
|
|
int row = consultTeamService.cancel(consult);
|
|
@ -732,11 +625,14 @@ public class ConsultController extends WeixinBaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "finish")
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String finish(@RequestParam(required = true) String code) {
|
|
|
try {
|
|
|
int row = consultTeamService.finishConsult(code, getRepUID(), 1);
|
|
|
if (row > 0) {
|
|
|
return success("操作成功!");
|
|
|
}else if(row==-2){
|
|
|
return error(-1, "续方未审核,不能结束续方咨询!");
|
|
|
} else {
|
|
|
return error(-1, "操作失败!");
|
|
|
}
|
|
@ -757,6 +653,7 @@ public class ConsultController extends WeixinBaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "append")
|
|
|
@ResponseBody
|
|
|
@ObserverRequired
|
|
|
public String append(@RequestParam String consult, @RequestParam String content, @RequestParam int type, @RequestParam(required = false, defaultValue = "0") Integer times) {
|
|
|
try {
|
|
|
List<ConsultTeamLog> logs = new ArrayList<ConsultTeamLog>();
|
|
@ -987,7 +884,12 @@ public class ConsultController extends WeixinBaseController {
|
|
|
JSONArray array = doctorCommentService.consultComment(getRepUID(), consult, content, star, 2);
|
|
|
// 添加到统计队列
|
|
|
if (array != null) {
|
|
|
DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
|
|
|
//新增判断 续方咨询暂不统计
|
|
|
ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
|
|
|
if(consultTeam.getType()!=8){
|
|
|
DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
|
|
|
}
|
|
|
// DoctorStatisticsTask.getInstance(doctorStatisticsService).put(array);
|
|
|
}
|
|
|
// 添加评价记录
|
|
|
ConsultTeamLog log = new ConsultTeamLog();
|
|
@ -1024,4 +926,124 @@ public class ConsultController extends WeixinBaseController {
|
|
|
return error(-1,e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/*===========================================续方咨询==============================================================*/
|
|
|
|
|
|
@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 = "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,"添加失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("获取续方咨询列表")
|
|
|
public String getPreConsultList(@RequestParam(required = false) String title,
|
|
|
@RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
|
|
|
try {
|
|
|
JSONArray array = new JSONArray();
|
|
|
Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
|
|
|
// Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
|
|
|
if (data != null) {
|
|
|
for (Object consult : data.getContent()) {
|
|
|
if (consult == null) {
|
|
|
continue;
|
|
|
}
|
|
|
Object[] result = (Object[]) consult;
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", result[0]);
|
|
|
// 设置咨询类型:1三师咨询,2视频咨询,3图文咨询,4公共咨询,5病友圈,8 续方咨询
|
|
|
json.put("type", result[1]);
|
|
|
// 设置咨询标识
|
|
|
json.put("code", result[2]);
|
|
|
// 设置显示标题
|
|
|
json.put("title", result[3]);
|
|
|
// 设置主诉
|
|
|
json.put("symptoms", result[4]);
|
|
|
// 咨询状态
|
|
|
json.put("status", result[6]);
|
|
|
// 设置咨询日期
|
|
|
json.put("czrq", DateUtil.dateToStrLong((Date) result[5]));
|
|
|
// 咨询状态
|
|
|
json.put("doctorCode", result[7]);
|
|
|
json.put("evaluate", result[8]);
|
|
|
String relationCode = result[9]==null?"":result[9].toString();
|
|
|
json.put("prescriptionCode",relationCode);//续方code
|
|
|
json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(relationCode));//续方疾病类型
|
|
|
json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(relationCode));//续方药品信息
|
|
|
|
|
|
array.put(json);
|
|
|
}
|
|
|
}
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "查询失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|