|
@ -3015,6 +3015,9 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取设备库存
|
|
|
* @param belongCommunity
|
|
@ -4463,5 +4466,121 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 预警详情
|
|
|
* @param deviceId
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getEaringWarringInfoByDeviceWithPage(String deviceId, int page, int size) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
// Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
|
|
|
//
|
|
|
// //该设备库存预警规则
|
|
|
// List<MedicineWarrayRule> rules = medicineWarrayRuleDao.findMedicineWarrayRulesByEquNumAndDel(mediicinedevice.getEquNum(), 1);
|
|
|
// //
|
|
|
// List<Map<String, Integer>> drugIds = new ArrayList<>();
|
|
|
// List<Map<String, Object>> collect = inventoryDao.selectsomethingBysomeConditionWithEquNum(mediicinedevice.getEquNum(), new String[]{"1", "21"});
|
|
|
// //获取了所有缺货的药品id
|
|
|
// for (MedicineWarrayRule rule : rules) {
|
|
|
// for (Map<String, Object> stringObjectMap : collect) {
|
|
|
// Integer ratedInventory = Integer.parseInt(stringObjectMap.get("ratedInventory") + "");
|
|
|
// if (ratedInventory > rule.getLower() && ratedInventory < rule.getUpper()) {
|
|
|
// Integer tempQty = Integer.parseInt(stringObjectMap.get("qty") + "");
|
|
|
// if ("%".equals(rule.getMatchUnit())) {
|
|
|
// Integer matchValue = (int) Math.ceil((rule.getUpper() * rule.getMatchValue()) / 100.0);
|
|
|
// if (tempQty <= matchValue) {
|
|
|
// Map<String, Integer> tempMap = new HashMap<>();
|
|
|
// tempMap.put(stringObjectMap.get("drugId") + "", Integer.parseInt(stringObjectMap.get("qty") + ""));
|
|
|
// drugIds.add(tempMap);
|
|
|
// }
|
|
|
// }
|
|
|
// if ("件".equals(rule.getMatchUnit())) {
|
|
|
// if (tempQty <= rule.getMatchValue()) {
|
|
|
// Map<String, Integer> tempMap = new HashMap<>();
|
|
|
// tempMap.put(stringObjectMap.get("drugId") + "", Integer.parseInt(stringObjectMap.get("qty") + ""));
|
|
|
// drugIds.add(tempMap);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// String sql = "";
|
|
|
// {
|
|
|
//
|
|
|
// sql = "SELECT\n" +
|
|
|
// "tmd.id,\n" +
|
|
|
// "tmd.approval_num,\n" +
|
|
|
// "tmd.barcode,\n" +
|
|
|
// "tmd.brand,\n" +
|
|
|
// "tmd.dos_form,\n" +
|
|
|
// "tmd.state,\n" +
|
|
|
// "tmd.drug_bar_code,\n" +
|
|
|
// "tmd.drug_class,\n" +
|
|
|
// "tmd.drug_class_code,\n" +
|
|
|
// "tmd.drug_code,\n" +
|
|
|
// "tmd.drug_name,\n" +
|
|
|
// "tmd.drug_name_alies,\n" +
|
|
|
// "tmd.drug_short_code,\n" +
|
|
|
// "tmd.drug_type_code,\n" +
|
|
|
// "tmd.earlywarningcate,\n" +
|
|
|
// "tmd.inventory,\n" +
|
|
|
// "tmd.manufactor,\n" +
|
|
|
// "tmd.med_cabinet,\n" +
|
|
|
// "tmd.pic,\n" +
|
|
|
// "tmd.price,\n" +
|
|
|
// "tmd.sale_volume,\n" +
|
|
|
// "tmd.self_code,\n" +
|
|
|
// "tmd.specif,\n" +
|
|
|
// "tmd.unit,\n" +
|
|
|
// "tmd.create_time,\n" +
|
|
|
// "tmd.create_user,\n" +
|
|
|
// "tmd.create_user_name,\n" +
|
|
|
// "tmd.update_time,\n" +
|
|
|
// "tmd.update_user,\n" +
|
|
|
// "tmd.update_user_name,\n" +
|
|
|
// "tmd.drug_sku,\n" +
|
|
|
// "tmd.drug_num,\n" +
|
|
|
// "tmd.use_num,\n" +
|
|
|
// "tmd.use_way,\n" +
|
|
|
// "tmd.use_rate,\n" +
|
|
|
// "tmd.use_dose,\n" +
|
|
|
// "tmd.use_way_add,\n" +
|
|
|
// "tmd.org_code,\n" +
|
|
|
// "tmd.org_name,\n" +
|
|
|
// "tmd.quantity_unit,\n" +
|
|
|
// "tmd.pack_unit,\n" +
|
|
|
// "tmd.spell_code\n" +
|
|
|
// "FROM\n" +
|
|
|
// "t_mediicine_drugs AS tmd\n" +
|
|
|
//// "WHERE ',"+ drugIds.stream().map(item->item.keySet()).collect(Collectors.joining(",")) +",' LIKE CONCAT('%,',t.belong_community,',%')\n";
|
|
|
//
|
|
|
// }
|
|
|
// List<Map<String, Object>> list = null;
|
|
|
// list = hibenateUtils.createSQLQuery(sql,page,size);
|
|
|
// String countSql = "SELECT\n" +
|
|
|
// "COUNT(DISTINCT(id))" +
|
|
|
// "FROM\n" +
|
|
|
// "\tt_mediicinecabinet_inventory\n" +
|
|
|
// "WHERE" +
|
|
|
// "\tid_device = '" + deviceId + "'\n" +
|
|
|
// "AND CAST(qty as UNSIGNED) < rated_inventory\n" +
|
|
|
// "AND drug_code IS NOT NULL\n" +
|
|
|
// "AND org_code IS NOT NULL\n" +
|
|
|
// "AND (state = 1 OR state = 21)\n" +
|
|
|
// "ORDER BY\n" +
|
|
|
// "\tdrug_code,\n" +
|
|
|
// "\torg_code";
|
|
|
// Logger.getAnonymousLogger().info("finalCountSql="+countSql);
|
|
|
// int count = jdbcTemplate.queryForObject(countSql,Integer.class);
|
|
|
//
|
|
|
// result.put("count", count);
|
|
|
// result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|