|
@ -7,10 +7,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.base.dao.a2dao.MediicineDeviceDao;
|
|
|
import com.yihu.jw.base.dao.a2dao.MediicinestoreDao;
|
|
|
import com.yihu.jw.base.dao.a2dao.MediicinewarrayDao;
|
|
|
import com.yihu.jw.base.dao.role.RoleDao;
|
|
|
import com.yihu.jw.base.dao.user.UserDao;
|
|
|
import com.yihu.jw.base.util.JavaBeanUtils;
|
|
|
import com.yihu.jw.entity.a1entity.Mediicinedevice;
|
|
|
import com.yihu.jw.entity.a1entity.Mediicinestore;
|
|
|
import com.yihu.jw.entity.a1entity.Mediicinewarray;
|
|
|
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.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
@ -41,7 +45,10 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
@Autowired
|
|
|
private MedicinedeviceService medicinedeviceService;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private UserDao userDao;
|
|
|
@Autowired
|
|
|
private RoleDao roleDao;
|
|
|
|
|
|
@Autowired
|
|
|
private HibenateUtils hibenateUtils;
|
|
@ -96,8 +103,60 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
|
|
|
public JSONObject getTemperature(
|
|
|
String equNum, String equType, String netStatus, String lowT, String heightT,String lowH,String heightH,
|
|
|
String content, String startTime, String endTime, int page, int size) throws Exception {
|
|
|
String content, String startTime, String endTime, String userId, int page, int size) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
UserDO user = userDao.findOne(userId);
|
|
|
RoleDO role = roleDao.findOne(user.getRoleId());
|
|
|
String belongCommunitys = "";
|
|
|
String tempSql = "";
|
|
|
//获取管理员所在社区code字符串
|
|
|
{
|
|
|
//市管理员
|
|
|
if ("saasAdmin".equals(role.getCode())) {
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\t`code`\tas community\n" +
|
|
|
"FROM\n" +
|
|
|
"\tdm_hospital\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tdel = 1";
|
|
|
}
|
|
|
//区域管理员
|
|
|
if ("regionAdmin".equals(role.getCode())) {
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\tdh.`code` 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()) || "replenisher".equals(role.getCode())) {
|
|
|
tempSql = "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(tempSql);
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String conditionSql = "";
|
|
|
if (!StringUtils.isEmpty(belongCommunitys)) {
|
|
|
conditionSql += " AND ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
}
|
|
|
String sql = "SELECT\n" +
|
|
|
" t.id as id,\n" +
|
|
|
" t.belong_community as belongCommunity,\n" +
|
|
@ -138,9 +197,9 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
" t.update_user_name as updateUserName,\n" +
|
|
|
" t.remark as remark\n" +
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_warray AS t where 1=1 and t.type like '%温度%' ";
|
|
|
" t_mediicine_warray AS t where 1=1 and t.type like '%温度%'\n";
|
|
|
|
|
|
|
|
|
String conditionSql = "";
|
|
|
|
|
|
// conditionSql += " and t.type like '%温度%'";
|
|
|
|
|
@ -287,8 +346,60 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
}
|
|
|
|
|
|
public JSONObject getOffline(String equNum, String equClass, String netStatus, String content,
|
|
|
String startTime, String endTime, int page, int size,String wechatId) throws Exception {
|
|
|
String startTime, String endTime, String userId, int page, int size,String wechatId) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
UserDO user = userDao.findOne(userId);
|
|
|
RoleDO role = roleDao.findOne(user.getRoleId());
|
|
|
String belongCommunitys = "";
|
|
|
String tempSql = "";
|
|
|
//获取管理员所在社区code字符串
|
|
|
{
|
|
|
//市管理员
|
|
|
if ("saasAdmin".equals(role.getCode())) {
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\t`code`\tas community\n" +
|
|
|
"FROM\n" +
|
|
|
"\tdm_hospital\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tdel = 1";
|
|
|
}
|
|
|
//区域管理员
|
|
|
if ("regionAdmin".equals(role.getCode())) {
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\tdh.`code` 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()) || "replenisher".equals(role.getCode())) {
|
|
|
tempSql = "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(tempSql);
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String conditionSql = "";
|
|
|
if (!StringUtils.isEmpty(belongCommunitys)) {
|
|
|
conditionSql += " AND ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
}
|
|
|
String sql = "SELECT\n" +
|
|
|
" t.id as id,\n" +
|
|
|
" t.belong_community as belongCommunity,\n" +
|
|
@ -329,9 +440,9 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
" t.update_user_name as updateUserName,\n" +
|
|
|
" t.remark as remark\n" +
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_warray AS t where 1=1";
|
|
|
" t_mediicine_warray AS t where 1=1\n";
|
|
|
|
|
|
String conditionSql = "";
|
|
|
// String conditionSql = "";
|
|
|
|
|
|
conditionSql += " and t.type LIKE '%网络%'";
|
|
|
|
|
@ -373,8 +484,60 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
|
|
|
public JSONObject getFault(
|
|
|
String equNum, String equClass, String netStatus, String content,
|
|
|
String startTime, String endTime, int page, int size,String wechatId) throws Exception {
|
|
|
String startTime, String endTime, String userId, int page, int size,String wechatId) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
UserDO user = userDao.findOne(userId);
|
|
|
RoleDO role = roleDao.findOne(user.getRoleId());
|
|
|
String belongCommunitys = "";
|
|
|
String tempSql = "";
|
|
|
//获取管理员所在社区code字符串
|
|
|
{
|
|
|
//市管理员
|
|
|
if ("saasAdmin".equals(role.getCode())) {
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\t`code`\tas community\n" +
|
|
|
"FROM\n" +
|
|
|
"\tdm_hospital\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tdel = 1";
|
|
|
}
|
|
|
//区域管理员
|
|
|
if ("regionAdmin".equals(role.getCode())) {
|
|
|
tempSql = "SELECT\n" +
|
|
|
"\tdh.`code` 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()) || "replenisher".equals(role.getCode())) {
|
|
|
tempSql = "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(tempSql);
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
String conditionSql = "";
|
|
|
if (!StringUtils.isEmpty(belongCommunitys)) {
|
|
|
conditionSql += " AND ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
}
|
|
|
String sql = "SELECT\n" +
|
|
|
" t.id as id,\n" +
|
|
|
" t.belong_community as belongCommunity,\n" +
|
|
@ -415,9 +578,9 @@ public class MedicineWarrayService extends BaseJpaService<Mediicinewarray, Medii
|
|
|
" t.update_user_name as updateUserName,\n" +
|
|
|
" t.remark as remark\n" +
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_warray AS t where 1=1";
|
|
|
" t_mediicine_warray AS t where 1=1\n";
|
|
|
|
|
|
String conditionSql = "";
|
|
|
// String conditionSql = "";
|
|
|
|
|
|
conditionSql += " and (t.type LIKE '%故障%' OR t.TYPE LIKE '%出货异常%')";
|
|
|
|