Browse Source

Merge branch 'medicare' of liubing/wlyy2.0 into medicare

liubing 2 years ago
parent
commit
257370f120

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -240,6 +240,7 @@ public class BaseRequestMapping {
        public static final String removeIncentive  = "/removeIncentive";
        public static final String removeIncentive  = "/removeIncentive";
        public static final String resetDoctorPwd  = "/resetDoctorPwd";
        public static final String resetDoctorPwd  = "/resetDoctorPwd";
        public static final String  findMediicinecabinetInventoryByDeviceId = "/findMediicinecabinetInventoryByDeviceId";
        public static final String  findMediicinecabinetInventoryByDeviceId = "/findMediicinecabinetInventoryByDeviceId";
        public static final String  findMediicinecabinetInventoryByDeviceIdPage = "/findMediicinecabinetInventoryByDeviceIdPage";
        public static final String  updateMediicinecabineInventory = "/updateMediicinecabineInventory";
        public static final String  updateMediicinecabineInventory = "/updateMediicinecabineInventory";
        public static final String selectMediicinecabineInventoryById="/selectMediicinecabineInventoryById";
        public static final String selectMediicinecabineInventoryById="/selectMediicinecabineInventoryById";
        public static final String updateMediicinecabineInventoryInfoById = "/updateMediicinecabineInventoryInfoById";
        public static final String updateMediicinecabineInventoryInfoById = "/updateMediicinecabineInventoryInfoById";

+ 12 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/a4endpoint/MedicineDeviceEndpoint.java

@ -715,6 +715,18 @@ public class MedicineDeviceEndpoint extends EnvelopRestEndpoint {
        return success(deviceService.selectById(deviceId));
        return success(deviceService.selectById(deviceId));
    }
    }
    @GetMapping(value = BaseRequestMapping.BaseDevice.findMediicinecabinetInventoryByDeviceIdPage)
    @ApiOperation(value = "根据设备id查询设备轨道数据", notes = "根据设备id查询设备轨道数据")
    public PageEnvelop findMediicinecabinetInventoryByDeviceIdPage(
            @ApiParam(name = "deviceId", value = "设备id", required = true)
            @RequestParam(value = "deviceId", required = true) String deviceId,
            @ApiParam(name = "page", value = "设备id", required = true)
            @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "pageSize", value = "设备id", required = true)
            @RequestParam(value = "pageSize", required = true) Integer pageSize) throws Exception {
            return deviceService.selectByIdPage(deviceId,page,pageSize);
    }
    @PostMapping(value = BaseRequestMapping.BaseDevice.updateMediicinecabineInventory)
    @PostMapping(value = BaseRequestMapping.BaseDevice.updateMediicinecabineInventory)
    @ApiOperation(value = "更换商品,或者设定商品", notes = "更换商品,或者设定商品")
    @ApiOperation(value = "更换商品,或者设定商品", notes = "更换商品,或者设定商品")
    public Envelop updateMediicinecabineInventory(
    public Envelop updateMediicinecabineInventory(

+ 101 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/a3service/MedicinedeviceService.java

@ -4642,6 +4642,107 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi
        return  array;
        return  array;
    }
    }
    /**
     * 根据设备id查询设备轨道数据
     *
     * @param deviceId
     * @return
     */
    public PageEnvelop selectByIdPage(String deviceId,Integer page,Integer pageSize){
        page = page>0?page-1:0;
        String sql = "  SELECT\n" +
                "t.id AS id,\n" +
                "t.id_device AS idDevice,\n" +
                "t.num AS num,\n" +
                "t.sku AS sku,\n" +
                "t.state AS state,\n" +
                "t.longtime AS longtime,\n" +
                "t.drug_id AS drugId,\n" +
                "t.drug_sku AS drugSku,\n" +
                "t.drug_code AS drugCode,\n" +
                "t.org_code AS orgCode,\n" +
                "t.layer_no AS layerNo,\n" +
                "t.wayer_no AS wayerNo,\n" +
                "t.qty AS qty,\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.drug_name AS drugName,\n" +
                "t.cargo_capacity AS cargoCapacity,\n" +
                "t.shelf_status AS shelfStatus,\n" +
                "t.price AS price,\n" +
                "t.pic AS pic,\n" +
                "t.equ_num AS equNum,\n" +
                "t.`merge` AS `merge`,\n" +
                "t.cargo_state AS cargoState,\n" +
                "d.specif AS specif,\n" +
                "t.fault_state AS faultState\n" ;
        String sqlCount = " select count(t.id) as total ";
        String sqlTab =
                    "FROM\n" +
                    "\tt_mediicinecabinet_inventory t left join t_mediicine_drugs d on d.id = t.drug_id  \n" +
                    "WHERE\n" +
                    "\tt.id_device = '" +deviceId + "'\n" +
                    "ORDER BY\n" +
                    "cast(t.layer_no AS UNSIGNED),cast(t.wayer_no AS UNSIGNED)\n";
        sql = sql+sqlTab+" limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        Long total = jdbcTemplate.queryForObject(sqlCount+sqlTab,Long.class);
        {
            sql = "SELECT\n" +
                    "\tlayer_no AS layerNo\n" +
                    "FROM\n" +
                    "\tt_mediicinecabinet_inventory\n" +
                    "WHERE\n" +
                    "\tid_device = '" + deviceId +"'\n" +
                    "GROUP BY\n" +
                    "\tlayer_no\n" +
                    "ORDER BY\n" +
                    "\tcast(layer_no AS UNSIGNED)";
        }
        List<Map<String,Object>> maps = hibenateUtils.createSQLQuery(sql);
        JSONArray array = new JSONArray();
        for (Map<String,Object> map:maps){
            String id = map.get("layerNo").toString();
            JSONObject object = new JSONObject();
            JSONArray jsonArray = new JSONArray();
            Map<String, Object> tempInventory = new HashMap<>();
            for (Map<String, Object> inventoryMap :list){
                if ("21".equals(inventoryMap.get("state").toString())) {
                    tempInventory = inventoryMap;
                }
                if ("20".equals(inventoryMap.get("state").toString())) {
                    if (tempInventory != null) {
                        if (tempInventory.get("cargoCapacity") != null && !StringUtils.isEmpty(tempInventory.get("cargoCapacity").toString())) {
                            inventoryMap.put("cargoCapacity", tempInventory.get("cargoCapacity").toString());
                        }
                        if (tempInventory.get("price") != null && !StringUtils.isEmpty(tempInventory.get("price").toString())) {
                            inventoryMap.put("price", tempInventory.get("price").toString());
                        }
                        if (tempInventory.get("drugName") != null && !StringUtils.isEmpty(tempInventory.get("drugName").toString())) {
                            inventoryMap.put("drugName", tempInventory.get("drugName").toString());
                        }
                        if (tempInventory.get("qty") != null && !StringUtils.isEmpty(tempInventory.get("qty").toString())) {
                            inventoryMap.put("qty", tempInventory.get("qty").toString());
                        }
                    }
                }
                if (id.equalsIgnoreCase(inventoryMap.get("layerNo").toString())){
                    jsonArray.add(inventoryMap);
                }
            }
            object.put(id,jsonArray);
            array.add(object);
        }
        return PageEnvelop.getSuccessListWithPage("success",array,page,pageSize,total);
    }
    /**
    /**
     * 更换商品,或者设定商品
     * 更换商品,或者设定商品