|
@ -1,5 +1,8 @@
|
|
|
package com.yihu.jw.complaint;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
@ -13,17 +16,20 @@ import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
|
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
|
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.jw.wechat.enterprise.EnterpriseService;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class BaseComplaintService {
|
|
@ -47,6 +53,14 @@ public class BaseComplaintService {
|
|
|
private BaseComplaintOperateDao baseComplaintOperateDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorRoleDao baseDoctorRoleDao;
|
|
|
@Autowired
|
|
|
private BasePatientDao basePatientDao;
|
|
|
@Autowired
|
|
|
private EnterpriseService enterpriseService;
|
|
|
@Value("${wechat.id}")
|
|
|
private String wxId;
|
|
|
@Value("${wechat.flag}")
|
|
|
private boolean flag;
|
|
|
|
|
|
//修改新增
|
|
|
public BaseComplaintDictDO createOrUpdateDict(String id, String name) {
|
|
@ -91,38 +105,40 @@ public class BaseComplaintService {
|
|
|
}
|
|
|
|
|
|
//新增投诉管理医生
|
|
|
public BaseComplaintDoctorDO createOrUpdateComplainDoctor(String id, String complaintId, String doctor, String deptCode) {
|
|
|
String deptName = "";
|
|
|
String doctorName = "";
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
if (null != baseDoctorDO) {
|
|
|
doctorName = baseDoctorDO.getName();
|
|
|
}
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDeptCodeDoctorCode(deptCode, doctor);
|
|
|
if (baseDoctorHospitalDO != null && baseDoctorHospitalDO.size() > 0) {
|
|
|
deptName = baseDoctorHospitalDO.get(0).getDeptName();
|
|
|
}
|
|
|
BaseComplaintDoctorDO baseComplaintDoctorDO = new BaseComplaintDoctorDO();
|
|
|
if (StringUtils.isNoneBlank(id)) {
|
|
|
baseComplaintDoctorDO = baseComplaintDoctorDao.findByDelAndId(id);
|
|
|
baseComplaintDoctorDO.setDept(deptCode);
|
|
|
baseComplaintDoctorDO.setDeptName(deptName);
|
|
|
baseComplaintDoctorDO.setComplaintId(complaintId);
|
|
|
baseComplaintDoctorDO.setDoctor(doctor);
|
|
|
baseComplaintDoctorDO.setDoctorName(doctorName);
|
|
|
baseComplaintDoctorDO.setUpdateTime(new Date());
|
|
|
} else {
|
|
|
baseComplaintDoctorDO.setDept(deptCode);
|
|
|
baseComplaintDoctorDO.setDeptName(deptName);
|
|
|
baseComplaintDoctorDO.setComplaintId(complaintId);
|
|
|
baseComplaintDoctorDO.setDoctor(doctor);
|
|
|
baseComplaintDoctorDO.setDoctorName(doctorName);
|
|
|
baseComplaintDoctorDO.setIsDel("1");
|
|
|
baseComplaintDoctorDO.setCreateTime(new Date());
|
|
|
}
|
|
|
return baseComplaintDoctorDao.save(baseComplaintDoctorDO);
|
|
|
@Transactional
|
|
|
public void createOrUpdateComplainDoctor(String id, String complaintId, String doctorList) throws Exception {
|
|
|
JSONArray jsonArray = JSON.parseArray(doctorList);
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String doctor = jsonObject.getString("doctor");
|
|
|
String deptCode = jsonObject.getString("deptCode");
|
|
|
String deptName = "";
|
|
|
String doctorName = "";
|
|
|
BaseComplaintDoctorDO preDoctor= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
if (null != baseDoctorDO) {
|
|
|
doctorName = baseDoctorDO.getName();
|
|
|
}
|
|
|
if (preDoctor!=null){
|
|
|
throw new Exception("医生"+doctorName+"已有负责的投诉类型");
|
|
|
}
|
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDO = baseDoctorHospitalDao.findByDeptCodeDoctorCode(deptCode, doctor);
|
|
|
if (baseDoctorHospitalDO != null && baseDoctorHospitalDO.size() > 0) {
|
|
|
deptName = baseDoctorHospitalDO.get(0).getDeptName();
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(id)) {
|
|
|
BaseComplaintDoctorDO baseComplaintDoctorDO = new BaseComplaintDoctorDO();
|
|
|
baseComplaintDoctorDO.setDept(deptCode);
|
|
|
baseComplaintDoctorDO.setDeptName(deptName);
|
|
|
baseComplaintDoctorDO.setComplaintId(id);
|
|
|
baseComplaintDoctorDO.setDoctor(doctor);
|
|
|
baseComplaintDoctorDO.setDoctorName(doctorName);
|
|
|
baseComplaintDoctorDO.setIsDel("1");
|
|
|
baseComplaintDoctorDO.setCreateTime(new Date());
|
|
|
baseComplaintDoctorDao.save(baseComplaintDoctorDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//删除管理医生
|
|
|
public BaseComplaintDoctorDO deleteDoctorComplain(String id) {
|
|
|
BaseComplaintDoctorDO baseComplaintDoctorDO = baseComplaintDoctorDao.findByDelAndId(id);
|
|
@ -144,9 +160,11 @@ public class BaseComplaintService {
|
|
|
" t.is_del as \"isDel\"," +
|
|
|
" t.create_time as \"createTime\"," +
|
|
|
" t.update_time as \"updateTime\"," +
|
|
|
" d.photo as \"photo\"," +
|
|
|
" b.name as \"name\" " +
|
|
|
" from base_complaint_doctor t left join base_complaint_dict b" +
|
|
|
" on t.complaint_id=b.id where t.is_del='1'";
|
|
|
" on t.complaint_id=b.id " +
|
|
|
" left join base_doctor d on t.doctor=d.id where t.is_del='1'";
|
|
|
if (StringUtils.isNoneBlank(doctorName)) {
|
|
|
sql += " and t.doctor_name like '%" + doctorName + "%'";
|
|
|
}
|
|
@ -177,7 +195,7 @@ public class BaseComplaintService {
|
|
|
/*
|
|
|
* 患者举报接口
|
|
|
* */
|
|
|
public void patiemtComplaint(String json) throws Exception{
|
|
|
public BaseComplaintDO patiemtComplaint(String json) throws Exception{
|
|
|
BaseComplaintDO baseComplaintDO =objectMapper.readValue(json,BaseComplaintDO.class);
|
|
|
BaseComplaintDictDO baseComplaintDictDO = baseComplaintDictDao.findById(baseComplaintDO.getComplaintId());
|
|
|
if (baseComplaintDictDO!=null){
|
|
@ -189,15 +207,34 @@ public class BaseComplaintService {
|
|
|
baseComplaintDO.setVisitDeptName(dictHospitalDeptDO.getName());
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNoneBlank(baseComplaintDO.getPatient())){
|
|
|
BasePatientDO basePatientDO= basePatientDao.findById(baseComplaintDO.getPatient());
|
|
|
if (basePatientDO!=null){
|
|
|
basePatientDO.setIdcardFront(baseComplaintDO.getIdcardFront());
|
|
|
basePatientDO.setIdcardBack(baseComplaintDO.getIdcardBack());
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
baseComplaintDO.setIsDel("1");
|
|
|
baseComplaintDO.setStatus("0");
|
|
|
baseComplaintDO.setCreateTime(new Date());
|
|
|
baseComplaintDao.save(baseComplaintDO);
|
|
|
baseComplaintDO= baseComplaintDao.save(baseComplaintDO);
|
|
|
try {
|
|
|
List<BaseComplaintDoctorDO> doctorList=baseComplaintDoctorDao.findbyComplaintId(baseComplaintDO.getComplaintId());
|
|
|
for (BaseComplaintDoctorDO baseComplaintDoctorDO:doctorList){
|
|
|
String url="";
|
|
|
enterpriseService.sendTWMesByDoctor("zsyy",baseComplaintDoctorDO.getDoctor(),"投诉反馈","您收到一条投诉反馈,点击查看。",url);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
|
|
|
}
|
|
|
return baseComplaintDao.save(baseComplaintDO);
|
|
|
}
|
|
|
/*
|
|
|
* 医生转交
|
|
|
* */
|
|
|
public void passTo(String id,String complaintId,String doctor,String operator){
|
|
|
public BaseComplaintDO passTo(String id,String complaintId,String doctor,String operator){
|
|
|
BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
|
|
|
BaseComplaintOperateLogDO baseComplaintOperateLogDO = new BaseComplaintOperateLogDO();
|
|
|
String doctorName="";
|
|
@ -222,11 +259,22 @@ public class BaseComplaintService {
|
|
|
complaitTypeName=baseComplaintDictDO.getName();
|
|
|
baseComplaintDO.setComplaintName(complaitTypeName);
|
|
|
}
|
|
|
baseComplaintDao.save(baseComplaintDO);
|
|
|
baseComplaintDO= baseComplaintDao.save(baseComplaintDO);
|
|
|
try {
|
|
|
List<BaseComplaintDoctorDO> doctorList=baseComplaintDoctorDao.findbyComplaintId(baseComplaintDO.getComplaintId());
|
|
|
for (BaseComplaintDoctorDO baseComplaintDoctorDO:doctorList){
|
|
|
String url="";
|
|
|
enterpriseService.sendTWMesByDoctor("zsyy",baseComplaintDoctorDO.getDoctor(),"投诉反馈","您收到一条投诉反馈,点击查看。",url);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
|
|
|
}
|
|
|
return baseComplaintDO;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
//接受投诉
|
|
|
public void doctorAccept(String id,String doctor) throws Exception{
|
|
|
public BaseComplaintDO doctorAccept(String id,String doctor) throws Exception{
|
|
|
BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
|
|
|
if (baseComplaintDO!=null&&"0".equalsIgnoreCase(baseComplaintDO.getStatus())){
|
|
|
baseComplaintDO.setStatus("1");
|
|
@ -242,15 +290,17 @@ public class BaseComplaintService {
|
|
|
}else {
|
|
|
throw new Exception("该工单已被处理完成");
|
|
|
}
|
|
|
return baseComplaintDO;
|
|
|
}
|
|
|
//反馈投诉
|
|
|
public void dealComplaint(String id,String operator,String content,String imgUrl ,String deptCode) throws Exception{
|
|
|
public BaseComplaintDO dealComplaint(String id,String operator,String content,String imgUrl ,String deptCode) throws Exception{
|
|
|
BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
|
|
|
if (baseComplaintDO!=null&&"1".equalsIgnoreCase(baseComplaintDO.getStatus())){
|
|
|
baseComplaintDO.setDealTime(new Date());
|
|
|
baseComplaintDO.setFeedBack(content);
|
|
|
baseComplaintDO.setFeedImg(imgUrl);
|
|
|
baseComplaintDO.setOperator(operator);
|
|
|
baseComplaintDO.setStatus("2");
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(operator);
|
|
|
if (null != baseDoctorDO) {
|
|
|
baseComplaintDO.setOperatorName(baseDoctorDO.getName());
|
|
@ -266,20 +316,27 @@ public class BaseComplaintService {
|
|
|
}else if ("0".equalsIgnoreCase(baseComplaintDO.getStatus())){
|
|
|
throw new Exception("该工单未被接收");
|
|
|
}
|
|
|
return baseComplaintDO;
|
|
|
}
|
|
|
|
|
|
//查询投诉列表
|
|
|
public void findComplaintList(String doctor,String status,String patientName,String patientId,String keyWord,Integer page ,Integer pageSize){
|
|
|
public MixEnvelop findComplaintList(String doctor,String status,String patientName,String patientId,String keyWord,String complaintId,
|
|
|
String startTime,String endTime,Integer page ,Integer pageSize){
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
List<BaseDoctorRoleDO> rolelist= baseDoctorRoleDao.findByDoctorCode(doctor);
|
|
|
Boolean queryAll=false;
|
|
|
if (rolelist.contains("admin")){
|
|
|
queryAll=true;
|
|
|
for (BaseDoctorRoleDO baseDoctorRoleDO:rolelist){
|
|
|
if ("admin".equalsIgnoreCase(baseDoctorRoleDO.getRoleCode())){
|
|
|
queryAll=true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
String sql="select t.id as \"id\"," +
|
|
|
" t.complaint_id as \"complaintId\"," +
|
|
|
" t.complaint_name as \"complaintName\"," +
|
|
|
" t.complaint_content as \"complaintContent\"," +
|
|
|
" t.visit_type as \"visitType\"," +
|
|
|
" case t.visit_type when '1' then '门诊' else '住院' end as \"visitTypeName\"," +
|
|
|
" t.visit_time as \"visitTime\"," +
|
|
|
" t.visit_dept as \"visitDept\"," +
|
|
|
" t.visit_dept_name as \"visitDeptName\"," +
|
|
@ -310,14 +367,32 @@ public class BaseComplaintService {
|
|
|
|
|
|
if (!queryAll){
|
|
|
BaseComplaintDoctorDO baseComplaintDoctorDO= baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
|
|
|
/*List<BaseComplaintOperateLogDO> logList =baseComplaintOperateDao.findbyOperateFrom(doctor);
|
|
|
String types= "";
|
|
|
if (logList!=null&&logList.size()>0){
|
|
|
for (int i=0;i<logList.size();i++){
|
|
|
if (i==logList.size()-1){
|
|
|
types+=logList.get(i).getComplaintTo();
|
|
|
}else {
|
|
|
types+=logList.get(i).getComplaintTo()+",";
|
|
|
}
|
|
|
}
|
|
|
}*/
|
|
|
String complaint="";
|
|
|
if (baseComplaintDoctorDO!=null){
|
|
|
complaint=baseComplaintDoctorDO.getComplaintId();
|
|
|
}
|
|
|
//complaint=complaint+","+types;
|
|
|
if (StringUtils.isNoneBlank(complaint)){
|
|
|
sql+=" and t.complaint_id ='"+complaint+"'";
|
|
|
//sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
|
|
|
sql+=" and t.complaint_id='"+complaint+"'";
|
|
|
}else {
|
|
|
return;
|
|
|
return null;
|
|
|
}
|
|
|
}else {
|
|
|
if (StringUtils.isNoneBlank(complaintId)){
|
|
|
//sql+=" and t.complaint_id in ('"+complaint.replace(",","','")+"')";
|
|
|
sql+=" and t.complaint_id='"+complaintId+"'";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
@ -330,10 +405,176 @@ public class BaseComplaintService {
|
|
|
sql+=" and t.patient ='"+patientId+"'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(keyWord)){
|
|
|
sql+=" and (t.patient_idcard like '%"+keyWord+"%' or t.patient_name like '%"+keyWord+"%')";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startTime)){
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
if (flag){
|
|
|
sql+=" and t.create_time > '"+startTime+"'";
|
|
|
}else {
|
|
|
sql+=" and t.create_time > to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
|
|
|
}
|
|
|
}else{
|
|
|
sql+=" and t.create_time > '"+startTime+"'";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endTime)){
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
if (flag){
|
|
|
sql+=" and t.create_time<='" + endTime + "'";
|
|
|
}else {
|
|
|
sql+=" and t.create_time<= to_date('" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
|
|
|
}
|
|
|
}else{
|
|
|
sql+=" and t.create_time<='" + endTime + "'";
|
|
|
}
|
|
|
}
|
|
|
sql+=" order by t.create_time desc ";
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql+") q";
|
|
|
Long count = 0L;
|
|
|
List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount);
|
|
|
if(total!=null){
|
|
|
//mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
|
|
|
count = hibenateUtils.objTransformLong(total.get(0).get("total"));
|
|
|
}
|
|
|
mixEnvelop.setTotalCount(count.intValue());
|
|
|
mixEnvelop.setDetailModelList(list);
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
|
mixEnvelop.setCurrPage(page);
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
public BaseComplaintDO findOnePaitentComplaint(String id){
|
|
|
BaseComplaintDO baseComplaintDO = baseComplaintDao.findOne(id);
|
|
|
BasePatientDO basePatientDO=basePatientDao.findById(baseComplaintDO.getPatient());
|
|
|
if (null!=basePatientDO){
|
|
|
baseComplaintDO.setMobile(basePatientDO.getMobile());
|
|
|
}
|
|
|
baseComplaintDO.setVisitTypeName(baseComplaintDO.getVisitType().equalsIgnoreCase("1")?"门诊":"住院");
|
|
|
return baseComplaintDO;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询投诉列表
|
|
|
public MixEnvelop findPatientComplaintList(String status,String patientName,String patientId,
|
|
|
String startTime,String endTime,String complaintType,Integer page ,Integer pageSize){
|
|
|
MixEnvelop mixEnvelop = new MixEnvelop();
|
|
|
String sql="select t.id as \"id\"," +
|
|
|
" t.complaint_id as \"complaintId\"," +
|
|
|
" t.complaint_name as \"complaintName\"," +
|
|
|
" t.complaint_content as \"complaintContent\"," +
|
|
|
" t.visit_type as \"visitType\"," +
|
|
|
" case t.visit_type when '1' then '门诊' else '住院' end as \"visitTypeName\"," +
|
|
|
" t.visit_time as \"visitTime\"," +
|
|
|
" t.visit_dept as \"visitDept\"," +
|
|
|
" t.visit_dept_name as \"visitDeptName\"," +
|
|
|
" t.adm_no as \"admNo\"," +
|
|
|
" t.patient as \"patient\"," +
|
|
|
" t.patient_name as \"patientName\"," +
|
|
|
" t.patient_idcard as \"patientIdcard\"," +
|
|
|
" t.idcard_front as \"idcardFront\"," +
|
|
|
" t.idcard_back as \"idcardBack\"," +
|
|
|
" t.img_url as \"imgUrl\"," +
|
|
|
" t.is_del as \"isDel\"," +
|
|
|
" t.status as \"status\"," +
|
|
|
" t.create_time as \"createTime\"," +
|
|
|
" t.accept_time as \"acceptTime\"," +
|
|
|
" t.deal_time as \"dealTime\"," +
|
|
|
" t.operator_dept as \"operatorDept\"," +
|
|
|
" t.operator_dept_name as \"operatorDeptName\"," +
|
|
|
" t.operator as \"operator\"," +
|
|
|
" t.operator_name as \"operatorName\"," +
|
|
|
" t.feed_back as \"feedBack\"," +
|
|
|
" t.feed_img as \"feedImg\"," +
|
|
|
" t.acceptor as \"acceptor\"," +
|
|
|
" b.mobile as \"mobile\"," +
|
|
|
" t.acceptor_name as \"acceptorName\"" +
|
|
|
" from base_complaint t " +
|
|
|
" left join base_patient b on t.patient=b.id" +
|
|
|
" where t.is_del=1";
|
|
|
if (StringUtils.isNoneBlank(status)){
|
|
|
sql+=" and t.status ='"+status+"'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patientName)){
|
|
|
sql+=" and t.patient_name like '%"+patientName+"%'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(patientId)){
|
|
|
sql+=" and t.patient ='"+patientId+"'";
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(complaintType)){
|
|
|
sql+=" and t.complaint_id ='"+complaintType+"'";
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(startTime)){
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
if (flag){
|
|
|
sql+=" and t.create_time > '"+startTime+"'";
|
|
|
}else {
|
|
|
sql+=" and t.create_time > to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
|
|
|
}
|
|
|
}else{
|
|
|
sql+=" and t.create_time > '"+startTime+"'";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(endTime)){
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
if (flag){
|
|
|
sql+=" and t.create_time<='" + endTime + "'";
|
|
|
}else {
|
|
|
sql+=" and t.create_time<= to_date('" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
|
|
|
}
|
|
|
}else{
|
|
|
sql+=" and t.create_time<='" + endTime + "'";
|
|
|
}
|
|
|
}
|
|
|
sql+=" order by t.create_time desc ";
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql+") q";
|
|
|
Long count = 0L;
|
|
|
List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount);
|
|
|
if(total!=null){
|
|
|
//mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
|
|
|
count = hibenateUtils.objTransformLong(total.get(0).get("total"));
|
|
|
}
|
|
|
mixEnvelop.setTotalCount(count.intValue());
|
|
|
mixEnvelop.setDetailModelList(list);
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
|
mixEnvelop.setCurrPage(page);
|
|
|
return mixEnvelop;
|
|
|
}
|
|
|
/*
|
|
|
* 查询投诉数量*/
|
|
|
public Map<String,Object> findComplaintCount(String doctor){
|
|
|
BaseComplaintDoctorDO baseComplaintDoctorDO=baseComplaintDoctorDao.findbyDoctorAndDel(doctor);
|
|
|
List<BaseDoctorRoleDO> rolelist= baseDoctorRoleDao.findByDoctorCode(doctor);
|
|
|
Boolean queryAll=false;
|
|
|
if (rolelist!=null&&rolelist.contains("admin")){
|
|
|
queryAll=true;
|
|
|
}
|
|
|
Integer complaints=0;
|
|
|
Integer recieve=0;
|
|
|
Integer deal=0;
|
|
|
if (!queryAll){
|
|
|
complaints=baseComplaintDao.getCountByStatusAndComplaintId("0",baseComplaintDoctorDO.getComplaintId());
|
|
|
recieve=baseComplaintDao.getCountByStatusAndComplaintId("1",baseComplaintDoctorDO.getComplaintId());
|
|
|
deal=baseComplaintDao.getCountByStatusAndComplaintId("2",baseComplaintDoctorDO.getComplaintId());
|
|
|
}else {
|
|
|
complaints=baseComplaintDao.getCountByStatus("0");
|
|
|
recieve=baseComplaintDao.getCountByStatus("1");
|
|
|
deal=baseComplaintDao.getCountByStatus("2");
|
|
|
}
|
|
|
|
|
|
Integer total = complaints+recieve+deal;
|
|
|
Map map=new HashMap();
|
|
|
map.put("complaints",complaints);
|
|
|
map.put("recieve",recieve);
|
|
|
map.put("deal",deal);
|
|
|
map.put("total",total);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|