瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

wangzhinan 7 年之前
父節點
當前提交
bcb3787927

+ 115 - 36
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/rehabilitation/RehabilitationManageService.java

@ -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";//康复管理-康复计划列表
@ -323,7 +341,7 @@ public class RehabilitationManageService extends BaseService {
     * @throws Exception
     */
    public JSONObject patientRehabilitationDetail(String patientCode) throws Exception{
        Map<String, Object> param = new HashedMap();
        List<SignFamily> list = signFamilyDao.findByPatientAndExpensesStatusAndStatus(patientCode,"1",1);
        String healthDoctor = null;
        String healthDoctorName =null;
@ -333,6 +351,8 @@ public class RehabilitationManageService extends BaseService {
        Integer age = null;
        String sex = null;
        String signHospitalName = null;
        JSONObject json = null;
        Patient patient = patientDao.findByCode(patientCode);
        if(list.size()>0){
            SignFamily signFamily = list.get(0);
            healthDoctor = signFamily.getDoctorHealth();
@ -340,43 +360,56 @@ public class RehabilitationManageService extends BaseService {
            generalDoctor = signFamily.getDoctor();
            generalDoctorName = signFamily.getDoctorName();
            patientName = signFamily.getName();
            age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
            sex = IdCardUtil.getSexForIdcard_new(signFamily.getIdcard());
            signHospitalName = signFamily.getHospitalName();
        }
        param.put("patientCode", patientCode);
        param.put("healthDoctor", healthDoctor);
        param.put("healthDoctorName", healthDoctorName);
        param.put("generalDoctor", generalDoctor);
        param.put("generalDoctorName", generalDoctorName);
        HttpResponse response = HttpUtils.doGet(specialistUrl + patientRehabilitationDetail, param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            JSONObject json = result.getJSONObject("obj").getJSONObject("patientInfo");
            json.put("patientName",patientName);
            json.put("age",age);
            json.put("sex",sex);
            String healthyConditionSql =" select  label_name,label from wlyy_sign_patient_label_info where status=1 and patient='"+patientCode+"' and label_type=8";
            List<Map<String,Object>> healthyConditionList = jdbcTemplate.queryForList(healthyConditionSql);
            String healthyCondition = healthyConditionList.size()>0?healthyConditionList.get(0).get("label_name")+"":"";
            String healthyConditionType = healthyConditionList.size()>0?healthyConditionList.get(0).get("label")+"":"";
            json.put("healthyCondition",healthyCondition);
            json.put("healthyConditionType",healthyConditionType);
            json.put("signHospitalName",signHospitalName);
            Patient patient = patientDao.findByCode(patientCode);
            json.put("photo",patient.getPhoto());
            json.put("mobile",patient.getMobile());
            JSONArray jsonArray = result.getJSONObject("obj").getJSONArray("serviceDoctorList");
            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():"");
            Map<String, Object> param = new HashedMap();
            param.put("patientCode", patientCode);
            param.put("healthDoctor", healthDoctor);
            param.put("healthDoctorName", healthDoctorName);
            param.put("generalDoctor", generalDoctor);
            param.put("generalDoctorName", generalDoctorName);
            HttpResponse response = HttpUtils.doGet(specialistUrl + patientRehabilitationDetail, param);
            JSONObject result = new JSONObject(response.getContent());
            if(result.getInt("status")==200){
                json = result.getJSONObject("obj").getJSONObject("patientInfo");
                json.put("patientName",patientName);
                String healthyConditionSql =" select  label_name,label from wlyy_sign_patient_label_info where status=1 and patient='"+patientCode+"' and label_type=8";
                List<Map<String,Object>> healthyConditionList = jdbcTemplate.queryForList(healthyConditionSql);
                String healthyCondition = healthyConditionList.size()>0?healthyConditionList.get(0).get("label_name")+"":"";
                String healthyConditionType = healthyConditionList.size()>0?healthyConditionList.get(0).get("label")+"":"";
                json.put("healthyCondition",healthyCondition);
                json.put("healthyConditionType",healthyConditionType);
                json.put("signHospitalName",signHospitalName);
                age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
                sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
                json.put("patientCode", patientCode);
                json.put("patientName", patient.getName());
                json.put("age",age);
                json.put("sex",sex);
                json.put("photo",patient.getPhoto());
                json.put("mobile",patient.getMobile());
                JSONArray jsonArray = result.getJSONObject("obj").getJSONArray("serviceDoctorList");
                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 result.getJSONObject("obj").put("patientInfo",json);
            }
            return result.getJSONObject("obj").put("patientInfo",json);
            throw new Exception("请求微服务失败!");
        }else{
            json = new JSONObject();
        }
        throw new Exception("请求微服务失败!");
        age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
        sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
        json.put("patientCode", patientCode);
        json.put("patientName", patient.getName());
        json.put("age",age);
        json.put("sex",sex);
        json.put("photo",patient.getPhoto());
        json.put("mobile",patient.getMobile());
        return new JSONObject().put("patientInfo",json) ;
    }
    /**
@ -404,8 +437,46 @@ 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)){
            //生成二维码图片
            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();
                }
            }
        }
        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());
@ -454,7 +525,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("请求微服务失败!");
    }

+ 51 - 78
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

@ -2,96 +2,69 @@
"button":[
   {
	  "name":"家庭医生",
	  "sub_button":[
	      {
            "type":"view",
            "name":"健康评估",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkpg%2fhtml%2fjkpg.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
          },
		  {
			"type":"view",
			"name":"签约管理",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fqygl%2fhtml%2fsigning_management.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生咨询",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszx%2fhtml%2fdoctor-consultation.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生指导",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszd%2fhtml%2fdoctor-guidance.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
            "type":"view",
            "name":"健康文章",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjy%2fhtml%2farticle_list.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
          }
	  ]
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fhome%2fhtml%2findex.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
   },
   {
	  "name":"健康管理",
	  "name":"快捷服务",
	  "sub_button":[
		 {
			  "type":"view",
			  "name":"预约挂号",
			  "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fappointment-register.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		 },
         		"type":"view",
         		"name":"预约挂号",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fappointment-register.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
            	"type":"view",
         	    "name":"医生咨询",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszx%2fhtml%2fdoctor-consultation.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
               "type":"view",
               "name":"健康记录",
               "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjl%2fhtml%2fhealth-record.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                "type":"view",
               	"name":"健康评估",
               	"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkpg%2fhtml%2fjkpg.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"view",
                "name":"康复管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fkfgl%2fhtml%2frecover_manage.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		{
			"type":"click",
			"name":"健康档案",
			"key":"jiankangdangan"
		},
         {
            "type":"view",
            "name":"疾病社区",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjbsq%2fhtml%2fdisease-community.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
        {
                    "type":"click",
                    "name":"妇幼保健",
                    "key":"fuyoubaojian"
        }
                "type":"view",
                "name":"慢病管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjbsq%2fhtml%2fslow-disease-manage.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	  ]
   },
   {
	  "name":"我的",
	  "sub_button":[
		{
		   "type":"view",
		   "name":"集美家签特色",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fdist%2fhtml%2fexclusive-service.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
		{
           "type":"view",
           "name":"电子健康卡",
           "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-health-card.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
		{
		   "type":"view",
		   "name":"我的资料",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-detail.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
        {
           "type":"view",
           "name":"我的家庭",
           "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjtgx%2fhtml%2ffamily.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
		{
		   "type":"view",
		   "name":"我的设备",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdsb%2fhtml%2fmy-equipments.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		}
	     {
         		"type":"view",
         		"name":"集美家签特色",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fdist%2fhtml%2fexclusive-service.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
                "type":"view",
                "name":"电子健康卡",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-health-card.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
        		"type":"view",
        		"name":"我的资料",
        		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-detail.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
        	    "type":"view",
        	    "name":"健康银行",
        	    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjf%2fhtml%2funopened.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"click",
                "name":"用户指南",
                "key":"caozuoshuoming"
         }
	 ]
  }],
    "matchrule":{
      "tag_id":"103"
      }
  }
]
}