|
@ -8,6 +8,7 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
import com.yihu.jw.file_upload.FileUploadService;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.restmodel.iot.common.UploadVO;
|
|
import com.yihu.jw.restmodel.iot.common.UploadVO;
|
|
|
|
import com.yihu.jw.wechat.service.WxAccessTokenService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -43,6 +44,10 @@ public class QrcodeUtil {
|
|
private String fastdfs_file_url;
|
|
private String fastdfs_file_url;
|
|
@Autowired
|
|
@Autowired
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
|
|
|
|
@Autowired
|
|
|
|
private WxAccessTokenService wxAccessTokenService;
|
|
|
|
@Value("${wechat.id}")
|
|
|
|
private String wxId;
|
|
|
|
|
|
//获取设备二维码前缀
|
|
//获取设备二维码前缀
|
|
// https://hlw.xmdsyy.cn/hlw/ims-wx/#/healthRecords/deviceBind?SN=&deviceId=
|
|
// https://hlw.xmdsyy.cn/hlw/ims-wx/#/healthRecords/deviceBind?SN=&deviceId=
|
|
@ -57,14 +62,20 @@ public class QrcodeUtil {
|
|
//生成设备的小程序二维码 flag 是否强制生成
|
|
//生成设备的小程序二维码 flag 是否强制生成
|
|
public String makeDeviceXcxQrcode(DeviceDetail device, List<DeviceDetail> deviceDetailList,boolean flag){
|
|
public String makeDeviceXcxQrcode(DeviceDetail device, List<DeviceDetail> deviceDetailList,boolean flag){
|
|
try {
|
|
try {
|
|
// String token = wxAccessTokenService.getWxAppletsAccessTokenById(wxId).getAccessToken();
|
|
|
|
|
|
//pages/patient/index?redirectUrl=healthRecords/deviceBind?SN=06B52305030388&deviceId=18
|
|
|
|
String token = wxAccessTokenService.getWxAppletsAccessTokenById(wxId).getAccessToken();
|
|
String url = devicePriUrl();
|
|
String url = devicePriUrl();
|
|
if (device!=null){
|
|
if (device!=null){
|
|
if (flag||StringUtils.isBlank(device.getQrcode())){
|
|
if (flag||StringUtils.isBlank(device.getQrcode())){
|
|
|
|
// 通过微信接口生成医生二维码
|
|
|
|
// String fileName = device.getDeviceCode()+".png";
|
|
|
|
// String page = "pages/patient/index";
|
|
|
|
// String scene = "redirectUrl="+URLEncoder.encode("healthRecords/deviceBind?SN="+device.getDeviceCode()+"&deviceId="+device.getCategoryCode(),"UTF-8");
|
|
|
|
// String qrcode = makeXcxQrcodeFromWx(fileName,page,scene,token);
|
|
InputStream ipt = com.yihu.jw.util.common.QrcodeUtil.createQrcode(url+device.getDeviceCode()+"&deviceId="+device.getCategoryCode(), 300, "png");
|
|
InputStream ipt = com.yihu.jw.util.common.QrcodeUtil.createQrcode(url+device.getDeviceCode()+"&deviceId="+device.getCategoryCode(), 300, "png");
|
|
String qrcode = getFullUri(ipt);
|
|
String qrcode = getFullUri(ipt);
|
|
device.setQrcode(qrcode);
|
|
device.setQrcode(qrcode);
|
|
// deviceDetailDao.save(device);
|
|
|
|
|
|
// deviceDetailDao.save(device);
|
|
return qrcode;
|
|
return qrcode;
|
|
}else {
|
|
}else {
|
|
return device.getQrcode();
|
|
return device.getQrcode();
|
|
@ -72,6 +83,10 @@ public class QrcodeUtil {
|
|
}else {
|
|
}else {
|
|
for (DeviceDetail deviceTmp : deviceDetailList) {
|
|
for (DeviceDetail deviceTmp : deviceDetailList) {
|
|
if (StringUtils.isBlank(deviceTmp.getQrcode())){
|
|
if (StringUtils.isBlank(deviceTmp.getQrcode())){
|
|
|
|
// String fileName = device.getDeviceCode()+".png";
|
|
|
|
// String page = "pages/patient/index";
|
|
|
|
// String scene = "redirectUrl="+URLEncoder.encode("healthRecords/deviceBind?SN="+device.getDeviceCode()+"&deviceId="+device.getCategoryCode(),"UTF-8");
|
|
|
|
// String qrcode = makeXcxQrcodeFromWx(fileName,page,scene,token);
|
|
InputStream ipt = com.yihu.jw.util.common.QrcodeUtil.createQrcode(url+deviceTmp.getDeviceCode()+"&deviceId="+device.getCategoryCode(), 300, "png");
|
|
InputStream ipt = com.yihu.jw.util.common.QrcodeUtil.createQrcode(url+deviceTmp.getDeviceCode()+"&deviceId="+device.getCategoryCode(), 300, "png");
|
|
String qrcode = getFullUri(ipt);
|
|
String qrcode = getFullUri(ipt);
|
|
deviceTmp.setQrcode(qrcode);
|
|
deviceTmp.setQrcode(qrcode);
|