Trick 5 лет назад
Родитель
Сommit
3762e3416b

+ 41 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -514,6 +514,47 @@ public class XzzxEntranceService {
        }
    }
    public String sendXCXMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String miniProgramPagepath,String miniProgramAppId){
        JSONObject params = new JSONObject();
        params.put("transType","sms.hospital.notice");
        params.put("merchId","3501000014");
        params.put("miniProgramPagepath",miniProgramPagepath);
        params.put("miniProgramAppId",miniProgramAppId);
        JSONObject p = new JSONObject();
        String openId = "";
        if(StringUtils.isNotBlank(patient)){
            List<BasePatientWechatDo> paientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient);
            if(paientWechatDos!=null&&paientWechatDos.size()>0){
                openId = paientWechatDos.get(0).getOpenid();
                p.put("openId",openId);
            }
        }else {
            p.put("cardNo",cardNo);
        }
        p.put("first",first);
        p.put("noticeTime", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
        p.put("noticeContent",noticeContent);
        p.put("remark",remark);
        params.put("param",p);
        logger.info("params :"+params.toString());
        if(StringUtils.isNotBlank(openId)||StringUtils.isNotBlank(cardNo)){
            String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
            logger.info("rs :"+rs);
            JSONObject rsJson = JSON.parseObject(rs);
            String resCode = rsJson.getString("resCode");
            if("000".equals(resCode)){
                return "1";
            }
            return "0";
        }else {
            return "-1";
        }
    }
//=====================微信模板消息推送接口================================
}

+ 37 - 37
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -469,48 +469,48 @@ public class EnterpriseService {
//
//    }
    public static void main(String args[])throws Exception{
        String corpsecret = "Uo-QnbYthpUC0tZt--l71n3QEafT3g2oH_j4mLjCokU";
        String corpid = "ww4bf28f7a26e67fee";
        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+corpid+"&corpsecret="+corpsecret);
        JSONObject json = JSONObject.parseObject(result);
        String token = json.getString("access_token");
//        String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token="+token;
//    public static void main(String args[])throws Exception{
//
//        String rs = HttpUtil.sendGet(url);
//        String corpsecret = "Uo-QnbYthpUC0tZt--l71n3QEafT3g2oH_j4mLjCokU";
//
//        JSONObject r = JSONObject.parseObject(rs);
//        String corpid = "ww4bf28f7a26e67fee";
//
//        JSONArray depts = r.getJSONArray("department");
//        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+corpid+"&corpsecret="+corpsecret);
//
//        String deptStr ="";
//        JSONObject json = JSONObject.parseObject(result);
//
//        if(depts!=null&&depts.size()>0){
//            for(int i=0;i<depts.size();i++){
//                JSONObject dept = (JSONObject) depts.get(i);
//                deptStr+=dept.getString("id")+"|";
//            }
//           deptStr = deptStr.substring(0,deptStr.length()-1);
//        }
//        System.out.println("deptStr"+deptStr);
        String userUrl ="https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+token+"&department_id=20&fetch_child=FETCH_CHILD";
        String users = HttpUtil.sendGet(userUrl);
        JSONObject us = JSONObject.parseObject(users);
        JSONArray list = us.getJSONArray("userlist");
        System.out.println("list"+list.size());
    }
//        String token = json.getString("access_token");
//
////        String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token="+token;
////
////        String rs = HttpUtil.sendGet(url);
////
////        JSONObject r = JSONObject.parseObject(rs);
////
////        JSONArray depts = r.getJSONArray("department");
////
////        String deptStr ="";
////
////        if(depts!=null&&depts.size()>0){
////            for(int i=0;i<depts.size();i++){
////                JSONObject dept = (JSONObject) depts.get(i);
////                deptStr+=dept.getString("id")+"|";
////            }
////           deptStr = deptStr.substring(0,deptStr.length()-1);
////        }
////        System.out.println("deptStr"+deptStr);
//
//        String userUrl ="https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+token+"&department_id=20&fetch_child=FETCH_CHILD";
//
//        String users = HttpUtil.sendGet(userUrl);
//
//        JSONObject us = JSONObject.parseObject(users);
//
//        JSONArray list = us.getJSONArray("userlist");
//
//        System.out.println("list"+list.size());
//
//    }
}

+ 6 - 0
server/svr-authentication/pom.xml

@ -176,6 +176,12 @@
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <!--<version>RELEASE</version>-->
        </dependency>
    </dependencies>
    <build>

+ 15 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -1338,5 +1338,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        return ObjEnvelop.getError("手机号未注册!");
    }
    @RequestMapping(value = "/oauth/updateDoctorMoble", method = RequestMethod.POST)
    public Envelop updateDoctorMoble(String id,String mobile,String client_id,String captcha){
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
        }
        String rs = registerService.updateDoctorMoble(id,mobile);
        if("ok".equals(rs)){
            return ObjEnvelop.getSuccess("修改成功!");
        }
        return ObjEnvelop.getError("手机号未注册!");
    }
}

+ 44 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/FileUploadService.java

@ -5,14 +5,24 @@ import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.exception.business.file_upload.*;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
@ -188,5 +198,39 @@ public class FileUploadService {
        return uploadVO;
    }
    public String request(String remote_url, MultipartFile file, String type) {
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        String result = "";
        try {
            String fileName = file.getOriginalFilename();
            HttpPost httpPost = new HttpPost(remote_url);
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.addBinaryBody("file", file.getInputStream(), ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
            builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
            if (!org.springframework.util.StringUtils.isEmpty(type)) {
                builder.addTextBody("type", type); //发送类型
            }
            HttpEntity entity = builder.build();
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost);// 执行提交
            HttpEntity responseEntity = response.getEntity();
            if (responseEntity != null) {
                // 将响应内容转换为字符串
                result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
}

+ 55 - 9
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -1,6 +1,8 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.restmodel.iot.common.UploadVO;
@ -20,8 +22,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import java.io.InputStream;
@ -47,6 +51,15 @@ public class OauthYlzConfigService {
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Value("${testPattern.sign}")
    private String isClose;
    @Value("${testPattern.remote_inner_url}")
    private String remote_inner_url;
    @Autowired
    private ObjectMapper objectMapper;
    public Map<String,Object> getOauthQRCode(){
        try {
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
@ -63,26 +76,54 @@ public class OauthYlzConfigService {
            bizContent.put("out_authorize_no", no);
            bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
            e.setBiz_content(JSON.toJSONString(bizContent));
            String param = com.alibaba.fastjson.JSONObject.toJSONString(e);
            logger.info("TransRequest :"+param);
            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            logger.info("TransResponse:"+rs);
            logger.info("TransResponse :"+rs);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
            InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
            logger.info("fastdfs_file_url:"+fastdfs_file_url);
            UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
            Map<String,Object> map = new HashedMap();
            map.put("fileName",uploadVO.getFileName());
            map.put("fileType",uploadVO.getFileType());
            map.put("fullUrl",uploadVO.getFullUrl());
            map.put("fullUri",uploadVO.getFullUri());
            map.put("out_authorize_no",no);
            logger.info("fileUploadService:"+map.toString());
            if(isClose.equals("2")){
                //内网上传
                MultipartFile file = new MockMultipartFile("qrcode.jpg","qrcode.jpg","qrcode.jpg",qrcode);
                String rsJson = fileUploadService.request(remote_inner_url,file,null);
                logger.info("内网上传"+rsJson);
                JSONObject uploadJson = JSON.parseObject(rsJson);
                UploadVO uploadVO = objectMapper.readValue(uploadJson.getJSONObject("obj").toJSONString(),UploadVO.class);
                map.put("fileName",uploadVO.getFileName());
                map.put("fileType",uploadVO.getFileType());
                map.put("fullUrl",uploadVO.getFullUrl());
                map.put("fullUri",uploadVO.getFullUri());
                map.put("out_authorize_no",no);
                logger.info("fileUploadService:"+map.toString());
            }else {
                // 得到文件的完整名称  xxx.txt
                logger.info("fastdfs_file_url:"+fastdfs_file_url);
                UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
                map = new HashedMap();
                map.put("fileName",uploadVO.getFileName());
                map.put("fileType",uploadVO.getFileType());
                map.put("fullUrl",uploadVO.getFullUrl());
                map.put("fullUri",uploadVO.getFullUri());
                map.put("out_authorize_no",no);
                logger.info("fileUploadService:"+map.toString());
            }
            return map;
        } catch (Exception var5) {
            logger.info("获取电子健康卡图片异常");
            var5.printStackTrace();
        }
@ -107,10 +148,15 @@ public class OauthYlzConfigService {
            bizContent.put("out_authorize_no", no);
            bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
            e.setBiz_content(JSON.toJSONString(bizContent));
            String param = com.alibaba.fastjson.JSONObject.toJSONString(e);
            logger.info("TransRequest :"+param);
            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            logger.info("TransResponse:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS")+" "+rs);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");

+ 8 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java

@ -151,6 +151,14 @@ public class RegisterService {
        return "ok";
    }
    public String updateDoctorMoble(String id,String mobile){
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        //认证信息设置
        doctorDO.setMobile(mobile);
        baseDoctorDao.save(doctorDO);
        return "ok";
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();

+ 20 - 1
server/svr-authentication/src/main/resources/application.yml

@ -64,6 +64,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwtest
@ -83,6 +87,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwprod
@ -102,6 +110,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://192.0.33.26:22122
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
## 心脏中心外网
spring:
@ -122,7 +134,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.16.100.240:22122
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 2
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
## 卫计委
spring:
@ -143,3 +158,7 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://192.168.103.159:22122
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 1
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream

+ 1 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/file_upload/FileUploadEndpoint.java

@ -61,6 +61,7 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
        UploadVO uploadVO = new UploadVO();
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);

+ 11 - 1
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -32,7 +32,7 @@ spring:
      min-idle: 5  # 连接池中的最小空闲连接
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
#  tracker-server: 172.26.0.110:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
@ -86,6 +86,8 @@ im:
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -116,6 +118,8 @@ im:
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -143,6 +147,8 @@ im:
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -179,6 +185,8 @@ im:
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -209,6 +217,8 @@ im:
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.168.103.159:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0

+ 20 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -620,7 +620,26 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                           @RequestParam(value = "redirectUrl", required = true)String redirectUrl) {
        return success(xzzxEntranceService.sendMes(wxId,patient,cardNo,first,noticeContent,remark,redirectUrl));
    }
    @PostMapping(value = "/sendXCXMes")
    @ApiOperation(value = "心脏模板消息推送小程序跳转", notes = "心脏模板消息推送小程序跳转")
    public Envelop sendXCXMes(@ApiParam(name = "wxId", value = "wxId")
                           @RequestParam(value = "wxId", required = true)String wxId,
                           @ApiParam(name = "patient", value = "居民ID")
                           @RequestParam(value = "patient", required = false)String patient,
                           @ApiParam(name = "cardNo", value = "卡号")
                           @RequestParam(value = "cardNo", required = false)String cardNo,
                           @ApiParam(name = "first", value = "头部")
                           @RequestParam(value = "first", required = true)String first,
                           @ApiParam(name = "noticeContent", value = "内容")
                           @RequestParam(value = "noticeContent", required = true)String noticeContent,
                           @ApiParam(name = "remark", value = "备注")
                           @RequestParam(value = "remark", required = true)String remark,
                           @ApiParam(name = "redirectUrl", value = "跳转链接")
                           @RequestParam(value = "redirectUrl", required = true)String miniProgramPagepath,
                           @ApiParam(name = "miniProgramAppId", value = "APPID")
                           @RequestParam(value = "miniProgramAppId", required = true)String miniProgramAppId  ) {
        return success(xzzxEntranceService.sendXCXMes( wxId, patient, cardNo, first, noticeContent, remark, miniProgramPagepath, miniProgramAppId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientInfo)
    @ApiOperation(value = "获取居民信息接口", notes = "获取居民信息接口")