|
@ -0,0 +1,543 @@
|
|
|
package com.yihu.jw.care.service.consult;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.im.ConsultDo;
|
|
|
import com.yihu.jw.entity.base.im.ConsultTeamDo;
|
|
|
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
|
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
|
|
|
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
|
|
|
import com.yihu.jw.im.dao.ConsultDao;
|
|
|
import com.yihu.jw.im.dao.ConsultTeamDao;
|
|
|
import com.yihu.jw.im.dao.ConsultTeamDoctorDao;
|
|
|
import com.yihu.jw.im.service.ImService;
|
|
|
import com.yihu.jw.im.util.ImUtil;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.sms.dao.HospitalSysDictDao;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import static jxl.biff.FormatRecord.logger;
|
|
|
|
|
|
/**
|
|
|
* Created with IntelliJ IDEA.
|
|
|
*
|
|
|
* @Author: yeshijie
|
|
|
* @Date: 2021/5/28
|
|
|
* @Description:
|
|
|
*/
|
|
|
@Service
|
|
|
public class ConsultService {
|
|
|
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private HospitalSysDictDao hospitalSysDictDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao baseDoctorDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
@Autowired
|
|
|
private ImUtil imUtil;
|
|
|
@Autowired
|
|
|
private ImService imService;
|
|
|
@Autowired
|
|
|
private ConsultTeamDao consultTeamDao;
|
|
|
@Autowired
|
|
|
private ConsultDao consultDao;
|
|
|
@Autowired
|
|
|
private ConsultTeamDoctorDao consultTeamDoctorDao;
|
|
|
@Autowired
|
|
|
private SystemMessageDao systemMessageDao;
|
|
|
@Autowired
|
|
|
private HibenateUtils hibenateUtils;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
|
|
|
|
/**
|
|
|
* 居民结束咨询
|
|
|
* @param consult 咨询CODE
|
|
|
* @param endOperator 操作人
|
|
|
* @param endType 1居民 2医生
|
|
|
* @return
|
|
|
*/
|
|
|
public int finish(String consult, String endOperator, int endType) {
|
|
|
|
|
|
ConsultTeamDo consultTeam = consultTeamDao.findByConsult(consult);
|
|
|
|
|
|
ConsultDo cons = consultDao.findOne(consult);
|
|
|
if (consultTeam.getStatus() == 1) {
|
|
|
return -1;
|
|
|
}
|
|
|
String endName = "";
|
|
|
String endId = "";
|
|
|
JSONObject obj = new JSONObject();
|
|
|
//结束咨询才发送推送给IM文字消息
|
|
|
if (endType == 1) {
|
|
|
BasePatientDO p = basePatientDao.findById(endOperator);
|
|
|
endName = p.getName();
|
|
|
endId = p.getId();
|
|
|
obj = imUtil.endTopics(consultTeam.getPatient(), endId, endName, consultTeam.getConsult());
|
|
|
} else {
|
|
|
BaseDoctorDO d = baseDoctorDao.findById(endOperator);
|
|
|
if (endOperator.equals("admin")) {
|
|
|
endId = "system";
|
|
|
endName = "超时,系统自动";
|
|
|
} else {
|
|
|
endId = d.getId();
|
|
|
endName = d.getName();
|
|
|
}
|
|
|
obj = imUtil.endTopics(consultTeam.getDoctor(), endId, endName, consultTeam.getConsult());
|
|
|
}
|
|
|
|
|
|
if (obj == null) {
|
|
|
throw new RuntimeException("IM消息结束异常!");
|
|
|
}
|
|
|
if (obj.getInteger("status") == -1) {
|
|
|
throw new RuntimeException(String.valueOf(null==obj.get("message")?"无失败信息":obj.get("message")));
|
|
|
}
|
|
|
|
|
|
consultTeam.setEndMsgId(obj.getString("id"));
|
|
|
cons.setEndTime(new Date());
|
|
|
consultTeam.setEndTime(new Date());
|
|
|
consultTeam.setStatus(1);
|
|
|
consultDao.save(cons);
|
|
|
consultTeamDao.save(consultTeam);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询患者所有的咨询记录
|
|
|
* @param patient 患者标识
|
|
|
* @param id 会话ID(等同IM表topicId)
|
|
|
* @param type 咨询会话类型
|
|
|
* @param pagesize 分页大小
|
|
|
* @param title 标题关键字
|
|
|
* @param status 状态
|
|
|
* @param doctorName 医生名字
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findConsultRecordByPatient(String patient, String id,String type, int page
|
|
|
,int pagesize, String title, String symptoms,Integer status,String doctorName) {
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
"a.id AS \"id\"," +
|
|
|
"a.type AS \"type\"," +
|
|
|
"a.title AS \"title\"," +
|
|
|
"a.symptoms AS \"symptoms\","+
|
|
|
"date_format(a.czrq,'%Y-%m-%d %H:%i:%S' ) AS \"czrq\","+
|
|
|
"b.status AS \"status\"," +
|
|
|
"b.evaluate AS \"evaluate\"," +
|
|
|
"d.name AS \"doctorName\"," +
|
|
|
"d.photo AS \"doctorphoto\"," +
|
|
|
"d.id AS \"doctorCode\"," +
|
|
|
"d.job_title_name AS \"jobTitleName\", " +
|
|
|
"h.dept_name AS \"deptName\", " +
|
|
|
"h.org_name AS \"hospitalName\", " +
|
|
|
"a.pay_status AS \"payStatus\", "+
|
|
|
"a.source AS \"source\" "+
|
|
|
"FROM wlyy_consult a," +
|
|
|
"wlyy_consult_team b," +
|
|
|
"base_doctor d, " +
|
|
|
"base_doctor_hospital h " +
|
|
|
"WHERE a.id=b.consult and d.id = h.doctor_code " +
|
|
|
"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+")";
|
|
|
|
|
|
if(!StringUtils.isEmpty(title)){
|
|
|
title="%"+title+"%";
|
|
|
sql +=" and a.title like '"+title+"'";
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(symptoms)){
|
|
|
symptoms="%"+symptoms+"%";
|
|
|
sql +=" and a.symptoms like '"+symptoms+"'";
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(doctorName)){
|
|
|
doctorName="%"+doctorName+"%";
|
|
|
sql +=" and d.name like '"+doctorName+"'";
|
|
|
}
|
|
|
|
|
|
//咨询状态
|
|
|
if(status != null && status != 0){
|
|
|
sql +=" and b.status ="+status;
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(id)) {
|
|
|
sql += " and a.id = '" + id + "'";
|
|
|
}
|
|
|
|
|
|
sql += " ORDER BY a.czrq desc ";
|
|
|
logger.info("sql="+sql);
|
|
|
List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询患者所有的咨询记录总数
|
|
|
* @param patient 患者标识
|
|
|
* @param id 会话ID(等同IM表topicId)
|
|
|
* @param type 咨询会话类型
|
|
|
* @param title 标题关键字
|
|
|
* @return
|
|
|
*/
|
|
|
public Long countConsultRecordByPatient(String patient, String id,String type, String title,String symptoms,String doctorName,Integer status) {
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
"FROM wlyy_consult a," +
|
|
|
"wlyy_consult_team b," +
|
|
|
"base_doctor d " +
|
|
|
"WHERE a.id=b.consult " +
|
|
|
"AND b.doctor=d.id AND a.patient='"+patient+"' AND a.type in ("+type+") ";
|
|
|
if(!StringUtils.isEmpty(title)){
|
|
|
title="%"+title+"%";
|
|
|
sql +=" and a.title like '"+title+"'";
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(symptoms)){
|
|
|
symptoms="%"+symptoms+"%";
|
|
|
sql +=" and a.symptoms like '"+symptoms+"'";
|
|
|
}
|
|
|
if(!StringUtils.isEmpty(doctorName)){
|
|
|
doctorName="%"+doctorName+"%";
|
|
|
sql +=" and d.name like '"+doctorName+"'";
|
|
|
}
|
|
|
|
|
|
//咨询状态
|
|
|
if(status != null && status != 0){
|
|
|
sql +=" and b.status ="+status;
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(id)) {
|
|
|
sql += " and a.id = '" + id + "'";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
Long count = 0L;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
count = Long.parseLong(rstotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询患者所有的咨询记录总数
|
|
|
* @param doctor 患者标识
|
|
|
* @param id 会话ID(等同IM表topicId)
|
|
|
* @param type 咨询会话类型
|
|
|
* @param symptoms 标题关键字
|
|
|
* @return
|
|
|
*/
|
|
|
public Long countConsultRecordByDoctor(String doctor, String id,String type, String symptoms,Integer status,String start_time,String end_time,String name) {
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
" COUNT(1) AS \"total\" " +
|
|
|
"FROM wlyy_consult a," +
|
|
|
"wlyy_consult_team b," +
|
|
|
"base_patient d " +
|
|
|
"WHERE a.id=b.consult " +
|
|
|
"AND b.patient=d.id AND b.doctor='"+doctor+"' AND a.type in ("+type+") ";
|
|
|
if (!StringUtils.isEmpty(symptoms)) {
|
|
|
symptoms = "%" + symptoms + "%";
|
|
|
sql += " and a.symptoms like '" + symptoms + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(name)) {
|
|
|
name = "%" + name + "%";
|
|
|
sql += " and b.name like '" + name + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(start_time)) {
|
|
|
sql += " and a.czrq >= '" + start_time + "'";
|
|
|
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(end_time)) {
|
|
|
sql += " and a.czrq <= '" + end_time + "'";
|
|
|
}
|
|
|
//咨询状态
|
|
|
if (status != null) {
|
|
|
sql += " and b.status = "+status;
|
|
|
|
|
|
}
|
|
|
//咨询类型
|
|
|
if (!StringUtils.isEmpty(type)) {
|
|
|
sql += " AND a.type in (" + type + ")";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(id)) {
|
|
|
sql += " and a.id = '" + id + "'";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
Long count = 0L;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
count = Long.parseLong(rstotal.get(0).get("total").toString());
|
|
|
}
|
|
|
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询医生所有的咨询记录
|
|
|
* @param doctor 医生标识
|
|
|
* @param id 会话ID(等同IM表topicId)
|
|
|
* @param type 咨询会话类型 : 0 全部
|
|
|
* @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
|
|
|
* @param pagesize 分页大小
|
|
|
* @param symptoms 标题关键字
|
|
|
* @param start_time 开始时间
|
|
|
* @param end_time 结束时间
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String,Object>> findConsultRecordByDoctor(String doctor, String id,
|
|
|
String type, Integer status,
|
|
|
int page,int pagesize,
|
|
|
String symptoms,String start_time,String end_time,String name) {
|
|
|
String sql = "SELECT " +
|
|
|
"a.id AS \"id\"," +
|
|
|
"a.type AS \"type\"," +
|
|
|
"a.title AS \"title\"," +
|
|
|
"a.symptoms AS \"symptoms\","+
|
|
|
"date_format(a.czrq,'%Y-%m-%d %H:%i:%S' ) AS \"czrq\","+
|
|
|
"b.status AS \"status\"," +
|
|
|
"b.evaluate AS \"evaluate\"," +
|
|
|
"d.name AS \"patientName\"," +
|
|
|
"d.id as \"patientId\"," +
|
|
|
"d.idcard as \"patientIdcard\"," +
|
|
|
"d.sex as \"patientSex\"," +
|
|
|
"d.photo AS \"patientPhoto\", " +
|
|
|
"b.doctor as \"doctor\" ,"+
|
|
|
"a.source as \"source\" "+
|
|
|
"FROM wlyy_consult a," +
|
|
|
"wlyy_consult_team b," +
|
|
|
"base_patient d " +
|
|
|
"WHERE a.id=b.consult " +
|
|
|
"AND b.patient=d.id ";
|
|
|
if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
|
|
|
sql += " AND b.doctor='" + doctor + "' ";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(symptoms)) {
|
|
|
symptoms = "%" + symptoms + "%";
|
|
|
sql += " and a.symptoms like '" + symptoms + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(start_time)) {
|
|
|
sql += " and a.czrq >= '" + start_time + "'";
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(end_time)) {
|
|
|
sql += " and a.czrq <= '" + end_time + "'";
|
|
|
}
|
|
|
//咨询状态
|
|
|
if (status != null) {
|
|
|
sql += " and b.status = "+status;
|
|
|
|
|
|
}
|
|
|
//咨询类型
|
|
|
if (!StringUtils.isEmpty(type)) {
|
|
|
sql += " AND a.type in (" + type + ")";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(id)) {
|
|
|
sql += " and a.id = '" + id + "'";
|
|
|
}
|
|
|
sql += " ORDER BY a.czrq desc ";
|
|
|
|
|
|
List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize);
|
|
|
for (Map<String,Object> map:mapList){
|
|
|
if (map.get("patientIdcard")!=null){
|
|
|
String idcard = map.get("patientIdcard").toString();
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(idcard);
|
|
|
map.put("patientAge",age);
|
|
|
}else {
|
|
|
map.put("patientAge",null);
|
|
|
}
|
|
|
if (map.get("doctor")!=null){
|
|
|
String doctorId = map.get("doctor").toString();
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
|
|
|
if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
|
|
|
map.put("deptName",doctorHospitalDOS.get(0).getDeptName());
|
|
|
}
|
|
|
if (baseDoctorDO!=null){
|
|
|
map.put("doctorName",baseDoctorDO.getName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存系统消息&发送IM外层刷新事件的消息
|
|
|
* @param systemMessageDO
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void saveMessage(SystemMessageDO systemMessageDO) throws Exception{
|
|
|
//发送系统消息
|
|
|
systemMessageDO.setIsRead("0");
|
|
|
systemMessageDO.setDel("1");
|
|
|
systemMessageDO.setCreateTime(new Date());
|
|
|
systemMessageDao.save(systemMessageDO);
|
|
|
//发型IM外层消息
|
|
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("socket_sms_type",11);//系统消息刷新事件
|
|
|
object.put("relation_code",systemMessageDO.getType());
|
|
|
imService.sendWaiSocketMessage(systemMessageDO.getSender(),systemMessageDO.getReceiver(),object.toString(),"1");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 患者端
|
|
|
* 发起在线咨询
|
|
|
* @param ct 在线咨询对象
|
|
|
* @param patient 患者标识
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source) throws Exception {
|
|
|
JSONObject re = new JSONObject();
|
|
|
boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor));
|
|
|
logger.info("boo"+boo);
|
|
|
WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
|
|
|
boolean flag = false;
|
|
|
if (sysDictDO!=null){
|
|
|
if (sysDictDO.getDictCode().equalsIgnoreCase("1")){
|
|
|
flag = true;
|
|
|
}
|
|
|
}
|
|
|
if (!flag){
|
|
|
if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor))) {
|
|
|
throw new RuntimeException("居民还有未结束的在线咨询!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
JSONObject users = new JSONObject();
|
|
|
users.put(doctor,0);
|
|
|
|
|
|
// 设置医生名称
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
// 设置患者信息
|
|
|
ct.setPatient(patient);
|
|
|
// 查询患者信息
|
|
|
BasePatientDO tempPatient = basePatientDao.findById(patient);
|
|
|
// 设置患者姓名
|
|
|
ct.setName(tempPatient.getName());
|
|
|
// 设置患者生日
|
|
|
ct.setBirthday(tempPatient.getBirthday());
|
|
|
//新增性别
|
|
|
ct.setSex(tempPatient.getSex());
|
|
|
// 设置患者头像
|
|
|
ct.setPhoto(tempPatient.getPhoto());
|
|
|
// 设置操作日期
|
|
|
ct.setCzrq(new Date());
|
|
|
ct.setDel("1");
|
|
|
ct.setStatus(0);
|
|
|
ct.setEvaluate(0);
|
|
|
// 医生未读数量为1
|
|
|
ct.setDoctorRead(1);
|
|
|
// 添加咨询记录
|
|
|
ConsultDo consult = imService.addConsult(ct.getPatient(), "在线咨询", ct.getSymptoms(), ct.getImages(), ct.getType(),source);
|
|
|
// // 设置关联指导
|
|
|
// consult.setGuidance(ct.getGuidance());
|
|
|
// 设置咨询标识
|
|
|
ct.setConsult(consult.getId());
|
|
|
// 设置医生CODE
|
|
|
ct.setDoctor(doctor);
|
|
|
// 设置医生名称
|
|
|
ct.setDoctorName(baseDoctorDO.getName());
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("title", tempPatient.getName() + "申请在线咨询");
|
|
|
jsonObject.put("content",ct.getSymptoms());
|
|
|
jsonObject.put("age", DateUtil.getAgeForIdcard(tempPatient.getIdcard()));
|
|
|
jsonObject.put("sex",tempPatient.getSex());
|
|
|
jsonObject.put("name",tempPatient.getName());
|
|
|
|
|
|
//推送给IM去创建议题,取得成员消息
|
|
|
JSONObject messages = imUtil.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), jsonObject.toJSONString(), consult.getImages(), doctor);
|
|
|
users.put(patient, 0);
|
|
|
users.put(doctor, 0);
|
|
|
String session_type = ImUtil.SESSION_TYPE_ONLINE;
|
|
|
|
|
|
JSONObject obj = imUtil.createTopics(patient + "_" + doctor + "_" + ct.getType(), consult.getId(), tempPatient.getName(), users, messages, session_type);
|
|
|
if (obj == null) {
|
|
|
throw new RuntimeException("IM消息发送异常!");
|
|
|
}
|
|
|
if (obj.getInteger("status") == -1) {//im议题创建失败
|
|
|
throw new RuntimeException(obj.getString("message"));
|
|
|
}
|
|
|
ct.setStartMsgId(obj.get("start_msg_id").toString());
|
|
|
consultTeamDao.save(ct);
|
|
|
consultDao.save(consult);
|
|
|
|
|
|
JSONArray doctors = new JSONArray();
|
|
|
for (String key : users.keySet()) {
|
|
|
if (patient.equals(key)) {
|
|
|
continue;
|
|
|
}
|
|
|
doctors.add(key);
|
|
|
//记录咨询的医生详情误删
|
|
|
ConsultTeamDoctorDo cd = new ConsultTeamDoctorDo();
|
|
|
cd.setConsult(consult.getId());
|
|
|
cd.setDel("1");
|
|
|
cd.setCzrq(new Date());
|
|
|
cd.setTo(key);
|
|
|
consultTeamDoctorDao.save(cd);
|
|
|
}
|
|
|
|
|
|
// 保存医生咨询信息
|
|
|
// 添加咨询转发记录
|
|
|
// 添加医生咨询日志
|
|
|
String content = imService.addLogs(ct);
|
|
|
re.put("doctor", doctor);
|
|
|
re.put("doctorName", baseDoctorDO.getName());
|
|
|
re.put("status", 1);
|
|
|
re.put("sessiond_id",patient + "_" + doctor + "_" + ct.getType());
|
|
|
re.put("patient",patient);
|
|
|
re.put("patientName",tempPatient.getName());
|
|
|
re.put("patient_idcard",tempPatient.getIdcard());
|
|
|
re.put("consult",consult.getId());
|
|
|
return re;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询居民是否有未结束的在线咨询
|
|
|
*
|
|
|
* @param patient 居民
|
|
|
* @param doctor 医生
|
|
|
* @return
|
|
|
*/
|
|
|
public String getUnfinishedConsult(String patient, String doctor) {
|
|
|
|
|
|
String totalSql = "SELECT a.consult as \"consultCode\" " +
|
|
|
"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
|
|
|
"WHERE a.consult=b.consult " +
|
|
|
"AND a.patient= '" +patient+"' "+
|
|
|
// "AND b.to_doctor='" +doctor+"' "+
|
|
|
"AND a.del='1' " +
|
|
|
"AND type = 23 " +
|
|
|
"AND a.status=0";
|
|
|
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
|
|
|
String consultCode = null;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
consultCode = rstotal.get(0).get("consultCode").toString();
|
|
|
}
|
|
|
logger.info("未结束判断语句"+totalSql+"======consultCode"+consultCode);
|
|
|
return consultCode;
|
|
|
}
|
|
|
}
|