Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

chenyongxing 6 years ago
parent
commit
f91e07387d
100 changed files with 3775 additions and 1662 deletions
  1. 83 0
      business/base-service/pom.xml
  2. 22 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java
  3. 192 0
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
  4. 22 0
      business/base-service/src/main/java/com/yihu/jw/message/dao/MessageDao.java
  5. 169 0
      business/base-service/src/main/java/com/yihu/jw/message/service/MessageService.java
  6. 45 0
      business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java
  7. 2 5
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/BasePatientDao.java
  8. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java
  9. 8 8
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java
  10. 35 28
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java
  11. 16 0
      business/base-service/src/main/java/com/yihu/jw/patient/util/ConstantUtils.java
  12. 31 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WechatDao.java
  13. 17 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxAccessTokenDao.java
  14. 19 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxTemplateConfigDao.java
  15. 26 0
      business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxTemplateDao.java
  16. 115 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WeChatQrcodeService.java
  17. 157 0
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java
  18. 41 0
      business/sms-service/pom.xml
  19. 5 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/sms/SmsDao.java
  20. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/sms/SmsGatewayDao.java
  21. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/sms/SmsTemplateDao.java
  22. 118 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsGatewayService.java
  23. 29 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsService.java
  24. 15 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsTemplateService.java
  25. 16 0
      business/sms-service/src/main/java/com/yihu/jw/sms/util/ConstantUtils.java
  26. 19 21
      common/common-entity/src/main/java/com/yihu/jw/entity/base/message/BaseMessageDO.java
  27. 100 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/AccountAppealDO.java
  28. 0 53
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  29. 11 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientFamilyMemberDO.java
  30. 113 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java
  31. 100 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/HelpCenterDO.java
  32. 87 40
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java
  33. 2 4
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java
  34. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java
  35. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/sms/SmsTemplateDO.java
  36. 100 0
      common/common-entity/src/main/java/com/yihu/jw/entity/myFamily/PatientApplyLog.java
  37. 9 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FastfdsFileURLEmptyException.java
  38. 9 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileInputStreamEmptyException.java
  39. 9 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileNameEmptyException.java
  40. 9 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileTooLargeSizeException.java
  41. 9 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileWrongFormatException.java
  42. 11 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/CapthcaInvalidException.java
  43. 11 0
      common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/NotFoundPatientException.java
  44. 33 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  45. 16 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java
  46. 83 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorOrgVO.java
  47. 374 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorSimpleVO.java
  48. 56 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/OrgDistanceVO.java
  49. 104 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/AccountAppealVO.java
  50. 117 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/FeedbackVO.java
  51. 104 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/HelpCenterVO.java
  52. 144 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/PatientMedicareCardVO.java
  53. 53 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/SerivePackageItemVO.java
  54. 149 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageVO.java
  55. 3 3
      server/svr-configuration/src/main/resources/bootstrap.yml
  56. 13 0
      svr/svr-base/pom.xml
  57. 1 2
      sql/init.sql
  58. 23 0
      svr/svr-base/src/main/java/com/yihu/jw/base/config/SpringSecurityAuditorAware.java
  59. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java
  60. 46 46
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java
  61. 31 31
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WechatDao.java
  62. 17 17
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxAccessTokenDao.java
  63. 19 19
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateConfigDao.java
  64. 26 26
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateDao.java
  65. 13 97
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java
  66. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java
  67. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WeChatQrcodeController.java
  68. 0 138
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WechatConfigController.java
  69. 0 47
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxAccessTokenController.java
  70. 0 164
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxGraphicMessageController.java
  71. 0 184
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxMenuController.java
  72. 0 148
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxTemplateController.java
  73. 47 46
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  74. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java
  75. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  76. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientFamilyMemberService.java
  77. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java
  78. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java
  79. 3 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageService.java
  80. 4 104
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sms/SmsGatewayService.java
  81. 2 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sms/SmsService.java
  82. 4 6
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sms/SmsTemplateService.java
  83. 99 98
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WeChatQrcodeService.java
  84. 2 5
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatCoreService.java
  85. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatFansService.java
  86. 4 5
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java
  87. 157 157
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxAccessTokenService.java
  88. 2 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxMenuService.java
  89. 3 125
      svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxTemplateService.java
  90. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  91. 18 1
      svr/svr-patient/pom.xml
  92. 64 0
      svr/svr-patient/sql/sql
  93. 11 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/myFamily/PatientApplyLogDao.java
  94. 29 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/myFamily/PatientFamilyMemberDao.java
  95. 29 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java
  96. 30 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientMedicareCardDao.java
  97. 2 4
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageDao.java
  98. 16 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageItemDao.java
  99. 12 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageSignRecordDao.java
  100. 0 0
      svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/settings/AccountAppealDao.java

+ 83 - 0
business/base-service/pom.xml

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>wlyy-lib-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>base-service</artifactId>
    <version>${parent.version}</version>
    <dependencies>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!--   poi xml导入导出工具 start-->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.yihu.ehr</groupId>
                    <artifactId>commons-util</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-collections4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
        </dependency>
        <!-- xlsx  依赖这个包 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 end -->
    </dependencies>
</project>

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.doctor.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 *
 * 医生基础信息 数据库访问层
 *
 * @version
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO, String>, JpaSpecificationExecutor<BaseDoctorDO>  {
}

+ 192 - 0
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -0,0 +1,192 @@
package com.yihu.jw.file_upload;
import com.fasterxml.jackson.databind.node.ObjectNode;
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.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
/**
 * 文件上传服务
 */
@Service
public class FileUploadService {
    @Autowired
    private FastDFSUtil fastDFSHelper;
    /**
     * 文件流上传图片
     * @param inputStream
     * @param originalFileName
     * @return
     * @throws Exception
     */
    public UploadVO uploadImg(InputStream inputStream, String originalFileName,long fileSize,String fastdfs_file_url) throws NoSuchAlgorithmException, IOException, MyException {
        // 得到文件的完整名称  xxx.txt
        if( null == inputStream){
            throw new FileInputStreamEmptyException("图片文件流不可为空!");
        }
        if(StringUtils.isBlank(originalFileName)){
            throw new FileNameEmptyException("图片文件名不可为空!");
        }
        if(StringUtils.isBlank(fastdfs_file_url)){
            throw new FastfdsFileURLEmptyException("fastdfs url不可为空!");
        }
        //得到文件类型
        String fileType = originalFileName.substring(originalFileName.lastIndexOf(".") + 1).toLowerCase();
        if(StringUtils.isBlank(fileType)||!"jpg,jpeg,png".contains(fileType)){
            throw new FileWrongFormatException("图片文件格式不正确,请上传jpg,jpeg,png等任一格式!");
        }
        long max = 5*1024*1024;
        if(fileSize > max){
            throw new FileTooLargeSizeException("图片文件过大,请不要超过5M!");
        }
        String fileName = originalFileName.substring(0, originalFileName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSHelper.upload(inputStream, fileType, "");
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        return uploadVO;
    }
     /*
     * 文件流上传附件
     * @param file
     * @return
     * @throws Exception
     */
    public UploadVO uploadAttachment(InputStream inputStream, String originalFileName,long fileSize,String fastdfs_file_url) throws Exception{
        // 得到文件的完整名称  xxx.txt
        if( null == inputStream){
            throw new FileInputStreamEmptyException("附件文件流不可为空!");
        }
        if(StringUtils.isBlank(originalFileName)){
            throw new FileNameEmptyException("图片文件名不可为空!");
        }
        if(StringUtils.isBlank(fastdfs_file_url)){
            throw new FastfdsFileURLEmptyException("fastdfs url不可为空!");
        }
        //得到文件类型
        String fileType = originalFileName.substring(originalFileName.lastIndexOf(".") + 1).toLowerCase();
        if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、jpg、jpeg、png".contains(fileType)){
            throw new FileWrongFormatException("附件文件格式不正确,请上传doc、docx、pdf、xls、xlsx、jpg、jpeg、png等任一格式!");
        }
        long max = 5*1024*1024;
        if(fileSize > max){
            throw new FileTooLargeSizeException("附件文件过大,请不要超过5M!");
        }
        String fileName = originalFileName.substring(0, originalFileName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSHelper.upload(inputStream, fileType, "");
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        return uploadVO;
    }
    /*
     * 文件流上传文件
     * @param file
     * @return
     * @throws Exception
     */
    public UploadVO uploadStream(InputStream inputStream, String originalFileName,String fastdfs_file_url) throws Exception{
        if( null == inputStream){
            throw new FileInputStreamEmptyException("文件内容不可为空!");
        }
        if(StringUtils.isBlank(originalFileName)){
            throw new FileNameEmptyException("文件名不可为空!");
        }
        if(StringUtils.isBlank(fastdfs_file_url)){
            throw new FastfdsFileURLEmptyException("fastdfs url不可为空!");
        }
        //得到文件类型
        String fileType = originalFileName.substring(originalFileName.lastIndexOf(".") + 1).toLowerCase();
        String fileName = originalFileName.substring(0, originalFileName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSHelper.upload(inputStream, fileType, "");
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        return uploadVO;
    }
    /*
     * base64上传图片
     * @param jsonData,头像转化后的输入流
     * @return
     * @throws Exception
     */
    public UploadVO uploadImages(String jsonData,String fastdfs_file_url) throws Exception {
        if(StringUtils.isBlank(jsonData)){
            throw new FileInputStreamEmptyException("图片的base64文件文件流不可为空!");
        }
        if(StringUtils.isBlank(fastdfs_file_url)){
            throw new FastfdsFileURLEmptyException("fastdfs url不可为空!");
        }
        String date = URLDecoder.decode(jsonData,"UTF-8");
        String[] fileStreams = date.split(",");
        String is = URLDecoder.decode(fileStreams[1],"UTF-8").replace(" ","+");
        byte[] in = Base64.getDecoder().decode(is);
        String pictureName = fileStreams[0].substring(0,fileStreams[0].length()-1);
        String fileExtension = pictureName.substring(pictureName.lastIndexOf(".") + 1).toLowerCase();
        String description = null;
        if ((pictureName != null) && (pictureName.length() > 0)) {
            int dot = pictureName.lastIndexOf('.');
            if ((dot > -1) && (dot < (pictureName.length()))) {
                description = pictureName.substring(0, dot);
            }
        }
        InputStream inputStream = new ByteArrayInputStream(in);
        ObjectNode objectNode = fastDFSHelper.upload(inputStream, "png", "");
        String groupName = objectNode.get("groupName").toString();
        String remoteFileName = objectNode.get("remoteFileName").toString();
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(remoteFileName);
        uploadVO.setFileType(groupName);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        //返回文件路径
        return uploadVO;
    }
}

+ 22 - 0
business/base-service/src/main/java/com/yihu/jw/message/dao/MessageDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.message.dao;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author liuwenbin on 2018/11/28.
 */
public interface MessageDao extends PagingAndSortingRepository<BaseMessageDO, String>, JpaSpecificationExecutor<BaseMessageDO> {
    @Query("select m from BaseMessageDO m where m.platform=?1 and m.receiver=?2 and m.saasId=?3 and m.del=1 and m.msgTypeCode like ?4 order by m.readState desc")
    List<BaseMessageDO> messageList(Integer platform, String code, String saasId,String msgTypeCode);
    @Query("select count(m.id) from BaseMessageDO m where m.platform=?1 and m.receiver=?2 and m.saasId=?3 and m.del=1 and m.msgTypeCode like ?4 and m.readState=1")
    Integer countMessage(Integer platform, String code, String saasId,String msgTypeCode);
}

+ 169 - 0
business/base-service/src/main/java/com/yihu/jw/message/service/MessageService.java

@ -0,0 +1,169 @@
package com.yihu.jw.message.service;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
 * @author liuwenbin on 2018/11/28.
 */
@Service
public class MessageService extends BaseJpaService<BaseMessageDO, MessageDao> {
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 消息列表
     * @param platform
     * @param code
     * @param saasId
     * @param page
     * @param pageSize
     * @return
     */
    public List<Map<String,Object>> messageList(Integer platform,String code,String saasId,Integer page,Integer pageSize){
        if(page==null){
            page = 0;
        }else if(page > 0)
        {
            page = page -1;
        }
        if (pageSize <= 0) {
            pageSize = 10;
        }
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        // 分页信息
        List<BaseMessageDO> applyList = messageDao.messageList(platform,code,saasId,"00%");
        Integer applyReadCount = messageDao.countMessage(platform,code,saasId,"00%");
        List<BaseMessageDO> systemList = messageDao.messageList(platform,code,saasId,"01%");
        Integer systemReadCount = messageDao.countMessage(platform,code,saasId,"01%");
        List<Map<String,Object>> resultList = new LinkedList<>();
        Map<String,Object> applyMap = new HashedMap();
        applyMap.put("name","应用消息");
        applyMap.put("count",applyReadCount);
        applyMap.put("message",applyList.size()>0?applyList.get(0).getMsgContent():null);
        resultList.add(applyMap);
        Map<String,Object> systemMap = new HashedMap();
        systemMap.put("name","系统消息");
        systemMap.put("count",systemReadCount);
        systemMap.put("message",systemList.size()>0?systemList.get(0).getMsgContent():null);
        resultList.add(systemMap);
        Integer unReadPageSize = pageSize;
        if(page==0){
            unReadPageSize=unReadPageSize-2;
        }
        //1、未读消息(置顶)
        List<Map<String, Object>> unReadResult = messageListSql(platform,code,saasId,0,page,unReadPageSize);
        for(Map<String, Object> one:unReadResult){
            Map<String,Object> unReadMap = new HashedMap();
            unReadMap.put("name",one.get("sender_name"));
            unReadMap.put("count",one.get("num"));
            unReadMap.put("message",one.get("msg_content"));
            resultList.add(unReadMap);
        }
        if(unReadResult.size()<unReadPageSize){
            page = messageCountSql(platform,code,saasId,1,page,pageSize);
            //2、已读消息
            List<Map<String, Object>> readResult = messageListSql(platform,code,saasId,1,page,unReadPageSize);
            for(Map<String, Object> one:readResult){
                Map<String,Object> readMap = new HashedMap();
                readMap.put("name",one.get("sender_name"));
                readMap.put("count",one.get("num"));
                readMap.put("message",one.get("msg_content"));
                resultList.add(readMap);
            }
        }
        return resultList;
    }
    public BaseMessageDO create(BaseMessageDO messageDO){
        return messageDao.save(messageDO);
    }
    private List<Map<String, Object>> messageListSql(Integer platform,String code,String saasId,Integer readState,Integer page,Integer pageSize){
        String sql =" SELECT " +
                " a.*, b.msg_content " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   m.sender, " +
                "   m.sender_name, " +
                "   count(*) as num, " +
                "   max(m.create_time) AS create_time " +
                "  FROM " +
                "   base_message m " +
                "  WHERE " +
                "   m.platform = '"+platform+"' " +
                "  AND m.receiver = '"+code+"' " +
                "  AND m.saas_id = '"+saasId+"' " +
                "  AND m.del = 1 " +
                "  AND m.read_state = "+readState+" " +
                "  GROUP BY " +
                "   m.sender, " +
                "   m.sender_name " +
                "  LIMIT "+page+", " +
                "  "+pageSize+" " +
                " ) a " +
                " LEFT JOIN base_message b ON a.sender = b.sender " +
                " AND a.create_time = b.create_time " +
                " AND b.platform = '"+platform+"' " +
                " AND b.receiver = '"+code+"' " +
                " AND b.saas_id = '"+saasId+"' " +
                " AND b.del = 1 " +
                " AND m.read_state = "+readState;
        return jdbcTemplate.queryForList(sql);
    }
    private Integer messageCountSql(Integer platform,String code,String saasId,Integer readState,Integer page,Integer originalPageSize){
        String sql ="  SELECT count(*) as num " +
                "  FROM " +
                "   base_message m " +
                "  WHERE " +
                "   m.platform = '"+platform+"' " +
                "  AND m.receiver = '"+code+"' " +
                "  AND m.saas_id = '"+saasId+"' " +
                "  AND m.del = 1 " +
                "  AND m.read_state = "+readState+" " +
                "  GROUP BY " +
                "   m.sender, " +
                "   m.sender_name " ;
        Integer count  = jdbcTemplate.queryForObject(sql,Integer.class);
        if(count<=(originalPageSize-2)){
            return page-1;
        }else{
            Integer s = (count-(originalPageSize-2))/originalPageSize;
            Integer y = (count-(originalPageSize-2))%originalPageSize;
            if(y>0){
                return page-(s+2);
            }else{
                return page-(s+1);
            }
        }
    }
}

+ 45 - 0
business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java

@ -0,0 +1,45 @@
package com.yihu.jw.org.dao;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * 
 * 机构信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1
 */
public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String>, JpaSpecificationExecutor<BaseOrgDO>  {
    @Query(value="select b.* from base_org b where b.code= ?1 and b.saasid= ?2 limit 1",nativeQuery = true)
    BaseOrgDO findByCodeAndSaasId(String code, String saasId);
    boolean existsByCode(String code);
    BaseOrgDO findByCode(String code);
    @Modifying
    @Query("delete from BaseOrgDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
    @Query("select id from BaseOrgDO where del = 1 and saasid = ?1")
    List findOrgCodeBySaasId(String saasId);
   /* @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
    List<Map<String,Object>> findOrgListBySaasId(String saasId);*/
    @Query("select code as code,name as name from BaseOrgDO where del = 1")
    List<Map<String,Object>> findOrgListBySaasId();
}

+ 2 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/BasePatientDao.java

@ -1,14 +1,11 @@
package com.yihu.jw.base.dao.patient;
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -17,7 +14,7 @@ import java.util.Map;
 */
public interface BasePatientDao extends PagingAndSortingRepository<BasePatientDO, String>, JpaSpecificationExecutor<BasePatientDO> {
    BasePatientDO findByIdAndDel(String id,String del);
    BasePatientDO findByIdAndDel(String id, String del);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/patient/PatientMedicareCardDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.base.dao.patient;
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -11,7 +11,7 @@ import java.util.Set;
/**
 * Created by Trick on 2018/8/31.
 */
public interface PatientMedicareCardDao extends PagingAndSortingRepository<PatientMedicareCardDO, String>, JpaSpecificationExecutor<PatientMedicareCardDO> {
public interface BasePatientMedicareCardDao extends PagingAndSortingRepository<PatientMedicareCardDO, String>, JpaSpecificationExecutor<PatientMedicareCardDO> {
    List<PatientMedicareCardDO> findByPatientCode(String patientCode);

+ 8 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientMedicardCardService.java

@ -1,9 +1,9 @@
package com.yihu.jw.base.service.patient;
package com.yihu.jw.patient.service;
import com.yihu.jw.base.dao.patient.PatientMedicareCardDao;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -14,7 +14,7 @@ import java.util.Set;
/**
 * 
 * 居民信息服务service
 * 居民卡包基础信息服务service
 * 
 * @version 
 * <pre>
@ -25,10 +25,10 @@ import java.util.Set;
 * @since 1.
 */
@Service
public class PatientMedicardCardService extends BaseJpaService<PatientMedicareCardDO, PatientMedicareCardDao> {
public class BasePatientMedicardCardService extends BaseJpaService<PatientMedicareCardDO, BasePatientMedicareCardDao> {
    @Autowired
    private PatientMedicareCardDao patientMedicareCardDao;
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    /**
     * 根据居民标识获取居民医疗相关卡列表
@ -40,7 +40,7 @@ public class PatientMedicardCardService extends BaseJpaService<PatientMedicareCa
        if(StringUtils.isEmpty(patientCode)){
            return result;
        }
        return patientMedicareCardDao.findByPatientCode(patientCode);
        return basePatientMedicareCardDao.findByPatientCode(patientCode);
    }
    /**
@ -53,7 +53,7 @@ public class PatientMedicardCardService extends BaseJpaService<PatientMedicareCa
        if(StringUtils.isEmpty(patientCode)){
            return result;
        }
        return patientMedicareCardDao.findIdListByPatientCode(patientCode);
        return basePatientMedicareCardDao.findIdListByPatientCode(patientCode);
    }
}

+ 35 - 28
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/BasePatientService.java

@ -1,28 +1,29 @@
package com.yihu.jw.base.service.patient;
package com.yihu.jw.patient.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.patient.BasePatientDao;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 
 * 居民信息服务service
 * 居民基础信息服务service
 * 
 * @version 
 * <pre>
@ -39,10 +40,13 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
    private BasePatientDao basePatientDao;
    @Autowired
    private PatientMedicardCardService patientMedicardCardService;
    private BasePatientMedicardCardService basePatientMedicardCardService;
    @Autowired
    private ObjectMapper objectMapper;
    
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
@ -62,7 +66,7 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
            return result.toString();
        }
        result.put("patient",patientDOList.get(0));
        List<PatientMedicareCardDO> cards = patientMedicardCardService.findPatientCardByCode(patientId);
        List<PatientMedicareCardDO> cards = basePatientMedicardCardService.findPatientCardByCode(patientId);
        result.put("medicareCard",cards);
        return result.toJSONString();
    }
@ -75,20 +79,23 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
     * @return
     */
    public List<Map<String,Object>> queryPatientBaseInfo(String nameOrIdcard,int page,int size,String sorts)throws Exception{
        List<Map<String,Object>> result = new ArrayList<>();
        if(StringUtils.isEmpty(nameOrIdcard)){
            result = basePatientDao.findBaseInfo(createPage(page,size,sorts));
        }else{
            String pattern = "^\\d+";
            boolean isMatch = Pattern.matches(pattern, nameOrIdcard);
            if(isMatch){
                result = basePatientDao.findByIdcard("%"+nameOrIdcard+"%",createPage(page,size,sorts));
                return result;
            }else{
                result = basePatientDao.findByName("%"+nameOrIdcard+"%",createPage(page,size,sorts));
                return result;
            }
        List<Map<String, Object>> result = new ArrayList<>();
        String param = null == nameOrIdcard ? "": nameOrIdcard;
        String sql = "select id                                                as id, " +
                "       idcard                                                 as idcard, " +
                "       name                                                   as name, " +
                "       case sex when 1 then '男' when 2 then '女' else '未知' end as sex, " +
                "       phone                                                  as phone, " +
                "       committee_name                                         as committeeName, " +
                "       concat(province_name, city_name, town_name, street_name)   as address " +
                " from base_patient " +
                " where name like '%" + param + "%' or idcard like '%" + param + "%' order by create_time desc";
        String countSql = "select count(id) from base_patient where name like '%" + param + "%' or idcard like '%" + param + "%'";
        Long count  = jdbcTemplate.queryForObject(countSql,Long.class);
        if(count <= 0){
            return result;
        }
        result = jdbcTemplate.queryForList(sql);
        return result;
    }
@ -115,7 +122,7 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
            }
        });
        this.save(basePatientDO);
        patientMedicardCardService.batchInsert(list);
        basePatientMedicardCardService.batchInsert(list);
        return ConstantUtils.SUCCESS;
    }
@ -138,7 +145,7 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        // 保存修改的居民信息
        this.save(basePatientDO);
        Set<Object> cardIdList = patientMedicardCardService.findIdListByPatientCode(basePatientDO.getId());
        Set<Object> cardIdList = basePatientMedicardCardService.findIdListByPatientCode(basePatientDO.getId());
        // 有些卡可能是新增或修改的,一条一条修改居民相关的卡的信息
        for (Object obj : patientMedicareCards) {
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(), PatientMedicareCardDO.class);
@ -146,11 +153,11 @@ public class BasePatientService extends BaseJpaService<BasePatientDO, BasePatien
            if(cardIdList.contains(card.getId())){
                cardIdList.remove(card.getId());
            }
            patientMedicardCardService.save(card);
            basePatientMedicardCardService.save(card);
        }
        // 有些卡可能是删除的
        if(cardIdList.size() > 0){
            patientMedicardCardService.delete(cardIdList.toArray());
            basePatientMedicardCardService.delete(cardIdList.toArray());
        }
        return ConstantUtils.SUCCESS;
    }

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/patient/util/ConstantUtils.java

@ -0,0 +1,16 @@
package com.yihu.jw.patient.util;
/**
 * @author litaohong on 2018/10/11
 * @project jw2.0
 */
public class ConstantUtils {
    public static final String SUCCESS = "success";
    public static final String FAIL = "fail";
    // 状态失效
    public static final String STATUS_0 = "0";
    // 状态有效
    public static final String STATUS_1 = "1";
}

+ 31 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WechatDao.java

@ -0,0 +1,31 @@
package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String>, JpaSpecificationExecutor<WxWechatDO> {
    @Query("from WxWechatDO w where w.appId = ?1 and w.status!=-1")
    WxWechatDO findByAppId(String appId);
    @Query("from WxWechatDO w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
    WxWechatDO findByAppIdExcludeId(String appId, String id);
    @Query("from WxWechatDO w where w.id = ?1 and w.status!=-1")
    WxWechatDO findById(String id);
    @Query("from WxWechatDO w where w.status!=-1")
    List<WxWechatDO> findAll();
    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
    WxWechatDO findByAppOriginId(String appOriginId);
    List<WxWechatDO> findByName(String name);
}

+ 17 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxAccessTokenDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/18 0018.
 */
public interface WxAccessTokenDao extends PagingAndSortingRepository<WxAccessTokenDO, String>, JpaSpecificationExecutor<WxAccessTokenDO> {
    @Query("from WxAccessTokenDO w where w.wechatId =?1 order by w.addTimestamp desc")
    List<WxAccessTokenDO> getWxAccessTokenById(String wechatId);
}

+ 19 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxTemplateConfigDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.wechat.dao;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/8/21.
 */
public interface WxTemplateConfigDao extends PagingAndSortingRepository<WxTemplateConfigDO, String>, JpaSpecificationExecutor<WxTemplateConfigDO> {
    WxTemplateConfigDO findByWechatIdAndTemplateNameAndSceneAndStatus(String wechatId, String templateName, String scene, Integer status);
    WxTemplateConfigDO findByWechatIdAndTemplateNameAndScene(String wechatId, String templateName, String scene);
    List<WxTemplateConfigDO> findByWechatIdAndScene(String wechatId, String scene);
}

+ 26 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/dao/WxTemplateDao.java

@ -0,0 +1,26 @@
package com.yihu.jw.wechat.dao;//package com.yihu.jw.business.wx.dao;
import com.yihu.jw.entity.base.wx.WxTemplateDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public interface WxTemplateDao extends PagingAndSortingRepository<WxTemplateDO, String>, JpaSpecificationExecutor<WxTemplateDO> {
    @Query("from WxTemplateDO w where w.id = ?1 and w.status =1")
    WxTemplateDO findById(String id);
    @Query("from WxTemplateDO w where w.wechatId = ?1 and w.status =1")
    List<WxTemplateDO> findByWxId(String wechatId);
    List<WxTemplateDO> findByTemplateIdAndWechatIdAndStatus(String templateId, String wechatId, Integer status);
    List<WxTemplateDO> findByTemplateNameAndWechatIdAndStatus(String templateId, String wechatId, Integer status);
}

+ 115 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WeChatQrcodeService.java

@ -0,0 +1,115 @@
package com.yihu.jw.wechat.service;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
 * 微信二维码
 * Created by Trick on 2018/9/7.
 */
@Service
public class WeChatQrcodeService {
    @Autowired
    private FastDFSUtil fastDFSHelper;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    public String getQrcode(HttpServletRequest request, String wechatId, String scene) throws Exception{
        String token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken();
        String params = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"" + scene + "\"}}}";
        //服务号必须是通过腾讯认证,每年是300元,如果没有认证而导致的错误提示,那就去认证
        //微信登录提示48001,{"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}
        String result = HttpUtil.sendPost(token_url, params);
        if (!StringUtils.isEmpty(result)) {
            JSONObject json = new JSONObject(result);
            if (json.has("ticket")) {
                // 请求输入流
                InputStream inputStream = null;
                // 下载二维码图片
                URL urlGet = new URL("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="
                        + URLEncoder.encode(json.get("ticket").toString(), "UTF-8"));
                HttpURLConnection connection = (HttpURLConnection) urlGet.openConnection();
                connection.connect();
                //下载图片到内存
                inputStream = connection.getInputStream();
                //======start===
                //fastDFS方法问题,直接将inputStream文件流上传文件服务器存数据缺失,
                // 故将文件输出本地,在上传文件服务器,之后删除本地文件
                String path = WeChatQrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                        + File.separator + "qrcode" ;
                //判断目录是否存在,创建目录
                File dir = new File(path);
                if(!dir.exists()){
                    dir.mkdir();
                }
                path+= File.separator + wechatId+"_"+scene+".png";
                File file = new File(path);
                // 保存文件
                FileOutputStream outputStream = new FileOutputStream(file);
                byte[] data = new byte[1024];
                int len = 0;
                while ((len = inputStream.read(data)) != -1) {
                    outputStream.write(data, 0, len);
                }
                InputStream input = new FileInputStream(file);
                //=======end=========
                ObjectNode objectNode = fastDFSHelper.upload(input,"png","");
                if (outputStream != null) {
                    outputStream.close();
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                //流关闭,删除文件
                if(file.exists()&&file.isFile()){
                    file.delete();
                }
                return objectNode.get("fileId").toString().replaceAll("\"", "");
            }
        }
        return "";
    }
//    public void write(InputStream inputStream)throws Exception{
//        String file = "D:\\workspace\\file\\test.png";
//        // 保存文件
//        FileOutputStream outputStream = new FileOutputStream(file);
//
//        byte[] data = new byte[1024];
//        int len = 0;
//
//        while ((len = inputStream.read(data)) != -1) {
//            outputStream.write(data, 0, len);
//        }
//
//        if (outputStream != null) {
//            outputStream.close();
//        }
//
//    }
}

+ 157 - 0
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxAccessTokenService.java

@ -0,0 +1,157 @@
package com.yihu.jw.wechat.service;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxAccessTokenDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
/**
 * Created by Administrator on 2017/5/18 0018.
 */
@Service
public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAccessTokenDao> {
    private Logger logger= LoggerFactory.getLogger(WxAccessTokenService.class);
    @Autowired
    private WxAccessTokenDao wxAccessTokenDao;
    @Autowired
    private WechatDao wechatDao;
    /**
     * 根据原始id查找
     * @param appOriginId
     * @return
     */
    public WxAccessTokenDO getWxAccessTokenByOriginId(String appOriginId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findByAppOriginId(appOriginId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wxWechat.getId());
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
            appId = wxWechat.getAppId();
            appSecret = wxWechat.getAppSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
            }
            /*String params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
            String result = HttpUtil.sendGet(token_url, params);*/
            Map<String, Object> params = new HashMap<>();
            params.put("grant_type", "client_credential");
            params.put("appid", appId);
            params.put("secret", appSecret);
            String result = HttpUtils.doGet(token_url, params).getContent();
            logger.info("--------------wechat token return :"+result+"---------------");
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();
                String expires_in = json.get("expires_in").toString();
                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wxWechat.getId());
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    public WxAccessTokenDO getWxAccessTokenById(String wechatId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findById(wechatId);
            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wechatId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
            appId = wxWechat.getAppId();
            appSecret = wxWechat.getAppSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
            }
            Map<String, Object> params = new HashMap<>();
            params.put("grant_type", "client_credential");
            params.put("appid", appId);
            params.put("secret", appSecret);
            String result = HttpUtils.doGet(token_url, params).getContent();
            logger.info("--------------wechat token return:"+result+"---------------");
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();
                String expires_in = json.get("expires_in").toString();
                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wechatId);
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

+ 41 - 0
business/sms-service/pom.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>wlyy-lib-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>sms-service</artifactId>
    <version>${parent.version}</version>
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-web</artifactId>
        </dependency>
        <!--   poi xml导入导出工具 end -->
    </dependencies>
</project>

+ 5 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/sms/SmsDao.java

@ -1,13 +1,16 @@
package com.yihu.jw.base.dao.sms;
package com.yihu.jw.sms.dao;
import com.yihu.jw.entity.base.sms.SmsDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
 * Dao - 短信记录
 * Created by progr1mmer on 2018/8/23.
 */
public interface SmsDao extends PagingAndSortingRepository<SmsDO, String>, JpaSpecificationExecutor<SmsDO> {
public interface BaseSmsDao extends PagingAndSortingRepository<SmsDO, String>, JpaSpecificationExecutor<SmsDO> {
    boolean existsByCaptchaAndDeadlineBefore(String captcha, Date now);
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/sms/SmsGatewayDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.base.dao.sms;
package com.yihu.jw.sms.dao;
import com.yihu.jw.entity.base.sms.SmsGatewayDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -10,7 +10,7 @@ import java.util.List;
 * Dao - 短信网关
 * Created by progr1mmer on 2018/8/23.
 */
public interface SmsGatewayDao extends PagingAndSortingRepository<SmsGatewayDO, String>, JpaSpecificationExecutor<SmsGatewayDO> {
public interface BaseSmsGatewayDao extends PagingAndSortingRepository<SmsGatewayDO, String>, JpaSpecificationExecutor<SmsGatewayDO> {
    List<SmsGatewayDO> findByClientIdAndStatus(String clientId, SmsGatewayDO.Status status);

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/dao/sms/SmsTemplateDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.base.dao.sms;
package com.yihu.jw.sms.dao;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -10,7 +10,7 @@ import java.util.List;
 * Dao - 短信模板
 * Created by progr1mmer on 2018/8/23.
 */
public interface SmsTemplateDao extends PagingAndSortingRepository<SmsTemplateDO, String>, JpaSpecificationExecutor<SmsTemplateDO> {
public interface BaseSmsTemplateDao extends PagingAndSortingRepository<SmsTemplateDO, String>, JpaSpecificationExecutor<SmsTemplateDO> {
    List<SmsTemplateDO> findByClientIdAndType(String clientId, SmsTemplateDO.Type type);

+ 118 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsGatewayService.java

@ -0,0 +1,118 @@
package com.yihu.jw.sms.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.sms.SmsDO;
import com.yihu.jw.entity.base.sms.SmsGatewayDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.sms.dao.BaseSmsDao;
import com.yihu.jw.sms.dao.BaseSmsGatewayDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.network.IPInfoUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Service - 短信网关,发送短信
 * Created by progr1mmer on 2018/8/23.
 */
@Service
public class BaseSmsGatewayService extends BaseJpaService<SmsGatewayDO, BaseSmsGatewayDao> {
    private static final Pattern PATTERN  = Pattern.compile("\\$\\{[A-Za-z0-9]+\\}");
    @Autowired
    private BaseSmsTemplateDao baseSmsTemplateDao;
    @Autowired
    private BaseSmsGatewayDao baseSmsGatewayDao;
    @Autowired
    private BaseSmsDao baseSmsDao;
    @Autowired
    private ObjectMapper objectMapper;
    public SmsDO send(String clientId, SmsTemplateDO.Type type, String to) throws Exception {
        List<SmsGatewayDO> smsGatewayDOS = baseSmsGatewayDao.findByClientIdAndStatus(clientId, SmsGatewayDO.Status.available);
        if (smsGatewayDOS.size() == 0) {
            throw new ApiException("no gateway available");
        }
        List<SmsTemplateDO> smsTemplateDOS = baseSmsTemplateDao.findByClientIdAndType(clientId, type);
        if (smsTemplateDOS.size() == 0) {
            throw new ApiException("no template available");
        }
        Random random = new Random();
        SmsGatewayDO smsGatewayDO = smsGatewayDOS.get(random.nextInt(smsGatewayDOS.size()));
        SmsTemplateDO smsTemplateDO = smsTemplateDOS.get(random.nextInt(smsTemplateDOS.size()));
        //生成内容
        String rawContent = smsTemplateDO.getContent();
        /*
         * 0 - 验证码
         * 1 - 过期时间(分钟)
         */
        String [] contentDatas = new String[] {
                randomInt(6),
                smsGatewayDO.getExpireMin().toString()
        };
        Matcher contentMatcher = PATTERN.matcher(rawContent);
        int index = 0;
        while (contentMatcher.find()) {
            String matchWord = contentMatcher.group(0);
            rawContent = rawContent.replace(matchWord, contentDatas[index]);
            index ++;
        }
        String sendContent = smsTemplateDO.getHeader() + rawContent;
        //第三方API服务请求参数
        String rawCertificate = smsGatewayDO.getRequestCertificate();
        /*
         * 0 - 接收手机号码
         * 1 - 短信内容
         */
        String [] certificateDatas = new String[] {
                to,
                sendContent
        };
        Matcher certificateMatcher = PATTERN.matcher(rawCertificate);
        index = 0;
        while (certificateMatcher.find()) {
            String matchWord = certificateMatcher.group(0);
            rawCertificate = rawCertificate.replace(matchWord, certificateDatas[index]);
            index ++;
        }
        HttpResponse httpResponse = HttpUtils.doPost(smsGatewayDO.getRequestUrl(), objectMapper.readValue(rawCertificate, Map.class));
        if (httpResponse.isSuccessFlg()) {
            Map<String, Object> response = objectMapper.readValue(httpResponse.getContent(), Map.class);
            String responseCode = String.valueOf(response.get(smsGatewayDO.getResponseCode()));
            if (responseCode.equals(smsGatewayDO.getSuccessValue())) {
                HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
                SmsDO smsDO = new SmsDO();
                smsDO.setClientId(clientId);
                smsDO.setSmsGatewayId(smsGatewayDO.getId());
                smsDO.setRequestIp(IPInfoUtils.getIPAddress(request));
                smsDO.setMobile(to);
                smsDO.setContent(sendContent);
                smsDO.setDeadline(DateUtils.addMinutes(new Date(), smsGatewayDO.getExpireMin()));
                smsDO.setCaptcha(contentDatas[0]);
                smsDO.setType(type);
                return baseSmsDao.save(smsDO);
            } else {
                throw new ApiException(httpResponse.getContent());
            }
        } else {
            throw new ApiException(httpResponse.getContent());
        }
    }
}

+ 29 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsService.java

@ -0,0 +1,29 @@
package com.yihu.jw.sms.service;
import com.yihu.jw.entity.base.sms.SmsDO;
import com.yihu.jw.sms.dao.BaseSmsDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
 * Service - 短信记录
 * Created by progr1mmer on 2018/9/6.
 */
@Service
public class BaseSmsService extends BaseJpaService<SmsDO, BaseSmsDao>{
    @Autowired
    private BaseSmsDao baseSmsDao;
    /**
     * 判断验证码是否正确
     * @param captcha
     * @return
     */
    public Boolean verifyCaptcha(String captcha){
        return baseSmsDao.existsByCaptchaAndDeadlineBefore(captcha,new Date());
    }
}

+ 15 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/BaseSmsTemplateService.java

@ -0,0 +1,15 @@
package com.yihu.jw.sms.service;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * Service - 短信模板
 * Created by progr1mmer on 2018/8/23.
 */
@Service
public class BaseSmsTemplateService extends BaseJpaService<SmsTemplateDO, BaseSmsTemplateDao>{
}

+ 16 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/util/ConstantUtils.java

@ -0,0 +1,16 @@
package com.yihu.jw.patient.util;
/**
 * @author litaohong on 2018/10/11
 * @project jw2.0
 */
public class ConstantUtils {
    public static final String SUCCESS = "success";
    public static final String FAIL = "fail";
    // 状态失效
    public static final String STATUS_0 = "0";
    // 状态有效
    public static final String STATUS_1 = "1";
}

File diff suppressed because it is too large
+ 19 - 21
common/common-entity/src/main/java/com/yihu/jw/entity/base/message/BaseMessageDO.java


+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/AccountAppealDO.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.base.patient;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 账号申诉实体
 * 
 * @author Administrator on  2018年11月27日
 *
 */
@Entity
@Table(name = "account_appeal")
public class AccountAppealDO extends IntegerIdentityEntity {
    /**
	 * 申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)
	 */
	private String type;
    /**
	 * 申诉内容,问题描述
	 */
	private String content;
    /**
	 * 申诉人姓名
	 */
	private String name;
    /**
	 * 申诉人身份证号码
	 */
	private String idcard;
    /**
	 * 申诉人手机号码
	 */
	private String mobile;
    /**
	 * 身份证正反面照片,存地址,逗号分割
	 */
	private String img;
	@Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
	@Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
	@Column(name = "idcard")
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
	@Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
}

+ 0 - 53
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -64,11 +64,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
	 */
	private String phone;
    /**
	 * 社保卡号
	 */
	private String ssc;
    /**
	 * 头像http地址
	 */
@ -165,17 +160,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
     */
    private String committeeName;
    /**
	 * 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	 */
	private String disease;
    /**
	 * 病情:0绿标,1黄标,2红标,3重点关注,
	 */
	private String diseaseCondition;
    /**
	 * 总积分
	 */
@ -238,11 +222,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
	 */
	private Integer standardStatus;
    /**
	 * 医疗保险号
	 */
	private String medicareNumber;
    /**
	 * unionId 开发平台唯一标识
	 */
@ -331,14 +310,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.phone = phone;
    }
	@Column(name = "ssc")
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
	@Column(name = "photo")
    public String getPhoto() {
        return photo;
@ -427,22 +398,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.committeeName = committeeName;
    }
    @Column(name = "disease")
    public String getDisease() {
        return disease;
    }
    public void setDisease(String disease) {
        this.disease = disease;
    }
	@Column(name = "disease_condition")
    public String getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(String diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
	@Column(name = "points")
    public String getPoints() {
        return points;
@ -539,14 +494,6 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.standardStatus = standardStatus;
    }
	@Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
	@Column(name = "unionid")
    public String getUnionid() {
        return unionid;

+ 11 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientFamilyMemberDO.java

@ -15,8 +15,9 @@ public class BasePatientFamilyMemberDO extends UuidIdentityEntityWithOperator {
    private String patient;//居民code',
    private String familyMember;//家庭成员code',
    private Integer familyRelation;//家庭关系',
    private Integer familyRelation;//家庭关系关系 1配偶 2父亲 3母亲 4公公 5婆婆 6岳父 7岳母 8子女',
    private Integer isAuthorize;//是否授权0:未授权,1:已授权,默认为1',
    private Integer del;//删除标志(1正常,0删除)
    @Column(name = "patient")
    public String getPatient() {
@ -53,4 +54,13 @@ public class BasePatientFamilyMemberDO extends UuidIdentityEntityWithOperator {
    public void setIsAuthorize(Integer isAuthorize) {
        this.isAuthorize = isAuthorize;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 113 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/FeedbackDO.java

@ -0,0 +1,113 @@
package com.yihu.jw.entity.base.patient;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 意见反馈实体
 * 
 * @author Administrator on  2018年11月27日
 *
 */
@Entity
@Table(name = "feedback")
public class FeedbackDO extends IntegerIdentityEntity {
    /**
	 * 反馈问题大类(功能异常,功能优化,新功能建议,其他等)
	 */
	private String parentType;
    /**
	 * 问题小类(功能异常-某些功能不可用等)
	 */
	private String type;
    /**
	 * 反馈内容,问题和建议
	 */
	private String feedbackContent;
    /**
	 * 问题回答
	 */
	private String answer;
    /**
	 * 图片,存图片地址,逗号分割
	 */
	private String img;
    /**
	 * 联系手机号码
	 */
	private String mobile;
    /**
	 * 反馈次数
	 */
	private String count;
	@Column(name = "parent_type")
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
	@Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@Column(name = "feedback_content")
    public String getFeedbackContent() {
        return feedbackContent;
    }
    public void setFeedbackContent(String feedbackContent) {
        this.feedbackContent = feedbackContent;
    }
	@Column(name = "answer")
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
	@Column(name = "img")
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
	@Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
	@Column(name = "count")
    public String getCount() {
        return count;
    }
    public void setCount(String count) {
        this.count = count;
    }
}

+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/HelpCenterDO.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.base.patient;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 帮助中心实体
 * 
 * @author Administrator on  2018年11月27日
 *
 */
@Entity
@Table(name = "help_center")
public class HelpCenterDO extends IntegerIdentityEntity {
    /**
	 * 问题大类(账号问题,续方问题,操作问题)
	 */
	private String parentType;
    /**
	 * 问题小类(账号被锁问题,身份证占用问题等等)
	 */
	private String type;
    /**
	 * 问题描述
	 */
	private String question;
    /**
	 * 问题回答
	 */
	private String answer;
    /**
	 * 有用次数
	 */
	private String usefulCount;
    /**
	 * 无用次数
	 */
	private String unusefulCount;
	@Column(name = "parent_type")
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
	@Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
	@Column(name = "question")
    public String getQuestion() {
        return question;
    }
    public void setQuestion(String question) {
        this.question = question;
    }
	@Column(name = "answer")
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
	@Column(name = "useful_count")
    public String getUsefulCount() {
        return usefulCount;
    }
    public void setUsefulCount(String usefulCount) {
        this.usefulCount = usefulCount;
    }
	@Column(name = "unuseful_count")
    public String getUnusefulCount() {
        return unusefulCount;
    }
    public void setUnusefulCount(String unusefulCount) {
        this.unusefulCount = unusefulCount;
    }
}

+ 87 - 40
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java

@ -1,93 +1,140 @@
package com.yihu.jw.entity.base.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 居民信息(居民就是患者)实体
*
* @author Administrator on  2018年09月05日
*
*/
 * 居民卡包实体
 * 
 * @author Administrator on  2018年11月27日
 *
 */
@Entity
@Table(name = "patient_medicare_card")
public class PatientMedicareCardDO extends IntegerIdentityEntity {
    public enum Type{
        medicareCard(0),
        healthCard(1);
        private int value;
        Type(int value){
            this.value = value;
        }
        public int getValue() {
            return value;
        }
    }
    /**
	 * 卡标识
	 */
	private String code;
    /**
	 * 卡类型,1-医保卡,2-电子健康卡
	 * 卡的大类(A-医疗卡,B-优惠券,C-银行卡,unknow-其他)
	 */
	private String type;
	private String parentType;
    /**
     * 医疗保险号
     */
	private String medicareNumber;
	 * 卡的小类:医疗卡包含 A_01 医保卡,A_02 电子社保卡 A_03 电子就诊卡等等,,,
	 */
	private String type;
    /**
	 * 居民标识
	 */
	private String patientCode;
    @Column(name = "code")
    /**
	 * 医疗保险号
	 */
	private String medicareNumber;
    /**
	 * 绑定密码
	 */
	private String password;
    /**
	 * 微信openid,有些卡会绑定微信
	 */
	private String wxOpenid;
    /**
	 * 备注
	 */
	private String remark;
    /**
	 * 状态,0-解除绑定,1-绑定中
	 */
	private String del;
	@Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "type")
	@Column(name = "parent_type")
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
	@Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "medicare_number")
	@Column(name = "patient_code")
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
	@Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
    @Column(name = "patient_code")
    public String getPatientCode() {
        return patientCode;
	@Column(name = "password")
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
	@Column(name = "wx_openid")
    public String getWxOpenid() {
        return wxOpenid;
    }
    public void setWxOpenid(String wxOpenid) {
        this.wxOpenid = wxOpenid;
    }
	@Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
	@Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 2 - 4
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageDO.java

@ -20,10 +20,8 @@ public class ServicePackageDO extends UuidIdentityEntity implements Serializable
    public enum Level {
        system("系统", "0"),
        doctor("医生", "1"),
        team("团队", "2"),
        hospital("社区", "3"),
        town("区", "4");
        hospital("社区", "1"),
        saas("租户", "2");
        private String name;
        private String value;

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageSignRecordDO.java

@ -61,6 +61,7 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
    private Date endTime;//服务结束时间
    private String status;//状态(1新建,2已完成)
    private String doctorTeamCode;//医生服务团队code
    private String operator;//签约申请人处理人
    private Date createTime;//创建时间
    @Column(name = "saas_id")
@ -217,4 +218,12 @@ public class ServicePackageSignRecordDO extends UuidIdentityEntity implements Se
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
}

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/sms/SmsTemplateDO.java

@ -19,11 +19,13 @@ public class SmsTemplateDO extends UuidIdentityEntityWithOperator {
     * 0 - 注册
     * 1 - 登陆
     * 2 - 重置密码
     * 3 - 修改手机号
     */
    public enum Type {
        register,
        login,
        resetPassword
        resetPassword,
        updateMobile
    }
    //应用ID

+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/myFamily/PatientApplyLog.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.myFamily;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * @author liuwenbin on 2018/11/30.
 */
@Entity
@Table(name = "patient_apply_for_log")
public class PatientApplyLog extends IntegerIdentityEntity {
    private String patientFamilyMemberName;//家庭成员名称
    private String patienyFamilyMemberCode;//家庭成员code
    private String qrCode;//二维码地址
    private Date failureTime;//失效时间
    private Integer status;//1、添加家人(默认),2、邀请登录,3、通过,4、拒绝
    private Integer del;//删除标志(1正常,0删除)申请人主动终止申请
    private Date createTime;//创建时间
    private String createUser;//申请人
    private String createUserName;//申请人姓名
    public String getPatientFamilyMemberName() {
        return patientFamilyMemberName;
    }
    public void setPatientFamilyMemberName(String patientFamilyMemberName) {
        this.patientFamilyMemberName = patientFamilyMemberName;
    }
    public String getPatienyFamilyMemberCode() {
        return patienyFamilyMemberCode;
    }
    public void setPatienyFamilyMemberCode(String patienyFamilyMemberCode) {
        this.patienyFamilyMemberCode = patienyFamilyMemberCode;
    }
    public String getQrCode() {
        return qrCode;
    }
    public void setQrCode(String qrCode) {
        this.qrCode = qrCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getFailureTime() {
        return failureTime;
    }
    public void setFailureTime(Date failureTime) {
        this.failureTime = failureTime;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
}

+ 9 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FastfdsFileURLEmptyException.java

@ -0,0 +1,9 @@
package com.yihu.jw.exception.business.file_upload;
public class FastfdsFileURLEmptyException extends RuntimeException {
    public FastfdsFileURLEmptyException(String msg){
        super(msg);
    }
}

+ 9 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileInputStreamEmptyException.java

@ -0,0 +1,9 @@
package com.yihu.jw.exception.business.file_upload;
public class FileInputStreamEmptyException extends RuntimeException {
    public FileInputStreamEmptyException(String msg){
        super(msg);
    }
}

+ 9 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileNameEmptyException.java

@ -0,0 +1,9 @@
package com.yihu.jw.exception.business.file_upload;
public class FileNameEmptyException extends RuntimeException {
    public FileNameEmptyException(String msg){
        super(msg);
    }
}

+ 9 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileTooLargeSizeException.java

@ -0,0 +1,9 @@
package com.yihu.jw.exception.business.file_upload;
public class FileTooLargeSizeException extends RuntimeException {
    public FileTooLargeSizeException(String msg){
        super(msg);
    }
    
}

+ 9 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/file_upload/FileWrongFormatException.java

@ -0,0 +1,9 @@
package com.yihu.jw.exception.business.file_upload;
public class FileWrongFormatException extends RuntimeException {
    public FileWrongFormatException(String msg){
        super(msg);
    }
    
}

+ 11 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/CapthcaInvalidException.java

@ -0,0 +1,11 @@
package com.yihu.jw.exception.business.patient;
/**
 * 居民不存在
 */
public class CapthcaInvalidException extends RuntimeException{
    public CapthcaInvalidException(String msg){
        super(msg);
    }
}

+ 11 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/business/patient/NotFoundPatientException.java

@ -0,0 +1,11 @@
package com.yihu.jw.exception.business.patient;
/**
 * 居民不存在
 */
public class NotFoundPatientException extends RuntimeException{
    public NotFoundPatientException(String msg){
        super(msg);
    }
}

+ 33 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -459,14 +459,46 @@ public class BaseRequestMapping {
    /**
     * 患者信息
     * 居民信息
     */
    public static class BasePatient extends Basic {
        public static final String PREFIX  = "/basePatient";
        public static final String getPatientById  = "/getPatientById";
        public static final String getBaseInfo  = "/getBaseInfo";
        public static final String sendCaptcha  = "/sendCaptcha";
    }
   /**
     * 居民卡包信息
     */
    public static class PatientMedicareCard extends Basic {
        public static final String PREFIX  = "/patientMedicareCard";
        public static final String getPatientById  = "/getCardsByPatientId";
    }
    /**
     * 居民账号申诉
     */
    public static class AccountAppeal extends Basic {
        public static final String PREFIX  = "/accountAppeal";
    }
    /**
     * 居民问题反馈
     */
    public static class Feedback extends Basic {
        public static final String PREFIX  = "/feedback";
    }
    /**
     * 居民帮助中心
     */
    public static class HelpCenter extends Basic {
        public static final String PREFIX  = "/helpCenter";
    }
    /**
     * 基础人口基数
     */

+ 16 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/patient/PatientRequestMapping.java

@ -30,6 +30,22 @@ public class PatientRequestMapping {
     */
    public static class SignPackage extends Basic {
        public static final String PREFIX  = "/signPackage";
        public static final String api_success ="success";
        public static final String findPackageService  = "/findPackageService";
        public static final String findServicePackageByPackageId  = "/findServicePackageByPackageId";
        public static final String findOrgByPackageId  = "/findOrgByPackageId";
        public static final String findDoctorByOrg  = "/findDoctorByOrg";
        public static final String signPackage  = "/signPackage";
        public static final String findDoctorById  = "/findDoctorById";
        public static final String findOrgByCode  = "/findOrgByCode";
    }
    /**
     * myFamily
     */
    public static class MyFamily extends Basic {
        public static final String PREFIX  = "/myFamily";
        public static final String getMyFamilyBindingRole  = "/getMyFamilyBindingRole";
    }

+ 83 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorOrgVO.java

@ -0,0 +1,83 @@
package com.yihu.jw.restmodel.base.doctor;
import io.swagger.annotations.ApiModel;
/**
 * Created by Trick on 2018/11/28.
 */
@ApiModel(value = "BaseDoctorOrgVO", description = "获取签约医生")
public class BaseDoctorOrgVO {
    private String id;
    private String name;
    private String jobTitleCode;
    private String jobTitleName;
    private String deptName;
    private String deptCode;
    private String introduce;
    private String photo;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getJobTitleCode() {
        return jobTitleCode;
    }
    public void setJobTitleCode(String jobTitleCode) {
        this.jobTitleCode = jobTitleCode;
    }
    public String getJobTitleName() {
        return jobTitleName;
    }
    public void setJobTitleName(String jobTitleName) {
        this.jobTitleName = jobTitleName;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getDeptCode() {
        return deptCode;
    }
    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}

+ 374 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorSimpleVO.java

@ -0,0 +1,374 @@
package com.yihu.jw.restmodel.base.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2018/11/29.
 */
public class BaseDoctorSimpleVO {
    private String id;
    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名", example = "张三")
    private String name;
    /**
     * 性别(1男,2女) 用国家标准字典
     */
    @ApiModelProperty(value = "性别(1男,2女,整型 用国家标准字典", example = "1")
    private Integer sex;
    /**
     * 医生专长
     */
    @ApiModelProperty(value = "医生专长", example = "擅长....")
    private String expertise;
    /**
     * 医生介绍
     */
    @ApiModelProperty(value = "医生介绍", example = "....")
    private String introduce;
    /**
     *  身份证
     */
    @ApiModelProperty(value = " 身份证", example = "350.....")
    private String idcard;
    /**
     * 生日
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "生日", example = "yyyy-MM-dd HH:mm:ss")
    private Date birthday;
    /**
     * 头像http地址
     */
    @ApiModelProperty(value = "头像http地址", example = "")
    private String photo;
    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号", example = "")
    private String mobile;
    /**
     * 医生二维码
     */
    @ApiModelProperty(value = "医生二维码", example = "")
    private String qrcode;
    /**
     * 省代码
     */
    @ApiModelProperty(value = "省代码", example = "参考省代码")
    private String provinceCode;
    /**
     * 省名称
     */
    @ApiModelProperty(value = "省名称", example = "某某省")
    private String provinceName;
    /**
     * 市代码
     */
    @ApiModelProperty(value = "市代码", example = "参考市代码")
    private String cityCode;
    /**
     * 市名称
     */
    @ApiModelProperty(value = "市名称", example = "某某市")
    private String cityName;
    /**
     * 区县代码
     */
    @ApiModelProperty(value = "区县代码", example = "参考区县代码")
    private String townCode;
    /**
     * 区县名称
     */
    @ApiModelProperty(value = "区县名称", example = "某某区县")
    private String townName;
    /**
     * 街道代码
     */
    @ApiModelProperty(value = "街道代码", example = "参考街道代码")
    private String streetCode;
    /**
     * 街道名称
     */
    @ApiModelProperty(value = "街道名称", example = "某某街道")
    private String streetName;
    /**
     * 资格是否认证通过,1是,0否
     */
    @ApiModelProperty(value = "资格是否认证通过,1是,0否", example = "1")
    private String iscertified;
    /**
     * 是否是名医,1是,0否
     */
    @ApiModelProperty(value = "是否是名医,1是,0否,整型", example = "0")
    private Integer isFamous;
    /**
     * 是否提示设置密码  1 提示过 0未提示
     */
    @ApiModelProperty(value = "是否提示设置密码  1 提示过 0未提示", example = "0")
    private String isPasswordPrompt;
    /**
     * 名称拼音首字母
     */
    @ApiModelProperty(value = "名称拼音首字母", example = "")
    private String spell;
    /**
     * CA证书过期时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "CA证书过期时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date certifiedOvertime;
    /**
     * CA证书编号
     */
    @ApiModelProperty(value = "CA证书编号", example = "实际证书编号")
    private String certificateNum;
    /**
     * 用户微信openid
     */
    @ApiModelProperty(value = "用户微信openid", example = "填上微信那边分配给用户的")
    private String openid;
    /**
     * 作废标识,1正常,0作废
     */
    @ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    public String getIscertified() {
        return iscertified;
    }
    public void setIscertified(String iscertified) {
        this.iscertified = iscertified;
    }
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }
    public String getIsPasswordPrompt() {
        return isPasswordPrompt;
    }
    public void setIsPasswordPrompt(String isPasswordPrompt) {
        this.isPasswordPrompt = isPasswordPrompt;
    }
    public String getSpell() {
        return spell;
    }
    public void setSpell(String spell) {
        this.spell = spell;
    }
    public Date getCertifiedOvertime() {
        return certifiedOvertime;
    }
    public void setCertifiedOvertime(Date certifiedOvertime) {
        this.certifiedOvertime = certifiedOvertime;
    }
    public String getCertificateNum() {
        return certificateNum;
    }
    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 56 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/OrgDistanceVO.java

@ -0,0 +1,56 @@
package com.yihu.jw.restmodel.base.org;
import io.swagger.annotations.ApiModel;
/**
 * Created by Trick on 2018/11/28.
 */
@ApiModel(value = "OrgDistanceVO", description = "机构信息(医院)带距离")
public class OrgDistanceVO {
    private String code;
    private String name;
    private String address;
    private String distance;
    private String photo;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getDistance() {
        return distance;
    }
    public void setDistance(String distance) {
        this.distance = distance;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
}

+ 104 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/AccountAppealVO.java

@ -0,0 +1,104 @@
package com.yihu.jw.restmodel.base.patient;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * 
 * 账号申诉vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  2018年11月27日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "AccountAppealVO", description = "账号申诉")
public class AccountAppealVO extends IntegerIdentityVO{
    /**
	 * 申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)
	 */
	@ApiModelProperty(value = "申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)", example = "模块1")
    private String type;
    /**
	 * 申诉内容,问题描述
	 */
	@ApiModelProperty(value = "申诉内容,问题描述", example = "模块1")
    private String content;
    /**
	 * 申诉人姓名
	 */
	@ApiModelProperty(value = "申诉人姓名", example = "模块1")
    private String name;
    /**
	 * 申诉人身份证号码
	 */
	@ApiModelProperty(value = "申诉人身份证号码", example = "模块1")
    private String idcard;
    /**
	 * 申诉人手机号码
	 */
	@ApiModelProperty(value = "申诉人手机号码", example = "模块1")
    private String mobile;
    /**
	 * 身份证正反面照片,存地址,逗号分割
	 */
	@ApiModelProperty(value = "身份证正反面照片,存地址,逗号分割", example = "模块1")
    private String img;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
}

+ 117 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/FeedbackVO.java

@ -0,0 +1,117 @@
package com.yihu.jw.restmodel.base.patient;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * 
 * 意见反馈vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  2018年11月27日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "FeedbackVO", description = "意见反馈")
public class FeedbackVO extends IntegerIdentityVO{
    /**
	 * 反馈问题大类(功能异常,功能优化,新功能建议,其他等)
	 */
	@ApiModelProperty(value = "反馈问题大类(功能异常,功能优化,新功能建议,其他等)", example = "模块1")
    private String parentType;
    /**
	 * 问题小类(功能异常-某些功能不可用等)
	 */
	@ApiModelProperty(value = "问题小类(功能异常-某些功能不可用等)", example = "模块1")
    private String type;
    /**
	 * 反馈内容,问题和建议
	 */
	@ApiModelProperty(value = "反馈内容,问题和建议", example = "模块1")
    private String feedbackContent;
    /**
	 * 问题回答
	 */
	@ApiModelProperty(value = "问题回答", example = "模块1")
    private String answer;
    /**
	 * 图片,存图片地址,逗号分割
	 */
	@ApiModelProperty(value = "图片,存图片地址,逗号分割", example = "模块1")
    private String img;
    /**
	 * 联系手机号码
	 */
	@ApiModelProperty(value = "联系手机号码", example = "模块1")
    private String mobile;
    /**
	 * 反馈次数
	 */
	@ApiModelProperty(value = "反馈次数", example = "模块1")
    private String count;
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getFeedbackContent() {
        return feedbackContent;
    }
    public void setFeedbackContent(String feedbackContent) {
        this.feedbackContent = feedbackContent;
    }
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getCount() {
        return count;
    }
    public void setCount(String count) {
        this.count = count;
    }
}

+ 104 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/HelpCenterVO.java

@ -0,0 +1,104 @@
package com.yihu.jw.restmodel.base.patient;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * 
 * 帮助中心vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  2018年11月27日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "HelpCenterVO", description = "帮助中心")
public class HelpCenterVO extends IntegerIdentityVO{
    /**
	 * 问题大类(账号问题,续方问题,操作问题)
	 */
	@ApiModelProperty(value = "问题大类(账号问题,续方问题,操作问题)", example = "模块1")
    private String parentType;
    /**
	 * 问题小类(账号被锁问题,身份证占用问题等等)
	 */
	@ApiModelProperty(value = "问题小类(账号被锁问题,身份证占用问题等等)", example = "模块1")
    private String type;
    /**
	 * 问题描述
	 */
	@ApiModelProperty(value = "问题描述", example = "模块1")
    private String question;
    /**
	 * 问题回答
	 */
	@ApiModelProperty(value = "问题回答", example = "模块1")
    private String answer;
    /**
	 * 有用次数
	 */
	@ApiModelProperty(value = "有用次数", example = "模块1")
    private String usefulCount;
    /**
	 * 无用次数
	 */
	@ApiModelProperty(value = "无用次数", example = "模块1")
    private String unusefulCount;
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getQuestion() {
        return question;
    }
    public void setQuestion(String question) {
        this.question = question;
    }
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
    public String getUsefulCount() {
        return usefulCount;
    }
    public void setUsefulCount(String usefulCount) {
        this.usefulCount = usefulCount;
    }
    public String getUnusefulCount() {
        return unusefulCount;
    }
    public void setUnusefulCount(String unusefulCount) {
        this.unusefulCount = unusefulCount;
    }
}

+ 144 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/patient/PatientMedicareCardVO.java

@ -0,0 +1,144 @@
package com.yihu.jw.restmodel.base.patient;
import com.yihu.jw.restmodel.IntegerIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * 
 * 居民卡包vo
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  2018年11月27日 Created
 *
 * </pre>
 * @since 1.
 */
@ApiModel(value = "PatientMedicareCardVO", description = "居民卡包")
public class PatientMedicareCardVO extends IntegerIdentityVO{
    /**
	 * 卡标识
	 */
	@ApiModelProperty(value = "卡标识", example = "模块1")
    private String code;
    /**
	 * 卡的大类(A-医疗卡,B-优惠券,C-银行卡,unknow-其他)
	 */
	@ApiModelProperty(value = "卡的大类(A-医疗卡,B-优惠券,C-银行卡,unknow-其他)", example = "模块1")
    private String parentType;
    /**
	 * 卡的小类:医疗卡包含 A_01 医保卡,A_02 电子社保卡 A_03 电子就诊卡等等,,,
	 */
	@ApiModelProperty(value = "卡的小类:医疗卡包含 A_01 医保卡,A_02 电子社保卡 A_03 电子就诊卡等等,,,", example = "模块1")
    private String type;
    /**
	 * 居民标识
	 */
	@ApiModelProperty(value = "居民标识", example = "模块1")
    private String patientCode;
    /**
	 * 医疗保险号
	 */
	@ApiModelProperty(value = "医疗保险号", example = "模块1")
    private String medicareNumber;
    /**
	 * 绑定密码
	 */
	@ApiModelProperty(value = "绑定密码", example = "模块1")
    private String password;
    /**
	 * 微信openid,有些卡会绑定微信
	 */
	@ApiModelProperty(value = "微信openid,有些卡会绑定微信", example = "模块1")
    private String wxOpenid;
    /**
	 * 备注
	 */
	@ApiModelProperty(value = "备注", example = "模块1")
    private String remark;
    /**
	 * 状态,0-解除绑定,1-绑定中
	 */
	@ApiModelProperty(value = "状态,0-解除绑定,1-绑定中", example = "模块1")
    private String del;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getParentType() {
        return parentType;
    }
    public void setParentType(String parentType) {
        this.parentType = parentType;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getWxOpenid() {
        return wxOpenid;
    }
    public void setWxOpenid(String wxOpenid) {
        this.wxOpenid = wxOpenid;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 53 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/SerivePackageItemVO.java

@ -0,0 +1,53 @@
package com.yihu.jw.restmodel.patient.signPackage;
/**
 * Created by Trick on 2018/11/29.
 */
public class SerivePackageItemVO {
    private String id;
    private String servicePackageId;//服务包ID
    private String itemName;//服务包名称
    private Double price;//价格
    private String times;//次数/频次
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getServicePackageId() {
        return servicePackageId;
    }
    public void setServicePackageId(String servicePackageId) {
        this.servicePackageId = servicePackageId;
    }
    public String getItemName() {
        return itemName;
    }
    public void setItemName(String itemName) {
        this.itemName = itemName;
    }
    public Double getPrice() {
        return price;
    }
    public void setPrice(Double price) {
        this.price = price;
    }
    public String getTimes() {
        return times;
    }
    public void setTimes(String times) {
        this.times = times;
    }
}

+ 149 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/patient/signPackage/ServicePackageVO.java

@ -0,0 +1,149 @@
package com.yihu.jw.restmodel.patient.signPackage;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import java.util.Date;
import java.util.List;
/**
 * Created by Trick on 2018/11/27.
 */
public class ServicePackageVO {
    private String provinceCode;
    private String provinceName;
    private String cityCode;
    private String cityName;
    private String saasId;
    private String name;//服务包名称
    private Integer num;//服务项数量
    private Long price;//预售价//单位分
    private String level;//服务包级别(0系统,1.医生,2团队,3社区,4区)
    private String creater;//创建者
    private Date createTime;//创建时间
    private String introduce;//服务介绍
    private String status;//审核状态(预留字段0待审核,1审核通过,2审核不通过)
    private Integer del;//是否有效(1有效,0失效)
    private List<SerivePackageItemVO> items;//服务项描述
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public Long getPrice() {
        return price;
    }
    public void setPrice(Long price) {
        this.price = price;
    }
    public String getLevel() {
        return level;
    }
    public void setLevel(String level) {
        this.level = level;
    }
    public String getCreater() {
        return creater;
    }
    public void setCreater(String creater) {
        this.creater = creater;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public List<SerivePackageItemVO> getItems() {
        return items;
    }
    public void setItems(List<SerivePackageItemVO> items) {
        this.items = items;
    }
}

+ 3 - 3
server/svr-configuration/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-configurations
    name: svr-configuration
---
spring:
@ -36,7 +36,7 @@ spring:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.120.153:3000/jiwei/wlyy2.0.config.git}
          uri: ${wlyy.spring.config.git.uri:http://192.168.120.153:3000/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:prod}
@ -49,6 +49,6 @@ spring:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://10.95.22.168:3000/jiwei/wlyy2.0.config.git}
          uri: ${wlyy.spring.config.git.uri:http://10.95.22.168:3000/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:local}

+ 13 - 0
svr/svr-base/pom.xml

@ -138,6 +138,19 @@
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
        <!--   poi xml导入导出工具 end -->

+ 1 - 2
sql/init.sql

@ -20,8 +20,7 @@ CREATE TABLE `base_org` (
  `address` varchar(300) DEFAULT NULL COMMENT '机构详细地址',
  `photo` varchar(200) DEFAULT NULL COMMENT '机构图片',
  `longitude` varchar(10) DEFAULT NULL COMMENT '经度',
  `latitude` varchar(10) DEFAULT NULL COMMENT '纬度',
  `legalperson` varchar(50) DEFAULT NULL COMMENT '法人',
  `latitude` varchar(10) DEFAULT NULL COMMENxMENT '法人',
  `org_admin` varchar(50) DEFAULT NULL COMMENT '机构管理员',
  `org_url` varchar(200) DEFAULT NULL COMMENT '机构网址',
  `intro` text COMMENT '机构简介',

+ 23 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/config/SpringSecurityAuditorAware.java

@ -0,0 +1,23 @@
package com.yihu.jw.base.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.Optional;
@Configuration
public class SpringSecurityAuditorAware implements AuditorAware {
    @Override
    public Object getCurrentAuditor() {
//        return Optional.ofNullable(SecurityContextHolder.getContext())
//                .map(SecurityContext::getAuthentication)
//                .filter(Authentication::isAuthenticated)
//                .map(Authentication::getPrincipal);
////                .map(Authentication::getDetails);
        return "123";
    }
}

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorDao.java

@ -21,6 +21,6 @@ import java.util.Map;
 * </pre>
 * @since 1.
 */
public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO, String>, JpaSpecificationExecutor<BaseDoctorDO>  {
}
//public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO, String>, JpaSpecificationExecutor<BaseDoctorDO>  {
//
//}

+ 46 - 46
svr/svr-base/src/main/java/com/yihu/jw/base/dao/org/BaseOrgDao.java

@ -1,46 +1,46 @@
package com.yihu.jw.base.dao.org;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * 
 * 机构信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String>, JpaSpecificationExecutor<BaseOrgDO>  {
    @Query(value="select b.* from base_org b where b.code= ?1 and b.saasid= ?2 limit 1",nativeQuery = true)
    BaseOrgDO findByCodeAndSaasId(String code,String saasId);
    boolean existsByCode(String code);
    BaseOrgDO findByCode(String code);
    @Modifying
    @Query("delete from BaseOrgDO p where p.saasid=?1 ")
    void deleteBySaasId(String saasId);
    @Query("select id from BaseOrgDO where del = 1 and saasid = ?1")
    List findOrgCodeBySaasId(String saasId);
   /* @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
    List<Map<String,Object>> findOrgListBySaasId(String saasId);*/
    @Query("select code as code,name as name from BaseOrgDO where del = 1")
    List<Map<String,Object>> findOrgListBySaasId();
}
//package com.yihu.jw.base.dao.org;
//
//import com.yihu.jw.entity.base.org.BaseOrgDO;
//import org.springframework.data.domain.Pageable;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Modifying;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//import java.util.Map;
//
///**
// *
// * 机构信息 数据库访问层
// *
// * @version
// * <pre>
// * Author	Version		Date		Changes
// * litaohong 	1.0  		2018年08月31日 	Created
// *
// * </pre>
// * @since 1.
// */
//public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String>, JpaSpecificationExecutor<BaseOrgDO>  {
//
//    @Query(value="select b.* from base_org b where b.code= ?1 and b.saasid= ?2 limit 1",nativeQuery = true)
//    BaseOrgDO findByCodeAndSaasId(String code,String saasId);
//
//    boolean existsByCode(String code);
//
//    BaseOrgDO findByCode(String code);
//
//    @Modifying
//    @Query("delete from BaseOrgDO p where p.saasid=?1 ")
//    void deleteBySaasId(String saasId);
//
//    @Query("select id from BaseOrgDO where del = 1 and saasid = ?1")
//    List findOrgCodeBySaasId(String saasId);
//
//   /* @Query("select code as code,name as name from BaseOrgDO where del = 1 and saasid = ?1 ")
//    List<Map<String,Object>> findOrgListBySaasId(String saasId);*/
//
//    @Query("select code as code,name as name from BaseOrgDO where del = 1")
//    List<Map<String,Object>> findOrgListBySaasId();
//}

+ 31 - 31
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WechatDao.java

@ -1,31 +1,31 @@
package com.yihu.jw.base.dao.wx;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String>, JpaSpecificationExecutor<WxWechatDO> {
    @Query("from WxWechatDO w where w.appId = ?1 and w.status!=-1")
    WxWechatDO findByAppId(String appId);
    @Query("from WxWechatDO w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
    WxWechatDO findByAppIdExcludeId(String appId, String id);
    @Query("from WxWechatDO w where w.id = ?1 and w.status!=-1")
    WxWechatDO findById(String id);
    @Query("from WxWechatDO w where w.status!=-1")
    List<WxWechatDO> findAll();
    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
    WxWechatDO findByAppOriginId(String appOriginId);
    List<WxWechatDO> findByName(String name);
}
//package com.yihu.jw.base.dao.wx;
//
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WechatDao extends PagingAndSortingRepository<WxWechatDO, String>, JpaSpecificationExecutor<WxWechatDO> {
//
//    @Query("from WxWechatDO w where w.appId = ?1 and w.status!=-1")
//    WxWechatDO findByAppId(String appId);
//
//    @Query("from WxWechatDO w where w.appId = ?1 and w.id!= ?2 and w.status!=-1")
//    WxWechatDO findByAppIdExcludeId(String appId, String id);
//
//    @Query("from WxWechatDO w where w.id = ?1 and w.status!=-1")
//    WxWechatDO findById(String id);
//
//    @Query("from WxWechatDO w where w.status!=-1")
//    List<WxWechatDO> findAll();
//
//    @Query("from WxWechatDO w where w.appOriginId = ?1 and w.status!=-1")
//    WxWechatDO findByAppOriginId(String appOriginId);
//
//    List<WxWechatDO> findByName(String name);
//}

+ 17 - 17
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxAccessTokenDao.java

@ -1,17 +1,17 @@
package com.yihu.jw.base.dao.wx;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/18 0018.
 */
public interface WxAccessTokenDao extends PagingAndSortingRepository<WxAccessTokenDO, String>, JpaSpecificationExecutor<WxAccessTokenDO> {
    @Query("from WxAccessTokenDO w where w.wechatId =?1 order by w.addTimestamp desc")
    List<WxAccessTokenDO> getWxAccessTokenById(String wechatId);
}
//package com.yihu.jw.base.dao.wx;
//
//import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/18 0018.
// */
//public interface WxAccessTokenDao extends PagingAndSortingRepository<WxAccessTokenDO, String>, JpaSpecificationExecutor<WxAccessTokenDO> {
//
//    @Query("from WxAccessTokenDO w where w.wechatId =?1 order by w.addTimestamp desc")
//    List<WxAccessTokenDO> getWxAccessTokenById(String wechatId);
//}

+ 19 - 19
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateConfigDao.java

@ -1,19 +1,19 @@
package com.yihu.jw.base.dao.wx;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/8/21.
 */
public interface WxTemplateConfigDao extends PagingAndSortingRepository<WxTemplateConfigDO, String>, JpaSpecificationExecutor<WxTemplateConfigDO> {
    WxTemplateConfigDO findByWechatIdAndTemplateNameAndSceneAndStatus(String wechatId, String templateName, String scene,Integer status);
    WxTemplateConfigDO findByWechatIdAndTemplateNameAndScene(String wechatId, String templateName, String scene);
    List<WxTemplateConfigDO> findByWechatIdAndScene(String wechatId,String scene);
}
//package com.yihu.jw.base.dao.wx;
//
//
//import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Trick on 2018/8/21.
// */
//public interface WxTemplateConfigDao extends PagingAndSortingRepository<WxTemplateConfigDO, String>, JpaSpecificationExecutor<WxTemplateConfigDO> {
//
//    WxTemplateConfigDO findByWechatIdAndTemplateNameAndSceneAndStatus(String wechatId, String templateName, String scene,Integer status);
//    WxTemplateConfigDO findByWechatIdAndTemplateNameAndScene(String wechatId, String templateName, String scene);
//    List<WxTemplateConfigDO> findByWechatIdAndScene(String wechatId,String scene);
//
//}

+ 26 - 26
svr/svr-base/src/main/java/com/yihu/jw/base/dao/wx/WxTemplateDao.java

@ -1,26 +1,26 @@
package com.yihu.jw.base.dao.wx;//package com.yihu.jw.business.wx.dao;
import com.yihu.jw.entity.base.wx.WxTemplateDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public interface WxTemplateDao extends PagingAndSortingRepository<WxTemplateDO, String>, JpaSpecificationExecutor<WxTemplateDO> {
    @Query("from WxTemplateDO w where w.id = ?1 and w.status =1")
    WxTemplateDO findById(String id);
    @Query("from WxTemplateDO w where w.wechatId = ?1 and w.status =1")
    List<WxTemplateDO> findByWxId(String wechatId);
    List<WxTemplateDO> findByTemplateIdAndWechatIdAndStatus(String templateId,String wechatId,Integer status);
    List<WxTemplateDO> findByTemplateNameAndWechatIdAndStatus(String templateId,String wechatId,Integer status);
}
//package com.yihu.jw.base.dao.wx;//package com.yihu.jw.business.wx.dao;
//
//import com.yihu.jw.entity.base.wx.WxTemplateDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//
///**
// * Created by Administrator on 2017/5/20 0020.
// */
//public interface WxTemplateDao extends PagingAndSortingRepository<WxTemplateDO, String>, JpaSpecificationExecutor<WxTemplateDO> {
//
//
//    @Query("from WxTemplateDO w where w.id = ?1 and w.status =1")
//    WxTemplateDO findById(String id);
//
//    @Query("from WxTemplateDO w where w.wechatId = ?1 and w.status =1")
//    List<WxTemplateDO> findByWxId(String wechatId);
//
//    List<WxTemplateDO> findByTemplateIdAndWechatIdAndStatus(String templateId,String wechatId,Integer status);
//
//    List<WxTemplateDO> findByTemplateNameAndWechatIdAndStatus(String templateId,String wechatId,Integer status);
//
//}

+ 13 - 97
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -31,44 +32,19 @@ import java.util.Base64;
@Api(tags = "文件上传相关操作", description = "文件上传相关操作")
public class FileUploadController extends EnvelopRestEndpoint {
    @Autowired
    private FastDFSUtil fastDFSHelper;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Autowired
    private ErrorCodeUtil errorCodeUtil;
    FileUploadService fileUploadService;
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public ObjEnvelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String fullName = file.getOriginalFilename();
        if(StringUtils.isBlank(fullName)){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.FileUpload.FAIL_UPLOAD_FORMAT), ObjEnvelop.class);
        }
        //得到文件类型
        String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
        if(StringUtils.isBlank(fileType)||!"jpg,jpeg,png".contains(fileType)){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.FileUpload.FAIL_UPLOAD_FORMAT), ObjEnvelop.class);
        }
        long size = file.getSize();
        long max = 5*1024*1024;
        if(size>max){
            String msg = String.format(BaseErrorCode.FileUpload.FAIL_FILE_SIZE, 5);
            return failed(msg, ObjEnvelop.class);
        }
        String fileName = fullName.substring(0, fullName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadImg(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
@ -77,53 +53,20 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public ObjEnvelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String fullName = file.getOriginalFilename();
        if(StringUtils.isBlank(fullName)){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.FileUpload.FAIL_UPLOAD_FORMAT), ObjEnvelop.class);
        }
        //得到文件类型
        String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
        if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、jpg、jpeg、png".contains(fileType)){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.FileUpload.FAIL_UPLOAD_FORMAT), ObjEnvelop.class);
        }
        long size = file.getSize();
        long max = 5*1024*1024;
        if(size>max){
            String msg = String.format(BaseErrorCode.FileUpload.FAIL_FILE_SIZE, 5);
            return failed(msg, ObjEnvelop.class);
        }
        String fileName = fullName.substring(0, fullName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadAttachment(inputStream,originalFilename,file.getSize(),fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
        @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
                                                 @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
        // 得到文件的完整名称  xxx.txt
        String fullName = file.getOriginalFilename();
        //得到文件类型
        String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
        String fileName = fullName.substring(0, fullName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(fileName);
        uploadVO.setFileType(fileType);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        UploadVO uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }
@ -131,34 +74,7 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public ObjEnvelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流")
                                                 @RequestBody String jsonData) throws Exception {
        if(jsonData == null){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.FileUpload.FILE_NULL), ObjEnvelop.class);
        }
        String date = URLDecoder.decode(jsonData,"UTF-8");
        String[] fileStreams = date.split(",");
        String is = URLDecoder.decode(fileStreams[1],"UTF-8").replace(" ","+");
        byte[] in = Base64.getDecoder().decode(is);
        String pictureName = fileStreams[0].substring(0,fileStreams[0].length()-1);
        String fileExtension = pictureName.substring(pictureName.lastIndexOf(".") + 1).toLowerCase();
        String description = null;
        if ((pictureName != null) && (pictureName.length() > 0)) {
            int dot = pictureName.lastIndexOf('.');
            if ((dot > -1) && (dot < (pictureName.length()))) {
                description = pictureName.substring(0, dot);
            }
        }
        InputStream inputStream = new ByteArrayInputStream(in);
        ObjectNode objectNode = fastDFSHelper.upload(inputStream, "png", "");
        String groupName = objectNode.get("groupName").toString();
        String remoteFileName = objectNode.get("remoteFileName").toString();
        //解析返回的objectNode
        UploadVO uploadVO = new UploadVO();
        uploadVO.setFileName(remoteFileName);
        uploadVO.setFileType(groupName);
        uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
        uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
        //返回文件路径
        UploadVO uploadVO = fileUploadService.uploadImages(jsonData,fastdfs_file_url);
        return success("上传成功", uploadVO);
    }

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -1,7 +1,7 @@
package com.yihu.jw.base.endpoint.patient;
import com.yihu.jw.base.service.patient.BasePatientService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.base.patient.BasePatientVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WeChatQrcodeController.java

@ -1,10 +1,10 @@
package com.yihu.jw.base.endpoint.wx;
import com.yihu.jw.base.service.wx.WeChatQrcodeService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.service.WeChatQrcodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

+ 0 - 138
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WechatConfigController.java

@ -1,138 +0,0 @@
package com.yihu.jw.base.endpoint.wx;//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.base.wx.WxWechatDO;
//import com.yihu.jw.business.wx.service.WechatService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.restmodel.base.wx.WxWechatVO;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/5/11.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信相关操作", description = "微信相关操作")
//public class WechatConfigController extends EnvelopRestController {
//    @Autowired
//    private WechatService wechatService;
//
//    @PostMapping(value = WechatRequestMapping.WxConfig.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建微信配置", notes = "创建微信配置")
//    public Envelop createWechat(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxWechatDO wechat = toEntity(jsonData, WxWechatDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_create, wechatService.createWechat(wechat));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PutMapping(value = WechatRequestMapping.WxConfig.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改微信配置", notes = "修改微信配置")
//    public Envelop updateWechat(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxWechatDO wechat = toEntity(jsonData, WxWechatDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_update, wechatService.updateWxchat(wechat));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @DeleteMapping(value = WechatRequestMapping.WxConfig.api_delete)
//    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
//    public Envelop deleteWechat(
//            @ApiParam(name = "ids", value = "ids")
//            @RequestParam(value = "ids", required = true) String ids,
//            @ApiParam(name = "userId", value = "userId")
//            @RequestParam(value = "userId", required = true) String userId,
//            @ApiParam(name = "userName", value = "userName")
//            @RequestParam(value = "userName", required = true) String userName
//            ) {
//        try {
//            wechatService.deleteWechat(ids,userId,userName);
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxConfig.api_getById)
//    @ApiOperation(value = "根据Id查找微信配置", notes = "根据code查找微信配置")
//    public Envelop findById(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxConfig.message_success_find, wechatService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @RequestMapping(value = WechatRequestMapping.WxConfig.api_getWechats, method = RequestMethod.GET)
//    @ApiOperation(value = "获取微信配置列表(分页)")
//    public Envelop getWechats(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        if(StringUtils.isBlank(sorts)){
//            sorts = "-updateTime";
//        }
//        //得到list数据
//        List<WxWechatDO> list = wechatService.search(fields, filters, sorts, page, size);
//        //获取总数
//        long count=wechatService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<WxWechatVO> WxWechatVOs = convertToModels(list, new ArrayList<>(list.size()), WxWechatVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxConfig.message_success_find_functions,WxWechatVOs, page, size,count);
//    }
//
//
//    @GetMapping(value = WechatRequestMapping.WxConfig.api_getWechatNoPage)
//    @ApiOperation(value = "获取微信列表配置,不分页")
//    public Envelop getWechatNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<WxWechatDO> list = wechatService.search(fields,filters,sorts);
//        //封装返回格式
//        List<WxWechatVO> WxWechatVOs = convertToModels(list, new ArrayList<>(list.size()), WxWechatVO.class, fields);
//        return Envelop.getSuccessList(WechatRequestMapping.WxConfig.message_success_find_functions,WxWechatVOs);
//    }
//
//}

+ 0 - 47
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxAccessTokenController.java

@ -1,47 +0,0 @@
package com.yihu.jw.base.endpoint.wx;//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.base.wx.WxAccessTokenDO;
//import com.yihu.jw.business.wx.service.WxAccessTokenService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * Created by cyx on 2017/5/11.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信token模块", description = "微信token模块接口管理")
//public class WxAccessTokenController extends EnvelopRestController {
//
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//
//    /**
//     * 根据wechatCode获取WxAccessToken
//     * @param wechatId
//     * @return MWxAccessToken
//     * @throws Exception
//     */
//    @GetMapping(value = WechatRequestMapping.WxAccessToken.api_get)
//    @ApiOperation(value = "根据wechatId获取最新的WxAccessToken")
//    public Envelop getWxAccessToken(
//            @ApiParam(name = "wechatId", value = "wechatId")
//            @RequestParam(value = "wechatId") String wechatId) {
//        try {
//            WxAccessTokenDO wxAccessToken = wxAccessTokenService.getWxAccessTokenById(wechatId);
//            return Envelop.getSuccess(WechatRequestMapping.WxAccessToken.message_success_get, wxAccessToken);
//        }catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//}

+ 0 - 164
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxGraphicMessageController.java

@ -1,164 +0,0 @@
package com.yihu.jw.base.endpoint.wx;//package com.yihu.jw.business.wx.controller;
//
//import com.yihu.jw.base.wx.WxGraphicMessageDO;
//import com.yihu.jw.business.wx.service.WxGraphicMessageService;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.restmodel.common.Envelop;
//import com.yihu.jw.restmodel.common.EnvelopRestController;
//import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// *   2017/5/11.
// */
//@RestController
//@RequestMapping(WechatRequestMapping.api_common)
//@Api(value = "微信图文相关操作", description = "微信图文相关操作")
//public class WxGraphicMessageController extends EnvelopRestController {
//    @Autowired
//    private WxGraphicMessageService wxGraphicMessageService;
//
//    @PostMapping(value = WechatRequestMapping.WxGraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
//    public Envelop createWxGraphicMessage(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxGraphicMessageDO WxGraphicMessage = toEntity(jsonData, WxGraphicMessageDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_create, wxGraphicMessageService.createWxGraphicMessage(WxGraphicMessage));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @PutMapping(value = WechatRequestMapping.WxGraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
//    public Envelop updateWxGraphicMessage(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxGraphicMessageDO WxGraphicMessage = toEntity(jsonData, WxGraphicMessageDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_update, wxGraphicMessageService.updateWxGraphicMessage(WxGraphicMessage));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    @DeleteMapping(value = WechatRequestMapping.WxGraphicMessage.api_delete)
//    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
//    public Envelop deleteWxGraphicMessage(
//            @ApiParam(name = "codes", value = "codes")
//            @RequestParam(value = "codes", required = true) String codes,
//            @ApiParam(name = "userCode", value = "userCode")
//            @RequestParam(value = "userCode", required = true) String userCode,
//            @ApiParam(name = "userName", value = "userName")
//            @RequestParam(value = "userName", required = true) String userName
//    ) {
//        try {
//            wxGraphicMessageService.deleteWxGraphicMessage(codes, userCode, userName);
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxGraphicMessage.api_getById)
//    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
//    public Envelop findByCode(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxGraphicMessage.message_success_find, wxGraphicMessageService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @RequestMapping(value = WechatRequestMapping.WxGraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
//    @ApiOperation(value = "获取微信图文消息列表(分页)")
//    public Envelop getWxGraphicMessages(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        if(StringUtils.isBlank(sorts)){
//            sorts = "-updateTime";
//        }
//        //得到list数据
//        List<WxGraphicMessageDO> list = wxGraphicMessageService.search(fields, filters, sorts, page, size);
//        //获取总数
//        long count=wxGraphicMessageService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<WxGraphicMessageVO> WxGraphicMessageVOs = convertToModels(list, new ArrayList<>(list.size()), WxGraphicMessageVO.class, fields);
//
//        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxGraphicMessage.message_success_find_functions,WxGraphicMessageVOs, page, size,count);
//    }
//
//
//    @GetMapping(value = WechatRequestMapping.WxGraphicMessage.api_getWxGraphicMessageNoPage)
//    @ApiOperation(value = "获取图文消息列表,不分页")
//    public Envelop getWxGraphicMessageNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<WxGraphicMessageDO> list = wxGraphicMessageService.search(fields,filters,sorts);
//        //封装返回格式
//        List<WxGraphicMessageVO> WxGraphicMessageVOs = convertToModels(list, new ArrayList<>(list.size()), WxGraphicMessageVO.class, fields);
//        return Envelop.getSuccessList(WechatRequestMapping.WxGraphicMessage.message_success_find_functions,WxGraphicMessageVOs);
//    }
//
//    //@GetMapping(value = WlyyContants.WxGraphicMessage.api_sendGraphicMessages)
//    //@ApiOperation(value = "发送图文消息")
//    //public Envelop sendGraphicMessages(
//    //        @ApiParam(name = "codes", value = "根据code发送微信图文消息,多个code用,分割")
//    //        @RequestParam(value = "codes", required = true) String codes,HttpServletRequest request) throws Exception {
//    //    String messages = wxGraphicMessageService.sendGraphicMessages(codes, request);
//    //    return Envelop.getSuccess("成功",messages);
//    //}
//
//    @GetMapping(value = WechatRequestMapping.WxGraphicMessage.api_sendGraphicMessages)
//    @ApiOperation(value = "发送图文消息")
//    @ResponseBody
//    public String sendGraphicMessages(
//            @ApiParam(name = "ids", value = "根据code发送微信图文消息,多个code用,分割")
//            @RequestParam(value = "ids", required = true) String ids,
//            @ApiParam(name = "fromUserName", value = "用户openid")
//            @RequestParam(value = "fromUserName", required = true) String fromUserName,
//            @ApiParam(name = "toUserName", value = "公众号")
//            @RequestParam(value = "toUserName", required = true) String toUserName
//            ) throws Exception {
//        String messages = wxGraphicMessageService.sendGraphicMessages(ids, fromUserName,toUserName);
//        return messages;
//    }
//
//
//}

+ 0 - 184
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxMenuController.java

@ -26,194 +26,10 @@ public class WxMenuController extends EnvelopRestEndpoint {
    @Autowired
    private WxMenuService wxMenuService;
    @Autowired
    private WechatService wechatService;
    @PostMapping(value = WechatRequestMapping.WxMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    public MixEnvelop createWxMenu(@ApiParam(name = "wxId", value = "微信id")
                                    @RequestParam(value = "wxId", required = false)String wxId) throws Exception{
        return wxMenuService.createWxMenu(wxId);
    }
//    @PutMapping(value = WechatRequestMapping.WxMenu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
//    public Envelop updateWxMenu(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxMenuDO wxMenu = toEntity(jsonData, WxMenuDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_update, wxMenuService.updateWxMenu(wxMenu));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//    @DeleteMapping(value = WechatRequestMapping.WxMenu.api_delete)
//    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
//    public Envelop deleteWxMenu(
//            @ApiParam(name = "ids", value = "ids")
//            @RequestParam(value = "ids", required = true) String ids,
//            @ApiParam(name = "userId", value = "userId")
//            @RequestParam(value = "userId", required = true) String userId,
//            @ApiParam(name = "userName", value = "userName")
//            @RequestParam(value = "userName", required = true) String userName
//    ) {
//        try {
//            wxMenuService.deleteWxMenu(ids, userId, userName);
//            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxMenu.api_getById)
//    @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
//    public Envelop findByCode(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_find, wxMenuService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @RequestMapping(value = WechatRequestMapping.WxMenu.api_getWxMenus, method = RequestMethod.GET)
//    @ApiOperation(value = "获取微信菜单列表(分页)")
//    public Envelop getWxMenus(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        if(StringUtils.isBlank(sorts)){
//            sorts = "-updateTime";
//        }
//
//        //得到微信列表数据
//        List<WxWechatDO> wechats = wechatService.search(fields, filters, sorts, page, size);
//        for(WxWechatDO wechat:wechats){
//            List<WxMenuDO> parentMenus = wxMenuService.findParentMenuByWechatCode(wechat.getId());
//            if (parentMenus.size()>0){
//                wechat.setState("closed");
//            }else{
//                wechat.setState("open");
//            }
//        }
//        //获取总数
//        long count=wechatService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<WxWechatVO> mwechats = convertToModels(wechats, new ArrayList<>(wechats.size()), WxWechatVO.class, fields);
//        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxMenu.message_success_find_functions,mwechats, page, size,count);
//    }
//
//
//    @GetMapping(value = WechatRequestMapping.WxMenu.api_getWxMenuNoPage)
//    @ApiOperation(value = "获取微信菜单列表,不分页")
//    public Envelop getWxMenuNoPage(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        if(filters!=null){
//            filters = "supMenucode=0;"+filters;
//        }else{
//            filters = "supMenucode=0;";
//        }
//        //得到list数据
//        List<WxMenuDO> list = wxMenuService.search(fields,filters,sorts);
//        for(WxMenuDO wxMenu:list){
//            List<WxMenuDO> childMenus = wxMenuService.findChildMenus(wxMenu.getId());
//            wxMenu.setChildren(childMenus);
//        }
//        //封装返回格式
//        List<WxMenuVO> WxMenuVOs = convertToModels(list, new ArrayList<>(list.size()), WxMenuVO.class, fields);
//        Map<String, String> map = wechatService.getAllWechatConfig();
//        for(WxMenuVO menu:WxMenuVOs){
//            menu.setWechatName(map.get(menu.getWechatCode()));
//        }
//        return Envelop.getSuccessList(WechatRequestMapping.WxMenu.message_success_find_functions,WxMenuVOs);
//    }
//
//    /**
//     * 创建微信公众号菜单
//     *
//     * @return
//     */
//    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
//    @RequestMapping(value = WechatRequestMapping.WxMenu.api_createMenu ,method = RequestMethod.GET)
//    public Envelop createWechatMenu(
//            @ApiParam(name = "wechatId", value = "", defaultValue = "")
//            @RequestParam(value = "wechatId", required = true)String wechatId){
//        try{
//            JSONObject result = wxMenuService.createWechatMenu(wechatId);
//            String errcode = result.get("errcode").toString();
//            WechatResponse wechatResponse = new WechatResponse(Integer.valueOf(errcode));
//            String msg = wechatResponse.getMsg();
//            return Envelop.getSuccess("成功",msg);
//        }catch (Exception e){
//            return Envelop.getSuccess("创建失败",e );
//        }
//    }
//
//    /**
//     * 根据微信code查找父菜单
//     * @param wechatId
//     * @return
//     */
//    @GetMapping(value = WechatRequestMapping.WxMenu.api_getParentMenu)
//    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
//    public Envelop getParentMenu(
//            @ApiParam(name = "wechatId", value = "wechatId")
//            @PathVariable(value = "wechatId", required = true) String wechatId
//    ) {
//        try {
//            List<WxMenuDO> parentMenus = wxMenuService.findParentMenuByWechatCode(wechatId);
//            for(WxMenuDO parentMenu:parentMenus){
//                List<WxMenuDO> childMenus = wxMenuService.findChildMenus(parentMenu.getId());
//                if (childMenus.size()>0){
//                    parentMenu.setState("closed");
//                }else{
//                    parentMenu.setState("open");
//                }
//            }
//            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_find, parentMenus);
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//
//    /**
//     * 根据父级菜单code查找子菜单
//     * @param parentCode
//     * @return
//     */
//    @GetMapping(value = WechatRequestMapping.WxMenu.api_getChildMenus)
//    @ApiOperation(value = "根据父级菜单code查找子菜单", notes = "根据父级菜单code查找子菜单")
//    public Envelop getChildMenus(
//            @ApiParam(name = "parentCode", value = "parentCode")
//            @PathVariable(value = "parentCode", required = true) String parentCode
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxMenu.message_success_find, wxMenuService.findChildMenus(parentCode));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
}

+ 0 - 148
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/wx/WxTemplateController.java

@ -35,152 +35,4 @@ public class WxTemplateController extends EnvelopRestEndpoint {
        return wxTemplateService.getAllTemp(wechatId);
    }
//    @PostMapping(value = WechatRequestMapping.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
//    public Envelop createWxTemplate(
//            @ApiParam(name = "json_data", value = "微信模版json字符串")
//            @RequestBody String jsonData) {
//        try {
//            WxTemplateDO WxTemplate = toEntity(jsonData, WxTemplateDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_create, wxTemplateService.createWxTemplate(WxTemplate));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @PutMapping(value = WechatRequestMapping.WxTemplate.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
//    public Envelop updateWxTemplate(
//            @ApiParam(name = "json_data", value = "", defaultValue = "")
//            @RequestBody String jsonData) {
//        try {
//            WxTemplateDO WxTemplate = toEntity(jsonData, WxTemplateDO.class);
//            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_update, wxTemplateService.updateWxTemplate(WxTemplate));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @DeleteMapping(value = WechatRequestMapping.WxTemplate.api_delete)
//    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
//    public Envelop deleteWxTemplate(
//            @ApiParam(name = "codes", value = "codes")
//            @RequestParam(value = "codes", required = true) String codes,
//            @ApiParam(name = "userCode", value = "userCode")
//            @RequestParam(value = "userCode", required = true) String userCode,
//            @ApiParam(name = "userName", value = "userName")
//            @RequestParam(value = "userName", required = true) String userName
//    ) {
//        try {
//            wxTemplateService.deleteWxTemplate(codes, userCode, userName);
//            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_delete );
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxTemplate.api_getById)
//    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
//    public Envelop findById(
//            @ApiParam(name = "id", value = "id")
//            @RequestParam(value = "id", required = true) String id
//    ) {
//        try {
//            return Envelop.getSuccess(WechatRequestMapping.WxTemplate.message_success_find, wxTemplateService.findById(id));
//        } catch (ApiException e) {
//            return Envelop.getError(e.getMessage(), e.getErrorCode());
//        }
//    }
//
//    @RequestMapping(value = WechatRequestMapping.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
//    @ApiOperation(value = "获取微信模版列表(分页)")
//    public Envelop getWechats(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts,
//            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
//            @RequestParam(value = "size", required = false) int size,
//            @ApiParam(name = "page", value = "页码", defaultValue = "1")
//            @RequestParam(value = "page", required = false) int page,
//            HttpServletRequest request,
//            HttpServletResponse response) throws Exception {
//        if(StringUtils.isBlank(sorts)){
//            sorts = "-updateTime";
//        }
//
//        //得到微信列表数据
//        List<WxWechatDO> wechats = wechatService.search(fields, filters, sorts, page, size);
//        for(WxWechatDO wechat:wechats){
//            List<WxTemplateDO> wxTemplates = wxTemplateService.findByWxId(wechat.getId());
//            if (wxTemplates.size()>0){
//                wechat.setState("closed");
//            }else{
//                wechat.setState("open");
//            }
//        }
//        //获取总数
//        long count=wechatService.getCount(filters);
//        //封装头信息
//        pagedResponse(request, response, count, page, size);
//        //封装返回格式
//        List<WxWechatVO> mwechats = convertToModels(wechats, new ArrayList<>(wechats.size()), WxWechatVO.class, fields);
//        return Envelop.getSuccessListWithPage(WechatRequestMapping.WxMenu.message_success_find_functions,mwechats, page, size,count);
//
//    }
//
//
//    @GetMapping(value = WechatRequestMapping.WxTemplate.api_getWxTemplatesNoPage)
//    @ApiOperation(value = "获取微信模版列表(不分页)")
//    public Envelop getList(
//            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
//            @RequestParam(value = "fields", required = false) String fields,
//            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
//            @RequestParam(value = "filters", required = false) String filters,
//            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
//            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
//        //得到list数据
//        List<WxTemplateDO> list = wxTemplateService.search(fields,filters,sorts);
//        //封装返回格式
//        List<WxTemplateVO> mWxTemplateVOs = convertToModels(list, new ArrayList<>(list.size()), WxTemplateVO.class, fields);
//        return Envelop.getSuccessList(WechatRequestMapping.WxTemplate.message_success_find_functions,mWxTemplateVOs);
//    }
//
//    @GetMapping(value = WechatRequestMapping.WxTemplate.api_sendTemplateMessage)
//    @ApiOperation(value = "发送微信模板消息")
//    @ResponseBody
//    public Envelop sendTemplateMessage(
//            @ApiParam(name="openid",value="微信用户的openid")
//            @RequestParam String openid,
//            @ApiParam(name="templateCode",value = "模板code")
//            @RequestParam String templateCode,
//            @ApiParam(name="url",value="模板跳转链接")
//            @RequestParam(required = false) String url,
//            @ApiParam(name="appid",value="所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系)")
//            @RequestParam(required = false) String appid,
//            @ApiParam(name="pagepath",value="所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar)")
//            @RequestParam(required = false) String pagepath,
//            @ApiParam(name="data",value="json字符串")
//            @RequestParam String data
//    ){
//        try {
//            Miniprogram miniprogram = null;
//            if(StringUtils.isNotBlank(appid)&&StringUtils.isNotBlank(pagepath)){
//                miniprogram = new Miniprogram();
//                miniprogram.setAppid(appid);
//                miniprogram.setPagepath(pagepath);
//            }
//            JSONObject jsonObject = wxTemplateService.sendTemplateMessage(openid, templateCode, url, data, miniprogram);
//            String errcode = jsonObject.get("errcode").toString();
//            WechatResponse wechatResponse = new WechatResponse(Integer.valueOf(errcode));
//            String msg = wechatResponse.getMsg();
//            return Envelop.getSuccess("成功",msg);
//        }catch (Exception exception) {
//            return Envelop.getSuccess("error", exception);
//        }
//    }
}

+ 47 - 46
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -7,13 +7,11 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.base.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
@ -22,6 +20,7 @@ import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.TreeNode;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.dict.DictDoctorDutyDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
@ -32,6 +31,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@ -226,10 +226,10 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public String createDoctor(String jsonData){
    public String createDoctor(String jsonData) {
        JSONObject result = new JSONObject();
        if(StringUtils.isEmpty(jsonData)){
            result.put("msg","jsonData is null");
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
@ -237,58 +237,60 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONObject doctor = jsonObject.getJSONObject("doctor");
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor || CollectionUtils.isEmpty(hospital)){
            result.put("msg","parameter doctor or hospital of jsonData is null");
        if (null == doctor) {
            result.put("msg", "医生信息不可为空!");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        //组装医生信息
        BaseDoctorDO baseDoctorDO = null;
        try {
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(),BaseDoctorDO.class);
            baseDoctorDO = objectMapper.readValue(doctor.toJSONString(), BaseDoctorDO.class);
        } catch (IOException e) {
           result.put("msg","convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
           result.put("response",ConstantUtils.FAIL);
           return result.toJSONString();
            result.put("msg", "convert doctor jsonObject to BaseDoctorDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11,17));
        baseDoctorDO.setPassword(baseDoctorDO.getIdcard().substring(11, 17));
        this.save(baseDoctorDO);
        //组装医生角色关联关系,医生默认可以没有角色
        if(!CollectionUtils.isEmpty(role)){
        BaseDoctorRoleDO baseDoctorRoleDO = null;
        List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
        try {
            for(Object object : role){
                baseDoctorRoleDO = objectMapper.readValue(object.toString(),BaseDoctorRoleDO.class);
                baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorRoleDOList.add(baseDoctorRoleDO);
        //组装医生角色关联关系,医生默认可以没有角色,没有机构/部门信息等
        if (!CollectionUtils.isEmpty(role)) {
            BaseDoctorRoleDO baseDoctorRoleDO = null;
            List<BaseDoctorRoleDO> baseDoctorRoleDOList = new ArrayList<>();
            try {
                for (Object object : role) {
                    baseDoctorRoleDO = objectMapper.readValue(object.toString(), BaseDoctorRoleDO.class);
                    baseDoctorRoleDO.setDoctorCode(baseDoctorDO.getId());
                    baseDoctorRoleDOList.add(baseDoctorRoleDO);
                }
            } catch (IOException e) {
                result.put("msg", "convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                result.put("response", ConstantUtils.FAIL);
                return result.toJSONString();
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
        }
        baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
            baseDoctorRoleService.batchInsert(baseDoctorRoleDOList);
        }
        // 组装医生任职机构及职业信息
        BaseDoctorHospitalDO baseDoctorHospitalDO = null;
        List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
        try {
            for(Object object : hospital){
                baseDoctorHospitalDO = objectMapper.readValue(object.toString(),BaseDoctorHospitalDO.class);
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                hospitalDOList.add(baseDoctorHospitalDO);
        // 组装医生任职机构及职业信息,医生默认可以没有角色,没有机构/部门信息等
        if (!CollectionUtils.isEmpty(hospital)) {
            BaseDoctorHospitalDO baseDoctorHospitalDO = null;
            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
            try {
                for (Object object : hospital) {
                    baseDoctorHospitalDO = objectMapper.readValue(object.toString(), BaseDoctorHospitalDO.class);
                    baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                    hospitalDOList.add(baseDoctorHospitalDO);
                }
            } catch (IOException e) {
                result.put("msg", "convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
                result.put("response", ConstantUtils.FAIL);
                return result.toJSONString();
            }
        } catch (IOException e) {
            result.put("msg","convert hospital jsonObject to baseDoctorHospitalDO failed," + e.getCause());
            result.put("response",ConstantUtils.FAIL);
            return result.toJSONString();
            baseDoctorHospitalService.batchInsert(hospitalDOList);
        }
        baseDoctorHospitalService.batchInsert(hospitalDOList);
        result.put("response",ConstantUtils.SUCCESS);
        result.put("msg",baseDoctorDO);
        result.put("response", ConstantUtils.SUCCESS);
        result.put("msg", baseDoctorDO);
        return result.toJSONString();
    }
@ -310,7 +312,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        JSONArray role = jsonObject.getJSONArray("role");
        JSONArray hospital = jsonObject.getJSONArray("hospital");
        if(null == doctor){
            result.put("msg","parameter role of jsonData is null");
            result.put("msg","parameter doctor of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result.toJSONString();
        }
@ -334,7 +336,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        }
        this.save(baseDoctorDO);
        //修改医生角色关联关系,医生默认可以没有角色
        //修改医生角色关联关系,医生默认可以没有角色,前端不修改就不做任何操作
        if(!CollectionUtils.isEmpty(role)){
            BaseDoctorRoleDO baseDoctorRoleDO = null;
            Set<Object> roleIdList = baseDoctorRoleService.findRoleIdList(baseDoctorDO.getId());
@ -356,8 +358,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }
        }
        // 修改医生任职机构及职业信息,前端不修改就不做任何操作
        // 修改医生任职机构及职业信息,,医生默认可以没有机构/部门信息,前端不修改就不做任何操作
         if(!CollectionUtils.isEmpty(hospital)){
             BaseDoctorHospitalDO baseDoctorHospitalDO = null;
             Set<Object> hospitalIdList = baseDoctorHospitalService.findDocHospIdList(baseDoctorDO.getId());

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java

@ -4,10 +4,10 @@ import com.yihu.jw.base.dao.dict.DictDoctorDutyDao;
import com.yihu.jw.base.dao.dict.DictHospitalDeptDao;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.service.org.tree.SimpleTree;
import com.yihu.jw.base.service.org.tree.SimpleTreeNode;
import com.yihu.jw.base.service.org.tree.TreeNode;
@ -14,6 +13,7 @@ import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.base.org.BaseOrgSaasDO;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/patient/PatientFamilyMemberService.java

@ -1,9 +1,9 @@
package com.yihu.jw.base.service.patient;
import com.yihu.jw.base.dao.patient.BasePatientDao;
import com.yihu.jw.base.dao.patient.BasePatientFamilyMemberDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.mysql.query.BaseJpaService;

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasBusinessCardService.java

@ -2,8 +2,8 @@ package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.saas.SaasBusinessCardDao;
import com.yihu.jw.base.service.doctor.BaseDoctorService;
import com.yihu.jw.base.service.patient.BasePatientService;
import com.yihu.jw.entity.base.saas.SaasBusinessCardDO;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -3,7 +3,6 @@ package com.yihu.jw.base.service.saas;
import com.yihu.jw.base.dao.dict.*;
import com.yihu.jw.base.dao.module.ModuleDao;
import com.yihu.jw.base.dao.module.SaasModuleDao;
import com.yihu.jw.base.dao.org.BaseOrgDao;
import com.yihu.jw.base.dao.org.BaseOrgSaasDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.saas.SaasDao;
@ -25,6 +24,7 @@ import com.yihu.jw.entity.base.saas.SaasThemeDO;
import com.yihu.jw.entity.base.saas.SaasThemeExtendDO;
import com.yihu.jw.entity.base.system.SystemDictEntryDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;

+ 3 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageService.java

@ -61,7 +61,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
    public ServicePackageDO addRehabilitation(RehabilitationVO rehabilitationVO,ServicePackageSignRecordDO signRecordDO) throws Exception{
        ServicePackageVO servicePackageVO = rehabilitationVO.getServicePackageVO();
        ServicePackageDO servicePackageDO = convertToModelDO(servicePackageVO);
        List<ServicePackageDetailsDO> detailsDOList = servicePackageDO.getDetailsDOList();
        /*List<ServicePackageDetailsDO> detailsDOList = servicePackageDO.getDetailsDOList();
        //新增服务包主表
        servicePackageDO.setCreateTime(new Date());
        servicePackageDO.setDel(1);
@ -99,7 +99,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        logVO.setUserType(ServicePackageLogVO.UserType.doctor.getValue());
        logVO.setUserCode(signRecordDO.getSignDoctor());
        logVO.setUserName(signRecordDO.getSignDoctorName());
        elastricSearchHelper.save(servicePackLongIndex,servicePackLongType, objectMapper.writeValueAsString(logVO));
        elastricSearchHelper.save(servicePackLongIndex,servicePackLongType, objectMapper.writeValueAsString(logVO));*/
        return servicePackageDO;
    }
@ -157,7 +157,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        BeanUtils.copyProperties(servicePackageVO, target);
        List<ServicePackageDetailsDO> voList = convertToModels(servicePackageVO.getDetailsVOList(),new ArrayList<>(servicePackageVO.getDetailsVOList().size()),ServicePackageDetailsDO.class);
        target.setDetailsDOList(voList);
//        target.setDetailsDOList(voList);
        return target;
    }
}

+ 4 - 104
svr/svr-base/src/main/java/com/yihu/jw/base/service/sms/SmsGatewayService.java

@ -1,115 +1,15 @@
package com.yihu.jw.base.service.sms;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.sms.SmsDao;
import com.yihu.jw.base.dao.sms.SmsGatewayDao;
import com.yihu.jw.base.dao.sms.SmsTemplateDao;
import com.yihu.jw.entity.base.sms.SmsDO;
import com.yihu.jw.entity.base.sms.SmsGatewayDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.sms.service.BaseSmsGatewayService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.network.IPInfoUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * Service - 短信网关
 * Created by progr1mmer on 2018/8/23.
 * Service - 短信记录
 * Created by progr1mmer on 2018/9/6.
 */
@Service
public class SmsGatewayService extends BaseJpaService<SmsGatewayDO, SmsGatewayDao> {
    private static final Pattern PATTERN  = Pattern.compile("\\$\\{[A-Za-z0-9]+\\}");
    @Autowired
    private SmsTemplateDao smsTemplateDao;
    @Autowired
    private SmsGatewayDao smsGatewayDao;
    @Autowired
    private SmsDao smsDao;
    @Autowired
    private ObjectMapper objectMapper;
    public SmsDO send(String clientId, SmsTemplateDO.Type type, String to) throws Exception {
        List<SmsGatewayDO> smsGatewayDOS = smsGatewayDao.findByClientIdAndStatus(clientId, SmsGatewayDO.Status.available);
        if (smsGatewayDOS.size() == 0) {
            throw new ApiException("no gateway available");
        }
        List<SmsTemplateDO> smsTemplateDOS = smsTemplateDao.findByClientIdAndType(clientId, type);
        if (smsTemplateDOS.size() == 0) {
            throw new ApiException("no template available");
        }
        Random random = new Random();
        SmsGatewayDO smsGatewayDO = smsGatewayDOS.get(random.nextInt(smsGatewayDOS.size()));
        SmsTemplateDO smsTemplateDO = smsTemplateDOS.get(random.nextInt(smsTemplateDOS.size()));
        //生成内容
        String rawContent = smsTemplateDO.getContent();
        /*
         * 0 - 验证码
         * 1 - 过期时间(分钟)
         */
        String [] contentDatas = new String[] {
                randomInt(6),
                smsGatewayDO.getExpireMin().toString()
        };
        Matcher contentMatcher = PATTERN.matcher(rawContent);
        int index = 0;
        while (contentMatcher.find()) {
            String matchWord = contentMatcher.group(0);
            rawContent = rawContent.replace(matchWord, contentDatas[index]);
            index ++;
        }
        String sendContent = smsTemplateDO.getHeader() + rawContent;
        //第三方API服务请求参数
        String rawCertificate = smsGatewayDO.getRequestCertificate();
        /*
         * 0 - 接收手机号码
         * 1 - 短信内容
         */
        String [] certificateDatas = new String[] {
                to,
                sendContent
        };
        Matcher certificateMatcher = PATTERN.matcher(rawCertificate);
        index = 0;
        while (certificateMatcher.find()) {
            String matchWord = certificateMatcher.group(0);
            rawCertificate = rawCertificate.replace(matchWord, certificateDatas[index]);
            index ++;
        }
        HttpResponse httpResponse = HttpUtils.doPost(smsGatewayDO.getRequestUrl(), objectMapper.readValue(rawCertificate, Map.class));
        if (httpResponse.isSuccessFlg()) {
            Map<String, Object> response = objectMapper.readValue(httpResponse.getContent(), Map.class);
            String responseCode = String.valueOf(response.get(smsGatewayDO.getResponseCode()));
            if (responseCode.equals(smsGatewayDO.getSuccessValue())) {
                HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
                SmsDO smsDO = new SmsDO();
                smsDO.setClientId(clientId);
                smsDO.setSmsGatewayId(smsGatewayDO.getId());
                smsDO.setRequestIp(IPInfoUtils.getIPAddress(request));
                smsDO.setMobile(to);
                smsDO.setContent(sendContent);
                smsDO.setDeadline(DateUtils.addMinutes(new Date(), smsGatewayDO.getExpireMin()));
                smsDO.setCaptcha(contentDatas[0]);
                smsDO.setType(type);
                return smsDao.save(smsDO);
            } else {
                throw new ApiException(httpResponse.getContent());
            }
        } else {
            throw new ApiException(httpResponse.getContent());
        }
    }
public class SmsGatewayService extends BaseSmsGatewayService {
}

+ 2 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/sms/SmsService.java

@ -1,8 +1,6 @@
package com.yihu.jw.base.service.sms;
import com.yihu.jw.base.dao.sms.SmsDao;
import com.yihu.jw.entity.base.sms.SmsDO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.jw.sms.service.BaseSmsService;
import org.springframework.stereotype.Service;
/**
@ -10,6 +8,6 @@ import org.springframework.stereotype.Service;
 * Created by progr1mmer on 2018/9/6.
 */
@Service
public class SmsService extends BaseJpaService<SmsDO, SmsDao>{
public class SmsService extends BaseSmsService {
}

+ 4 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/service/sms/SmsTemplateService.java

@ -1,15 +1,13 @@
package com.yihu.jw.base.service.sms;
import com.yihu.jw.base.dao.sms.SmsTemplateDao;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.jw.sms.service.BaseSmsTemplateService;
import org.springframework.stereotype.Service;
/**
 * Service - 短信模板
 * Created by progr1mmer on 2018/8/23.
 * Service - 短信记录
 * Created by progr1mmer on 2018/9/6.
 */
@Service
public class SmsTemplateService extends BaseJpaService<SmsTemplateDO, SmsTemplateDao>{
public class SmsTemplateService extends BaseSmsTemplateService {
}

+ 99 - 98
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WeChatQrcodeService.java

@ -1,99 +1,100 @@
package com.yihu.jw.base.service.wx;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpRequest;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
 * 微信二维码
 * Created by Trick on 2018/9/7.
 */
@Service
public class WeChatQrcodeService {
    @Autowired
    private FastDFSUtil fastDFSHelper;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    public String getQrcode(HttpServletRequest request, String wechatId, String scene) throws Exception{
        String token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken();
        String params = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"" + scene + "\"}}}";
        //服务号必须是通过腾讯认证,每年是300元,如果没有认证而导致的错误提示,那就去认证
        //微信登录提示48001,{"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}
        String result = HttpUtil.sendPost(token_url, params);
        if (!StringUtils.isEmpty(result)) {
            JSONObject json = new JSONObject(result);
            if (json.has("ticket")) {
                // 请求输入流
                InputStream inputStream = null;
                // 下载二维码图片
                URL urlGet = new URL("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="
                        + URLEncoder.encode(json.get("ticket").toString(), "UTF-8"));
                HttpURLConnection connection = (HttpURLConnection) urlGet.openConnection();
                connection.connect();
                //下载图片到内存
                inputStream = connection.getInputStream();
                //======start===
                //fastDFS方法问题,直接将inputStream文件流上传文件服务器存数据缺失,
                // 故将文件输出本地,在上传文件服务器,之后删除本地文件
                String path = WeChatQrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                        + File.separator + "qrcode" ;
                //判断目录是否存在,创建目录
                File dir = new File(path);
                if(!dir.exists()){
                    dir.mkdir();
                }
                path+= File.separator + wechatId+"_"+scene+".png";
                File file = new File(path);
                // 保存文件
                FileOutputStream outputStream = new FileOutputStream(file);
                byte[] data = new byte[1024];
                int len = 0;
                while ((len = inputStream.read(data)) != -1) {
                    outputStream.write(data, 0, len);
                }
                InputStream input = new FileInputStream(file);
                //=======end=========
                ObjectNode objectNode = fastDFSHelper.upload(input,"png","");
                if (outputStream != null) {
                    outputStream.close();
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                //流关闭,删除文件
                if(file.exists()&&file.isFile()){
                    file.delete();
                }
                return objectNode.get("fileId").toString().replaceAll("\"", "");
            }
        }
        return "";
    }
//package com.yihu.jw.base.service.wx;
//
//import com.fasterxml.jackson.databind.node.ObjectNode;
//import com.yihu.fastdfs.FastDFSUtil;
//import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
//import com.yihu.jw.wechat.service.WxAccessTokenService;
//import org.apache.commons.lang3.StringUtils;
//import org.json.JSONObject;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import javax.servlet.http.HttpServletRequest;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.FileOutputStream;
//import java.io.InputStream;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.net.URLEncoder;
//
///**
// * 微信二维码
// * Created by Trick on 2018/9/7.
// */
//@Service
//public class WeChatQrcodeService {
//
//    @Autowired
//    private FastDFSUtil fastDFSHelper;
//    @Autowired
//    private WxAccessTokenService wxAccessTokenService;
//
//    public String getQrcode(HttpServletRequest request, String wechatId, String scene) throws Exception{
//        String token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken();
//        String params = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"" + scene + "\"}}}";
//        //服务号必须是通过腾讯认证,每年是300元,如果没有认证而导致的错误提示,那就去认证
//        //微信登录提示48001,{"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}
//        String result = HttpUtil.sendPost(token_url, params);
//
//        if (!StringUtils.isEmpty(result)) {
//            JSONObject json = new JSONObject(result);
//            if (json.has("ticket")) {
//                // 请求输入流
//                InputStream inputStream = null;
//                // 下载二维码图片
//                URL urlGet = new URL("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="
//                        + URLEncoder.encode(json.get("ticket").toString(), "UTF-8"));
//                HttpURLConnection connection = (HttpURLConnection) urlGet.openConnection();
//                connection.connect();
//                //下载图片到内存
//                inputStream = connection.getInputStream();
//                //======start===
//                //fastDFS方法问题,直接将inputStream文件流上传文件服务器存数据缺失,
//                // 故将文件输出本地,在上传文件服务器,之后删除本地文件
//                String path = WeChatQrcodeService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
//                        + File.separator + "qrcode" ;
//
//                //判断目录是否存在,创建目录
//                File dir = new File(path);
//                if(!dir.exists()){
//                    dir.mkdir();
//                }
//                path+= File.separator + wechatId+"_"+scene+".png";
//                File file = new File(path);
//                // 保存文件
//                FileOutputStream outputStream = new FileOutputStream(file);
//
//                byte[] data = new byte[1024];
//                int len = 0;
//
//                while ((len = inputStream.read(data)) != -1) {
//                    outputStream.write(data, 0, len);
//                }
//
//                InputStream input = new FileInputStream(file);
//
//                //=======end=========
//                ObjectNode objectNode = fastDFSHelper.upload(input,"png","");
//
//                if (outputStream != null) {
//                    outputStream.close();
//                }
//
//                if (inputStream != null) {
//                    inputStream.close();
//                }
//
//                //流关闭,删除文件
//                if(file.exists()&&file.isFile()){
//                    file.delete();
//                }
//                return objectNode.get("fileId").toString().replaceAll("\"", "");
//            }
//        }
//
//        return "";
//    }
//    public void write(InputStream inputStream)throws Exception{
//        String file = "D:\\workspace\\file\\test.png";
@ -111,5 +112,5 @@ public class WeChatQrcodeService {
//            outputStream.close();
//        }
//
//    }
}
////    }
//}

+ 2 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatCoreService.java

@ -1,11 +1,12 @@
package com.yihu.jw.base.service.wx;
import com.yihu.jw.base.dao.wx.WechatDao;
import com.yihu.jw.base.dao.wx.WxReplySceneDao;
import com.yihu.jw.entity.base.wx.WxReplySceneDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@ -38,9 +39,6 @@ public class WechatCoreService {
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private WxAccessTokenService wxAccessTokenService;
    @Autowired
    private WxReplySceneDao wxReplySceneDao;
@ -372,5 +370,4 @@ public class WechatCoreService {
        return wechatDao.findAll();
    }
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatFansService.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.service.wx;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

+ 4 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WechatService.java

@ -9,14 +9,14 @@ import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.restmodel.base.wx.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import io.swagger.util.Json;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -26,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * Created by trick on 2017/5/20

+ 157 - 157
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxAccessTokenService.java

@ -1,157 +1,157 @@
package com.yihu.jw.base.service.wx;
import com.yihu.jw.base.dao.wx.WechatDao;
import com.yihu.jw.base.dao.wx.WxAccessTokenDao;
import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.*;
/**
 * Created by Administrator on 2017/5/18 0018.
 */
@Service
public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAccessTokenDao> {
    private Logger logger= LoggerFactory.getLogger(WxAccessTokenService.class);
    @Autowired
    private WxAccessTokenDao wxAccessTokenDao;
    @Autowired
    private WechatDao wechatDao;
    /**
     * 根据原始id查找
     * @param appOriginId
     * @return
     */
    public WxAccessTokenDO getWxAccessTokenByOriginId(String appOriginId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findByAppOriginId(appOriginId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wxWechat.getId());
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
            appId = wxWechat.getAppId();
            appSecret = wxWechat.getAppSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
            }
            /*String params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
            String result = HttpUtil.sendGet(token_url, params);*/
            Map<String, Object> params = new HashMap<>();
            params.put("grant_type", "client_credential");
            params.put("appid", appId);
            params.put("secret", appSecret);
            String result = HttpUtils.doGet(token_url, params).getContent();
            logger.info("--------------wechat token return :"+result+"---------------");
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();
                String expires_in = json.get("expires_in").toString();
                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wxWechat.getId());
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    public WxAccessTokenDO getWxAccessTokenById(String wechatId) {
        try {
            //根据wechatCode查找出appid和appSecret
            WxWechatDO wxWechat = wechatDao.findById(wechatId);
            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wechatId);
            if(wxWechat==null){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
            }
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
                for (WxAccessTokenDO accessToken : wxAccessTokens) {
                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
                        return accessToken;
                    } else {
                        wxAccessTokenDao.delete(accessToken);
                        break;
                    }
                }
            }
            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
            String appId="";
            String appSecret="";
            appId = wxWechat.getAppId();
            appSecret = wxWechat.getAppSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
            }
            Map<String, Object> params = new HashMap<>();
            params.put("grant_type", "client_credential");
            params.put("appid", appId);
            params.put("secret", appSecret);
            String result = HttpUtils.doGet(token_url, params).getContent();
            logger.info("--------------wechat token return:"+result+"---------------");
            JSONObject json = new JSONObject(result);
            if (json.has("access_token")) {
                String token = json.get("access_token").toString();
                String expires_in = json.get("expires_in").toString();
                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
                newaccessToken.setAccessToken(token);
                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
                newaccessToken.setAddTimestamp(System.currentTimeMillis());
                newaccessToken.setCzrq(new Date());
                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
                newaccessToken.setWechatId(wechatId);
                wxAccessTokenDao.save(newaccessToken);
                return newaccessToken;
            } else {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
//package com.yihu.jw.base.service.wx;
//
//import com.yihu.jw.entity.base.wx.WxAccessTokenDO;
//import com.yihu.jw.entity.base.wx.WxWechatDO;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
//import com.yihu.jw.rm.base.WechatRequestMapping;
//import com.yihu.jw.wechat.dao.WechatDao;
//import com.yihu.jw.wechat.dao.WxAccessTokenDao;
//import com.yihu.mysql.query.BaseJpaService;
//import com.yihu.utils.network.HttpUtils;
//import org.json.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.StringUtils;
//
//import java.util.*;
//
///**
// * Created by Administrator on 2017/5/18 0018.
// */
//@Service
//public class WxAccessTokenService extends BaseJpaService<WxAccessTokenDO, WxAccessTokenDao> {
//
//
//    private Logger logger= LoggerFactory.getLogger(WxAccessTokenService.class);
//
//    @Autowired
//    private WxAccessTokenDao wxAccessTokenDao;
//
//    @Autowired
//    private WechatDao wechatDao;
//
//    /**
//     * 根据原始id查找
//     * @param appOriginId
//     * @return
//     */
//    public WxAccessTokenDO getWxAccessTokenByOriginId(String appOriginId) {
//        try {
//            //根据wechatCode查找出appid和appSecret
//            WxWechatDO wxWechat = wechatDao.findByAppOriginId(appOriginId);
//            if(wxWechat==null){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
//            }
//            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wxWechat.getId());
//            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
//                for (WxAccessTokenDO accessToken : wxAccessTokens) {
//                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
//                        return accessToken;
//                    } else {
//                        wxAccessTokenDao.delete(accessToken);
//                        break;
//                    }
//                }
//            }
//            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
//            String appId="";
//            String appSecret="";
//            appId = wxWechat.getAppId();
//            appSecret = wxWechat.getAppSecret();
//            if (StringUtils.isEmpty(appId)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
//            }
//            if (StringUtils.isEmpty(appSecret)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
//            }
//            /*String params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
//            String result = HttpUtil.sendGet(token_url, params);*/
//            Map<String, Object> params = new HashMap<>();
//            params.put("grant_type", "client_credential");
//            params.put("appid", appId);
//            params.put("secret", appSecret);
//            String result = HttpUtils.doGet(token_url, params).getContent();
//            logger.info("--------------wechat token return :"+result+"---------------");
//            JSONObject json = new JSONObject(result);
//            if (json.has("access_token")) {
//                String token = json.get("access_token").toString();
//                String expires_in = json.get("expires_in").toString();
//                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
//                newaccessToken.setAccessToken(token);
//                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
//                newaccessToken.setAddTimestamp(System.currentTimeMillis());
//                newaccessToken.setCzrq(new Date());
//                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
//                newaccessToken.setWechatId(wxWechat.getId());
//                wxAccessTokenDao.save(newaccessToken);
//                return newaccessToken;
//            } else {
//                return null;
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return null;
//        }
//    }
//
//
//    public WxAccessTokenDO getWxAccessTokenById(String wechatId) {
//        try {
//            //根据wechatCode查找出appid和appSecret
//            WxWechatDO wxWechat = wechatDao.findById(wechatId);
//            List<WxAccessTokenDO> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenById(wechatId);
//            if(wxWechat==null){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_wxWechat_is_no_exist, ExceptionCode.common_error_params_code);
//            }
//            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
//                for (WxAccessTokenDO accessToken : wxAccessTokens) {
//                    if ((System.currentTimeMillis() - accessToken.getAddTimestamp()) < (accessToken.getExpiresIn() * 500)) {
//                        return accessToken;
//                    } else {
//                        wxAccessTokenDao.delete(accessToken);
//                        break;
//                    }
//                }
//            }
//            String token_url = "https://api.weixin.qq.com/cgi-bin/token";
//            String appId="";
//            String appSecret="";
//            appId = wxWechat.getAppId();
//            appSecret = wxWechat.getAppSecret();
//            if (StringUtils.isEmpty(appId)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appId_is_null, ExceptionCode.common_error_params_code);
//            }
//            if (StringUtils.isEmpty(appSecret)){
//                throw new ApiException(WechatRequestMapping.WxConfig.message_fail_appSecret_is_null, ExceptionCode.common_error_params_code);
//            }
//            Map<String, Object> params = new HashMap<>();
//            params.put("grant_type", "client_credential");
//            params.put("appid", appId);
//            params.put("secret", appSecret);
//            String result = HttpUtils.doGet(token_url, params).getContent();
//            logger.info("--------------wechat token return:"+result+"---------------");
//            JSONObject json = new JSONObject(result);
//            if (json.has("access_token")) {
//                String token = json.get("access_token").toString();
//                String expires_in = json.get("expires_in").toString();
//                WxAccessTokenDO newaccessToken = new WxAccessTokenDO();
//                newaccessToken.setAccessToken(token);
//                newaccessToken.setExpiresIn(Long.parseLong(expires_in));
//                newaccessToken.setAddTimestamp(System.currentTimeMillis());
//                newaccessToken.setCzrq(new Date());
//                newaccessToken.setCode(UUID.randomUUID().toString().replace("-",""));
//                newaccessToken.setWechatId(wechatId);
//                wxAccessTokenDao.save(newaccessToken);
//                return newaccessToken;
//            } else {
//                return null;
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return null;
//        }
//    }
//}

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxMenuService.java

@ -1,6 +1,5 @@
package com.yihu.jw.base.service.wx;
import com.yihu.jw.base.dao.wx.WechatDao;
import com.yihu.jw.base.dao.wx.WxMenuDao;
import com.yihu.jw.base.dao.wx.WxMenuJsonDao;
import com.yihu.jw.base.util.HttpUtil;
@ -9,6 +8,8 @@ import com.yihu.jw.entity.base.wx.WxMenuJsonDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.mysql.query.BaseJpaService;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;

+ 3 - 125
svr/svr-base/src/main/java/com/yihu/jw/base/service/wx/WxTemplateService.java

@ -3,15 +3,15 @@ package com.yihu.jw.base.service.wx;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.wx.WxTemplateConfigDao;
import com.yihu.jw.base.dao.wx.WxTemplateDao;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.base.wx.WxTemplateDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.base.WechatRequestMapping;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -93,126 +93,4 @@ public class WxTemplateService {
        }
        return rs;
    }
//    public WxTemplateDO createWxTemplate(WxTemplateDO wxTemplate) {
//        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_templateid_is_null, ExceptionCode.common_error_params_code);
//        }
//        String content = wxTemplate.getContent().replace(" ","");
//        if (StringUtils.isEmpty(content)) {
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_is_null, ExceptionCode.common_error_params_code);
//        }
//        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_format_is_not_right, ExceptionCode.common_error_params_code);
//        }
//        return wxTemplateDao.save(wxTemplate);
//    }
//
//    public WxTemplateDO updateWxTemplate(WxTemplateDO wxTemplate) {
//        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_templateid_is_null, ExceptionCode.common_error_params_code);
//        }
//        String content = wxTemplate.getContent().replace(" ","");
//        if (StringUtils.isEmpty(content)) {
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_is_null, ExceptionCode.common_error_params_code);
//        }
//        String id = wxTemplate.getId();
//        if (StringUtils.isEmpty(id)) {
//            throw new ApiException(WechatRequestMapping.WxConfig.message_fail_id_is_null, ExceptionCode.common_error_params_code);
//        }
//        WxTemplateDO wxTemplate1 = findById(id);
//        if(wxTemplate1==null){
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_template_is_no_exist, ExceptionCode.common_error_params_code);
//        }
//        wxTemplate.setCreateTime(wxTemplate1.getCreateTime());
//        wxTemplate.setUpdateTime(new Date());
//        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
//            throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_content_format_is_not_right, ExceptionCode.common_error_params_code);
//        }
//        return wxTemplateDao.save(wxTemplate);
//    }
//
//    public void deleteWxTemplate(String codes, String userCode, String userName) {
//        if(!StringUtils.isEmpty(codes)) {
//            String[] codeArray = codes.split(",");
//            for (String code : codeArray) {
//                WxTemplateDO wxTemplate = wxTemplateDao.findById(code);
//                if (wxTemplate == null) {
//                    throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_id_no_exist, ExceptionCode.common_error_params_code);
//                }
//                wxTemplate.setStatus(-1);
//                wxTemplate.setUpdateUser(userCode);
//                wxTemplate.setUpdateUserName(userName);
//                wxTemplateDao.save(wxTemplate);
//            }
//        }
//    }
//
//
//    public WxTemplateDO findById(String id) {
//        WxTemplateDO wxTemplate = wxTemplateDao.findById(id);
//        return wxTemplate;
//    }
//
//    public JSONObject sendTemplateMessage(String openid, String templateId, String url, String data,Miniprogram miniprogram) {
//        try {
//            //首先根据wechatTemplate获取微信模版
//            WxTemplateDO wxTemplate = findById(templateId);
//            if(wxTemplate==null){
//                throw new ApiException(WechatRequestMapping.WxTemplate.message_fail_template_is_no_exist, ExceptionCode.common_error_params_code);
//            }
//            String wechatCode =  wxTemplate.getWechatId();
//            String content = wxTemplate.getContent().replaceAll(" ", "");//{{result.DATA}}领奖金额:{{withdrawMoney.DATA}   }领奖  时间:{ {withdrawTime.DATA} }银行信息:{ {cardInfo.DATA} }到账时间:{{arrivedTime.DATA}}{{remark.DATA}}
//            String[] contentArray = content.split("\\{\\{");
//
//            //将result,withdrawMoney,withdrawTime,cardInfo,arrivedTime等字符串放入contentList中
//            List<String> contentList = new ArrayList<>();
//            for(int i=1;i<contentArray.length;i++){
//                contentList.add(contentArray[i].substring(0,contentArray[i].indexOf(".")));
//            }
//
//            ObjectMapper mapper = new ObjectMapper();
//            ////将data转为对象
//            Map<String, WechatTemplateDataDO> dataMap = mapper.readValue(data, new TypeReference<LinkedHashMap<String, WechatTemplateDataDO>>() {});
//            Map<String, WechatTemplateDataDO> newDataMap = new LinkedHashMap<String, WechatTemplateDataDO>();
//            int j = 0;
//            for (Map.Entry<String, WechatTemplateDataDO> entry : dataMap.entrySet()) {//(keyword1,WechatTemplateData)
//                String key = entry.getKey();//keyword1   转为result
//                newDataMap.put(contentList.get(j),entry.getValue());
//                j++;
//            }
//
//            //将数据封装在WechatTemplate对象中
//            WechatTemplateDO wechatTemplate = new WechatTemplateDO();
//            wechatTemplate.setTouser(openid);
//            wechatTemplate.setUrl(url);
//            wechatTemplate.setTemplate_id(wxTemplate.getTemplateId());
//            if(miniprogram!=null){
//                wechatTemplate.setMiniprogram(miniprogram);
//            }
//            wechatTemplate.setData(newDataMap);
//
//            String params = mapper.writeValueAsString(wechatTemplate);
//            logger.info("----------------------模版消息json字符串:"+params+"------------------");
//
//            WxAccessTokenDO wxAccessTokenByCode = wxAccessTokenService.getWxAccessTokenById(wechatCode);
//            String token = wxAccessTokenByCode.getAccessToken();
//            String token_url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token;
//            String result = HttpUtil.sendPost(token_url, params);
//            logger.info("------------------------发送模板消息,微信返回结果:"+result+"-----------------------");
//
//            JSONObject jsonResult = new JSONObject(result);
//            return jsonResult;
//        } catch (Exception e) {
//            e.printStackTrace();
//            JSONObject jsonResult = new JSONObject();
//            return jsonResult;
//        }
//    }
//
//    public List<WxTemplateDO> findByWxId(String code) {
//        return wxTemplateDao.findByWxId(code);
//    }
}

+ 1 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-base-lith
    name: svr-base
  cloud:
    config:
      failFast: true

+ 18 - 1
svr/svr-patient/pom.xml

@ -93,6 +93,11 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>${parent.version}</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-web</artifactId>
@ -179,11 +184,23 @@
        </dependency>
        <!--   poi xml导入导出工具 end -->
        <!--基础业务组件-->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>base-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-base</finalName>
        <finalName>svr-patient</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>

+ 64 - 0
svr/svr-patient/sql/sql

@ -0,0 +1,64 @@
-- 居民卡包信息
drop table IF EXISTS `patient_medicare_card`;
create table `patient_medicare_card`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `code` varchar(50) not null COMMENT '卡标识',
  `parent_type` varchar(1) DEFAULT NULL COMMENT '卡的大类(A-医疗卡,B-优惠券,C-银行卡,unknow-其他)',
  `type` varchar(1) DEFAULT NULL COMMENT '卡的小类:医疗卡包含 A_01 医保卡,A_02 电子社保卡 A_03 电子就诊卡等等',
  `patient_code` varchar(50) not null COMMENT '居民标识',
  `password` varchar(50) not null COMMENT '绑定密码',
  `wx_openid` varchar(50) not null COMMENT '微信openid,有些卡会绑定微信',
  `remark` varchar(50) not null COMMENT '备注',
  `del` varchar(50) not null COMMENT '状态,0-解除绑定,1-绑定中',
  primary key (id)
)
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='居民卡包信息';
-- 帮助中心
drop table IF EXISTS `help_center`;
create table `help_center`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `parent_type` varchar(1) DEFAULT NULL COMMENT '问题大类(账号问题,续方问题,操作问题)',
  `type` varchar(1) DEFAULT NULL COMMENT '问题小类(账号被锁问题,身份证占用问题等等)',
  `question` varchar(100) not null COMMENT '问题描述',
  `answer` varchar(500) not null COMMENT '问题回答',
  `useful_count` varchar(3) not null COMMENT '有用次数',
  `unuseful_count` varchar(3) not null COMMENT '无用次数',
  primary key (id)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='帮助中心';
-- 意见反馈
drop table IF EXISTS `feedback`;
create table `feedback`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `parent_type` varchar(1) DEFAULT NULL COMMENT '反馈问题大类(功能异常,功能优化,新功能建议,其他等)',
  `type` varchar(1) DEFAULT NULL COMMENT '问题小类(功能异常-某些功能不可用等)',
  `feedback_content` varchar(100) not null COMMENT '反馈内容,问题和建议',
  `answer` varchar(500) not null COMMENT '问题回答',
  `img` varchar(1000) not null COMMENT '图片,存图片地址,逗号分割',
  `mobile` varchar(11) not null COMMENT '联系手机号码',
  `count` varchar(50) not null COMMENT '反馈次数',
  primary key (id)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='意见反馈';
-- 账号申诉
drop table IF EXISTS `account_appeal`;
create table `account_appeal`
(
  `id` int(11) NOT NULL AUTO_INCREMENT  COMMENT '表id,自增长',
  `type` varchar(1) DEFAULT NULL COMMENT '申诉问题类型(0-手机号码无法使用,1-无法找回密码,2-身份证被占用)',
  `content` varchar(100) not null COMMENT '申诉内容,问题描述',
  `name` varchar(10) not null COMMENT '申诉人姓名',
  `idcard` varchar(18) not null COMMENT '申诉人身份证号码',
  `mobile` varchar(11) not null COMMENT '申诉人手机号码',
  `img` varchar(1000) not null COMMENT '身份证正反面照片,存地址,逗号分割',
  primary key (id)
)
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='账号申诉';

+ 11 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/myFamily/PatientApplyLogDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.patient.dao.myFamily;
import com.yihu.jw.entity.myFamily.PatientApplyLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author liuwenbin on 2018/11/30.
 */
public interface PatientApplyLogDao extends PagingAndSortingRepository<PatientApplyLog, String>, JpaSpecificationExecutor<PatientApplyLog> {
}

+ 29 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/myFamily/PatientFamilyMemberDao.java

@ -0,0 +1,29 @@
package com.yihu.jw.patient.dao.myFamily;
import com.yihu.jw.entity.base.patient.BasePatientFamilyMemberDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author liuwenbin on 2018/11/27.
 */
public interface PatientFamilyMemberDao extends PagingAndSortingRepository<BasePatientFamilyMemberDO, String>, JpaSpecificationExecutor<BasePatientFamilyMemberDO> {
    @Query("select m from BasePatientFamilyMemberDO m where m.del=1 and m.patient=?1")
    List<BasePatientFamilyMemberDO> getByPatient(String patient);
    @Query("select m from BasePatientFamilyMemberDO m where m.del=1 and m.patient=?1 and m.familyRelation=?2")
    List<BasePatientFamilyMemberDO> getByPatientAndFamilyRelation(String patient,Integer familyRelation);
    @Query("select m from BasePatientFamilyMemberDO m where m.del=1 and m.familyMember=?1")
    List<BasePatientFamilyMemberDO> getByFamilyMember(String familyMember);
    @Query("select m from BasePatientFamilyMemberDO m where m.del=1 and m.familyMember=?1 and m.familyRelation=?2")
    List<BasePatientFamilyMemberDO> getByFamilyMemberAndFamilyRelation(String familyMember,Integer familyRelation);
    @Query("select m from BasePatientFamilyMemberDO m where m.del=1 and m.familyMember=?1 and m.familyRelation in (?2,?3)")
    List<BasePatientFamilyMemberDO> getByFamilyMemberAndFamilyRelation(String familyMember,Integer familyRelation1,Integer familyRelation2);
}

+ 29 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientDao.java

@ -0,0 +1,29 @@
package com.yihu.jw.patient.dao.personal_info;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/8/31.
 */
public interface PatientDao extends PagingAndSortingRepository<BasePatientDO, String>, JpaSpecificationExecutor<BasePatientDO> {
    BasePatientDO findByIdAndDel(String id, String del);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where idcard like ?1")
    List<Map<String,Object>> findByIdcard(String idcard, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO where name like ?1")
    List<Map<String,Object>> findByName(String name, Pageable pageable);
    @Query("select id as id,idcard as idcard,name as name,case sex when 1 then '男' when 2 then '女' else '未知' end as sex,phone as phone,committeeName as committeeName,concat(provinceName,cityName,townName,streetName) as address from BasePatientDO")
    List<Map<String,Object>> findBaseInfo(Pageable pageable);
}

+ 30 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/personal_info/PatientMedicareCardDao.java

@ -0,0 +1,30 @@
package com.yihu.jw.patient.dao.personal_info;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
 * 
 * 居民卡包 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  		2018年11月27日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface PatientMedicareCardDao extends PagingAndSortingRepository<PatientMedicareCardDO, Integer>, JpaSpecificationExecutor<PatientMedicareCardDO>  {
    List<PatientMedicareCardDO> findByPatientCode(String patientCode);
    @Query("select id from PatientMedicareCardDO where patientCode = ?1")
    Set<Object> findIdListByPatientCode(String patientCode);
}

+ 2 - 4
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageDao.java

@ -1,13 +1,11 @@
package com.yihu.jw.patient.dao.servicePackage;
package com.yihu.jw.patient.dao.servicepackage;
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 *
 * @author yeshijie on 2018/8/17
 * Created by Trick on 2018/11/29.
 */
public interface ServicePackageDao extends PagingAndSortingRepository<ServicePackageDO, String>, JpaSpecificationExecutor<ServicePackageDO> {
}

+ 16 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageItemDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.patient.dao.servicepackage;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/11/29.
 */
public interface ServicePackageItemDao extends PagingAndSortingRepository<ServicePackageItemDO, String>, JpaSpecificationExecutor<ServicePackageItemDO> {
    List<ServicePackageItemDO> findByServicePackageId(String servicePackageId);
}

+ 12 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/servicePackage/ServicePackageSignRecordDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.patient.dao.servicepackage;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/11/29.
 */
public interface ServicePackageSignRecordDao extends PagingAndSortingRepository<ServicePackageSignRecordDO, String>, JpaSpecificationExecutor<ServicePackageSignRecordDO> {
}

+ 0 - 0
svr/svr-patient/src/main/java/com/yihu/jw/patient/dao/settings/AccountAppealDao.java


Some files were not shown because too many files changed in this diff