|
@ -5,10 +5,14 @@ package com.yihu.jw.base.service.a3service;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.yihu.jw.base.dao.a2dao.*;
|
|
import com.yihu.jw.base.dao.a2dao.*;
|
|
|
|
import com.yihu.jw.base.dao.role.RoleDao;
|
|
|
|
import com.yihu.jw.base.dao.user.UserDao;
|
|
import com.yihu.jw.base.util.ConstantUtils;
|
|
import com.yihu.jw.base.util.ConstantUtils;
|
|
import com.yihu.jw.base.util.JavaBeanUtils;
|
|
import com.yihu.jw.base.util.JavaBeanUtils;
|
|
import com.yihu.jw.entity.a1entity.*;
|
|
import com.yihu.jw.entity.a1entity.*;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
|
import com.yihu.jw.entity.base.role.RoleDO;
|
|
|
|
import com.yihu.jw.entity.base.user.UserDO;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
@ -42,6 +46,11 @@ public class MedicineStockOutService extends BaseJpaService<Mediicinestockout, M
|
|
@Autowired
|
|
@Autowired
|
|
private MediicinestockupDao upDao;
|
|
private MediicinestockupDao upDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private UserDao userDao;
|
|
|
|
@Autowired
|
|
|
|
private RoleDao roleDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ObjectMapper objectMapper;
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
@ -240,9 +249,61 @@ public class MedicineStockOutService extends BaseJpaService<Mediicinestockout, M
|
|
//orderNum, equNum, contact, startTime, endTime, sellState, orderState, dispensingWindow
|
|
//orderNum, equNum, contact, startTime, endTime, sellState, orderState, dispensingWindow
|
|
public JSONObject queryOutListFullInfo(
|
|
public JSONObject queryOutListFullInfo(
|
|
String startTime, String endTime, String replenishEr,
|
|
String startTime, String endTime, String replenishEr,
|
|
String docNum, int page, int size,String wechatId) throws Exception {
|
|
|
|
|
|
String docNum, String userId, int page, int size,String wechatId) throws Exception {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
UserDO user = userDao.findOne(userId);
|
|
|
|
RoleDO role = roleDao.findOne(user.getRoleId());
|
|
|
|
String conditionSql = "";
|
|
|
|
if ("replenisher".equals(role.getCode())) {
|
|
|
|
conditionSql += " AND t.replenish_equ = '" + userId + "'\n";
|
|
|
|
} else {
|
|
|
|
String belongCommunitys = "";
|
|
|
|
String sql = "";
|
|
|
|
//市管理员
|
|
|
|
if ("saasAdmin".equals(role.getCode())) {
|
|
|
|
sql = "SELECT\n" +
|
|
|
|
"\tid\tas community\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\tdm_hospital\n" +
|
|
|
|
"WHERE\n" +
|
|
|
|
"\tdel = 1";
|
|
|
|
}
|
|
|
|
//区域管理员
|
|
|
|
if ("regionAdmin".equals(role.getCode())) {
|
|
|
|
sql = "SELECT\n" +
|
|
|
|
"\tdh.id AS community\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"\twlyy_user_area t\n" +
|
|
|
|
"LEFT JOIN dm_hospital dh ON t.town = dh.town\n" +
|
|
|
|
"WHERE\n" +
|
|
|
|
"\tt.user_id = '" + userId + "'\n" +
|
|
|
|
"AND t.del = 1\n" +
|
|
|
|
"AND dh.del = 1";
|
|
|
|
}
|
|
|
|
//社区管理员
|
|
|
|
if ("communityAdmin".equals(role.getCode())) {
|
|
|
|
sql = "SELECT\n" +
|
|
|
|
"t.hospital AS community\n" +
|
|
|
|
"FROM\n" +
|
|
|
|
"wlyy_user_area AS t\n" +
|
|
|
|
"WHERE\n" +
|
|
|
|
"t.user_id = '" + userId + "'\n" +
|
|
|
|
"AND t.del = 1";
|
|
|
|
}
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
|
|
|
|
for (Map<String, Object> stringObjectMap : list) {
|
|
|
|
if (stringObjectMap.get("community") != null && !StringUtils.isEmpty(stringObjectMap.get("community").toString())) {
|
|
|
|
if (StringUtils.isEmpty(belongCommunitys)) {
|
|
|
|
belongCommunitys += stringObjectMap.get("community").toString();
|
|
|
|
} else {
|
|
|
|
belongCommunitys += "," + stringObjectMap.get("community").toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!StringUtils.isEmpty(belongCommunitys)) {
|
|
|
|
conditionSql += " AND ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.community,',%')\n";
|
|
|
|
}
|
|
|
|
}
|
|
String sql="SELECT\n" +
|
|
String sql="SELECT\n" +
|
|
" t.id as id,\n" +
|
|
" t.id as id,\n" +
|
|
" t.address as address,\n" +
|
|
" t.address as address,\n" +
|
|
@ -267,7 +328,6 @@ public class MedicineStockOutService extends BaseJpaService<Mediicinestockout, M
|
|
" t.up_num as upNum\n" +
|
|
" t.up_num as upNum\n" +
|
|
"FROM\n" +
|
|
"FROM\n" +
|
|
" t_mediicine_stockout AS t where 1=1";
|
|
" t_mediicine_stockout AS t where 1=1";
|
|
String conditionSql = "";
|
|
|
|
if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
|
|
if (org.apache.commons.lang.StringUtils.isNotBlank(startTime)&& org.apache.commons.lang.StringUtils.isNotBlank(endTime)){
|
|
// conditionSql += " AND t.prescribe_time BETWEEN to_date('" + startTime +"','yyyy-mm-dd hh24:mi:ss') " +
|
|
// conditionSql += " AND t.prescribe_time BETWEEN to_date('" + startTime +"','yyyy-mm-dd hh24:mi:ss') " +
|
|
// " AND to_date('" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
|
|
// " AND to_date('" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
|