|
@ -11,6 +11,8 @@ import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
|
|
import jxl.Workbook;
|
|
|
|
import jxl.write.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -19,6 +21,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.OutputStream;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@ -92,8 +96,8 @@ public class SynergyManageService extends BaseJpaService {
|
|
*/
|
|
*/
|
|
public Map<String,Object> workorderList(String code,String keywords,Integer workorderType,
|
|
public Map<String,Object> workorderList(String code,String keywords,Integer workorderType,
|
|
Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
|
|
Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
|
|
String principal,String serviceStartTime,String serviceEndTime,
|
|
|
|
String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,Integer page, Integer pageSize) throws Exception{
|
|
|
|
|
|
String principal,String serviceStartTime,String serviceEndTime,String patientName,String ssc,String idcard,
|
|
|
|
Integer userType,Integer isAcceptTask,String userName,String hospitalName,Integer page, Integer pageSize) throws Exception{
|
|
|
|
|
|
String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1 " ;
|
|
String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1 " ;
|
|
String whereSql = "";
|
|
String whereSql = "";
|
|
@ -111,7 +115,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
whereSql += " and e.executor_code ='"+code+"' ";
|
|
whereSql += " and e.executor_code ='"+code+"' ";
|
|
}else if(isAcceptTask==2){//我派发
|
|
}else if(isAcceptTask==2){//我派发
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
whereSql += " and e.create_user ='"+code+"' ";
|
|
|
|
|
|
whereSql += " and w.create_user ='"+code+"' ";
|
|
}
|
|
}
|
|
}else if(userType==3){//医生
|
|
}else if(userType==3){//医生
|
|
if(isAcceptTask==1){//我接收
|
|
if(isAcceptTask==1){//我接收
|
|
@ -148,7 +152,11 @@ public class SynergyManageService extends BaseJpaService {
|
|
}
|
|
}
|
|
//是否超时
|
|
//是否超时
|
|
if(timeout!=null){
|
|
if(timeout!=null){
|
|
whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
|
|
|
|
|
|
if(timeout==1){
|
|
|
|
whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
|
|
|
|
}else if(timeout==2){
|
|
|
|
whereSql +=" and w.service_time <='"+DateUtil.dateToStrLong(new Date())+"' ";
|
|
|
|
}
|
|
}
|
|
}
|
|
//服务编码
|
|
//服务编码
|
|
if(StringUtils.isNotEmpty(workorderCode)){
|
|
if(StringUtils.isNotEmpty(workorderCode)){
|
|
@ -167,15 +175,22 @@ public class SynergyManageService extends BaseJpaService {
|
|
}
|
|
}
|
|
//服务对象
|
|
//服务对象
|
|
if(StringUtils.isNotEmpty(patientName)){
|
|
if(StringUtils.isNotEmpty(patientName)){
|
|
whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
|
|
|
|
|
|
whereSql+=" and s.service_patient_name like '%"+keywords+"%' ";
|
|
}
|
|
}
|
|
//社保卡号
|
|
//社保卡号
|
|
if(StringUtils.isNotEmpty(ssc)){
|
|
if(StringUtils.isNotEmpty(ssc)){
|
|
whereSql+=" s.ssc like '%"+keywords+"%' ";
|
|
|
|
|
|
whereSql+=" and s.ssc like '%"+keywords+"%' ";
|
|
}
|
|
}
|
|
//身份证号
|
|
//身份证号
|
|
if(StringUtils.isNotEmpty(idcard)){
|
|
if(StringUtils.isNotEmpty(idcard)){
|
|
whereSql+=" s.idcard like '%"+keywords+"%' ";
|
|
|
|
|
|
whereSql+=" and s.idcard like '%"+keywords+"%' ";
|
|
|
|
}
|
|
|
|
//需求方
|
|
|
|
if(StringUtils.isNotEmpty(userName)){
|
|
|
|
whereSql+=" and w.create_user_name like '%"+userName+"%' ";
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotEmpty(hospitalName)){
|
|
|
|
whereSql+=" and w.hospital_name like '%"+hospitalName+"%' ";
|
|
}
|
|
}
|
|
String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w " +servicerTable+
|
|
String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w " +servicerTable+
|
|
|
|
|
|
@ -228,6 +243,8 @@ public class SynergyManageService extends BaseJpaService {
|
|
map.put("managerName",managerName);//负责人的名称
|
|
map.put("managerName",managerName);//负责人的名称
|
|
Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
|
|
Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
|
|
map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
|
|
map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
|
|
|
|
map.put("userName",one.get("create_user_name"));
|
|
|
|
map.put("hospitalName",one.get("hospital_name"));
|
|
resultList.add(map);
|
|
resultList.add(map);
|
|
}
|
|
}
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
@ -479,6 +496,8 @@ public class SynergyManageService extends BaseJpaService {
|
|
workorderDO.setReturnedRemark(jsonObject.getString("returnedRemark"));
|
|
workorderDO.setReturnedRemark(jsonObject.getString("returnedRemark"));
|
|
this.sendMessage(workorderDO, null, 26);
|
|
this.sendMessage(workorderDO, null, 26);
|
|
}else if(status == 2){
|
|
}else if(status == 2){
|
|
|
|
//设置接收时间
|
|
|
|
workorderDO.setReceiverTime(new Date());
|
|
//创建负责人信息
|
|
//创建负责人信息
|
|
List<ManageSynergyWorkorderExecutorDO> list = new ArrayList<>();
|
|
List<ManageSynergyWorkorderExecutorDO> list = new ArrayList<>();
|
|
String manager = jsonObject.getString("manager");
|
|
String manager = jsonObject.getString("manager");
|
|
@ -498,17 +517,19 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
|
|
|
//保存协作者信息
|
|
//保存协作者信息
|
|
String collaborator = jsonObject.getString("collaborator");
|
|
String collaborator = jsonObject.getString("collaborator");
|
|
String[] collaborators = manager.split(",");
|
|
|
|
for(String c : collaborators){
|
|
|
|
ManageSynergyWorkorderExecutorDO executorDO = new ManageSynergyWorkorderExecutorDO();
|
|
|
|
User u = userDao.findByCode(c);
|
|
|
|
executorDO.setCode(getCode());
|
|
|
|
executorDO.setWorkorderCode(code);
|
|
|
|
executorDO.setExecutorType(1);
|
|
|
|
executorDO.setExecutorCode(c);
|
|
|
|
executorDO.setExecutorName(u.getName());
|
|
|
|
executorDO.setDel(1);
|
|
|
|
list.add(executorDO);
|
|
|
|
|
|
if(StringUtils.isNotBlank(collaborator)) {
|
|
|
|
String[] collaborators = collaborator.split(",");
|
|
|
|
for (String c : collaborators) {
|
|
|
|
ManageSynergyWorkorderExecutorDO executorDO = new ManageSynergyWorkorderExecutorDO();
|
|
|
|
User u = userDao.findByCode(c);
|
|
|
|
executorDO.setCode(getCode());
|
|
|
|
executorDO.setWorkorderCode(code);
|
|
|
|
executorDO.setExecutorType(2);
|
|
|
|
executorDO.setExecutorCode(c);
|
|
|
|
executorDO.setExecutorName(u.getName());
|
|
|
|
executorDO.setDel(1);
|
|
|
|
list.add(executorDO);
|
|
|
|
}
|
|
}
|
|
}
|
|
workorderExecutorDao.save(list);
|
|
workorderExecutorDao.save(list);
|
|
}
|
|
}
|
|
@ -656,8 +677,12 @@ public class SynergyManageService extends BaseJpaService {
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@Transactional
|
|
@Transactional
|
|
public void reminder(String workorderCode,String userCode,Integer userType) throws Exception{
|
|
|
|
|
|
public Integer reminder(String workorderCode,String userCode,Integer userType) throws Exception{
|
|
|
|
|
|
|
|
Integer reminderStatus = reminderStatus(workorderCode);
|
|
|
|
if(reminderStatus==3||reminderStatus==4){
|
|
|
|
return reminderStatus;
|
|
|
|
}
|
|
ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
|
|
ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
|
|
if(manageSynergyWorkorderDO==null){
|
|
if(manageSynergyWorkorderDO==null){
|
|
throw new Exception();
|
|
throw new Exception();
|
|
@ -693,6 +718,40 @@ public class SynergyManageService extends BaseJpaService {
|
|
workordeReminderDO.setDealWith(0);
|
|
workordeReminderDO.setDealWith(0);
|
|
workordeReminderDO.setPriority(manageSynergyWorkorderDO.getPriority());
|
|
workordeReminderDO.setPriority(manageSynergyWorkorderDO.getPriority());
|
|
manageSynergyWorkorderReminderDao.save(workordeReminderDO);
|
|
manageSynergyWorkorderReminderDao.save(workordeReminderDO);
|
|
|
|
return reminderStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Integer reminderStatus(String workorderCode) throws Exception{
|
|
|
|
Integer reminderStatus=4;//默认是不满足催单条件
|
|
|
|
ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
|
|
|
|
//工单状态(0、草稿,1、未接受,2、处理中,3、处理完成,4、退回)
|
|
|
|
//1、当单子超过1小时扔未被接收或退回时
|
|
|
|
//2、当单子被接收后,如果距离服务时间小于4小时,则允许用户进行催单操作。
|
|
|
|
//3、当已催促过客服时,再次催单
|
|
|
|
//4、不满足催单条件时
|
|
|
|
List<ManageSynergyWorkordeReminderDO> list = manageSynergyWorkorderReminderDao.findByWorkorderCode(workorderCode);
|
|
|
|
if(workorderDO.getStatus()==1){
|
|
|
|
if(list.size()>0){
|
|
|
|
reminderStatus=3;
|
|
|
|
}else{
|
|
|
|
//单子超过1小时
|
|
|
|
long h1= 60*60*1000L;
|
|
|
|
if(new Date().getTime()-workorderDO.getCreateTime().getTime()>h1){
|
|
|
|
reminderStatus=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else if(workorderDO.getStatus()==2){
|
|
|
|
if(list.size()>0){
|
|
|
|
reminderStatus=3;
|
|
|
|
}else{
|
|
|
|
//距离服务时间小于4小时
|
|
|
|
long h4= 4*60*60*1000L;
|
|
|
|
if(workorderDO.getServiceTime().getTime()-new Date().getTime()<h4){
|
|
|
|
reminderStatus=2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return reminderStatus;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -840,108 +899,186 @@ public class SynergyManageService extends BaseJpaService {
|
|
return jsonObject;
|
|
return jsonObject;
|
|
}
|
|
}
|
|
|
|
|
|
public JSONObject getUnitLabels(String currentRoleCode) {
|
|
|
|
String url = wlyyUrl + "/wlyygc/doctor/label/unitLabels?currentRoleCode=" + currentRoleCode + "¤tRoleLevel=3";
|
|
|
|
|
|
public JSONObject getUnitLabels(String currentRoleCode, String currentRoleLevel) {
|
|
|
|
String url = wlyyUrl + "/wlyygc/doctor/label/unitLabels?currentRoleCode=" + currentRoleCode + "¤tRoleLevel=" + currentRoleLevel;
|
|
String response = httpClientUtil.get(url, "UTF-8");
|
|
String response = httpClientUtil.get(url, "UTF-8");
|
|
JSONObject jsonObject = new JSONObject(response);
|
|
JSONObject jsonObject = new JSONObject(response);
|
|
return jsonObject;
|
|
return jsonObject;
|
|
}
|
|
}
|
|
|
|
|
|
public List<Town> getTowns() {
|
|
|
|
return (List<Town>) townDao.findAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void exportWorkorder(String code,String keywords,Integer workorderType,
|
|
public void exportWorkorder(String code,String keywords,Integer workorderType,
|
|
Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
|
|
Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
|
|
String principal,String serviceStartTime,String serviceEndTime,
|
|
String principal,String serviceStartTime,String serviceEndTime,
|
|
String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask){
|
|
|
|
String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1 " ;
|
|
|
|
String whereSql = "";
|
|
|
|
if(userType==3){//客服管理员
|
|
|
|
whereSql +=" and w.create_user_type=1 ";//创建人为医生
|
|
|
|
if(isAcceptTask==3){//待接收
|
|
|
|
whereSql +=" and w.status =1 ";
|
|
|
|
servicerTable ="";
|
|
|
|
}else if(isAcceptTask==4){//已接收
|
|
|
|
whereSql +=" and w.status in (2,3) ";
|
|
|
|
}
|
|
|
|
}else if(userType==2){//客服
|
|
|
|
if(isAcceptTask==1){//我接收
|
|
|
|
|
|
String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,HttpServletResponse response) throws Exception{
|
|
|
|
WritableWorkbook wwb = null;
|
|
|
|
try{
|
|
|
|
|
|
|
|
String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1 " ;
|
|
|
|
String whereSql = "";
|
|
|
|
if(userType==3){//客服管理员
|
|
whereSql +=" and w.create_user_type=1 ";//创建人为医生
|
|
whereSql +=" and w.create_user_type=1 ";//创建人为医生
|
|
whereSql += " and e.executor_code ='"+code+"' ";
|
|
|
|
}else if(isAcceptTask==2){//我派发
|
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
|
|
whereSql += " and e.create_user ='"+code+"' ";
|
|
|
|
|
|
if(isAcceptTask==3){//待接收
|
|
|
|
whereSql +=" and w.status =1 ";
|
|
|
|
servicerTable ="";
|
|
|
|
}else if(isAcceptTask==4){//已接收
|
|
|
|
whereSql +=" and w.status in (2,3) ";
|
|
|
|
}
|
|
|
|
}else if(userType==2){//客服
|
|
|
|
if(isAcceptTask==1){//我接收
|
|
|
|
whereSql +=" and w.create_user_type=1 ";//创建人为医生
|
|
|
|
whereSql += " and e.executor_code ='"+code+"' ";
|
|
|
|
}else if(isAcceptTask==2){//我派发
|
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
|
|
whereSql += " and e.create_user ='"+code+"' ";
|
|
|
|
}
|
|
|
|
}else if(userType==3){//医生
|
|
|
|
if(isAcceptTask==1){//我接收
|
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
|
|
whereSql += " and e.executor_code ='"+code+"' ";
|
|
|
|
}else if(isAcceptTask==2){//我派发
|
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为医生
|
|
|
|
whereSql += " and e.create_user ='"+code+"' ";
|
|
|
|
}
|
|
}
|
|
}
|
|
}else if(userType==3){//医生
|
|
|
|
if(isAcceptTask==1){//我接收
|
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为客服
|
|
|
|
whereSql += " and e.executor_code ='"+code+"' ";
|
|
|
|
}else if(isAcceptTask==2){//我派发
|
|
|
|
whereSql +=" and w.create_user_type=2 ";//创建人为医生
|
|
|
|
whereSql += " and e.create_user ='"+code+"' ";
|
|
|
|
|
|
|
|
|
|
//关键字查询
|
|
|
|
if(StringUtils.isNotEmpty(keywords)){
|
|
|
|
servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
|
|
|
|
whereSql += " and w.servicer_count<=10 ";
|
|
|
|
whereSql += " and (w.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
|
|
|
|
" or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//服务类型
|
|
|
|
if(workorderType!=null){
|
|
|
|
whereSql += " and w.type ="+workorderType+" ";
|
|
|
|
}
|
|
|
|
//是否是我负责的
|
|
|
|
if(isMyTask!=null){
|
|
|
|
whereSql += " and e.executor_code ='"+code+"' and e.executor_type=1 ";
|
|
|
|
}
|
|
|
|
//工单状态
|
|
|
|
if(status!=null){
|
|
|
|
whereSql +=" and w.status ="+status+" ";
|
|
|
|
}
|
|
|
|
//优先级
|
|
|
|
if(priority!=null){
|
|
|
|
whereSql+= " and w.priority="+priority+" ";
|
|
|
|
}
|
|
|
|
//是否超时
|
|
|
|
if(timeout!=null){
|
|
|
|
whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
|
|
|
|
}
|
|
|
|
//服务编码
|
|
|
|
if(StringUtils.isNotEmpty(workorderCode)){
|
|
|
|
whereSql+=" and w.code like '%"+workorderCode+"%' ";
|
|
|
|
}
|
|
|
|
//负责人
|
|
|
|
if(StringUtils.isNotEmpty(principal)){
|
|
|
|
whereSql+=" and e.code like '%"+principal+"%' and e.executor_type=1 ";
|
|
|
|
}
|
|
|
|
//服务时间
|
|
|
|
if(StringUtils.isNotEmpty(serviceStartTime)){
|
|
|
|
whereSql+=" and w.service_time>='"+serviceStartTime+"' ";
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotEmpty(serviceEndTime)){
|
|
|
|
whereSql+=" and w.service_time<='"+serviceEndTime+"' ";
|
|
|
|
}
|
|
|
|
//服务对象
|
|
|
|
if(StringUtils.isNotEmpty(patientName)){
|
|
|
|
whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
|
|
|
|
}
|
|
|
|
//社保卡号
|
|
|
|
if(StringUtils.isNotEmpty(ssc)){
|
|
|
|
whereSql+=" s.ssc like '%"+keywords+"%' ";
|
|
|
|
}
|
|
|
|
//身份证号
|
|
|
|
if(StringUtils.isNotEmpty(idcard)){
|
|
|
|
whereSql+=" s.idcard like '%"+keywords+"%' ";
|
|
|
|
}
|
|
|
|
String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w " +servicerTable+
|
|
|
|
|
|
//关键字查询
|
|
|
|
if(StringUtils.isNotEmpty(keywords)){
|
|
|
|
servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
|
|
|
|
whereSql += " and w.servicer_count<=10 ";
|
|
|
|
whereSql += " and (w.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
|
|
|
|
" or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
|
|
|
|
}
|
|
|
|
//服务类型
|
|
|
|
if(workorderType!=null){
|
|
|
|
whereSql += " and w.type ="+workorderType+" ";
|
|
|
|
}
|
|
|
|
//是否是我负责的
|
|
|
|
if(isMyTask!=null){
|
|
|
|
whereSql += " and e.executor_code ='"+code+"' and e.executor_type=1 ";
|
|
|
|
}
|
|
|
|
//工单状态
|
|
|
|
if(status!=null){
|
|
|
|
whereSql +=" and w.status ="+status+" ";
|
|
|
|
}
|
|
|
|
//优先级
|
|
|
|
if(priority!=null){
|
|
|
|
whereSql+= " and w.priority="+priority+" ";
|
|
|
|
}
|
|
|
|
//是否超时
|
|
|
|
if(timeout!=null){
|
|
|
|
whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
|
|
|
|
}
|
|
|
|
//服务编码
|
|
|
|
if(StringUtils.isNotEmpty(workorderCode)){
|
|
|
|
whereSql+=" and w.code like '%"+workorderCode+"%' ";
|
|
|
|
}
|
|
|
|
//负责人
|
|
|
|
if(StringUtils.isNotEmpty(principal)){
|
|
|
|
whereSql+=" and e.code like '%"+principal+"%' and e.executor_type=1 ";
|
|
|
|
}
|
|
|
|
//服务时间
|
|
|
|
if(StringUtils.isNotEmpty(serviceStartTime)){
|
|
|
|
whereSql+=" and w.service_time>='"+serviceStartTime+"' ";
|
|
|
|
}
|
|
|
|
if(StringUtils.isNotEmpty(serviceEndTime)){
|
|
|
|
whereSql+=" and w.service_time<='"+serviceEndTime+"' ";
|
|
|
|
}
|
|
|
|
//服务对象
|
|
|
|
if(StringUtils.isNotEmpty(patientName)){
|
|
|
|
whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
|
|
|
|
}
|
|
|
|
//社保卡号
|
|
|
|
if(StringUtils.isNotEmpty(ssc)){
|
|
|
|
whereSql+=" s.ssc like '%"+keywords+"%' ";
|
|
|
|
|
|
" where w.del=1 " +
|
|
|
|
" and 1=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
//生成excel
|
|
|
|
response.setContentType("octets/stream");
|
|
|
|
response.setHeader("Content-Disposition", "attachment; filename="+ new String( "patientHealthIndexDataList.xls"));
|
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
|
wwb = Workbook.createWorkbook(os);
|
|
|
|
WritableSheet ws = Workbook.createWorkbook(os).createSheet("sheet",1);
|
|
|
|
String[] header = {"SN码","创建日期","身份证号","姓名","数据类型","value1","value2","value3","value4","value5","value6","value7"};
|
|
|
|
int i = 0;
|
|
|
|
for (String h : header) {
|
|
|
|
Label label = new Label(0, i, h);
|
|
|
|
ws.addCell(label);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
for(Map<String,Object> one:list){
|
|
|
|
// addCell(ws, i, 0, m.getDeviceSn(),"");
|
|
|
|
// addCell(ws, i, 1, format.format(m.getCzrq()),"");
|
|
|
|
// addCell(ws, i, 2, m.getIdcard(),"");
|
|
|
|
// addCell(ws, i, 3, m.getUserName(),"");
|
|
|
|
// addCell(ws, i, 4, type,"");
|
|
|
|
// addCell(ws, i, 5, m.getValue1(),"");
|
|
|
|
// addCell(ws, i, 6, m.getValue2(),"");
|
|
|
|
// addCell(ws, i, 7, m.getValue3(),"");
|
|
|
|
// addCell(ws, i, 8, m.getValue4(),"");
|
|
|
|
// addCell(ws, i, 9, m.getValue5(),"");
|
|
|
|
// addCell(ws, i, 10, m.getValue6(),"");
|
|
|
|
// addCell(ws, i, 11, m.getValue7(),"");
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
wwb.write();
|
|
|
|
wwb.close();
|
|
|
|
}catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
if (wwb != null) wwb.close();
|
|
|
|
throw e;
|
|
}
|
|
}
|
|
//身份证号
|
|
|
|
if(StringUtils.isNotEmpty(idcard)){
|
|
|
|
whereSql+=" s.idcard like '%"+keywords+"%' ";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//添加单元格内容
|
|
|
|
public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
|
|
|
|
Label label = new Label(column ,row, data);
|
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(memo)){
|
|
|
|
WritableCellFeatures cellFeatures = new WritableCellFeatures();
|
|
|
|
cellFeatures.setComment(memo);
|
|
|
|
label.setCellFeatures(cellFeatures);
|
|
}
|
|
}
|
|
String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w " +servicerTable+
|
|
|
|
|
|
ws.addCell(label);
|
|
|
|
}
|
|
|
|
|
|
" where w.del=1 " +
|
|
|
|
" and 1=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
|
|
|
|
|
|
public List<Map<String,Object>> getDealList(String idcard){
|
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
|
|
if (patient==null){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
String sql ="SELECT" +
|
|
|
|
" s.create_time," +
|
|
|
|
" s.service_patient_name," +
|
|
|
|
" w.priority," +
|
|
|
|
" w.relation_code," +
|
|
|
|
" w.relation_code_name," +
|
|
|
|
" w.create_user_type," +
|
|
|
|
" w.create_user_name," +
|
|
|
|
" w.create_user," +
|
|
|
|
" w.remark," +
|
|
|
|
" w.service_time" +
|
|
|
|
" FROM" +
|
|
|
|
" `manage_synergy_workorder_servicer` s" +
|
|
|
|
" LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
|
|
|
|
" WHERE" +
|
|
|
|
" s.service_patient_code = '"+patient.getCode()+"'" +
|
|
|
|
" AND s.`status` = 1" +
|
|
|
|
" ORDER BY" +
|
|
|
|
" s.create_time" +
|
|
|
|
" LIMIT 2";
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
|
|
for (Map<String,Object> map : list){
|
|
|
|
int isOver = isServiceOverTime(DateUtil.strToDate(String.valueOf(map.get("service_time")),DateUtil.YYYY_MM_DD_HH_MM_SS));
|
|
|
|
map.put("isOver",isOver);
|
|
|
|
}
|
|
|
|
return list;
|
|
}
|
|
}
|
|
}
|
|
}
|