|
@ -1405,17 +1405,108 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"FROM\n" +
|
|
|
" base_user AS t where\n";
|
|
|
|
|
|
String conditionSql = " t.id in (select du.user_id from t_mediicine_device_user du where del = 1 and du.device_id = '" + deviceId + "')";
|
|
|
|
|
|
String conditionSql = " t.id in (select du.user_id from t_mediicine_device_user du where del = 1 and du.device_id = '" + deviceId + "')\n";
|
|
|
sql = sql + conditionSql;
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
|
list = hibenateUtils.createSQLQuery(sql);
|
|
|
|
|
|
for (Map<String, Object> stringObjectMap : list) {
|
|
|
|
|
|
}
|
|
|
result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
|
|
|
// UserDO user = userDao.findOne(userId);
|
|
|
// RoleDO role = roleDao.findOne(user.getRoleId());
|
|
|
// String belongCommunitys = "";
|
|
|
// String sql = "";
|
|
|
// //市管理员
|
|
|
// if ("saasAdmin".equals(role.getCode())) {
|
|
|
// sql = "SELECT\n" +
|
|
|
// "\t`code`\tas community\n" +
|
|
|
// "FROM\n" +
|
|
|
// "\tdm_hospital\n" +
|
|
|
// "WHERE\n" +
|
|
|
// "\tdel = 1";
|
|
|
// }
|
|
|
// //区域管理员
|
|
|
// if ("regionAdmin".equals(role.getCode())) {
|
|
|
// sql = "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())) {
|
|
|
// 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();
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// sql = "SELECT\n" +
|
|
|
// "\tbu.id AS id,\n" +
|
|
|
// "\tbu.create_time AS createTime,\n" +
|
|
|
// "\tbu.create_user AS createUser,\n" +
|
|
|
// "\tbu.create_user_name AS createUserName,\n" +
|
|
|
// "\tbu.update_time AS updateTime,\n" +
|
|
|
// "\tbu.update_user AS updateUser,\n" +
|
|
|
// "\tbu.update_user_name AS updateUserName,\n" +
|
|
|
// "\tbu.username AS username,\n" +
|
|
|
// "\tbu.`password` AS `password`,\n" +
|
|
|
// "\tbu.salt AS salt,\n" +
|
|
|
// "\tbu.`name` AS `name`,\n" +
|
|
|
// "\tbu.gender AS gender,\n" +
|
|
|
// "\tbu.idcard AS idcard,\n" +
|
|
|
// "\tbu.mobile AS mobile,\n" +
|
|
|
// "\tbu.ak AS ak,\n" +
|
|
|
// "\tbu.email AS email,\n" +
|
|
|
// "\tbu.enabled AS enabled,\n" +
|
|
|
// "\tbu.locked AS locked,\n" +
|
|
|
// "\tbu.locked_date AS lockedDate,\n" +
|
|
|
// "\tbu.login_date AS loginDate,\n" +
|
|
|
// "\tbu.saas_id AS saasId,\n" +
|
|
|
// "\tbu.login_failure_count AS loginFailureCount,\n" +
|
|
|
// "\tbu.last_login_failure_time AS lastLoginFailureTime,\n" +
|
|
|
// "\tbu.role_id AS roleId\n" +
|
|
|
// "FROM\n" +
|
|
|
// "\tbase_user bu\n" +
|
|
|
// "WHERE\n" +
|
|
|
// "\tbu.id IN (\n" +
|
|
|
// "\t\t(\n" +
|
|
|
// "\t\t\tSELECT\n" +
|
|
|
// "\t\t\t\tuser_id\n" +
|
|
|
// "\t\t\tFROM\n" +
|
|
|
// "\t\t\t\twlyy_user_area wua\n" +
|
|
|
// "\t\t\tWHERE\n" +
|
|
|
// "\t\t\t\t',"+ belongCommunitys +",' LIKE CONCAT('%,',wua.hospital, ',%')\n" +
|
|
|
// "\t\t)\n" +
|
|
|
// "\t\tUNION\n" +
|
|
|
// "\t\t\t(\n" +
|
|
|
// "\t\t\t\tSELECT\n" +
|
|
|
// "\t\t\t\t\tSELECT\n" +
|
|
|
// "\t\t\t\t\t\tdu.user_id AS user_id\n" +
|
|
|
// "\t\t\t\t\tFROM\n" +
|
|
|
// "\t\t\t\t\t\tt_mediicine_device_user du\n" +
|
|
|
// "\t\t\t\t\tWHERE\n" +
|
|
|
// "\t\t\t\t\t\tdel = 1\n" +
|
|
|
// "\t\t\t\t\tAND du.device_id = '" + deviceId + "'\n" +
|
|
|
// "\t\t\t)\n" +
|
|
|
// "\t)";
|
|
|
|
|
|
List<Map<String,Object>> tempList=null;
|
|
|
tempList = hibenateUtils.createSQLQuery(sql);
|
|
|
|
|
|
result.put("msg", JavaBeanUtils.getInstance().mapListJson(tempList));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@ -1959,7 +2050,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"t.del = 1 AND \n" +
|
|
|
"t.`status` = 0 and ',"+ deviceIds +",' LIKE CONCAT('%,',t.id,',%')\n";
|
|
|
if (!StringUtils.isEmpty(content)) {
|
|
|
sencodSql += " AND CONCAT(IFNULL(tmu.equ_num,''), IFNULL(tmu.equ_name,'')) like '%" + content +"%'";
|
|
|
sencodSql += " AND CONCAT(IFNULL(tmu.`equ_num`,''), IFNULL(tmu.`equ_name`,'')) like '%" + content +"%'";
|
|
|
}
|
|
|
deviceList = hibenateUtils.createSQLQuery(sencodSql);
|
|
|
} else {
|
|
@ -2052,7 +2143,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"t.del = 1 AND \n" +
|
|
|
"t.`status` = 0 and ',"+ belongCommunitys +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
if (!StringUtils.isEmpty(content)) {
|
|
|
sencodSql += " AND CONCAT(IFNULL(tmu.equ_num,''), IFNULL(tmu.equ_name,'')) like '%" + content +"%'";
|
|
|
sencodSql += " AND (tmu.`equ_name` like '%" + content + "%' or tmu.`equ_num` like '%" + content + "%')\n";
|
|
|
}
|
|
|
|
|
|
|
|
@ -2674,6 +2765,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"\tdir.layer_no as layerNo,\n" +
|
|
|
"\tdir.wayer_no as wayerNo,\n" +
|
|
|
"\tdir.merge_cargo as mergeCargo,\n" +
|
|
|
"\tdir.old_quantity as oldQuantity,\n" +
|
|
|
"\tdir.quantity as quantity,\n" +
|
|
|
"\tdir.merge_state as mergeState\n" +
|
|
|
"FROM\n" +
|
|
@ -2689,7 +2781,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
condition +=" and dir.id= '"+id+"'";
|
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(wayerNo)){
|
|
|
condition +=" and dir.wayer_no= '"+wayerNo+"'";
|
|
|
// condition +=" and dir.wayer_no= '"+wayerNo+"'";
|
|
|
condition +=" and dir.merge_cargo like '%"+wayerNo+"%'";
|
|
|
}
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)){
|
|
|
condition +=" and dir.type= '"+type+"'";
|
|
@ -3940,6 +4033,28 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
}
|
|
|
//更改货道容量-start
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(cargoCapacity)){
|
|
|
//2022-01-05-bug:13617-start
|
|
|
if (Integer.parseInt(inventory.getQty()) > Integer.parseInt(cargoCapacity)) {
|
|
|
//有药品时的补货
|
|
|
MedicineDrugInventoryRecord inventoryRecord = new MedicineDrugInventoryRecord();
|
|
|
inventoryRecord.setDeviceId(inventory.getIdDevice());
|
|
|
inventoryRecord.setEquNum(inventory.getEquNum());
|
|
|
inventoryRecord.setOldDrugId(inventory.getDrugId());
|
|
|
inventoryRecord.setDrugId(inventory.getDrugId());
|
|
|
inventoryRecord.setLayerNo(inventory.getLayerNo());
|
|
|
inventoryRecord.setWayerNo(inventory.getWayerNo());
|
|
|
inventoryRecord.setMergeState(inventory.getState());
|
|
|
inventoryRecord.setMergeCargo(inventory.getMerge());
|
|
|
inventoryRecord.setOldQuantity(inventory.getQty());
|
|
|
inventoryRecord.setQuantity(cargoCapacity);
|
|
|
inventoryRecord.setCreateUser(userId);
|
|
|
inventoryRecord.setType("1");
|
|
|
inventoryRecordDao.save(inventoryRecord);
|
|
|
inventory.setQty(cargoCapacity);
|
|
|
//设置额定库存
|
|
|
inventory.setRatedInventory(Integer.parseInt(cargoCapacity));
|
|
|
}
|
|
|
//2022-01-05-bug:13617-end
|
|
|
if (Integer.parseInt(cargoCapacity) > 99) {
|
|
|
throw new Exception("货道容量最多99个,如超过请放置另一格");
|
|
|
}
|
|
@ -4652,9 +4767,10 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
if (content != null && !StringUtils.isEmpty(content)) {
|
|
|
sql += "AND tmi.drug_name like '%" + content + "%'\n";
|
|
|
}
|
|
|
|
|
|
//shelf_status = 1 上架的药品返回
|
|
|
sql += "AND (tmi.state = '1' OR tmi.state = '21')\n" +
|
|
|
"AND tmi.drug_code IS NOT NULL\n" +
|
|
|
"AND tmi.shelf_status = 1\n" +
|
|
|
"AND tmi.org_code IS NOT NULL\n" +
|
|
|
"GROUP BY\n" +
|
|
|
"\ttmi.drug_code,\n" +
|