|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.wlyy.service.specialist.rehabilitation;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
@ -14,6 +15,8 @@ import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.util.QrcodeUtil;
|
|
|
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
|
|
|
import com.yihu.wlyy.util.http.HttpResponse;
|
|
|
import com.yihu.wlyy.util.http.HttpUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
@ -28,7 +31,10 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@ -41,6 +47,14 @@ import java.util.Map;
|
|
|
public class RehabilitationManageService extends BaseService {
|
|
|
@Value("${specialist.url}")
|
|
|
private String specialistUrl;
|
|
|
@Value("${wechat.wechat_base_url}")
|
|
|
private String wechat_base_url;
|
|
|
@Value("${wechat.appId}")
|
|
|
private String appId;
|
|
|
@Value("${neiwang.enable}")
|
|
|
private Boolean isneiwang; //如果不是内网项目要转到到内网wlyy在上传
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
private String fastdfs_file_url;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
@ -59,6 +73,10 @@ public class RehabilitationManageService extends BaseService {
|
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
|
@Autowired
|
|
|
private WeiXinAccessTokenUtils accessTokenUtils;
|
|
|
@Autowired
|
|
|
protected HttpServletRequest request;
|
|
|
@Autowired
|
|
|
private com.yihu.wlyy.util.CommonUtil CommonUtil;
|
|
|
|
|
|
/************************************************************* start ************************************************************************/
|
|
|
private String findRehabilitationPlanList = "/svr-specialist/findRehabilitationPlanList";//康复管理-康复计划列表
|
|
@ -419,8 +437,47 @@ public class RehabilitationManageService extends BaseService {
|
|
|
|
|
|
public String createServiceQrCode(String planDetailId,String doctorCode) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
String fileUrl = "";
|
|
|
String sql ="SELECT service_qr_code FROM wlyy_specialist.wlyy_rehabilitation_plan_detail where id='"+planDetailId+"'";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if(list!=null && list.size()>0){
|
|
|
fileUrl = String.valueOf(list.get(0).get("service_qr_code"));
|
|
|
}
|
|
|
if (StringUtils.isEmpty(fileUrl) || "null".equals(fileUrl)){
|
|
|
//生成二维码图片
|
|
|
String contentJsonStr="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wechat_base_url+"/wx/html/kfgl/html/confirm-service.html"+"?paramStr="+planDetailId+","+doctorCode+"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
|
|
InputStream ipt = QrcodeUtil.createQrcode(contentJsonStr, 300, "png");
|
|
|
if (isneiwang) {
|
|
|
// 圖片列表
|
|
|
List<String> tempPaths = new ArrayList<String>();
|
|
|
try {
|
|
|
ObjectNode imgNode = FastDFSUtil.upload(ipt, "png", "plan_service_qrcode" + System.currentTimeMillis());
|
|
|
com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
|
|
|
tempPaths.add(json.getString("fid"));
|
|
|
String urls = "";
|
|
|
for (String image : tempPaths) {
|
|
|
if (urls.length() == 0) {
|
|
|
urls = image;
|
|
|
} else {
|
|
|
urls += "," + image;
|
|
|
}
|
|
|
}
|
|
|
fileUrl = fastdfs_file_url + urls;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
} else {
|
|
|
try {
|
|
|
fileUrl = fastdfs_file_url + CommonUtil.PrescriptionQRCodetoNeiWang(ipt);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
System.out.println("服务码-----------1"+fileUrl);
|
|
|
param.put("planDetailId", planDetailId);
|
|
|
param.put("doctorCode", doctorCode);
|
|
|
param.put("imageUrl",fileUrl);
|
|
|
//specialistUrl= "http://localhost:10051";
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + createServiceQrCode, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
@ -469,7 +526,15 @@ public class RehabilitationManageService extends BaseService {
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceDoctorList, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
if(result.getInt("status")==200){
|
|
|
return result.getJSONArray("obj");
|
|
|
JSONArray jsonArray = result.getJSONArray("obj");
|
|
|
String doctorCode ="";
|
|
|
Doctor doctor = null;
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
doctorCode = jsonArray.getJSONObject(i).get("doctorCode")+"";
|
|
|
doctor = doctorDao.findByCode(doctorCode);
|
|
|
jsonArray.getJSONObject(i).put("doctorPhoto",doctor!=null?doctor.getPhoto():"");
|
|
|
}
|
|
|
return jsonArray;
|
|
|
}
|
|
|
throw new Exception("请求微服务失败!");
|
|
|
}
|
|
@ -550,7 +615,9 @@ public class RehabilitationManageService extends BaseService {
|
|
|
param.put("image", image);
|
|
|
//specialistUrl= "http://localhost:10051";
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + updateNoteAndImageRehabilitationOperate, param);
|
|
|
System.out.println("返回数据=======1===="+response);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
System.out.println("返回数据=======2===="+result);
|
|
|
if(result.getInt("status") == 200){
|
|
|
JSONObject object = result.getJSONObject("obj");
|
|
|
//保存wlyy_message
|