|
@ -517,7 +517,13 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取缺货设备列表
|
|
|
* @param replenishEr
|
|
|
* @param address
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getOutOfStockDeviceList(String replenishEr, String address) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
String sql = "SELECT\n" +
|
|
@ -571,9 +577,9 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"\tt_mediicine_device t\n" +
|
|
|
"LEFT JOIN t_mediicinecabinet_inventory tmi ON t.id = tmi.id_device\n" +
|
|
|
"WHERE 1=1\n" ;
|
|
|
// if (!StringUtils.isEmpty(replenishEr)) {
|
|
|
// sql +=" AND t.id in (select device_id from t_mediicine_device_user tmdu left join t_mediicine_user tmu on tmdu.user_id = tmu.id where tmdu.del = 1 and CONCAT(tmu.name,tmu.account) like '%" + replenishEr + "%')\n";
|
|
|
// }
|
|
|
if (!StringUtils.isEmpty(replenishEr)) {
|
|
|
sql +=" AND t.id in (select device_id from t_mediicine_device_user tmdu left join t_mediicine_user tmu on tmdu.user_id = tmu.id where tmdu.del = 1 and CONCAT(tmu.name,tmu.account) like '%" + replenishEr + "%')\n";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(address)) {
|
|
|
sql += " AND CONCAT(t.detail_address,t.delivery_address) like '%" + address + "%'\n";
|
|
|
}
|
|
@ -584,7 +590,6 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"\tsum(tmi.qty) < t.capacity * t.ratio\n" +
|
|
|
"OR sum(tmi.qty) IS NULL";
|
|
|
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
|
list = hibenateUtils.createSQLQuery(sql);
|
|
|
result.put("response", ConstantUtils.SUCCESS);
|
|
@ -595,8 +600,92 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
|
|
|
public JSONObject getDetialOutOfStock(String ids) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
String sql = "select * from t_mediicine_device where id in (" + ids + ",'')";
|
|
|
String sencordSql = "select tmi.layer_no as layerNo,tmi.wayer_no as wayerNo,tmi.qty,tmd.* from t_mediicinecabinet_inventory tmi left join t_mediicine_drugs tmd on tmi.barcode = tmd.id";
|
|
|
String sql = "SELECT\n" +
|
|
|
" t.id AS id,\n" +
|
|
|
" t.belong_community AS belongCommunity,\n" +
|
|
|
" t.community AS community,\n" +
|
|
|
" t.del AS del,\n" +
|
|
|
" t.delivery_address AS deliveryAddress,\n" +
|
|
|
" t.detail_address AS detailAddress,\n" +
|
|
|
" t.equ_area AS equArea,\n" +
|
|
|
" t.equ_class AS equClass,\n" +
|
|
|
" t.equ_info AS equInfo,\n" +
|
|
|
" t.equ_name AS equName,\n" +
|
|
|
" t.equ_num AS equNum,\n" +
|
|
|
" t.equ_type AS equType,\n" +
|
|
|
" t.fbelong_community AS fbelongCommunity,\n" +
|
|
|
" t.machine_code AS machineCode,\n" +
|
|
|
" t.network_status AS networkStatus,\n" +
|
|
|
" t.poweron_test AS poweronTest,\n" +
|
|
|
" t.reg_date AS regDate,\n" +
|
|
|
" t.sale_status AS saleStatus,\n" +
|
|
|
" t.signalintensity AS signalintensity,\n" +
|
|
|
" t.upgr_adesit AS upgrAdesit,\n" +
|
|
|
" t.`status` AS `status`,\n" +
|
|
|
" t.card_status AS cardStatus,\n" +
|
|
|
" t.operator AS operator,\n" +
|
|
|
" t.pack_age AS packAge,\n" +
|
|
|
" t.usage_flow AS usageFlow,\n" +
|
|
|
" t.flow AS flow,\n" +
|
|
|
" t.create_time AS createTime,\n" +
|
|
|
" t.create_user AS createUser,\n" +
|
|
|
" t.create_user_name AS createUserName,\n" +
|
|
|
" t.update_time AS updateTime,\n" +
|
|
|
" t.update_user AS updateUser,\n" +
|
|
|
" t.update_user_name AS updateUserName,\n" +
|
|
|
" t.aisles AS aisles,\n" +
|
|
|
" t.capacity AS capacity,\n" +
|
|
|
" t.ratio AS ratio,\n" +
|
|
|
" t.cargo_capacity AS cargoCapacity\n" +
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_device AS t WHERE id in(" + ids + ",'')";
|
|
|
String sencordSql = "SELECT\n" +
|
|
|
"\ttmi.layer_no AS layerNo,\n" +
|
|
|
"\ttmi.wayer_no AS wayerNo,\n" +
|
|
|
"\ttmi.qty AS qty,\n" +
|
|
|
"\ttmd.id AS id,\n" +
|
|
|
"\ttmd.approval_num AS approvalNum,\n" +
|
|
|
"\ttmd.barcode AS barcode,\n" +
|
|
|
"\ttmd.brand AS brand,\n" +
|
|
|
"\ttmd.dos_form AS dosForm,\n" +
|
|
|
"\ttmd.state AS state,\n" +
|
|
|
"\ttmd.drug_bar_code AS drugBarCode,\n" +
|
|
|
"\ttmd.drug_class AS drugClass,\n" +
|
|
|
"\ttmd.drug_class_code AS drugClassCode,\n" +
|
|
|
"\ttmd.drug_code AS drugCode,\n" +
|
|
|
"\ttmd.drug_name AS drugName,\n" +
|
|
|
"\ttmd.drug_name_alies AS drugNameAlies,\n" +
|
|
|
"\ttmd.drug_short_code AS drugShortCode,\n" +
|
|
|
"\ttmd.drug_type_code AS drugTypeCode,\n" +
|
|
|
"\ttmd.earlywarningcate AS earlywarningcate,\n" +
|
|
|
"\ttmd.inventory AS inventory,\n" +
|
|
|
"\ttmd.manufactor AS manufactor,\n" +
|
|
|
"\ttmd.med_cabinet AS medCabinet,\n" +
|
|
|
"\ttmd.pic AS pic,\n" +
|
|
|
"\ttmd.price AS price,\n" +
|
|
|
"\ttmd.sale_volume AS saleVolume,\n" +
|
|
|
"\ttmd.self_code AS selfCode,\n" +
|
|
|
"\ttmd.specif AS specif,\n" +
|
|
|
"\ttmd.unit AS unit,\n" +
|
|
|
"\ttmd.create_time AS createTime,\n" +
|
|
|
"\ttmd.create_user AS createUser,\n" +
|
|
|
"\ttmd.create_user_name AS createUserName,\n" +
|
|
|
"\ttmd.update_time AS updateTime,\n" +
|
|
|
"\ttmd.update_user AS updateUser,\n" +
|
|
|
"\ttmd.update_user_name AS updateUserName,\n" +
|
|
|
"\ttmd.drug_sku AS drugSku,\n" +
|
|
|
"\ttmd.drug_num AS drugNum,\n" +
|
|
|
"\ttmd.use_num AS useNum,\n" +
|
|
|
"\ttmd.use_way AS useWay,\n" +
|
|
|
"\ttmd.use_rate AS useRate,\n" +
|
|
|
"\ttmd.use_dose AS useDose,\n" +
|
|
|
"\ttmd.use_way_add AS useWayAdd,\n" +
|
|
|
"\ttmd.org_code AS orgCode,\n" +
|
|
|
"\ttmd.org_name AS orgName\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicinecabinet_inventory tmi\n" +
|
|
|
"LEFT JOIN t_mediicine_drugs tmd ON tmi.barcode = tmd.id";
|
|
|
|
|
|
List<Map<String,Object>> list=null;
|
|
|
list = hibenateUtils.createSQLQuery(sql);
|
|
|
for (Map<String, Object> stringObjectMap : list) {
|
|
@ -604,6 +693,9 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
List<Map<String, Object>> childList = null;
|
|
|
childList = hibenateUtils.createSQLQuery(sencordSql);
|
|
|
if (childList != null) {
|
|
|
for (Map<String, Object> objectMap : childList) {
|
|
|
objectMap.put("upInventory", Integer.parseInt(stringObjectMap.get("cargoCapacity").toString()) - Integer.parseInt(objectMap.get("qty").toString()));
|
|
|
}
|
|
|
stringObjectMap.put("children", childList);
|
|
|
}
|
|
|
}
|