|
@ -190,16 +190,16 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(equClass)){
|
|
|
conditionSql += " and t.equ_class = "+equClass;
|
|
|
conditionSql += " and t.equ_class = '"+equClass + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(belongCommunity)){
|
|
|
conditionSql += " and t.belong_community = " + belongCommunity;
|
|
|
conditionSql += " and t.belong_community = '" + belongCommunity+ "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(networkStatus)){
|
|
|
conditionSql += " and t.network_status = " + networkStatus;
|
|
|
conditionSql += " and t.network_status = '" + networkStatus + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(saleStatus)){
|
|
|
conditionSql += " and t.sale_status = " + saleStatus;
|
|
|
conditionSql += " and t.sale_status = '" + saleStatus + "'";
|
|
|
}
|
|
|
|
|
|
sql = sql + conditionSql;
|
|
@ -285,35 +285,35 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
conditionSql += " and CONCAT(t.equ_name, t.equ_num) like '%" + content + "%'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(equClass)){
|
|
|
conditionSql += " and t.equ_class = "+equClass;
|
|
|
conditionSql += " and t.equ_class = '"+equClass + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(belongCommunity)){
|
|
|
conditionSql += " and t.belong_community = " + belongCommunity;
|
|
|
conditionSql += " and t.belong_community = '" + belongCommunity + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(networkStatus)){
|
|
|
conditionSql += " and t.network_status = " + networkStatus;
|
|
|
conditionSql += " and t.network_status = '" + networkStatus + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(saleStatus)){
|
|
|
conditionSql += " and t.sale_status = " + saleStatus;
|
|
|
conditionSql += " and t.sale_status = '" + saleStatus + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(machineCode)){
|
|
|
conditionSql += " and t.machine_code like '%" + machineCode + "%'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(deviceType)){
|
|
|
conditionSql += " and t.equ_type = "+deviceType;
|
|
|
conditionSql += " and t.equ_type = '"+deviceType + "'";
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(equArea)){
|
|
|
conditionSql += " and t.equ_area = "+equArea;
|
|
|
conditionSql += " and t.equ_area = '"+equArea + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(del)){
|
|
|
conditionSql += " and t.del = "+del;
|
|
|
conditionSql += " and t.del = '"+del + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(status)){
|
|
|
conditionSql += " and t.`status` = "+status;
|
|
|
conditionSql += " and t.`status` = '"+status + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(deliveryAddress)){
|
|
|
conditionSql += " and t.delivery_address = "+deliveryAddress;
|
|
|
conditionSql += " and t.delivery_address = '"+deliveryAddress + "'";
|
|
|
}
|
|
|
sql = sql + conditionSql;
|
|
|
|
|
@ -404,7 +404,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_device AS t where\n";
|
|
|
|
|
|
String conditionSql = " t.id in (select du.device_id from t_mediicine_device_user du where del = 1 and du.user_id = " + userId + ")";
|
|
|
// String conditionSql = " t.id in (select du.device_id from t_mediicine_device_user du where del = 1 and ',"+userId+",' LIKE CONCAT('%,',du.user_id,',%'))";
|
|
|
String conditionSql = " t.id in (select du.device_id from t_mediicine_device_user du where del = 1 and du.user_id = '" + userId + "'";
|
|
|
|
|
|
sql = sql + conditionSql;
|
|
|
|
|
@ -466,7 +467,8 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_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 ',"+deviceId+",' LIKE CONCAT('%,',du.device_id,',%'))";
|
|
|
String conditionSql = " t.id in (select du.user_id from t_mediicine_device_user du where del = 1 and du.device_id = '" + deviceId + "'";
|
|
|
|
|
|
sql = sql + conditionSql;
|
|
|
|
|
@ -744,7 +746,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
" t.ratio AS ratio,\n" +
|
|
|
" t.cargo_capacity AS cargoCapacity\n" +
|
|
|
"FROM\n" +
|
|
|
" t_mediicine_device AS t WHERE t.id in (" + ids + ")";
|
|
|
" t_mediicine_device AS t WHERE ',"+ ids +",' LIKE CONCAT('%,',t.id,',%')";
|
|
|
String sencordSql = "SELECT\n" +
|
|
|
"\ttmi.layer_no AS layerNo,\n" +
|
|
|
"\ttmi.wayer_no AS wayerNo,\n" +
|
|
@ -795,9 +797,11 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
List<Map<String,Object>> list=null;
|
|
|
list = hibenateUtils.createSQLQuery(sql);
|
|
|
for (Map<String, Object> stringObjectMap : list) {
|
|
|
sencordSql += " where tmi.id_device = " + stringObjectMap.get("id");
|
|
|
String tempStr = "";
|
|
|
// tempStr = sencordSql + " where ',"+stringObjectMap.get("id")+",' LIKE CONCAT('%,',tmi.id_device,',%')";
|
|
|
tempStr = sencordSql + " WHERE tmi.id_device = '" + stringObjectMap.get("id").toString() + "'";
|
|
|
List<Map<String, Object>> childList = null;
|
|
|
childList = hibenateUtils.createSQLQuery(sencordSql);
|
|
|
childList = hibenateUtils.createSQLQuery(tempStr);
|
|
|
if (childList != null) {
|
|
|
for (Map<String, Object> objectMap : childList) {
|
|
|
objectMap.put("upInventory", Integer.parseInt(stringObjectMap.get("cargoCapacity").toString()) - Integer.parseInt(objectMap.get("qty").toString()));
|
|
@ -812,5 +816,138 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取设备库存
|
|
|
* @param belongCommunity
|
|
|
* @param deviceId
|
|
|
* @param netStatus
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONObject getDevInventory(String belongCommunity, String deviceId, String netStatus) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
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 1=1";
|
|
|
|
|
|
if (!StringUtils.isEmpty(deviceId)) {
|
|
|
sql += " AND t.id = '" + deviceId + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(belongCommunity)) {
|
|
|
sql += " AND t.belong_community = '" + belongCommunity + "'";
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(netStatus)) {
|
|
|
sql += " AND t.network_status = '" + netStatus + "'";
|
|
|
}
|
|
|
|
|
|
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) {
|
|
|
// String tempStr = sencordSql + " where ',"+stringObjectMap.get("id").toString()+",' LIKE CONCAT('%,',tmi.id_device,',%')";
|
|
|
String tempStr = sencordSql + " WHERE tmi.id_device = '" + stringObjectMap.get("id").toString() + "'";
|
|
|
List<Map<String, Object>> childList = null;
|
|
|
childList = hibenateUtils.createSQLQuery(tempStr);
|
|
|
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);
|
|
|
stringObjectMap.put("totalQty", childList.stream().reduce(0, (sum, p) -> sum += Integer.parseInt(p.get("qty").toString()), Integer::sum));
|
|
|
}
|
|
|
//历史订单数
|
|
|
|
|
|
|
|
|
//总销售额
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
result.put("response", ConstantUtils.SUCCESS);
|
|
|
result.put("msg",list);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|