|
@ -4108,23 +4108,58 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
* 物联网大屏单个设备信息数据
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Mediicineorder> getDeviceOrderInfoPage(String deviceId,String startTime,String endTime,Integer page,Integer size) throws ParseException {
|
|
|
public List<Map<String,Object>> getDeviceOrderInfoPage(String deviceId,String startTime,String endTime,Integer page,Integer size) throws ParseException {
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
|
|
|
Sort sort = new Sort(Sort.Direction.DESC, "shippingTime");
|
|
|
PageRequest pageRequest = new PageRequest(page, size, sort);
|
|
|
List<Mediicineorder> mediicineorderList = new ArrayList<>();
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)&& org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)){
|
|
|
Date startDate = DateUtil.strToDateLong(startTime);
|
|
|
Date endDate = DateUtil.strToDateLong(endTime);
|
|
|
mediicineorderList = mediicineorderDao.findByEquNumAndDateAndPage(mediicinedevice.getEquNum(),startDate,endDate,pageRequest);
|
|
|
}else {
|
|
|
mediicineorderList = mediicineorderDao.findByEquNumAndPage(mediicinedevice.getEquNum(),pageRequest);
|
|
|
|
|
|
String sql = "SELECT\n" +
|
|
|
"\tid AS \"id\",\n" +
|
|
|
"\taddress AS \"address\",\n" +
|
|
|
"\tage AS \"age\",\n" +
|
|
|
"\tamount AS \"amount\",\n" +
|
|
|
"cargo_info as \"cargoInfo\",\n" +
|
|
|
"contact as \"contact\",\n" +
|
|
|
"dispensing_window as \"dispensingWindow\",\n" +
|
|
|
"equ_address as \"equAddress\",\n" +
|
|
|
"equ_num as \"equNum\",\n" +
|
|
|
"goods_name as \"goodsName\",\n" +
|
|
|
"id_num as \"idNum\",\n" +
|
|
|
"info_access as \"infoAccess\",\n" +
|
|
|
"name as \"name\",\n" +
|
|
|
"net_sale_amount as \"netSaleAmount\",\n" +
|
|
|
"order_amount as \"orderAmount\",\n" +
|
|
|
"order_num as \"orderNum\",\n" +
|
|
|
"order_source as \"orderSource\",\n" +
|
|
|
"order_state as \"orderState\",\n" +
|
|
|
"pick_up_num as \"pickUpNum\",\n" +
|
|
|
"prescribe_num as \"prescribeNum\",\n" +
|
|
|
"DATE_FORMAT(pay_time,'%Y-%m-%d %H:%i:%S') as \"payTime\",\n" +
|
|
|
"DATE_FORMAT(prescribe_time,'%Y-%m-%d %H:%i:%S') as \"prescribeTime\",\n" +
|
|
|
"DATE_FORMAT(shipping_time,'%Y-%m-%d %H:%i:%S') as \"shippingTime\",\n" +
|
|
|
"sell_state as \"sellState\",\n" +
|
|
|
"sex as sex,\n" +
|
|
|
"shipping_equ as shippingEqu,\n" +
|
|
|
"info as info\n" +
|
|
|
"\n" +
|
|
|
"FROM\n" +
|
|
|
"\tt_mediicine_order where shipping_equ = '"+mediicinedevice.getEquNum()+"' ";
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)){
|
|
|
sql +=" and shipping_time >='"+startTime+"' ";
|
|
|
}
|
|
|
for (Mediicineorder mediicineorder:mediicineorderList){
|
|
|
List<MedicineShipmentLog> shipmentLogs = medicineShipmentLogDao.findMedicineShipmentLogsByOrderId(mediicineorder.getId());
|
|
|
mediicineorder.setShipmentLogs(shipmentLogs);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)){
|
|
|
sql +=" and shipping_time <='"+endTime+"' ";
|
|
|
}
|
|
|
return mediicineorderList;
|
|
|
|
|
|
|
|
|
sql +=" order by shipping_time desc ";
|
|
|
|
|
|
List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,size);
|
|
|
|
|
|
|
|
|
for (Map<String,Object> map:mapList){
|
|
|
List<MedicineShipmentLog> shipmentLogs = medicineShipmentLogDao.findMedicineShipmentLogsByOrderId(map.get("id").toString());
|
|
|
map.put("shipmentLogs",shipmentLogs);
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
|