|
@ -16,6 +16,7 @@ import com.yihu.jw.entity.base.role.RoleDO;
|
|
import com.yihu.jw.entity.base.user.UserDO;
|
|
import com.yihu.jw.entity.base.user.UserDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
|
|
import com.yihu.jw.util.common.LatitudeUtils;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
@ -80,6 +81,9 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
@Autowired
|
|
@Autowired
|
|
private MediicinewarrayDao mediicinewarrayDao;
|
|
private MediicinewarrayDao mediicinewarrayDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private MediicineorderDao mediicineorderDao;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设备出货服务,创建设备,创建库存内容
|
|
* 设备出货服务,创建设备,创建库存内容
|
|
@ -365,6 +369,13 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
return result.toJSONString();
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
mediicinedevice.setDeliveryAddress(address);
|
|
mediicinedevice.setDeliveryAddress(address);
|
|
|
|
Map<String,String> map = LatitudeUtils.getGeocoderLatitude(address);
|
|
|
|
if (map!=null){
|
|
|
|
String lng = map.get("lng");
|
|
|
|
String lat = map.get("lat");
|
|
|
|
mediicinedevice.setLng(lng);
|
|
|
|
mediicinedevice.setLat(lat);
|
|
|
|
}
|
|
this.save(mediicinedevice);
|
|
this.save(mediicinedevice);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@ -403,7 +414,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
/**
|
|
/**
|
|
* 更新设备升级情况
|
|
* 更新设备升级情况
|
|
* @param deviceId
|
|
* @param deviceId
|
|
* @param status
|
|
|
|
|
|
* @param UpgrAdesitContent
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@ -733,7 +744,7 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
/**
|
|
/**
|
|
* 货道开启与关闭
|
|
* 货道开启与关闭
|
|
* @param cargoIds
|
|
* @param cargoIds
|
|
* @param isMerge
|
|
|
|
|
|
* @param cargoState
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public String openAndCloseCargo(String cargoIds, String cargoState){
|
|
public String openAndCloseCargo(String cargoIds, String cargoState){
|
|
@ -3411,4 +3422,68 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
return inventory;
|
|
return inventory;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 物联网大屏统计数据
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject getDeviceList(){
|
|
|
|
Long total = deviceDao.countAll();//总设备
|
|
|
|
Long usedTotal = deviceDao.countAllAndBelongCommunity();//已使用设备
|
|
|
|
Long notUsedTotal = deviceDao.countAllAndBelongCommunityAndDevice();//未使用设备
|
|
|
|
List<Mediicinedevice> mediicinedeviceList = deviceDao.selectByBelongComminity();//查询已使用设备
|
|
|
|
JSONObject object = new JSONObject();
|
|
|
|
object.put("total",total);
|
|
|
|
object.put("usedTotal",usedTotal);
|
|
|
|
object.put("notUsedTotal",notUsedTotal);
|
|
|
|
object.put("usedDeviceList",mediicinedeviceList);
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 物联网大屏单个设备信息数据
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public JSONObject getDeviceInfo(String deviceId,Integer day){
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
|
|
|
|
jsonObject.put("device",mediicinedevice);
|
|
|
|
Date startDate = DateUtil.getPreDays(new Date(),-day);
|
|
|
|
String endTime = DateUtil.getStringDate();
|
|
|
|
String condition = " and o.shipping_time >='"+DateUtil.dateToStrLong(startDate)+"' and o.shipping_time <= '"+endTime+"' and o.shipping_equ = '"+mediicinedevice.getEquNum()+"' ";
|
|
|
|
//扫码
|
|
|
|
String saomasql = "SELECT DATE_FORMAT(o.shipping_time, \"%Y-%m-%d\") as \"date\", COUNT(1) AS \"count\" FROM " +
|
|
|
|
"t_mediicine_order o WHERE o.sell_state=1 AND o.shipping_type=1 " +condition+
|
|
|
|
"GROUP BY DATE_FORMAT(o.shipping_time, \"%Y-%m-%d\") ORDER BY DATE_FORMAT(o.shipping_time, \"%Y-%m-%d\") ASC";
|
|
|
|
//医保
|
|
|
|
String yibaosql = "SELECT DATE_FORMAT(o.shipping_time, \"%Y-%m-%d\") as \"date\", COUNT(1) AS \"count\" FROM " +
|
|
|
|
"t_mediicine_order o WHERE o.sell_state=1 AND o.shipping_type=2 " +condition+
|
|
|
|
"GROUP BY DATE_FORMAT(o.shipping_time, \"%Y-%m-%d\") ORDER BY DATE_FORMAT(o.shipping_time, \"%Y-%m-%d\") ASC";
|
|
|
|
|
|
|
|
List<Map<String,Object>> saomaList = jdbcTemplate.queryForList(saomasql);
|
|
|
|
List<Map<String,Object>> yibaoList = jdbcTemplate.queryForList(yibaosql);
|
|
|
|
jsonObject.put("saomaList",saomaList);
|
|
|
|
jsonObject.put("yibaoList",yibaoList);
|
|
|
|
|
|
|
|
String shippingTypeTotal = "SELECT o.shipping_type as \"shippingType\", COUNT(1) as \"count\" FROM t_mediicine_order o " +
|
|
|
|
" WHERE o.sell_state=1 "+condition+" GROUP BY o.shipping_type";
|
|
|
|
|
|
|
|
List<Map<String,Object>> shippingTypeList = jdbcTemplate.queryForList(shippingTypeTotal);
|
|
|
|
for (Map<String,Object> map:shippingTypeList){
|
|
|
|
if (map.get("shippingType")!=null){
|
|
|
|
String shippingType = map.get("shippingType").toString();
|
|
|
|
if (shippingType.equalsIgnoreCase("1")){
|
|
|
|
map.put("shippingTypeName","扫码");
|
|
|
|
}else if (shippingType.equalsIgnoreCase("2")){
|
|
|
|
map.put("shippingTypeName","医保");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jsonObject.put("shippingTypeTotal",shippingTypeList);
|
|
|
|
List<Mediicineorder> mediicineorderList = mediicineorderDao.findByEquNum(mediicinedevice.getEquNum());
|
|
|
|
jsonObject.put("mediicineorderList",mediicineorderList);
|
|
|
|
return jsonObject;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|