|
@ -2,7 +2,9 @@ package com.yihu.jw.hospital.integrate.service;
|
|
|
|
|
|
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.hospital.integrate.BaseHospitalActivityDO;
|
|
|
import com.yihu.jw.entity.hospital.integrate.BaseHospitalGoodsDO;
|
|
|
import com.yihu.jw.entity.hospital.integrate.BaseHospitalIntegrateDO;
|
|
@ -35,6 +37,8 @@ public class BaseHospitalActivityService extends BaseJpaService<BaseHospitalActi
|
|
|
private BaseHospitalUserActivityDao userActivityDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorDao doctorDao;
|
|
|
@Autowired
|
|
|
private BaseDoctorHospitalDao doctorHospitalDao;
|
|
|
|
|
|
/**
|
|
|
* 新增或者修改活动
|
|
@ -79,7 +83,7 @@ public class BaseHospitalActivityService extends BaseJpaService<BaseHospitalActi
|
|
|
}
|
|
|
conditionSql = " and d.id IN(SELECT dh.doctor_code from base_doctor_hospital dh where dh.dept_code in("+deptCode+") and dh.del=1) ";
|
|
|
}
|
|
|
String doctorSql = " SELECT d.id,d.name FROM base_doctor d where 1=1 and d.del=1 ";
|
|
|
String doctorSql = " SELECT d.id,d.name FROM base_doctor d where 1=1 and d.del=1 and d.name is not null ";
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql+conditionSql);
|
|
|
for (Map<String,Object> map:mapList){
|
|
|
String id= map.get("id").toString();
|
|
@ -164,7 +168,7 @@ public class BaseHospitalActivityService extends BaseJpaService<BaseHospitalActi
|
|
|
/**
|
|
|
* 查询活动列表
|
|
|
*/
|
|
|
public MixEnvelop selectByCondition(String title, Integer page, Integer size,Integer flag,Integer status,String startTime,String endTime){
|
|
|
public MixEnvelop selectByCondition(String title, Integer page, Integer size,Integer flag,Integer status,String startTime,String endTime,String user,String userId){
|
|
|
String orderBy = " order by sort asc,create_time desc ";
|
|
|
String condition = " ";
|
|
|
String sql = "SELECT\n" +
|
|
@ -235,7 +239,26 @@ public class BaseHospitalActivityService extends BaseJpaService<BaseHospitalActi
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(endTime)){
|
|
|
condition +=" and start_time >= '"+endTime+"' ";
|
|
|
condition +=" and start_time <= '"+endTime+"' ";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(user)){
|
|
|
condition +=" and id IN(SELECT relation_code FROM `base_hospital_user_activity` where user ='"+user+"') ";
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNoneBlank(userId)){
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(userId);
|
|
|
String deptCondition = "";
|
|
|
if (doctorHospitalDOS.size()==1){
|
|
|
deptCondition +=" participants_code like '%"+doctorHospitalDOS.get(0).getDeptCode()+"%' ";
|
|
|
}else {
|
|
|
for (BaseDoctorHospitalDO doctorHospitalDO:doctorHospitalDOS){
|
|
|
deptCondition +=" participants_code like '%"+doctorHospitalDO.getDeptCode()+"%' or ";
|
|
|
}
|
|
|
deptCondition = deptCondition.substring(0,deptCondition.length()-3);
|
|
|
}
|
|
|
|
|
|
condition +=" and (("+deptCondition+") or participants_code is null or participants_code ='' ) ";
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql+condition+orderBy, page, size);
|
|
@ -267,7 +290,9 @@ public class BaseHospitalActivityService extends BaseJpaService<BaseHospitalActi
|
|
|
activityDO.setStatus(1);
|
|
|
}else if (date.compareTo(startTime)>0&&date.compareTo(endTime)<0){
|
|
|
activityDO.setStatus(1);
|
|
|
}else if (date.compareTo(startTime)<0||date.compareTo(endTime)>0){
|
|
|
}else if (date.compareTo(startTime)<0){
|
|
|
activityDO.setStatus(0);
|
|
|
}else if (date.compareTo(endTime)>0){
|
|
|
activityDO.setStatus(2);
|
|
|
}
|
|
|
hospitalActivityDao.save(activityDO);
|